Chris@335: #!/bin/bash Chris@335: Chris@335: app="$1" Chris@335: if [ -z "$app" ]; then Chris@335: echo "Usage: $0 " Chris@335: echo "Provide appname without the .app extension, please" Chris@335: exit 2 Chris@335: fi Chris@335: Chris@335: echo Chris@335: echo "I expect you to have already copied QtCore, QtNetwork and QtGui to " Chris@335: echo "$app.app/Contents/Frameworks and PyQt4/QtCore.so and PyQt4/QtGui.so to " Chris@335: echo "$app.app/Contents/MacOS -- expect errors to follow if they're missing" Chris@335: echo Chris@335: Chris@335: echo "Fixing up loader paths in binaries..." Chris@335: Chris@335: install_name_tool -id QtCore "$app.app/Contents/Frameworks/QtCore" Chris@335: install_name_tool -id QtGui "$app.app/Contents/Frameworks/QtGui" Chris@335: install_name_tool -id QtNetwork "$app.app/Contents/Frameworks/QtNetwork" Chris@335: Chris@335: for fwk in QtCore QtGui QtNetwork; do Chris@335: find "$app.app" -type f -print | while read x; do Chris@372: current=$(otool -L "$x" | grep "$fwk" | grep ramework | awk '{ print $1; }') Chris@335: [ -z "$current" ] && continue Chris@335: echo "$x has $current" Chris@335: relative=$(echo "$x" | sed -e "s,$app.app/Contents/,," \ Chris@335: -e 's,[^/]*/,../,g' -e 's,/[^/]*$,/Frameworks/'"$fwk"',' ) Chris@335: echo "replacing with relative path $relative" Chris@335: install_name_tool -change "$current" "@loader_path/$relative" "$x" Chris@335: done Chris@335: done Chris@335: Chris@335: echo "Done: be sure to run the app and see that it works!" Chris@335: Chris@335: