annotate deploy/osx/paths.sh @ 129:afd72eb2b0aa tip

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