annotate deploy/osx/copy-qt.sh @ 768:52717c66833b 2.4beta1

Attempt to make Qt plugin loading work. But it isn't.
author Chris Cannam
date Wed, 13 Aug 2014 22:30:41 +0100
parents d18c89386a71
children 675bc2e08c11
rev   line source
Chris@745 1 #!/bin/bash
Chris@745 2
Chris@745 3 app="$1"
Chris@745 4 if [ -z "$app" ]; then
Chris@745 5 echo "Usage: $0 <appname>"
Chris@745 6 echo "Provide appname without the .app extension, please"
Chris@745 7 exit 2
Chris@745 8 fi
Chris@745 9
Chris@745 10 frameworks="QtCore QtNetwork QtGui QtXml QtWidgets QtPrintSupport"
Chris@745 11
Chris@768 12 plugins="qtaccessiblewidgets qdds qgif qicns qico qjp2 qjpeg qmng qtga qtiff qwbmp qwebp"
Chris@768 13
Chris@768 14 platplugins="qcocoa qminimal"
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@768 25 ppdir="$app.app/Contents/plugins/platforms"
Chris@745 26
Chris@745 27 mkdir -p "$fdir"
Chris@745 28 mkdir -p "$pdir"
Chris@768 29 mkdir -p "$ppdir"
Chris@745 30
Chris@745 31 echo
Chris@745 32 echo "Copying frameworks..."
Chris@745 33 for fwk in $frameworks; do
Chris@745 34 cp -v "$qtdir/lib/$fwk.framework/$fwk" "$fdir" || exit 2
Chris@745 35 done
Chris@745 36
Chris@745 37 echo "Done"
Chris@745 38
Chris@745 39 echo
Chris@745 40 echo "Copying plugins..."
Chris@745 41 for plug in $plugins; do
Chris@745 42 pfile=$(ls "$qtdir"/plugins/*/lib"$plug".dylib)
Chris@745 43 if [ ! -f "$pfile" ]; then
Chris@745 44 echo "Failed to find plugin $plug, exiting"
Chris@745 45 exit 2
Chris@745 46 fi
Chris@745 47 cp -v "$pfile" "$pdir" || exit 2
Chris@745 48 done
Chris@745 49
Chris@745 50 echo "Done"
Chris@745 51
Chris@768 52 echo
Chris@768 53 echo "Copying platform plugins..."
Chris@768 54 for plug in $platplugins; do
Chris@768 55 pfile=$(ls "$qtdir"/plugins/*/lib"$plug".dylib)
Chris@768 56 if [ ! -f "$pfile" ]; then
Chris@768 57 echo "Failed to find plugin $plug, exiting"
Chris@768 58 exit 2
Chris@768 59 fi
Chris@768 60 # I really cannot be bothered to figure out why Qt fails if I copy
Chris@768 61 # to either one of these alone
Chris@768 62 cp -v "$pfile" "$pdir" || exit 2
Chris@768 63 cp -v "$pfile" "$ppdir" || exit 2
Chris@768 64 done
Chris@768 65
Chris@768 66 echo "Done"
Chris@768 67