annotate deploy/osx/copy-qt.sh @ 830:89b10dff01c7

Clarify some sneaky logic
author Chris Cannam
date Wed, 03 Sep 2014 11:49:31 +0100
parents f8264ad5737a
children 4a7c62938a13 9fbd599b4e3a 55575ded7d8c
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@772 12 plugins="taccessiblewidgets dds gif icns ico jp2 jpeg mng tga tiff wbmp webp cocoa minimal offscreen"
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@772 38 pfile=$(ls "$qtdir"/plugins/*/libq"$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@772 43 target="$pdir"/${pfile##?*plugins/}
Chris@772 44 tdir=`dirname "$target"`
Chris@772 45 mkdir -p "$tdir"
Chris@772 46 cp -v "$pfile" "$target" || exit 2
Chris@745 47 done
Chris@745 48
Chris@745 49 echo "Done"
Chris@745 50
Chris@772 51