comparison deploy/osx/paths.sh @ 1398:6f5a40419b00 bqaudioio

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