# HG changeset patch # User Chris Cannam # Date 1374156395 -3600 # Node ID 092a69229347578bf0991c681eb2d185959c40ce # Parent 85ac2e8e3872f11c177fef39a91f24cca63a2e33 Add OS/X deploy stuff diff -r 85ac2e8e3872 -r 092a69229347 deploy/osx/Info.plist --- /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 @@ + + + + + CFBundlePackageType + APPL + CFBundleName + Tony + CFBundleExecutable + Tony + CFBundleIconFile + sv-macicon.icns + CFBundleIdentifier + uk.ac.qmul.eecs.c4dm.Tony + CFBundleShortVersionString + TONY_VERSION + CFBundleDocumentTypes + + + + + CFBundleTypeExtensions + + mp3 + + CFBundleTypeMIMETypes + + audio/mpeg + + CFBundleTypeName + MP3 Audio + CFBundleTypeRole + Viewer + LSIsAppleDefaultForType + + LSHandlerRank + Alternate + + + CFBundleTypeExtensions + + ogg + oga + + CFBundleTypeMIMETypes + + audio/ogg + + CFBundleTypeName + Ogg Vorbis Audio + CFBundleTypeRole + Viewer + LSIsAppleDefaultForType + + LSHandlerRank + Alternate + + + CFBundleTypeExtensions + + wav + + CFBundleTypeMIMETypes + + audio/x-wav + + CFBundleTypeName + Wave Audio + CFBundleTypeRole + Viewer + LSIsAppleDefaultForType + + LSHandlerRank + Alternate + + + CFBundleTypeExtensions + + aif + aiff + + CFBundleTypeMIMETypes + + audio/x-aiff + + CFBundleTypeName + AIFF Audio + CFBundleTypeRole + Viewer + LSIsAppleDefaultForType + + LSHandlerRank + Alternate + + + CFBundleTypeExtensions + + flac + + CFBundleTypeMIMETypes + + audio/flac + + CFBundleTypeName + FLAC Audio + CFBundleTypeRole + Viewer + LSIsAppleDefaultForType + + LSHandlerRank + Alternate + + + + diff -r 85ac2e8e3872 -r 092a69229347 deploy/osx/deploy.sh --- /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 " + 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" diff -r 85ac2e8e3872 -r 092a69229347 deploy/osx/paths.sh --- /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 " + 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!" + + diff -r 85ac2e8e3872 -r 092a69229347 deploy/osx/sign.sh --- /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 " + echo "Where pkgdir is the directory containing .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 +