From 783aedf665a2971dcf44b6874a0a00718c8321ed Mon Sep 17 00:00:00 2001 From: casey langen Date: Sat, 3 Dec 2022 16:41:38 -0800 Subject: [PATCH] Separate staging and patching vendor library steps. --- script/archive-standalone-nix.sh | 2 ++ script/patch-vendor-libraries.sh | 25 +++++++++++++++++++++++++ script/stage-vendor-libraries.sh | 17 ----------------- 3 files changed, 27 insertions(+), 17 deletions(-) create mode 100644 script/patch-vendor-libraries.sh diff --git a/script/archive-standalone-nix.sh b/script/archive-standalone-nix.sh index d39ed6b9c..73fb51539 100755 --- a/script/archive-standalone-nix.sh +++ b/script/archive-standalone-nix.sh @@ -73,6 +73,8 @@ else make ${JOBS} || exit $? fi +./script/patch-vendor-libraries.sh || exit $? + rm -rf dist/$VERSION/*${OS_ARCH}_$VERSION* 2> /dev/null mkdir -p $OUTDIR/lib diff --git a/script/patch-vendor-libraries.sh b/script/patch-vendor-libraries.sh new file mode 100644 index 000000000..75350c439 --- /dev/null +++ b/script/patch-vendor-libraries.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +PLATFORM=$(uname) + +if [[ "$PLATFORM" == 'Linux' ]]; then + echo "[patch-static-vendor-libraries] patch Linux .so files..." + + # update the RPATH so libraries in libs/ can discover each other, + # and plugins can discover themselves, and libs/ (but not the + # other way around) + + FILES="./bin/lib/*" + for f in $FILES + do + patchelf --set-rpath "\$ORIGIN" "$f" + done + + FILES="./bin/plugins/*.so" + for f in $FILES + do + patchelf --set-rpath "\$ORIGIN:\$ORIGIN/../lib" "$f" + done + + chmod -x ./bin/lib/* +fi diff --git a/script/stage-vendor-libraries.sh b/script/stage-vendor-libraries.sh index c554981ba..33e257c0c 100755 --- a/script/stage-vendor-libraries.sh +++ b/script/stage-vendor-libraries.sh @@ -77,21 +77,4 @@ elif [[ "$PLATFORM" == 'Linux' ]]; then mkdir -p ./bin/share/terminfo cp -rfp /lib/terminfo/* ./bin/share/terminfo - # update the RPATH so libraries in libs/ can discover each other, - # and plugins can discover themselves, and libs/ (but not the - # other way around) - - FILES="./bin/lib/*" - for f in $FILES - do - patchelf --set-rpath "\$ORIGIN" "$f" - done - - FILES="./bin/plugins/*.so" - for f in $FILES - do - patchelf --set-rpath "\$ORIGIN:\$ORIGIN/../lib" "$f" - done - - chmod -x ./bin/lib/* fi