annotate deploy/osx/paths.sh @ 376:af15c5a78f84 tonioni_continuous_synth

Close old branch tonioni_continuous_synth
author Chris Cannam
date Mon, 21 Jul 2014 13:04:09 +0100
parents 092a69229347
children a3e9ddb7bb8b
rev   line source
Chris@62 1 #!/bin/bash
Chris@62 2
Chris@62 3 app="$1"
Chris@62 4 if [ -z "$app" ]; then
Chris@62 5 echo "Usage: $0 <appname>"
Chris@62 6 echo "Provide appname without the .app extension, please"
Chris@62 7 exit 2
Chris@62 8 fi
Chris@62 9
Chris@62 10 echo
Chris@62 11 echo "I expect you to have already copied QtCore, QtNetwork, QtGui, QtXml and QtWidgets to "
Chris@62 12 echo "$app.app/Contents/Frameworks -- expect errors to follow if they're missing"
Chris@62 13 echo
Chris@62 14
Chris@62 15 echo "Fixing up loader paths in binaries..."
Chris@62 16
Chris@62 17 install_name_tool -id QtCore "$app.app/Contents/Frameworks/QtCore"
Chris@62 18 install_name_tool -id QtGui "$app.app/Contents/Frameworks/QtGui"
Chris@62 19 install_name_tool -id QtNetwork "$app.app/Contents/Frameworks/QtNetwork"
Chris@62 20 install_name_tool -id QtXml "$app.app/Contents/Frameworks/QtXml"
Chris@62 21 install_name_tool -id QtWidgets "$app.app/Contents/Frameworks/QtWidgets"
Chris@62 22
Chris@62 23 find "$app.app" -name \*.dylib -print | while read x; do
Chris@62 24 install_name_tool -id "`basename \"$x\"`" "$x"
Chris@62 25 done
Chris@62 26
Chris@62 27 for fwk in QtCore QtGui QtNetwork QtXml QtWidgets; do
Chris@62 28 find "$app.app" -type f -print | while read x; do
Chris@62 29 current=$(otool -L "$x" | grep "$fwk" | grep amework | awk '{ print $1; }')
Chris@62 30 [ -z "$current" ] && continue
Chris@62 31 echo "$x has $current"
Chris@62 32 relative=$(echo "$x" | sed -e "s,$app.app/Contents/,," \
Chris@62 33 -e 's,[^/]*/,../,g' -e 's,/[^/]*$,/Frameworks/'"$fwk"',' )
Chris@62 34 echo "replacing with relative path $relative"
Chris@62 35 install_name_tool -change "$current" "@loader_path/$relative" "$x"
Chris@62 36 done
Chris@62 37 done
Chris@62 38
Chris@62 39 echo "Done: be sure to run the app and see that it works!"
Chris@62 40
Chris@62 41