Mercurial > hg > easyhg
comparison deploy/osx/paths.sh @ 672:88fa1544b407
Merge from branch qt5. There's much more to be done before we can make another release, but clearly it's going to be done using qt5
author | Chris Cannam |
---|---|
date | Wed, 05 Dec 2018 09:44:10 +0000 |
parents | 8f3075eeaac2 |
children | 646e48a0d3a5 |
comparison
equal
deleted
inserted
replaced
665:88061103b878 | 672:88fa1544b407 |
---|---|
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 |
23 find "$app.app" -type f -print | while read x; do | 29 install_name_tool -id "`basename \"$x\"`" "$x" |
24 current=$(otool -L "$x" | grep "$fwk" | grep ramework | awk '{ print $1; }') | 30 done |
25 [ -z "$current" ] && continue | 31 |
26 echo "$x has $current" | 32 for fwk in $frameworks; do |
27 relative=$(echo "$x" | sed -e "s,$app.app/Contents/,," \ | 33 find "$app.app" -type f -print | while read x; do |
28 -e 's,[^/]*/,../,g' -e 's,/[^/]*$,/Frameworks/'"$fwk"',' ) | 34 |
29 echo "replacing with relative path $relative" | 35 current=$(otool -L "$x" | |
30 install_name_tool -change "$current" "@loader_path/$relative" "$x" | 36 grep "$fwk" | grep amework | grep -v ':$' | |
31 done | 37 awk '{ print $1; }') |
38 | |
39 [ -z "$current" ] && continue | |
40 | |
41 echo "$x has $current" | |
42 | |
43 case "$x" in | |
44 *PyQt4*) | |
45 # These are "special" Qt4 libraries used by | |
46 # the PyQt module. They need to refer to their | |
47 # own local neighbours. Ugh, but let's handle | |
48 # those manually here. | |
49 relative="$fwk.so" | |
50 ;; | |
51 *) | |
52 # The normal Qt5 case | |
53 relative=$(echo "$x" | | |
54 sed -e "s,$app.app/Contents/,," \ | |
55 -e 's,[^/]*/,../,g' \ | |
56 -e 's,/[^/]*$,/Frameworks/'"$fwk"',' ) | |
57 ;; | |
58 esac | |
59 | |
60 echo "replacing with relative path $relative" | |
61 install_name_tool -change \ | |
62 "$current" "@loader_path/$relative" "$x" | |
63 done | |
64 done | |
65 | |
66 find "$app.app" -type f -print | while read x; do | |
67 qtdep=$(otool -L "$x" | grep Qt | grep amework | grep -v ':$' | grep -v '@loader_path' | awk '{ print $1; }') | |
68 if [ -n "$qtdep" ]; then | |
69 echo | |
70 echo "ERROR: File $x depends on Qt framework(s) not apparently present in the bundle:" | |
71 echo $qtdep | |
72 exit 1 | |
73 fi | |
32 done | 74 done |
33 | 75 |
34 echo "Done: be sure to run the app and see that it works!" | 76 echo "Done: be sure to run the app and see that it works!" |
35 | 77 |
36 | 78 |