annotate deploy/osx/paths.sh @ 769:675bc2e08c11 2.4beta1

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