annotate deploy/osx/deploy.sh @ 382:a5e63c0af39a tonioni_experiment_july2014 v0.7_experiment_july2014

Fix to settings reset -- needs to happen before the MainWindow ctor to avoid breaking behaviour within the current run!
author Chris Cannam
date Mon, 21 Jul 2014 15:23:10 +0100
parents 5641917aea9c
children
rev   line source
Chris@62 1 #!/bin/bash
Chris@62 2
Chris@62 3 # Execute this from the top-level directory of the project (the one
Chris@62 4 # that contains the .app bundle). Supply the name of the .app bundle
Chris@62 5 # as argument (the target will use $app.app regardless, but we need
Chris@62 6 # to know the source)
Chris@62 7
Chris@379 8 #!!! Special args for constructing experimental scripts. Do not merge
Chris@379 9 #!!! to default branch.
Chris@379 10 shext=""
Chris@379 11 if [ "$1" = "--no-sonification" ]; then
Chris@379 12 shext=".no-sonification"
Chris@379 13 shift
Chris@379 14 elif [ "$1" = "--no-spectrogram" ]; then
Chris@379 15 shext=".no-spectrogram"
Chris@379 16 shift
Chris@379 17 elif [ "$1" = "--all-features" ]; then
Chris@379 18 shext=""
Chris@379 19 shift
Chris@379 20 else
Chris@379 21 echo "Error: Must supply one of --all-features, --no-sonification, --no-spectrogram"
Chris@379 22 exit 2
Chris@379 23 fi
Chris@379 24
Chris@379 25 echo "Shell file extension: $shext"
Chris@379 26
Chris@62 27 source="$1"
Chris@62 28 dmg="$2"
Chris@62 29 if [ -z "$source" ] || [ ! -d "$source" ] || [ -z "$dmg" ]; then
Chris@62 30 echo "Usage: $0 <source.app> <target-dmg-basename>"
Chris@62 31 echo " e.g. $0 MyApplication.app MyApplication"
Chris@62 32 echo " Version number and .dmg will be appended automatically,"
Chris@62 33 echo " but the .app name must include .app"
Chris@62 34 exit 2
Chris@62 35 fi
Chris@62 36 app=`basename "$source" .app`
Chris@62 37
Chris@62 38 version=`perl -p -e 's/^[^"]*"([^"]*)".*$/$1/' version.h`
Chris@62 39 case "$version" in
Chris@62 40 [0-9].[0-9]) bundleVersion="$version".0 ;;
Chris@62 41 [0-9].[0-9].[0-9]) bundleVersion="$version" ;;
Chris@62 42 *) echo "Error: Version $version is neither two- nor three-part number" ;;
Chris@62 43 esac
Chris@62 44
Chris@66 45 if file "$source/Contents/MacOS/$app" | grep -q script; then
Chris@66 46 echo
Chris@379 47 echo "Executable is already a script, replacing it."
Chris@379 48
Chris@379 49 cp "deploy/osx/$app.sh$shext" "$source/Contents/MacOS/$app" || exit 1
Chris@379 50 chmod +x "$source/Contents/MacOS/$app"
Chris@66 51 else
Chris@66 52 echo
Chris@66 53 echo "Moving aside executable, adding script."
Chris@66 54
Chris@207 55 mv "$source/Contents/MacOS/$app" "$source/Contents/MacOS/$app.bin" || exit 1
Chris@379 56 cp "deploy/osx/$app.sh$shext" "$source/Contents/MacOS/$app" || exit 1
Chris@66 57 chmod +x "$source/Contents/MacOS/$app"
Chris@66 58 fi
Chris@66 59
Chris@66 60 echo
Chris@265 61 echo "Copying in plugins from pyin/pyin.dylib and chp/chp.dylib."
Chris@265 62 echo "(make sure they're present, up-to-date and compiled with optimisation!)"
Chris@66 63
Chris@265 64 cp pyin/pyin.{dylib,cat,n3} chp/chp.{dylib,cat,n3} "$source/Contents/Resources/"
Chris@66 65
Chris@62 66 echo
Chris@62 67 echo "Fixing up paths."
Chris@62 68
Chris@62 69 deploy/osx/paths.sh "$app"
Chris@62 70
Chris@62 71 echo
Chris@62 72 echo "Making target tree."
Chris@62 73
Chris@62 74 volume="$app"-"$version"
Chris@62 75 target="$volume"/"$app".app
Chris@381 76 dmg="$dmg"-"$version$shext".dmg
Chris@62 77
Chris@62 78 mkdir "$volume" || exit 1
Chris@62 79
Chris@62 80 ln -s /Applications "$volume"/Applications
Chris@62 81 cp README README.OSC COPYING CHANGELOG "$volume/"
Chris@100 82 cp -r "$source" "$target"
Chris@62 83
Chris@62 84 echo "Done"
Chris@62 85
Chris@207 86 echo
Chris@207 87 echo "Copying in qt.conf to set local-only plugin paths."
Chris@207 88 echo "Make sure all necessary Qt plugins are in $target/Contents/plugins/*"
Chris@207 89 echo "You probably want platforms/, accessible/ and imageformats/ subdirectories."
Chris@207 90 cp deploy/osx/qt.conf "$target"/Contents/Resources/qt.conf
Chris@207 91
Chris@207 92 echo
Chris@62 93 echo "Writing version $bundleVersion in to bundle."
Chris@62 94 echo "(This should be a three-part number: major.minor.point)"
Chris@62 95
Chris@62 96 perl -p -e "s/TONY_VERSION/$bundleVersion/" deploy/osx/Info.plist \
Chris@62 97 > "$target"/Contents/Info.plist
Chris@62 98
Chris@62 99 echo "Done: check $target/Contents/Info.plist for sanity please"
Chris@62 100
Chris@62 101 deploy/osx/sign.sh "$volume" || exit 1
Chris@62 102
Chris@62 103 echo
Chris@62 104 echo "Making dmg..."
Chris@62 105
Chris@62 106 hdiutil create -srcfolder "$volume" "$dmg" -volname "$volume" &&
Chris@62 107 rm -r "$volume"
Chris@62 108
Chris@62 109 echo "Done"