annotate deploy/osx/paths.sh @ 271:846df0ea9c82 v0.5

Version
author Chris Cannam <chris.cannam@eecs.qmul.ac.uk>
date Thu, 03 Apr 2014 09:39:16 +0100
parents a3e9ddb7bb8b
children af696edbd644
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@207 10 frameworks="QtCore QtNetwork QtGui QtXml QtWidgets QtPrintSupport"
Chris@207 11
Chris@62 12 echo
Chris@207 13 echo "I expect you to have already copied these frameworks from the Qt installation to"
Chris@207 14 echo "$app.app/Contents/Frameworks -- expect errors to follow if they're missing:"
Chris@207 15 echo "$frameworks"
Chris@62 16 echo
Chris@62 17
Chris@62 18 echo "Fixing up loader paths in binaries..."
Chris@62 19
Chris@207 20 for fwk in $frameworks; do
Chris@207 21 install_name_tool -id $fwk "$app.app/Contents/Frameworks/$fwk"
Chris@207 22 done
Chris@62 23
Chris@62 24 find "$app.app" -name \*.dylib -print | while read x; do
Chris@62 25 install_name_tool -id "`basename \"$x\"`" "$x"
Chris@62 26 done
Chris@62 27
Chris@207 28 for fwk in $frameworks; do
Chris@62 29 find "$app.app" -type f -print | while read x; do
Chris@62 30 current=$(otool -L "$x" | grep "$fwk" | grep amework | awk '{ print $1; }')
Chris@62 31 [ -z "$current" ] && continue
Chris@62 32 echo "$x has $current"
Chris@62 33 relative=$(echo "$x" | sed -e "s,$app.app/Contents/,," \
Chris@62 34 -e 's,[^/]*/,../,g' -e 's,/[^/]*$,/Frameworks/'"$fwk"',' )
Chris@62 35 echo "replacing with relative path $relative"
Chris@62 36 install_name_tool -change "$current" "@loader_path/$relative" "$x"
Chris@62 37 done
Chris@62 38 done
Chris@62 39
Chris@62 40 echo "Done: be sure to run the app and see that it works!"
Chris@62 41
Chris@62 42