changeset 437:af696edbd644

OS/X deployment updates
author Chris Cannam
date Tue, 31 Mar 2015 14:31:03 +0100
parents 4d9ce1ed2ac0
children 64dadfc5c6e8
files deploy/osx/copy-qt.sh deploy/osx/deploy.sh deploy/osx/paths.sh deploy/osx/sign.sh
diffstat 4 files changed, 72 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/deploy/osx/copy-qt.sh	Tue Mar 31 14:31:03 2015 +0100
@@ -0,0 +1,53 @@
+#!/bin/bash
+
+set -eu
+
+app="$1"
+if [ -z "$app" ]; then
+	echo "Usage: $0 <appname>"
+	echo "Provide appname without the .app extension, please"
+	exit 2
+fi
+
+frameworks="QtCore QtNetwork QtGui QtXml QtWidgets QtPrintSupport"
+
+plugins="dds gif icns ico jp2 jpeg mng tga tiff wbmp webp cocoa minimal offscreen"
+
+qtdir=$(grep "Command:" Makefile | head -1 | awk '{ print $3; }' | sed s,/bin/.*,,)
+
+if [ ! -d "$qtdir" ]; then
+    echo "Failed to discover Qt installation directory from Makefile, exiting"
+    exit 2
+fi
+
+fdir="$app.app/Contents/Frameworks"
+pdir="$app.app/Contents/plugins"
+
+mkdir -p "$fdir"
+mkdir -p "$pdir"
+
+echo
+echo "Copying frameworks..."
+for fwk in $frameworks; do
+    cp -v "$qtdir/lib/$fwk.framework/$fwk" "$fdir" || exit 2
+done
+
+echo "Done"
+
+echo
+echo "Copying plugins..."
+for plug in $plugins; do
+    pfile=$(ls "$qtdir"/plugins/*/libq"$plug".dylib)
+    if [ ! -f "$pfile" ]; then
+	echo "Failed to find plugin $plug, exiting"
+	exit 2
+    fi
+    target="$pdir"/${pfile##?*plugins/}
+    tdir=`dirname "$target"`
+    mkdir -p "$tdir"
+    cp -v "$pfile" "$target" || exit 2
+done
+
+echo "Done"
+
+
--- a/deploy/osx/deploy.sh	Tue Mar 31 14:30:55 2015 +0100
+++ b/deploy/osx/deploy.sh	Tue Mar 31 14:31:03 2015 +0100
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+set -eu
+
 # Execute this from the top-level directory of the project (the one
 # that contains the .app bundle).  Supply the name of the .app bundle
 # as argument (the target will use $app.app regardless, but we need
@@ -17,10 +19,11 @@
 app=`basename "$source" .app`
 
 version=`perl -p -e 's/^[^"]*"([^"]*)".*$/$1/' version.h`
-case "$version" in
-    [0-9].[0-9]) bundleVersion="$version".0 ;;
-    [0-9].[0-9].[0-9]) bundleVersion="$version" ;;
-    *) echo "Error: Version $version is neither two- nor three-part number" ;;
+stem=${version%%-*}
+case "$stem" in
+    [0-9].[0-9]) bundleVersion="$stem".0 ;;
+    [0-9].[0-9].[0-9]) bundleVersion="$stem" ;;
+    *) echo "Error: Version stem $stem (of version $version) is neither two- nor three-part number"; exit 1 ;;
 esac
 
 if file "$source/Contents/MacOS/$app" | grep -q script; then
@@ -39,7 +42,12 @@
 echo "Copying in plugins from pyin/pyin.dylib and chp/chp.dylib."
 echo "(make sure they're present, up-to-date and compiled with optimisation!)"
 
-cp pyin/pyin.{dylib,cat,n3} chp/chp.{dylib,cat,n3} "$source/Contents/Resources/"
+cp pyin/pyin.dylib chp/chp.dylib "$source/Contents/Resources/"
+
+echo
+echo "Copying in frameworks and plugins from Qt installation directory."
+
+deploy/osx/copy-qt.sh "$app" || exit 2
 
 echo
 echo "Fixing up paths."
@@ -56,8 +64,8 @@
 mkdir "$volume" || exit 1
 
 ln -s /Applications "$volume"/Applications
-cp README README.OSC COPYING CHANGELOG "$volume/"
-cp -r "$source" "$target"
+cp README COPYING CHANGELOG "$volume/"
+cp -rp "$source" "$target"
 
 echo "Done"
 
--- a/deploy/osx/paths.sh	Tue Mar 31 14:30:55 2015 +0100
+++ b/deploy/osx/paths.sh	Tue Mar 31 14:31:03 2015 +0100
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+set -eu
+
 app="$1"
 if [ -z "$app" ]; then
 	echo "Usage: $0 <appname>"
--- a/deploy/osx/sign.sh	Tue Mar 31 14:30:55 2015 +0100
+++ b/deploy/osx/sign.sh	Tue Mar 31 14:31:03 2015 +0100
@@ -1,5 +1,7 @@
 #!/bin/bash 
 
+set -eu
+
 # Execute this from the top-level directory of the project (the one
 # that contains the .app bundle).  Supply the name of the .app bundle
 # as argument