Mercurial > hg > tony
changeset 62:092a69229347
Add OS/X deploy stuff
author | Chris Cannam |
---|---|
date | Thu, 18 Jul 2013 15:06:35 +0100 |
parents | 85ac2e8e3872 |
children | 2fbd0d325acf |
files | deploy/osx/Info.plist deploy/osx/deploy.sh deploy/osx/paths.sh deploy/osx/sign.sh |
diffstat | 4 files changed, 236 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deploy/osx/Info.plist Thu Jul 18 15:06:35 2013 +0100 @@ -0,0 +1,115 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd"> +<plist version="0.9"> +<dict> + <key>CFBundlePackageType</key> + <string>APPL</string> + <key>CFBundleName</key> + <string>Tony</string> + <key>CFBundleExecutable</key> + <string>Tony</string> + <key>CFBundleIconFile</key> + <string>sv-macicon.icns</string> + <key>CFBundleIdentifier</key> + <string>uk.ac.qmul.eecs.c4dm.Tony</string> + <key>CFBundleShortVersionString</key> + <string>TONY_VERSION</string> + <key>CFBundleDocumentTypes</key> + + <array> + <!-- we are a 'viewer' of general audio files --> + <dict> + <key>CFBundleTypeExtensions</key> + <array> + <string>mp3</string> + </array> + <key>CFBundleTypeMIMETypes</key> + <array> + <string>audio/mpeg</string> + </array> + <key>CFBundleTypeName</key> + <string>MP3 Audio</string> + <key>CFBundleTypeRole</key> + <string>Viewer</string> + <key>LSIsAppleDefaultForType</key> + <false/> + <key>LSHandlerRank</key> + <string>Alternate</string> + </dict> + <dict> + <key>CFBundleTypeExtensions</key> + <array> + <string>ogg</string> + <string>oga</string> + </array> + <key>CFBundleTypeMIMETypes</key> + <array> + <string>audio/ogg</string> + </array> + <key>CFBundleTypeName</key> + <string>Ogg Vorbis Audio</string> + <key>CFBundleTypeRole</key> + <string>Viewer</string> + <key>LSIsAppleDefaultForType</key> + <false/> + <key>LSHandlerRank</key> + <string>Alternate</string> + </dict> + <dict> + <key>CFBundleTypeExtensions</key> + <array> + <string>wav</string> + </array> + <key>CFBundleTypeMIMETypes</key> + <array> + <string>audio/x-wav</string> + </array> + <key>CFBundleTypeName</key> + <string>Wave Audio</string> + <key>CFBundleTypeRole</key> + <string>Viewer</string> + <key>LSIsAppleDefaultForType</key> + <false/> + <key>LSHandlerRank</key> + <string>Alternate</string> + </dict> + <dict> + <key>CFBundleTypeExtensions</key> + <array> + <string>aif</string> + <string>aiff</string> + </array> + <key>CFBundleTypeMIMETypes</key> + <array> + <string>audio/x-aiff</string> + </array> + <key>CFBundleTypeName</key> + <string>AIFF Audio</string> + <key>CFBundleTypeRole</key> + <string>Viewer</string> + <key>LSIsAppleDefaultForType</key> + <false/> + <key>LSHandlerRank</key> + <string>Alternate</string> + </dict> + <dict> + <key>CFBundleTypeExtensions</key> + <array> + <string>flac</string> + </array> + <key>CFBundleTypeMIMETypes</key> + <array> + <string>audio/flac</string> + </array> + <key>CFBundleTypeName</key> + <string>FLAC Audio</string> + <key>CFBundleTypeRole</key> + <string>Viewer</string> + <key>LSIsAppleDefaultForType</key> + <false/> + <key>LSHandlerRank</key> + <string>Alternate</string> + </dict> + </array> + </dict> +</plist>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deploy/osx/deploy.sh Thu Jul 18 15:06:35 2013 +0100 @@ -0,0 +1,62 @@ +#!/bin/bash + +# Execute this from the top-level directory of the project (the one +# that contains the .app bundle). Supply the name of the .app bundle +# as argument (the target will use $app.app regardless, but we need +# to know the source) + +source="$1" +dmg="$2" +if [ -z "$source" ] || [ ! -d "$source" ] || [ -z "$dmg" ]; then + echo "Usage: $0 <source.app> <target-dmg-basename>" + echo " e.g. $0 MyApplication.app MyApplication" + echo " Version number and .dmg will be appended automatically," + echo " but the .app name must include .app" + exit 2 +fi +app=`basename "$source" .app` + +version=`perl -p -e 's/^[^"]*"([^"]*)".*$/$1/' version.h` +case "$version" in + [0-9].[0-9]) bundleVersion="$version".0 ;; + [0-9].[0-9].[0-9]) bundleVersion="$version" ;; + *) echo "Error: Version $version is neither two- nor three-part number" ;; +esac + +echo +echo "Fixing up paths." + +deploy/osx/paths.sh "$app" + +echo +echo "Making target tree." + +volume="$app"-"$version" +target="$volume"/"$app".app +dmg="$dmg"-"$version".dmg + +mkdir "$volume" || exit 1 + +ln -s /Applications "$volume"/Applications +cp README README.OSC COPYING CHANGELOG "$volume/" +cp -rp "$source" "$target" + +echo "Done" + +echo "Writing version $bundleVersion in to bundle." +echo "(This should be a three-part number: major.minor.point)" + +perl -p -e "s/TONY_VERSION/$bundleVersion/" deploy/osx/Info.plist \ + > "$target"/Contents/Info.plist + +echo "Done: check $target/Contents/Info.plist for sanity please" + +deploy/osx/sign.sh "$volume" || exit 1 + +echo +echo "Making dmg..." + +hdiutil create -srcfolder "$volume" "$dmg" -volname "$volume" && + rm -r "$volume" + +echo "Done"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deploy/osx/paths.sh Thu Jul 18 15:06:35 2013 +0100 @@ -0,0 +1,41 @@ +#!/bin/bash + +app="$1" +if [ -z "$app" ]; then + echo "Usage: $0 <appname>" + echo "Provide appname without the .app extension, please" + exit 2 +fi + +echo +echo "I expect you to have already copied QtCore, QtNetwork, QtGui, QtXml and QtWidgets to " +echo "$app.app/Contents/Frameworks -- expect errors to follow if they're missing" +echo + +echo "Fixing up loader paths in binaries..." + +install_name_tool -id QtCore "$app.app/Contents/Frameworks/QtCore" +install_name_tool -id QtGui "$app.app/Contents/Frameworks/QtGui" +install_name_tool -id QtNetwork "$app.app/Contents/Frameworks/QtNetwork" +install_name_tool -id QtXml "$app.app/Contents/Frameworks/QtXml" +install_name_tool -id QtWidgets "$app.app/Contents/Frameworks/QtWidgets" + +find "$app.app" -name \*.dylib -print | while read x; do + install_name_tool -id "`basename \"$x\"`" "$x" +done + +for fwk in QtCore QtGui QtNetwork QtXml QtWidgets; do + find "$app.app" -type f -print | while read x; do + current=$(otool -L "$x" | grep "$fwk" | grep amework | awk '{ print $1; }') + [ -z "$current" ] && continue + echo "$x has $current" + relative=$(echo "$x" | sed -e "s,$app.app/Contents/,," \ + -e 's,[^/]*/,../,g' -e 's,/[^/]*$,/Frameworks/'"$fwk"',' ) + echo "replacing with relative path $relative" + install_name_tool -change "$current" "@loader_path/$relative" "$x" + done +done + +echo "Done: be sure to run the app and see that it works!" + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deploy/osx/sign.sh Thu Jul 18 15:06:35 2013 +0100 @@ -0,0 +1,18 @@ +#!/bin/bash + +# Execute this from the top-level directory of the project (the one +# that contains the .app bundle). Supply the name of the .app bundle +# as argument +dir="$1" +if [ -z "$dir" ] || [ ! -d "$dir" ]; then + echo "Usage: $0 <pkgdir>" + echo "Where pkgdir is the directory containing <MyApplication>.app" + echo "All .app bundles in pkgdir will be signed" + exit 2 +fi +for app in "$dir"/*.app; do + codesign -s "Developer ID Application: Chris Cannam" -fv \ + --requirements '=designated => identifier "uk.ac.qmul.eecs.c4dm.Tony" and ( (anchor apple generic and certificate leaf[field.1.2.840.113635.100.6.1.9] ) or (anchor apple generic and certificate 1[field.1.2.840.113635.100.6.2.6] and certificate leaf[field.1.2.840.113635.100.6.1.13] and certificate leaf[subject.OU] = "43AQ936H96"))' \ + "$app" +done +