Chris@409: #!/bin/bash Chris@409: Chris@409: # Execute this from the top-level directory of the project (the one Chris@409: # that contains the .app bundle). Supply the name of the .app bundle Chris@409: # as argument (the target will use $app.app regardless, but we need Chris@409: # to know the source) Chris@409: Chris@409: source="$1" Chris@409: dmg="$2" Chris@409: if [ -z "$source" ] || [ ! -d "$source" ] || [ -z "$dmg" ]; then Chris@409: echo "Usage: $0 " Chris@463: echo " e.g. $0 MyApplication.app MyApplication" Chris@463: echo " Version number and .dmg will be appended automatically," Chris@463: echo " but the .app name must include .app" Chris@409: exit 2 Chris@409: fi Chris@409: app=`basename "$source" .app` Chris@409: Chris@409: version=`perl -p -e 's/^[^"]*"([^"]*)".*$/$1/' version.h` Chris@409: case "$version" in Chris@409: [0-9].[0-9]) bundleVersion="$version".0 ;; Chris@409: [0-9].[0-9].[0-9]) bundleVersion="$version" ;; Chris@409: *) echo "Error: Version $version is neither two- nor three-part number" ;; Chris@409: esac Chris@409: Chris@409: echo Chris@409: echo "Making target tree." Chris@409: Chris@409: volume="$app"-"$version" Chris@409: target="$volume"/"$app".app Chris@409: dmg="$dmg"-"$version".dmg Chris@409: Chris@409: mkdir "$volume" || exit 1 Chris@409: Chris@409: ln -s /Applications "$volume"/Applications Chris@412: cp README README.OSC COPYING CHANGELOG "$volume/" Chris@409: cp -rp "$source" "$target" Chris@409: Chris@409: echo "Done" Chris@409: Chris@409: echo "Writing version $bundleVersion in to bundle." Chris@409: echo "(This should be a three-part number: major.minor.point)" Chris@409: Chris@409: perl -p -e "s/SV_VERSION/$bundleVersion/" deploy/osx/Info.plist \ Chris@409: > "$target"/Contents/Info.plist Chris@409: Chris@409: echo "Done: check $target/Contents/Info.plist for sanity please" Chris@409: Chris@409: echo Chris@409: echo "Making dmg..." Chris@409: Chris@409: hdiutil create -srcfolder "$volume" "$dmg" -volname "$volume" && Chris@409: rm -r "$volume" Chris@409: Chris@409: echo "Done"