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@675: echo " e.g. $0 MyApplication.app MyApplication" Chris@675: echo " Version number and .dmg will be appended automatically," Chris@675: echo " but the .app name must include .app" Chris@366: exit 2 Chris@366: fi Chris@699: app=`basename "$source" .app` Chris@232: Chris@667: set -u Chris@667: Chris@372: version=`perl -p -e 's/^[^"]*"([^"]*)".*$/$1/' src/version.h` Chris@699: stem=${version%%-*} Chris@699: stem=${stem%%pre*} Chris@699: case "$stem" in Chris@699: [0-9].[0-9]) bundleVersion="$stem".0 ;; Chris@699: [0-9].[0-9].[0-9]) bundleVersion="$stem" ;; Chris@699: *) echo "Error: Version stem $stem (of version $version) is neither two- nor three-part number" ;; Chris@260: esac Chris@232: Chris@232: echo Chris@731: echo "Copying in kdiff3 program." Chris@731: Chris@731: deploy/osx/copy-kdiff3.sh "$app" || exit 2 Chris@731: Chris@731: 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@722: echo "Copying in PyQt libraries for use by Hg extension module." Chris@722: Chris@722: deploy/osx/copy-pyqt.sh "$app" || exit 2 Chris@722: Chris@722: 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@699: # update file timestamps so as to make the build date apparent Chris@699: find "$volume" -exec touch \{\} \; Chris@699: Chris@366: echo "Done" Chris@366: Chris@699: echo Chris@699: echo "Code-signing volume..." Chris@699: Chris@667: deploy/osx/sign.sh "$volume" || exit 1 Chris@256: Chris@699: echo "Done" Chris@699: Chris@256: echo Chris@232: echo "Making dmg..." Chris@232: Chris@699: hdiutil create -srcfolder "$volume" "$dmg" -volname "$volume" -fs HFS+ && Chris@366: rm -r "$volume" Chris@232: Chris@699: echo Chris@699: echo "Signing dmg..." Chris@699: Chris@699: codesign -s "Developer ID Application: Chris Cannam" -fv "$dmg" Chris@699: Chris@232: echo "Done"