Chris@62: #!/bin/bash Chris@62: Chris@62: # Execute this from the top-level directory of the project (the one Chris@62: # that contains the .app bundle). Supply the name of the .app bundle Chris@62: # as argument (the target will use $app.app regardless, but we need Chris@62: # to know the source) Chris@62: Chris@62: source="$1" Chris@62: dmg="$2" Chris@62: if [ -z "$source" ] || [ ! -d "$source" ] || [ -z "$dmg" ]; then Chris@62: echo "Usage: $0 " Chris@62: echo " e.g. $0 MyApplication.app MyApplication" Chris@62: echo " Version number and .dmg will be appended automatically," Chris@62: echo " but the .app name must include .app" Chris@62: exit 2 Chris@62: fi Chris@62: app=`basename "$source" .app` Chris@62: Chris@62: version=`perl -p -e 's/^[^"]*"([^"]*)".*$/$1/' version.h` Chris@62: case "$version" in Chris@62: [0-9].[0-9]) bundleVersion="$version".0 ;; Chris@62: [0-9].[0-9].[0-9]) bundleVersion="$version" ;; Chris@62: *) echo "Error: Version $version is neither two- nor three-part number" ;; Chris@62: esac Chris@62: Chris@66: if file "$source/Contents/MacOS/$app" | grep -q script; then Chris@66: echo Chris@66: echo "Executable is already a script, leaving it alone." Chris@66: else Chris@66: echo Chris@66: echo "Moving aside executable, adding script." Chris@66: Chris@66: mv "$source/Contents/MacOS/$app" "$source/Contents/Resources/" || exit 1 Chris@66: cp "deploy/osx/$app.sh" "$source/Contents/MacOS/$app" || exit 1 Chris@66: chmod +x "$source/Contents/MacOS/$app" Chris@66: fi Chris@66: Chris@66: echo Chris@66: echo "Copying in plugin." Chris@66: Chris@100: cp ../pyin/pyin.{dylib,cat,n3} "$source/Contents/Resources/" Chris@66: Chris@62: echo Chris@62: echo "Fixing up paths." Chris@62: Chris@62: deploy/osx/paths.sh "$app" Chris@62: Chris@62: echo Chris@62: echo "Making target tree." Chris@62: Chris@62: volume="$app"-"$version" Chris@62: target="$volume"/"$app".app Chris@62: dmg="$dmg"-"$version".dmg Chris@62: Chris@62: mkdir "$volume" || exit 1 Chris@62: Chris@62: ln -s /Applications "$volume"/Applications Chris@62: cp README README.OSC COPYING CHANGELOG "$volume/" Chris@100: cp -r "$source" "$target" Chris@62: Chris@62: echo "Done" Chris@62: Chris@62: echo "Writing version $bundleVersion in to bundle." Chris@62: echo "(This should be a three-part number: major.minor.point)" Chris@62: Chris@62: perl -p -e "s/TONY_VERSION/$bundleVersion/" deploy/osx/Info.plist \ Chris@62: > "$target"/Contents/Info.plist Chris@62: Chris@62: echo "Done: check $target/Contents/Info.plist for sanity please" Chris@62: Chris@62: deploy/osx/sign.sh "$volume" || exit 1 Chris@62: Chris@62: echo Chris@62: echo "Making dmg..." Chris@62: Chris@62: hdiutil create -srcfolder "$volume" "$dmg" -volname "$volume" && Chris@62: rm -r "$volume" Chris@62: Chris@62: echo "Done"