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