config/functions: add libtool_remove_rpath function

This function can be used on "autotools" and "configure" packages.

Use libtool_remove_rpath() to remove hardcode rpath when --disable-rpath
is not supported by "configure".

usage: `libtool_remove_rpath libtool`

If there are multiple libtool scripts or they are in subdirectories,
then you may need to run this function using the path to libtool or run
the function multiple times.

If binaries and shared objects installed by the package to target have
incorrect or system libraries then this function can be used. After
using the function, these example command below should NOT have a
RPATH/RUNPATH.

e.g. (before using the fucntion)
  $ readelf --dynamic ${filename} | grep PATH
    RPATH           Library runpath: [.....]
    RUNPATH         Library runpath: [.....]

Before using this function; check if the package supports
--disable-rpath (and that it works.) Work with upstream and have a
working --disable-rpath added to the package.
This commit is contained in:
heitbaum 2022-01-09 11:18:37 +00:00
parent cef9573d6c
commit 4762f8a1d0

View File

@ -873,6 +873,11 @@ is_sequential_build() {
[ "${MTWITHLOCKS}" != "yes" ] && return 0 || return 1
}
# arg1: filename (libtool) to remove hardcode rpath when --disable-rpath is not supported by configure
libtool_remove_rpath() {
sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' ${1}
sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' ${1}
}
### PACKAGE HELPERS ###
# get variable ($2) for package ($1).