Chris@232: #!/bin/bash Chris@232: Chris@667: set -e Chris@667: Chris@232: # Execute this from the top-level directory of the project (the one Chris@366: # that contains the .app bundle). Supply the name of the .app bundle Chris@366: # as argument (the target will use $app.app regardless, but we need Chris@366: # to know the source) Chris@232: Chris@366: source="$1" Chris@366: dmg="$2" Chris@366: if [ -z "$source" ] || [ ! -d "$source" ] || [ -z "$dmg" ]; then Chris@366: echo "Usage: $0 " Chris@366: exit 2 Chris@366: fi Chris@232: app=EasyMercurial Chris@232: Chris@667: set -u Chris@667: Chris@372: version=`perl -p -e 's/^[^"]*"([^"]*)".*$/$1/' src/version.h` Chris@260: case "$version" in Chris@260: [0-9].[0-9]) bundleVersion="$version".0 ;; Chris@260: [0-9].[0-9].[0-9]) bundleVersion="$version" ;; Chris@260: *) echo "Error: Version $version is neither two- nor three-part number" ;; Chris@260: esac Chris@232: Chris@232: echo Chris@667: echo "Copying in frameworks and plugins from Qt installation directory." Chris@667: Chris@667: deploy/osx/copy-qt.sh "$app" || exit 2 Chris@667: Chris@667: echo Chris@667: echo "Fixing up paths." Chris@667: Chris@667: deploy/osx/paths.sh "$app" Chris@667: Chris@667: echo Chris@667: echo "Copying in qt.conf to set local-only plugin paths." Chris@667: echo "Make sure all necessary Qt plugins are in $source/Contents/plugins/*" Chris@667: echo "You probably want platforms/, accessible/ and imageformats/ subdirectories." Chris@667: cp deploy/osx/qt.conf "$source"/Contents/Resources/qt.conf Chris@667: Chris@667: echo "Writing version $bundleVersion in to bundle." Chris@667: echo "(This should be a three-part number: major.minor.point)" Chris@667: Chris@667: perl -p -e "s/EASYHG_VERSION/$bundleVersion/" deploy/osx/Info.plist \ Chris@667: > "$source"/Contents/Info.plist Chris@667: Chris@667: echo "Done: check $source/Contents/Info.plist for sanity please" Chris@667: Chris@667: echo Chris@670: echo "Copying in helper scripts" Chris@670: cp easyhg-extdiff.sh "$source"/Contents/MacOS/ Chris@670: cp easyhg-merge.sh "$source"/Contents/MacOS/ Chris@670: chmod +x "$source"/Contents/MacOS/easyhg-extdiff.sh "$source"/Contents/MacOS/easyhg-merge.sh Chris@670: Chris@670: echo Chris@366: echo "Making target tree." Chris@366: Chris@366: volume="$app"-"$version" Chris@366: target="$volume"/"$app".app Chris@366: dmg="$dmg"-"$version".dmg Chris@366: Chris@366: mkdir "$volume" || exit 1 Chris@366: Chris@366: ln -s /Applications "$volume"/Applications Chris@577: cp COPYING "$volume/COPYING.txt" Chris@667: cp -rp "$source" "$target" Chris@366: Chris@366: echo "Done" Chris@366: Chris@667: deploy/osx/sign.sh "$volume" || exit 1 Chris@256: Chris@256: echo Chris@232: echo "Making dmg..." Chris@232: Chris@366: hdiutil create -srcfolder "$volume" "$dmg" -volname "$volume" && Chris@366: rm -r "$volume" Chris@232: Chris@232: echo "Done"