annotate deploy/osx/paths.sh @ 1191:c79cff394f59 spectrogram-minor-refactor

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