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%%-*} cannam@1648: stem=${stem%%pre*} Chris@1055: case "$stem" in cannam@1648: [0-9].[0-9]) bundleVersion="$stem".0 ;; cannam@1648: [0-9].[0-9].[0-9]) bundleVersion="$stem" ;; 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@1499: echo "Copying in plugin load checker." Chris@1499: cp checker/vamp-plugin-load-checker "$source"/Contents/MacOS/ cannam@1286: cannam@1286: echo cannam@1286: echo "Copying in plugin server." cannam@1345: cp piper-vamp-simple-server "$source"/Contents/MacOS/ Chris@1153: Chris@1153: 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@2170: echo "Copying in lproj directories containing InfoPlist.strings translation files." Chris@2170: cp -r i18n/*.lproj "$source"/Contents/Resources/ Chris@2170: Chris@2170: 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@1764: cp README.md "$volume/README.txt" Chris@1764: cp README.OSC "$volume/README-OSC.txt" Chris@1764: cp COPYING "$volume/COPYING.txt" Chris@1764: cp CHANGELOG "$volume/CHANGELOG.txt" Chris@1764: cp CITATION "$volume/CITATION.txt" Chris@409: cp -rp "$source" "$target" Chris@409: cannam@1714: # update file timestamps so as to make the build date apparent cannam@1714: find "$volume" -exec touch \{\} \; cannam@1714: Chris@409: echo "Done" Chris@409: cannam@1286: echo cannam@1286: echo "Code-signing volume..." cannam@1286: Chris@510: deploy/osx/sign.sh "$volume" || exit 1 Chris@510: cannam@1286: echo "Done" cannam@1286: Chris@409: echo Chris@409: echo "Making dmg..." Chris@409: cannam@1947: hdiutil create -srcfolder "$volume" "$dmg" -volname "$volume" -fs HFS+ && Chris@409: rm -r "$volume" Chris@409: Chris@2068: echo Chris@2068: echo "Signing dmg..." Chris@2068: Chris@2068: codesign -s "Developer ID Application: Chris Cannam" -fv "$dmg" Chris@2068: Chris@409: echo "Done"