annotate deploy/osx/deploy.sh @ 516:449a0355f864 v2.0_osx_deploy

Deployment fixes. Qt on OSX now seems to depend on QtDBus, so copy that in, and also fail if anything is found to depend on an absent Qt framework.
author Chris Cannam
date Fri, 23 Oct 2015 08:50:39 +0100
parents 8deff0bd9d45
children 2fcc15ca574a
rev   line source
Chris@62 1 #!/bin/bash
Chris@62 2
Chris@439 3 set -e
Chris@437 4
Chris@62 5 # Execute this from the top-level directory of the project (the one
Chris@62 6 # that contains the .app bundle). Supply the name of the .app bundle
Chris@62 7 # as argument (the target will use $app.app regardless, but we need
Chris@62 8 # to know the source)
Chris@62 9
Chris@62 10 source="$1"
Chris@62 11 dmg="$2"
Chris@62 12 if [ -z "$source" ] || [ ! -d "$source" ] || [ -z "$dmg" ]; then
Chris@62 13 echo "Usage: $0 <source.app> <target-dmg-basename>"
Chris@62 14 echo " e.g. $0 MyApplication.app MyApplication"
Chris@62 15 echo " Version number and .dmg will be appended automatically,"
Chris@62 16 echo " but the .app name must include .app"
Chris@62 17 exit 2
Chris@62 18 fi
Chris@62 19 app=`basename "$source" .app`
Chris@62 20
Chris@439 21 set -u
Chris@439 22
Chris@62 23 version=`perl -p -e 's/^[^"]*"([^"]*)".*$/$1/' version.h`
Chris@437 24 stem=${version%%-*}
Chris@437 25 case "$stem" in
Chris@437 26 [0-9].[0-9]) bundleVersion="$stem".0 ;;
Chris@437 27 [0-9].[0-9].[0-9]) bundleVersion="$stem" ;;
Chris@437 28 *) echo "Error: Version stem $stem (of version $version) is neither two- nor three-part number"; exit 1 ;;
Chris@62 29 esac
Chris@62 30
Chris@66 31 if file "$source/Contents/MacOS/$app" | grep -q script; then
Chris@66 32 echo
Chris@66 33 echo "Executable is already a script, leaving it alone."
Chris@66 34 else
Chris@66 35 echo
Chris@66 36 echo "Moving aside executable, adding script."
Chris@66 37
Chris@207 38 mv "$source/Contents/MacOS/$app" "$source/Contents/MacOS/$app.bin" || exit 1
Chris@66 39 cp "deploy/osx/$app.sh" "$source/Contents/MacOS/$app" || exit 1
Chris@66 40 chmod +x "$source/Contents/MacOS/$app"
Chris@66 41 fi
Chris@66 42
Chris@66 43 echo
Chris@265 44 echo "Copying in plugins from pyin/pyin.dylib and chp/chp.dylib."
Chris@265 45 echo "(make sure they're present, up-to-date and compiled with optimisation!)"
Chris@66 46
Chris@437 47 cp pyin/pyin.dylib chp/chp.dylib "$source/Contents/Resources/"
Chris@437 48
Chris@437 49 echo
Chris@437 50 echo "Copying in frameworks and plugins from Qt installation directory."
Chris@437 51
Chris@437 52 deploy/osx/copy-qt.sh "$app" || exit 2
Chris@66 53
Chris@62 54 echo
Chris@62 55 echo "Fixing up paths."
Chris@62 56
Chris@62 57 deploy/osx/paths.sh "$app"
Chris@62 58
Chris@62 59 echo
Chris@503 60 echo "Copying in qt.conf to set local-only plugin paths."
Chris@503 61 echo "Make sure all necessary Qt plugins are in $source/Contents/plugins/*"
Chris@503 62 echo "You probably want platforms/, accessible/ and imageformats/ subdirectories."
Chris@503 63 cp deploy/osx/qt.conf "$source"/Contents/Resources/qt.conf
Chris@503 64
Chris@503 65 echo
Chris@503 66 echo "Writing version $bundleVersion in to bundle."
Chris@503 67 echo "(This should be a three-part number: major.minor.point)"
Chris@503 68
Chris@503 69 perl -p -e "s/TONY_VERSION/$bundleVersion/" deploy/osx/Info.plist \
Chris@503 70 > "$source"/Contents/Info.plist
Chris@503 71
Chris@503 72 echo "Done: check $source/Contents/Info.plist for sanity please"
Chris@503 73
Chris@503 74 echo
Chris@62 75 echo "Making target tree."
Chris@62 76
Chris@62 77 volume="$app"-"$version"
Chris@62 78 target="$volume"/"$app".app
Chris@62 79 dmg="$dmg"-"$version".dmg
Chris@62 80
Chris@62 81 mkdir "$volume" || exit 1
Chris@62 82
Chris@62 83 ln -s /Applications "$volume"/Applications
Chris@457 84 cp README COPYING CHANGELOG CITATION "$volume/"
Chris@437 85 cp -rp "$source" "$target"
Chris@62 86
Chris@62 87 echo "Done"
Chris@62 88
Chris@62 89 deploy/osx/sign.sh "$volume" || exit 1
Chris@62 90
Chris@62 91 echo
Chris@62 92 echo "Making dmg..."
Chris@62 93
Chris@62 94 hdiutil create -srcfolder "$volume" "$dmg" -volname "$volume" &&
Chris@62 95 rm -r "$volume"
Chris@62 96
Chris@62 97 echo "Done"