From 4762f8a1d0f3d7ed904b86e57707a141c5e56d3b Mon Sep 17 00:00:00 2001 From: heitbaum Date: Sun, 9 Jan 2022 11:18:37 +0000 Subject: [PATCH] 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. --- config/functions | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/config/functions b/config/functions index d829f068f0..7166bb8086 100644 --- a/config/functions +++ b/config/functions @@ -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).