annotate deploy/osx/copy-qt.sh @ 745:d18c89386a71

OS/X build: copy frameworks and plugins automatically
author Chris Cannam
date Mon, 07 Jul 2014 08:14:08 +0100
parents
children 52717c66833b f8264ad5737a
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@745 12 plugins="qtaccessiblewidgets qdds qgif qicns qico qjp2 qjpeg qmng qtga qtiff qwbmp qwebp qcocoa qminimal"
Chris@745 13
Chris@745 14 qtdir=$(grep "Command:" Makefile | head -1 | awk '{ print $3; }' | sed s,/bin/.*,,)
Chris@745 15
Chris@745 16 if [ ! -d "$qtdir" ]; then
Chris@745 17 echo "Failed to discover Qt installation directory from Makefile, exiting"
Chris@745 18 exit 2
Chris@745 19 fi
Chris@745 20
Chris@745 21 fdir="$app.app/Contents/Frameworks"
Chris@745 22 pdir="$app.app/Contents/plugins"
Chris@745 23
Chris@745 24 mkdir -p "$fdir"
Chris@745 25 mkdir -p "$pdir"
Chris@745 26
Chris@745 27 echo
Chris@745 28 echo "Copying frameworks..."
Chris@745 29 for fwk in $frameworks; do
Chris@745 30 cp -v "$qtdir/lib/$fwk.framework/$fwk" "$fdir" || exit 2
Chris@745 31 done
Chris@745 32
Chris@745 33 echo "Done"
Chris@745 34
Chris@745 35 echo
Chris@745 36 echo "Copying plugins..."
Chris@745 37 for plug in $plugins; do
Chris@745 38 pfile=$(ls "$qtdir"/plugins/*/lib"$plug".dylib)
Chris@745 39 if [ ! -f "$pfile" ]; then
Chris@745 40 echo "Failed to find plugin $plug, exiting"
Chris@745 41 exit 2
Chris@745 42 fi
Chris@745 43 cp -v "$pfile" "$pdir" || exit 2
Chris@745 44 done
Chris@745 45
Chris@745 46 echo "Done"
Chris@745 47