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 @@ def fix_rpaths(self, project, target, frameworks = []): "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