Mercurial > hg > easyhg
comparison deploy/osx/paths.sh @ 667:0f3e086066fc qt5
Start reworking deployment scripts
author | Chris Cannam |
---|---|
date | Fri, 27 May 2016 09:56:22 +0100 |
parents | 2d3f1e5d8638 |
children | 8f3075eeaac2 |
comparison
equal
deleted
inserted
replaced
666:98a7fbbe9d88 | 667:0f3e086066fc |
---|---|
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 |
12 set -u | |
13 | |
14 frameworks="QtCore QtNetwork QtGui QtWidgets QtPrintSupport QtDBus" | |
15 | |
10 echo | 16 echo |
11 echo "I expect you to have already copied QtCore, QtNetwork and QtGui to " | 17 echo "I expect you to have already copied these frameworks from the Qt installation to" |
12 echo "$app.app/Contents/Frameworks and PyQt4/QtCore.so and PyQt4/QtGui.so to " | 18 echo "$app.app/Contents/Frameworks -- expect errors to follow if they're missing:" |
13 echo "$app.app/Contents/MacOS -- expect errors to follow if they're missing" | 19 echo "$frameworks" |
14 echo | 20 echo |
15 | 21 |
16 echo "Fixing up loader paths in binaries..." | 22 echo "Fixing up loader paths in binaries..." |
17 | 23 |
18 install_name_tool -id QtCore "$app.app/Contents/Frameworks/QtCore" | 24 for fwk in $frameworks; do |
19 install_name_tool -id QtGui "$app.app/Contents/Frameworks/QtGui" | 25 install_name_tool -id $fwk "$app.app/Contents/Frameworks/$fwk" |
20 install_name_tool -id QtNetwork "$app.app/Contents/Frameworks/QtNetwork" | 26 done |
21 | 27 |
22 for fwk in QtCore QtGui QtNetwork; do | 28 find "$app.app" -name \*.dylib -print | while read x; do |
29 install_name_tool -id "`basename \"$x\"`" "$x" | |
30 done | |
31 | |
32 for fwk in $frameworks; do | |
23 find "$app.app" -type f -print | while read x; do | 33 find "$app.app" -type f -print | while read x; do |
24 current=$(otool -L "$x" | grep "$fwk" | grep ramework | awk '{ print $1; }') | 34 current=$(otool -L "$x" | grep "$fwk" | grep amework | grep -v ':$' | awk '{ print $1; }') |
25 [ -z "$current" ] && continue | 35 [ -z "$current" ] && continue |
26 echo "$x has $current" | 36 echo "$x has $current" |
27 relative=$(echo "$x" | sed -e "s,$app.app/Contents/,," \ | 37 relative=$(echo "$x" | sed -e "s,$app.app/Contents/,," \ |
28 -e 's,[^/]*/,../,g' -e 's,/[^/]*$,/Frameworks/'"$fwk"',' ) | 38 -e 's,[^/]*/,../,g' -e 's,/[^/]*$,/Frameworks/'"$fwk"',' ) |
29 echo "replacing with relative path $relative" | 39 echo "replacing with relative path $relative" |
30 install_name_tool -change "$current" "@loader_path/$relative" "$x" | 40 install_name_tool -change "$current" "@loader_path/$relative" "$x" |
31 done | 41 done |
32 done | 42 done |
33 | 43 |
44 find "$app.app" -type f -print | while read x; do | |
45 qtdep=$(otool -L "$x" | grep Qt | grep amework | grep -v ':$' | grep -v '@loader_path' | awk '{ print $1; }') | |
46 if [ -n "$qtdep" ]; then | |
47 echo | |
48 echo "ERROR: File $x depends on Qt framework(s) not apparently present in the bundle:" | |
49 echo $qtdep | |
50 exit 1 | |
51 fi | |
52 done | |
53 | |
34 echo "Done: be sure to run the app and see that it works!" | 54 echo "Done: be sure to run the app and see that it works!" |
35 | 55 |
36 | 56 |