Chris@409: #!/bin/bash Chris@409: Chris@1077: set -e Chris@1077: 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@1077: set -u Chris@1077: Chris@409: version=`perl -p -e 's/^[^"]*"([^"]*)".*$/$1/' version.h` Chris@1055: stem=${version%%-*} Chris@1055: case "$stem" in Chris@409: [0-9].[0-9]) bundleVersion="$version".0 ;; Chris@409: [0-9].[0-9].[0-9]) bundleVersion="$version" ;; Chris@1055: *) echo "Error: Version stem $stem (of version $version) is neither two- nor three-part number" ;; Chris@409: esac Chris@409: Chris@409: echo Chris@745: echo "Copying in frameworks and plugins from Qt installation directory." Chris@745: Chris@745: deploy/osx/copy-qt.sh "$app" || exit 2 Chris@745: Chris@745: echo Chris@514: echo "Fixing up paths." Chris@514: Chris@514: deploy/osx/paths.sh "$app" Chris@514: Chris@514: echo Chris@1077: echo "Copying in qt.conf to set local-only plugin paths." Chris@1077: echo "Make sure all necessary Qt plugins are in $source/Contents/plugins/*" Chris@1077: echo "You probably want platforms/, accessible/ and imageformats/ subdirectories." Chris@1077: cp deploy/osx/qt.conf "$source"/Contents/Resources/qt.conf Chris@1077: Chris@1077: echo Chris@1077: echo "Writing version $bundleVersion in to bundle." Chris@1077: echo "(This should be a three-part number: major.minor.point)" Chris@1077: Chris@1077: perl -p -e "s/SV_VERSION/$bundleVersion/" deploy/osx/Info.plist \ Chris@1077: > "$source"/Contents/Info.plist Chris@1077: Chris@1077: echo "Done: check $source/Contents/Info.plist for sanity please" Chris@1077: Chris@1077: 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@510: deploy/osx/sign.sh "$volume" || exit 1 Chris@510: 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"