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