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