annotate deploy/osx/deploy.sh @ 727:bd9a54f9aca8

Fix typo
author Chris Cannam
date Mon, 17 Dec 2018 09:35:14 +0000
parents 5afb26b7575a
children 2cb03c4665aa
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@699 19 app=`basename "$source" .app`
Chris@232 20
Chris@667 21 set -u
Chris@667 22
Chris@372 23 version=`perl -p -e 's/^[^"]*"([^"]*)".*$/$1/' src/version.h`
Chris@699 24 stem=${version%%-*}
Chris@699 25 stem=${stem%%pre*}
Chris@699 26 case "$stem" in
Chris@699 27 [0-9].[0-9]) bundleVersion="$stem".0 ;;
Chris@699 28 [0-9].[0-9].[0-9]) bundleVersion="$stem" ;;
Chris@699 29 *) echo "Error: Version stem $stem (of version $version) is neither two- nor three-part number" ;;
Chris@260 30 esac
Chris@232 31
Chris@232 32 echo
Chris@667 33 echo "Copying in frameworks and plugins from Qt installation directory."
Chris@667 34
Chris@667 35 deploy/osx/copy-qt.sh "$app" || exit 2
Chris@667 36
Chris@667 37 echo
Chris@722 38 echo "Copying in PyQt libraries for use by Hg extension module."
Chris@722 39
Chris@722 40 deploy/osx/copy-pyqt.sh "$app" || exit 2
Chris@722 41
Chris@722 42 echo
Chris@667 43 echo "Fixing up paths."
Chris@667 44
Chris@667 45 deploy/osx/paths.sh "$app"
Chris@667 46
Chris@667 47 echo
Chris@667 48 echo "Copying in qt.conf to set local-only plugin paths."
Chris@667 49 echo "Make sure all necessary Qt plugins are in $source/Contents/plugins/*"
Chris@667 50 echo "You probably want platforms/, accessible/ and imageformats/ subdirectories."
Chris@667 51 cp deploy/osx/qt.conf "$source"/Contents/Resources/qt.conf
Chris@667 52
Chris@667 53 echo "Writing version $bundleVersion in to bundle."
Chris@667 54 echo "(This should be a three-part number: major.minor.point)"
Chris@667 55
Chris@667 56 perl -p -e "s/EASYHG_VERSION/$bundleVersion/" deploy/osx/Info.plist \
Chris@667 57 > "$source"/Contents/Info.plist
Chris@667 58
Chris@667 59 echo "Done: check $source/Contents/Info.plist for sanity please"
Chris@667 60
Chris@667 61 echo
Chris@670 62 echo "Copying in helper scripts"
Chris@670 63 cp easyhg-extdiff.sh "$source"/Contents/MacOS/
Chris@670 64 cp easyhg-merge.sh "$source"/Contents/MacOS/
Chris@670 65 chmod +x "$source"/Contents/MacOS/easyhg-extdiff.sh "$source"/Contents/MacOS/easyhg-merge.sh
Chris@670 66
Chris@670 67 echo
Chris@366 68 echo "Making target tree."
Chris@366 69
Chris@366 70 volume="$app"-"$version"
Chris@366 71 target="$volume"/"$app".app
Chris@366 72 dmg="$dmg"-"$version".dmg
Chris@366 73
Chris@366 74 mkdir "$volume" || exit 1
Chris@366 75
Chris@366 76 ln -s /Applications "$volume"/Applications
Chris@577 77 cp COPYING "$volume/COPYING.txt"
Chris@667 78 cp -rp "$source" "$target"
Chris@366 79
Chris@699 80 # update file timestamps so as to make the build date apparent
Chris@699 81 find "$volume" -exec touch \{\} \;
Chris@699 82
Chris@366 83 echo "Done"
Chris@366 84
Chris@699 85 echo
Chris@699 86 echo "Code-signing volume..."
Chris@699 87
Chris@667 88 deploy/osx/sign.sh "$volume" || exit 1
Chris@256 89
Chris@699 90 echo "Done"
Chris@699 91
Chris@256 92 echo
Chris@232 93 echo "Making dmg..."
Chris@232 94
Chris@699 95 hdiutil create -srcfolder "$volume" "$dmg" -volname "$volume" -fs HFS+ &&
Chris@366 96 rm -r "$volume"
Chris@232 97
Chris@699 98 echo
Chris@699 99 echo "Signing dmg..."
Chris@699 100
Chris@699 101 codesign -s "Developer ID Application: Chris Cannam" -fv "$dmg"
Chris@699 102
Chris@232 103 echo "Done"