annotate deploy/osx/deploy.sh @ 864:d47aa2977d7a

Auto dependencies
author Chris Cannam
date Wed, 24 Sep 2014 12:15:58 +0100
parents d18c89386a71
children 40ff7c801fc2 bd3728701e1e
rev   line source
Chris@409 1 #!/bin/bash
Chris@409 2
Chris@409 3 # Execute this from the top-level directory of the project (the one
Chris@409 4 # that contains the .app bundle). Supply the name of the .app bundle
Chris@409 5 # as argument (the target will use $app.app regardless, but we need
Chris@409 6 # to know the source)
Chris@409 7
Chris@409 8 source="$1"
Chris@409 9 dmg="$2"
Chris@409 10 if [ -z "$source" ] || [ ! -d "$source" ] || [ -z "$dmg" ]; then
Chris@409 11 echo "Usage: $0 <source.app> <target-dmg-basename>"
Chris@463 12 echo " e.g. $0 MyApplication.app MyApplication"
Chris@463 13 echo " Version number and .dmg will be appended automatically,"
Chris@463 14 echo " but the .app name must include .app"
Chris@409 15 exit 2
Chris@409 16 fi
Chris@409 17 app=`basename "$source" .app`
Chris@409 18
Chris@409 19 version=`perl -p -e 's/^[^"]*"([^"]*)".*$/$1/' version.h`
Chris@409 20 case "$version" in
Chris@409 21 [0-9].[0-9]) bundleVersion="$version".0 ;;
Chris@409 22 [0-9].[0-9].[0-9]) bundleVersion="$version" ;;
Chris@409 23 *) echo "Error: Version $version is neither two- nor three-part number" ;;
Chris@409 24 esac
Chris@409 25
Chris@409 26 echo
Chris@745 27 echo "Copying in frameworks and plugins from Qt installation directory."
Chris@745 28
Chris@745 29 deploy/osx/copy-qt.sh "$app" || exit 2
Chris@745 30
Chris@745 31 echo
Chris@514 32 echo "Fixing up paths."
Chris@514 33
Chris@514 34 deploy/osx/paths.sh "$app"
Chris@514 35
Chris@514 36 echo
Chris@409 37 echo "Making target tree."
Chris@409 38
Chris@409 39 volume="$app"-"$version"
Chris@409 40 target="$volume"/"$app".app
Chris@409 41 dmg="$dmg"-"$version".dmg
Chris@409 42
Chris@409 43 mkdir "$volume" || exit 1
Chris@409 44
Chris@409 45 ln -s /Applications "$volume"/Applications
Chris@412 46 cp README README.OSC COPYING CHANGELOG "$volume/"
Chris@409 47 cp -rp "$source" "$target"
Chris@409 48
Chris@409 49 echo "Done"
Chris@409 50
Chris@742 51 echo
Chris@742 52 echo "Copying in qt.conf to set local-only plugin paths."
Chris@742 53 echo "Make sure all necessary Qt plugins are in $target/Contents/plugins/*"
Chris@742 54 echo "You probably want platforms/, accessible/ and imageformats/ subdirectories."
Chris@742 55 cp deploy/osx/qt.conf "$target"/Contents/Resources/qt.conf
Chris@742 56
Chris@742 57 echo
Chris@409 58 echo "Writing version $bundleVersion in to bundle."
Chris@409 59 echo "(This should be a three-part number: major.minor.point)"
Chris@409 60
Chris@409 61 perl -p -e "s/SV_VERSION/$bundleVersion/" deploy/osx/Info.plist \
Chris@409 62 > "$target"/Contents/Info.plist
Chris@409 63
Chris@409 64 echo "Done: check $target/Contents/Info.plist for sanity please"
Chris@409 65
Chris@510 66 deploy/osx/sign.sh "$volume" || exit 1
Chris@510 67
Chris@409 68 echo
Chris@409 69 echo "Making dmg..."
Chris@409 70
Chris@409 71 hdiutil create -srcfolder "$volume" "$dmg" -volname "$volume" &&
Chris@409 72 rm -r "$volume"
Chris@409 73
Chris@409 74 echo "Done"