comparison deploy/osx/copy-qt.sh @ 699:646e48a0d3a5

Some work on macOS packaging
author Chris Cannam
date Tue, 11 Dec 2018 16:40:57 +0000
parents
children 5afb26b7575a
comparison
equal deleted inserted replaced
698:52b8a499f379 699:646e48a0d3a5
1 #!/bin/bash
2
3 set -eu
4
5 app="$1"
6 if [ -z "$app" ]; then
7 echo "Usage: $0 <appname>"
8 echo "Provide appname without the .app extension, please"
9 exit 2
10 fi
11
12 frameworks="QtCore QtNetwork QtGui QtWidgets QtPrintSupport QtDBus"
13
14 plugins="gif icns ico jpeg tga tiff wbmp webp cocoa macstyle minimal offscreen"
15
16 qtdir=$(grep "Command:" Makefile | head -1 | awk '{ print $3; }' | sed s,/bin/.*,,)
17
18 if [ ! -d "$qtdir" ]; then
19 echo "Failed to discover Qt installation directory from Makefile, exiting"
20 exit 2
21 fi
22
23 fdir="$app.app/Contents/Frameworks"
24 pdir="$app.app/Contents/plugins"
25
26 mkdir -p "$fdir"
27 mkdir -p "$pdir"
28
29 echo
30 echo "Copying frameworks..."
31 for fwk in $frameworks; do
32 if [ ! -d "$qtdir/lib/$fwk.framework" ]; then
33 if [ "$fwk" = "QtDBus" ]; then
34 echo "QtDBus.framework not found, assuming Qt was built without DBus support"
35 continue
36 fi
37 fi
38 cp -v "$qtdir/lib/$fwk.framework/$fwk" "$fdir" || exit 2
39 done
40
41 echo "Done"
42
43 echo
44 echo "Copying plugins..."
45 for plug in $plugins; do
46 pfile=$(ls "$qtdir"/plugins/*/libq"$plug".dylib)
47 if [ ! -f "$pfile" ]; then
48 echo "Failed to find plugin $plug, exiting"
49 exit 2
50 fi
51 target="$pdir"/${pfile##?*plugins/}
52 tdir=`dirname "$target"`
53 mkdir -p "$tdir"
54 cp -v "$pfile" "$target" || exit 2
55 done
56
57 echo "Done"
58
59