annotate deploy/osx/deploy.sh @ 62:092a69229347

Add OS/X deploy stuff
author Chris Cannam
date Thu, 18 Jul 2013 15:06:35 +0100
parents
children f9803dceab2a
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@62 8 source="$1"
Chris@62 9 dmg="$2"
Chris@62 10 if [ -z "$source" ] || [ ! -d "$source" ] || [ -z "$dmg" ]; then
Chris@62 11 echo "Usage: $0 <source.app> <target-dmg-basename>"
Chris@62 12 echo " e.g. $0 MyApplication.app MyApplication"
Chris@62 13 echo " Version number and .dmg will be appended automatically,"
Chris@62 14 echo " but the .app name must include .app"
Chris@62 15 exit 2
Chris@62 16 fi
Chris@62 17 app=`basename "$source" .app`
Chris@62 18
Chris@62 19 version=`perl -p -e 's/^[^"]*"([^"]*)".*$/$1/' version.h`
Chris@62 20 case "$version" in
Chris@62 21 [0-9].[0-9]) bundleVersion="$version".0 ;;
Chris@62 22 [0-9].[0-9].[0-9]) bundleVersion="$version" ;;
Chris@62 23 *) echo "Error: Version $version is neither two- nor three-part number" ;;
Chris@62 24 esac
Chris@62 25
Chris@62 26 echo
Chris@62 27 echo "Fixing up paths."
Chris@62 28
Chris@62 29 deploy/osx/paths.sh "$app"
Chris@62 30
Chris@62 31 echo
Chris@62 32 echo "Making target tree."
Chris@62 33
Chris@62 34 volume="$app"-"$version"
Chris@62 35 target="$volume"/"$app".app
Chris@62 36 dmg="$dmg"-"$version".dmg
Chris@62 37
Chris@62 38 mkdir "$volume" || exit 1
Chris@62 39
Chris@62 40 ln -s /Applications "$volume"/Applications
Chris@62 41 cp README README.OSC COPYING CHANGELOG "$volume/"
Chris@62 42 cp -rp "$source" "$target"
Chris@62 43
Chris@62 44 echo "Done"
Chris@62 45
Chris@62 46 echo "Writing version $bundleVersion in to bundle."
Chris@62 47 echo "(This should be a three-part number: major.minor.point)"
Chris@62 48
Chris@62 49 perl -p -e "s/TONY_VERSION/$bundleVersion/" deploy/osx/Info.plist \
Chris@62 50 > "$target"/Contents/Info.plist
Chris@62 51
Chris@62 52 echo "Done: check $target/Contents/Info.plist for sanity please"
Chris@62 53
Chris@62 54 deploy/osx/sign.sh "$volume" || exit 1
Chris@62 55
Chris@62 56 echo
Chris@62 57 echo "Making dmg..."
Chris@62 58
Chris@62 59 hdiutil create -srcfolder "$volume" "$dmg" -volname "$volume" &&
Chris@62 60 rm -r "$volume"
Chris@62 61
Chris@62 62 echo "Done"