From d5c8fce58b00a9254a058c5cb8c9b3968cd0a5eb Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Sat, 19 May 2018 21:13:51 +0200 Subject: [PATCH] Add helper function to fixup libtool files When "libdir" is not the final path where we install the library, libtool will mess up the relinking process and prepend the global library directories to the linker search path. If we fix the libdir path, libtool will insert it into the rpath in the binary, which is also pretty bonkers. Maybe, there is a way to do this correctly, but the various GNU mailing lists, Debian wiki, etc.. could not provide a better alternative than patching up libtool scripts. Signed-off-by: David Oberhollenzer --- pkg/gmp/build | 1 + pkg/util-linux/build | 1 + util/misc.sh | 12 ++++++++++++ 3 files changed, 14 insertions(+) diff --git a/pkg/gmp/build b/pkg/gmp/build index 6400c24..3705273 100755 --- a/pkg/gmp/build +++ b/pkg/gmp/build @@ -20,6 +20,7 @@ deploy() { local DEPLOY="$2" local DEVDEPLOY="$3" + unfuck_libtool make DESTDIR="$DEPLOY" install rm -r "$DEPLOY/share" diff --git a/pkg/util-linux/build b/pkg/util-linux/build index 4310a85..4e5e873 100755 --- a/pkg/util-linux/build +++ b/pkg/util-linux/build @@ -37,6 +37,7 @@ deploy() { mkdir -p "$DEPLOY/var/lib/hwclock" + unfuck_libtool make DESTDIR="$DEPLOY" install strip_files ${DEPLOY}/{bin,lib}/* diff --git a/util/misc.sh b/util/misc.sh index e2adc72..dbb0134 100644 --- a/util/misc.sh +++ b/util/misc.sh @@ -56,3 +56,15 @@ split_dev_deploy() { break done } + +unfuck_libtool() { + local libdir="$PKGDEPLOYDIR/$PKGNAME/lib" + local f + + for f in $(find $PKGBUILDDIR -type f -name '*.la'); do + sed -i "s#libdir='.*'#libdir='$libdir'#g" "$f"; + done + + sed -i -r "s/(finish_cmds)=.*$/\1=\"\"/" "$PKGBUILDDIR/libtool" + sed -i -r "s/(hardcode_into_libs)=.*$/\1=no/" "$PKGBUILDDIR/libtool" +}