annotate deploy/osx/deploy.sh @ 496:109016400b9c 2.0-integration

Update analysis stuff when recording starts (and when model is added) rather than when it ends. Not continuing to update during recording though...
author Chris Cannam
date Mon, 12 Oct 2015 17:10:43 +0100
parents f8488858feaf
children 8deff0bd9d45
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@62 60 echo "Making target tree."
Chris@62 61
Chris@62 62 volume="$app"-"$version"
Chris@62 63 target="$volume"/"$app".app
Chris@62 64 dmg="$dmg"-"$version".dmg
Chris@62 65
Chris@62 66 mkdir "$volume" || exit 1
Chris@62 67
Chris@62 68 ln -s /Applications "$volume"/Applications
Chris@457 69 cp README COPYING CHANGELOG CITATION "$volume/"
Chris@437 70 cp -rp "$source" "$target"
Chris@62 71
Chris@62 72 echo "Done"
Chris@62 73
Chris@207 74 echo
Chris@207 75 echo "Copying in qt.conf to set local-only plugin paths."
Chris@207 76 echo "Make sure all necessary Qt plugins are in $target/Contents/plugins/*"
Chris@207 77 echo "You probably want platforms/, accessible/ and imageformats/ subdirectories."
Chris@207 78 cp deploy/osx/qt.conf "$target"/Contents/Resources/qt.conf
Chris@207 79
Chris@207 80 echo
Chris@62 81 echo "Writing version $bundleVersion in to bundle."
Chris@62 82 echo "(This should be a three-part number: major.minor.point)"
Chris@62 83
Chris@62 84 perl -p -e "s/TONY_VERSION/$bundleVersion/" deploy/osx/Info.plist \
Chris@62 85 > "$target"/Contents/Info.plist
Chris@62 86
Chris@62 87 echo "Done: check $target/Contents/Info.plist for sanity please"
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"