annotate deploy/osx/deploy.sh @ 675:8121a6f9abca

Version etc
author Chris Cannam
date Wed, 05 Dec 2018 13:35:29 +0000
parents 8f3075eeaac2
children 646e48a0d3a5
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@675 14 echo " e.g. $0 MyApplication.app MyApplication"
Chris@675 15 echo " Version number and .dmg will be appended automatically,"
Chris@675 16 echo " but the .app name must include .app"
Chris@366 17 exit 2
Chris@366 18 fi
Chris@232 19 app=EasyMercurial
Chris@232 20
Chris@667 21 set -u
Chris@667 22
Chris@372 23 version=`perl -p -e 's/^[^"]*"([^"]*)".*$/$1/' src/version.h`
Chris@260 24 case "$version" in
Chris@260 25 [0-9].[0-9]) bundleVersion="$version".0 ;;
Chris@260 26 [0-9].[0-9].[0-9]) bundleVersion="$version" ;;
Chris@260 27 *) echo "Error: Version $version is neither two- nor three-part number" ;;
Chris@260 28 esac
Chris@232 29
Chris@232 30 echo
Chris@667 31 echo "Copying in frameworks and plugins from Qt installation directory."
Chris@667 32
Chris@667 33 deploy/osx/copy-qt.sh "$app" || exit 2
Chris@667 34
Chris@667 35 echo
Chris@667 36 echo "Fixing up paths."
Chris@667 37
Chris@667 38 deploy/osx/paths.sh "$app"
Chris@667 39
Chris@667 40 echo
Chris@667 41 echo "Copying in qt.conf to set local-only plugin paths."
Chris@667 42 echo "Make sure all necessary Qt plugins are in $source/Contents/plugins/*"
Chris@667 43 echo "You probably want platforms/, accessible/ and imageformats/ subdirectories."
Chris@667 44 cp deploy/osx/qt.conf "$source"/Contents/Resources/qt.conf
Chris@667 45
Chris@667 46 echo "Writing version $bundleVersion in to bundle."
Chris@667 47 echo "(This should be a three-part number: major.minor.point)"
Chris@667 48
Chris@667 49 perl -p -e "s/EASYHG_VERSION/$bundleVersion/" deploy/osx/Info.plist \
Chris@667 50 > "$source"/Contents/Info.plist
Chris@667 51
Chris@667 52 echo "Done: check $source/Contents/Info.plist for sanity please"
Chris@667 53
Chris@667 54 echo
Chris@670 55 echo "Copying in helper scripts"
Chris@670 56 cp easyhg-extdiff.sh "$source"/Contents/MacOS/
Chris@670 57 cp easyhg-merge.sh "$source"/Contents/MacOS/
Chris@670 58 chmod +x "$source"/Contents/MacOS/easyhg-extdiff.sh "$source"/Contents/MacOS/easyhg-merge.sh
Chris@670 59
Chris@670 60 echo
Chris@366 61 echo "Making target tree."
Chris@366 62
Chris@366 63 volume="$app"-"$version"
Chris@366 64 target="$volume"/"$app".app
Chris@366 65 dmg="$dmg"-"$version".dmg
Chris@366 66
Chris@366 67 mkdir "$volume" || exit 1
Chris@366 68
Chris@366 69 ln -s /Applications "$volume"/Applications
Chris@577 70 cp COPYING "$volume/COPYING.txt"
Chris@667 71 cp -rp "$source" "$target"
Chris@366 72
Chris@366 73 echo "Done"
Chris@366 74
Chris@667 75 deploy/osx/sign.sh "$volume" || exit 1
Chris@256 76
Chris@256 77 echo
Chris@232 78 echo "Making dmg..."
Chris@232 79
Chris@366 80 hdiutil create -srcfolder "$volume" "$dmg" -volname "$volume" &&
Chris@366 81 rm -r "$volume"
Chris@232 82
Chris@232 83 echo "Done"