[gtk-mac-bundler] Handle @rpath in installed names.



commit df5aa76f1c974d8a6508f52d8f22d051e1cb92cf
Author: John Ralls <jralls ceridwen us>
Date:   Mon May 9 14:05:00 2022 -0700

    Handle @rpath in installed names.
    
    Convert to @executable_path like prefixes.

 bundler/project.py                      |  3 +++
 bundler/run-install-name-tool-change.sh | 17 ++++++++++++-----
 2 files changed, 15 insertions(+), 5 deletions(-)
---
diff --git a/bundler/project.py b/bundler/project.py
index d2ea0b5..ad96ab5 100644
--- a/bundler/project.py
+++ b/bundler/project.py
@@ -296,8 +296,11 @@ class Binary(Path):
                            "run-install-name-tool-change.sh")
         for prefix in project.get_meta().prefixes:
             prefix_path = project.get_prefix(prefix)
+            bundle_libdir = os.path.join(self.bundledir, 'lib')
             call([cmd, target, prefix_path, self.bundledir, "change"])
             call([cmd, target, prefix_path, self.bundledir, "id"])
+            call([cmd, target, '@rpath', bundle_libdir, "change"])
+            call([cmd, target, '@rpath', bundle_libdir, "id"])
             for fw in frameworks:
                 call([cmd, path, fw.get_name(), fw.get_bundlename(), 'change'])
 
diff --git a/bundler/run-install-name-tool-change.sh b/bundler/run-install-name-tool-change.sh
index 1c349d3..2a0183a 100755
--- a/bundler/run-install-name-tool-change.sh
+++ b/bundler/run-install-name-tool-change.sh
@@ -12,16 +12,23 @@ ACTION=$4
 
 chmod u+w $LIBRARY
 
-if [ "x$ACTION" == "xchange" ]; then
+if [ "x$ACTION" = "xchange" ]; then
     libs="`otool -L $LIBRARY 2>/dev/null | fgrep compatibility | cut -d\( -f1 | grep $WRONG_PREFIX | sort | 
uniq`"
     for lib in $libs; do
        if ! echo $lib | grep --silent "@executable_path" ; then
-           fixed=`echo $lib | sed -e s,\$WRONG_PREFIX,\$RIGHT_PREFIX,`
+           fixed=`echo $lib | sed -e s,\${WRONG_PREFIX},\${RIGHT_PREFIX},`
            install_name_tool -change $lib $fixed $LIBRARY
        fi
     done;
-elif [ "x$ACTION" == "xid" ]; then
-    lib="`otool -D $LIBRARY 2>/dev/null | grep ^$WRONG_PREFIX | sed s,\${WRONG_PREFIX},,`"
-    install_name_tool -id "$RIGHT_PREFIX/$lib" $LIBRARY;
+elif [ "x$ACTION" = "xid" ]; then
+#    echo "$LIBRARY $WRONG_PREFIX to $RIGHT_PREFIX"
+    lib=$(otool -D "$LIBRARY" 2>/dev/null | grep ^"$WRONG_PREFIX" | sed s,"$WRONG_PREFIX",,)
+    if [ $lib ]; then
+#        echo "Rewrite $lib"
+        install_name_tool -id "${RIGHT_PREFIX}/${lib}" $LIBRARY;
+#    else
+#        path=$(otool -D "$LIBRARY" 2>/dev/null | sed -n 2p)
+#        echo "Empty Result $path"
+    fi
 fi
     


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]