annotate deploy/osx/deploy.sh @ 667:0f3e086066fc qt5

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