annotate deploy/osx/paths.sh @ 698:ee97c742d184 tip

Default branch is now named default on git as well as hg, in case we ever want to switch to mirroring in the other direction
author Chris Cannam
date Thu, 27 Aug 2020 15:58:43 +0100
parents 449a0355f864
children
rev   line source
Chris@62 1 #!/bin/bash
Chris@62 2
Chris@516 3 set -e
Chris@437 4
Chris@62 5 app="$1"
Chris@62 6 if [ -z "$app" ]; then
Chris@62 7 echo "Usage: $0 <appname>"
Chris@62 8 echo "Provide appname without the .app extension, please"
Chris@62 9 exit 2
Chris@62 10 fi
Chris@62 11
Chris@516 12 set -u
Chris@516 13
Chris@516 14 frameworks="QtCore QtNetwork QtGui QtXml QtSvg QtWidgets QtPrintSupport QtDBus"
Chris@207 15
Chris@62 16 echo
Chris@207 17 echo "I expect you to have already copied these frameworks from the Qt installation to"
Chris@207 18 echo "$app.app/Contents/Frameworks -- expect errors to follow if they're missing:"
Chris@207 19 echo "$frameworks"
Chris@62 20 echo
Chris@62 21
Chris@62 22 echo "Fixing up loader paths in binaries..."
Chris@62 23
Chris@207 24 for fwk in $frameworks; do
Chris@207 25 install_name_tool -id $fwk "$app.app/Contents/Frameworks/$fwk"
Chris@207 26 done
Chris@62 27
Chris@62 28 find "$app.app" -name \*.dylib -print | while read x; do
Chris@62 29 install_name_tool -id "`basename \"$x\"`" "$x"
Chris@62 30 done
Chris@62 31
Chris@207 32 for fwk in $frameworks; do
Chris@62 33 find "$app.app" -type f -print | while read x; do
Chris@516 34 current=$(otool -L "$x" | grep "$fwk" | grep amework | grep -v ':$' | awk '{ print $1; }')
Chris@62 35 [ -z "$current" ] && continue
Chris@62 36 echo "$x has $current"
Chris@62 37 relative=$(echo "$x" | sed -e "s,$app.app/Contents/,," \
Chris@62 38 -e 's,[^/]*/,../,g' -e 's,/[^/]*$,/Frameworks/'"$fwk"',' )
Chris@62 39 echo "replacing with relative path $relative"
Chris@62 40 install_name_tool -change "$current" "@loader_path/$relative" "$x"
Chris@62 41 done
Chris@62 42 done
Chris@62 43
Chris@516 44 find "$app.app" -type f -print | while read x; do
Chris@516 45 qtdep=$(otool -L "$x" | grep Qt | grep amework | grep -v ':$' | grep -v '@loader_path' | awk '{ print $1; }')
Chris@516 46 if [ -n "$qtdep" ]; then
Chris@516 47 echo
Chris@516 48 echo "ERROR: File $x depends on Qt framework(s) not apparently present in the bundle:"
Chris@516 49 echo $qtdep
Chris@516 50 exit 1
Chris@516 51 fi
Chris@516 52 done
Chris@516 53
Chris@62 54 echo "Done: be sure to run the app and see that it works!"
Chris@62 55
Chris@62 56