Chris@62: #!/bin/bash Chris@62: Chris@439: set -e Chris@437: 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@439: set -u Chris@439: Chris@62: version=`perl -p -e 's/^[^"]*"([^"]*)".*$/$1/' version.h` Chris@437: stem=${version%%-*} Chris@437: case "$stem" in Chris@437: [0-9].[0-9]) bundleVersion="$stem".0 ;; Chris@437: [0-9].[0-9].[0-9]) bundleVersion="$stem" ;; Chris@437: *) echo "Error: Version stem $stem (of version $version) is neither two- nor three-part number"; exit 1 ;; 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@207: mv "$source/Contents/MacOS/$app" "$source/Contents/MacOS/$app.bin" || 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@265: echo "Copying in plugins from pyin/pyin.dylib and chp/chp.dylib." Chris@265: echo "(make sure they're present, up-to-date and compiled with optimisation!)" Chris@66: Chris@437: cp pyin/pyin.dylib chp/chp.dylib "$source/Contents/Resources/" Chris@437: Chris@437: echo Chris@437: echo "Copying in frameworks and plugins from Qt installation directory." Chris@437: Chris@437: deploy/osx/copy-qt.sh "$app" || exit 2 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@457: cp README COPYING CHANGELOG CITATION "$volume/" Chris@437: cp -rp "$source" "$target" Chris@62: Chris@62: echo "Done" Chris@62: Chris@207: echo Chris@207: echo "Copying in qt.conf to set local-only plugin paths." Chris@207: echo "Make sure all necessary Qt plugins are in $target/Contents/plugins/*" Chris@207: echo "You probably want platforms/, accessible/ and imageformats/ subdirectories." Chris@207: cp deploy/osx/qt.conf "$target"/Contents/Resources/qt.conf Chris@207: Chris@207: echo 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"