annotate deploy/osx/deploy.sh @ 434:db0c86c4e5e9 templating

Merge from the default branch
author Chris Cannam
date Tue, 17 May 2011 13:33:15 +0100
parents 44741262c2e0
children 0ef4943f55ae
rev   line source
Chris@409 1 #!/bin/bash
Chris@409 2
Chris@409 3 # Execute this from the top-level directory of the project (the one
Chris@409 4 # that contains the .app bundle). Supply the name of the .app bundle
Chris@409 5 # as argument (the target will use $app.app regardless, but we need
Chris@409 6 # to know the source)
Chris@409 7
Chris@409 8 source="$1"
Chris@409 9 dmg="$2"
Chris@409 10 if [ -z "$source" ] || [ ! -d "$source" ] || [ -z "$dmg" ]; then
Chris@409 11 echo "Usage: $0 <source.app> <target-dmg-basename>"
Chris@409 12 exit 2
Chris@409 13 fi
Chris@409 14 app=`basename "$source" .app`
Chris@409 15
Chris@409 16 version=`perl -p -e 's/^[^"]*"([^"]*)".*$/$1/' version.h`
Chris@409 17 case "$version" in
Chris@409 18 [0-9].[0-9]) bundleVersion="$version".0 ;;
Chris@409 19 [0-9].[0-9].[0-9]) bundleVersion="$version" ;;
Chris@409 20 *) echo "Error: Version $version is neither two- nor three-part number" ;;
Chris@409 21 esac
Chris@409 22
Chris@409 23 echo
Chris@409 24 echo "Making target tree."
Chris@409 25
Chris@409 26 volume="$app"-"$version"
Chris@409 27 target="$volume"/"$app".app
Chris@409 28 dmg="$dmg"-"$version".dmg
Chris@409 29
Chris@409 30 mkdir "$volume" || exit 1
Chris@409 31
Chris@409 32 ln -s /Applications "$volume"/Applications
Chris@412 33 cp README README.OSC COPYING CHANGELOG "$volume/"
Chris@409 34 cp -rp "$source" "$target"
Chris@409 35
Chris@409 36 echo "Done"
Chris@409 37
Chris@409 38 echo "Writing version $bundleVersion in to bundle."
Chris@409 39 echo "(This should be a three-part number: major.minor.point)"
Chris@409 40
Chris@409 41 perl -p -e "s/SV_VERSION/$bundleVersion/" deploy/osx/Info.plist \
Chris@409 42 > "$target"/Contents/Info.plist
Chris@409 43
Chris@409 44 echo "Done: check $target/Contents/Info.plist for sanity please"
Chris@409 45
Chris@409 46 echo
Chris@409 47 echo "Making dmg..."
Chris@409 48
Chris@409 49 hdiutil create -srcfolder "$volume" "$dmg" -volname "$volume" &&
Chris@409 50 rm -r "$volume"
Chris@409 51
Chris@409 52 echo "Done"