annotate deploy/osx/deploy.sh @ 352:7178bb4dcdfb v0.6

Icons
author Chris Cannam
date Mon, 16 Jun 2014 13:04:09 +0100
parents 23287f4f521f
children 948148da3a46 af696edbd644
rev   line source
Chris@62 1 #!/bin/bash
Chris@62 2
Chris@62 3 # Execute this from the top-level directory of the project (the one
Chris@62 4 # that contains the .app bundle). Supply the name of the .app bundle
Chris@62 5 # as argument (the target will use $app.app regardless, but we need
Chris@62 6 # to know the source)
Chris@62 7
Chris@62 8 source="$1"
Chris@62 9 dmg="$2"
Chris@62 10 if [ -z "$source" ] || [ ! -d "$source" ] || [ -z "$dmg" ]; then
Chris@62 11 echo "Usage: $0 <source.app> <target-dmg-basename>"
Chris@62 12 echo " e.g. $0 MyApplication.app MyApplication"
Chris@62 13 echo " Version number and .dmg will be appended automatically,"
Chris@62 14 echo " but the .app name must include .app"
Chris@62 15 exit 2
Chris@62 16 fi
Chris@62 17 app=`basename "$source" .app`
Chris@62 18
Chris@62 19 version=`perl -p -e 's/^[^"]*"([^"]*)".*$/$1/' version.h`
Chris@62 20 case "$version" in
Chris@62 21 [0-9].[0-9]) bundleVersion="$version".0 ;;
Chris@62 22 [0-9].[0-9].[0-9]) bundleVersion="$version" ;;
Chris@62 23 *) echo "Error: Version $version is neither two- nor three-part number" ;;
Chris@62 24 esac
Chris@62 25
Chris@66 26 if file "$source/Contents/MacOS/$app" | grep -q script; then
Chris@66 27 echo
Chris@66 28 echo "Executable is already a script, leaving it alone."
Chris@66 29 else
Chris@66 30 echo
Chris@66 31 echo "Moving aside executable, adding script."
Chris@66 32
Chris@207 33 mv "$source/Contents/MacOS/$app" "$source/Contents/MacOS/$app.bin" || exit 1
Chris@66 34 cp "deploy/osx/$app.sh" "$source/Contents/MacOS/$app" || exit 1
Chris@66 35 chmod +x "$source/Contents/MacOS/$app"
Chris@66 36 fi
Chris@66 37
Chris@66 38 echo
Chris@265 39 echo "Copying in plugins from pyin/pyin.dylib and chp/chp.dylib."
Chris@265 40 echo "(make sure they're present, up-to-date and compiled with optimisation!)"
Chris@66 41
Chris@265 42 cp pyin/pyin.{dylib,cat,n3} chp/chp.{dylib,cat,n3} "$source/Contents/Resources/"
Chris@66 43
Chris@62 44 echo
Chris@62 45 echo "Fixing up paths."
Chris@62 46
Chris@62 47 deploy/osx/paths.sh "$app"
Chris@62 48
Chris@62 49 echo
Chris@62 50 echo "Making target tree."
Chris@62 51
Chris@62 52 volume="$app"-"$version"
Chris@62 53 target="$volume"/"$app".app
Chris@62 54 dmg="$dmg"-"$version".dmg
Chris@62 55
Chris@62 56 mkdir "$volume" || exit 1
Chris@62 57
Chris@62 58 ln -s /Applications "$volume"/Applications
Chris@62 59 cp README README.OSC COPYING CHANGELOG "$volume/"
Chris@100 60 cp -r "$source" "$target"
Chris@62 61
Chris@62 62 echo "Done"
Chris@62 63
Chris@207 64 echo
Chris@207 65 echo "Copying in qt.conf to set local-only plugin paths."
Chris@207 66 echo "Make sure all necessary Qt plugins are in $target/Contents/plugins/*"
Chris@207 67 echo "You probably want platforms/, accessible/ and imageformats/ subdirectories."
Chris@207 68 cp deploy/osx/qt.conf "$target"/Contents/Resources/qt.conf
Chris@207 69
Chris@207 70 echo
Chris@62 71 echo "Writing version $bundleVersion in to bundle."
Chris@62 72 echo "(This should be a three-part number: major.minor.point)"
Chris@62 73
Chris@62 74 perl -p -e "s/TONY_VERSION/$bundleVersion/" deploy/osx/Info.plist \
Chris@62 75 > "$target"/Contents/Info.plist
Chris@62 76
Chris@62 77 echo "Done: check $target/Contents/Info.plist for sanity please"
Chris@62 78
Chris@62 79 deploy/osx/sign.sh "$volume" || exit 1
Chris@62 80
Chris@62 81 echo
Chris@62 82 echo "Making dmg..."
Chris@62 83
Chris@62 84 hdiutil create -srcfolder "$volume" "$dmg" -volname "$volume" &&
Chris@62 85 rm -r "$volume"
Chris@62 86
Chris@62 87 echo "Done"