changeset 316:806e9cb9ce61

* Fix up framework paths regardless of their initial values
author Chris Cannam
date Wed, 02 Mar 2011 12:29:45 +0000
parents 2b2f0ba33262
children 124a3ea9fafb
files deploy/osx/deploy.sh
diffstat 1 files changed, 11 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/deploy/osx/deploy.sh	Tue Mar 01 16:50:06 2011 +0000
+++ b/deploy/osx/deploy.sh	Wed Mar 02 12:29:45 2011 +0000
@@ -33,20 +33,17 @@
 install_name_tool -id QtGui "$app.app/Contents/Frameworks/QtGui"
 install_name_tool -id QtNetwork "$app.app/Contents/Frameworks/QtNetwork"
 
-install_name_tool -change QtCore.framework/Versions/4/QtCore @executable_path/../Frameworks/QtCore "$app.app/Contents/MacOS/$app"
-install_name_tool -change QtGui.framework/Versions/4/QtGui @executable_path/../Frameworks/QtGui "$app.app/Contents/MacOS/$app"
-install_name_tool -change QtNetwork.framework/Versions/4/QtNetwork @executable_path/../Frameworks/QtNetwork "$app.app/Contents/MacOS/$app"
-
-install_name_tool -change QtCore.framework/Versions/4/QtCore @executable_path/../Frameworks/QtCore "$app.app/Contents/MacOS/kdiff3"
-install_name_tool -change QtGui.framework/Versions/4/QtGui @executable_path/../Frameworks/QtGui "$app.app/Contents/MacOS/kdiff3"
-install_name_tool -change QtNetwork.framework/Versions/4/QtNetwork @executable_path/../Frameworks/QtNetwork "$app.app/Contents/MacOS/kdiff3"
-
-install_name_tool -change QtCore.framework/Versions/4/QtCore @loader_path/QtCore "$app.app/Contents/Frameworks/QtGui"
-install_name_tool -change QtCore.framework/Versions/4/QtCore @loader_path/QtCore "$app.app/Contents/Frameworks/QtNetwork"
-
-install_name_tool -change QtCore.framework/Versions/4/QtCore @loader_path/../../Frameworks/QtCore "$app.app/Contents/MacOS/PyQt4/QtCore.so"
-install_name_tool -change QtCore.framework/Versions/4/QtCore @loader_path/../../Frameworks/QtCore "$app.app/Contents/MacOS/PyQt4/QtGui.so"
-install_name_tool -change QtCore.framework/Versions/4/QtCore @loader_path/../../Frameworks/QtGui "$app.app/Contents/MacOS/PyQt4/QtGui.so"
+for fwk in QtCore QtGui QtNetwork; do
+	find "$app.app" -type f -print | while read x; do
+		current=$(otool -L "$x" | grep "$fwk.framework/" | awk '{ print $1; }')
+		[ -z "$current" ] && continue
+		echo "$x has $current"
+		relative=$(echo "$x" | sed -e "s,$app.app/Contents/,," \
+			-e 's,[^/]*/,../,g' -e 's,/[^/]*$,/Frameworks/'"$fwk"',' )
+		echo "replacing with relative path $relative"
+		install_name_tool -change "$current" "@loader_path/$relative" "$x"
+	done
+done
 
 echo "Done: be sure to run the app and see that it works!"