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