From 72ef0cd440a416b0dbeae0f9be625751fae788fb Mon Sep 17 00:00:00 2001
From: Joe Garcia <joe.garcia@ssec.wisc.edu>
Date: Thu, 13 Jan 2022 16:52:17 +0000
Subject: [PATCH] fix absolute links in bin using relative links on linux

---
 ShellB3/shallbethree.sh | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/ShellB3/shallbethree.sh b/ShellB3/shallbethree.sh
index 0bf303db..c6a8925b 100755
--- a/ShellB3/shallbethree.sh
+++ b/ShellB3/shallbethree.sh
@@ -10931,6 +10931,15 @@ bundle_elfs() {
     for elf in $(${PYTHON} sb3bin/thosewhohuntelfs.py --patchelf=${PATCHELF}/patchelf --hunt bin); do
       _pydling $elf requires
     done
+    #relink binaries relatively
+    for fa in $( find bin -type l | sed 's, ,@@@@,g' ) ; do
+      export f="$(echo $fa | sed 's,@@@@, ,g')"
+      echo Checking $f 1>&2
+      if [ -L "$f" -a -n "$(readlink "$f" | grep "${BASE}" )" ] ; then
+        echo Repairing link "$f" from $(readlink "$f") 1>&2
+        relative_link "$( readlink "$f" )" "$f"
+      fi
+    done
     # fix RPATHs on ELF binaries, excluding libstdc++ and libgfortran
     ${PYTHON} sb3bin/thosewhohuntelfs.py . lib $( is64Bit && echo lib64 ) "$@" --patchelf=${PATCHELF}/patchelf \
       --exclude='(?:.*?build/.*)|(?:.*?lib/libgfort.*)|(?:.*?lib/libstdc.*)' || oops "could not make binary bundle relocatable"
-- 
GitLab