annotate deploy/osx/deploy.sh @ 736:3e6995d01c15

Update server certificate fingerprints
author Chris Cannam
date Wed, 14 Aug 2019 14:52:50 +0100
parents 2cb03c4665aa
children
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@731 33 echo "Copying in kdiff3 program."
Chris@731 34
Chris@731 35 deploy/osx/copy-kdiff3.sh "$app" || exit 2
Chris@731 36
Chris@731 37 echo
Chris@667 38 echo "Copying in frameworks and plugins from Qt installation directory."
Chris@667 39
Chris@667 40 deploy/osx/copy-qt.sh "$app" || exit 2
Chris@667 41
Chris@667 42 echo
Chris@722 43 echo "Copying in PyQt libraries for use by Hg extension module."
Chris@722 44
Chris@722 45 deploy/osx/copy-pyqt.sh "$app" || exit 2
Chris@722 46
Chris@722 47 echo
Chris@667 48 echo "Fixing up paths."
Chris@667 49
Chris@667 50 deploy/osx/paths.sh "$app"
Chris@667 51
Chris@667 52 echo
Chris@667 53 echo "Copying in qt.conf to set local-only plugin paths."
Chris@667 54 echo "Make sure all necessary Qt plugins are in $source/Contents/plugins/*"
Chris@667 55 echo "You probably want platforms/, accessible/ and imageformats/ subdirectories."
Chris@667 56 cp deploy/osx/qt.conf "$source"/Contents/Resources/qt.conf
Chris@667 57
Chris@667 58 echo "Writing version $bundleVersion in to bundle."
Chris@667 59 echo "(This should be a three-part number: major.minor.point)"
Chris@667 60
Chris@667 61 perl -p -e "s/EASYHG_VERSION/$bundleVersion/" deploy/osx/Info.plist \
Chris@667 62 > "$source"/Contents/Info.plist
Chris@667 63
Chris@667 64 echo "Done: check $source/Contents/Info.plist for sanity please"
Chris@667 65
Chris@667 66 echo
Chris@670 67 echo "Copying in helper scripts"
Chris@670 68 cp easyhg-extdiff.sh "$source"/Contents/MacOS/
Chris@670 69 cp easyhg-merge.sh "$source"/Contents/MacOS/
Chris@670 70 chmod +x "$source"/Contents/MacOS/easyhg-extdiff.sh "$source"/Contents/MacOS/easyhg-merge.sh
Chris@670 71
Chris@670 72 echo
Chris@366 73 echo "Making target tree."
Chris@366 74
Chris@366 75 volume="$app"-"$version"
Chris@366 76 target="$volume"/"$app".app
Chris@366 77 dmg="$dmg"-"$version".dmg
Chris@366 78
Chris@366 79 mkdir "$volume" || exit 1
Chris@366 80
Chris@366 81 ln -s /Applications "$volume"/Applications
Chris@577 82 cp COPYING "$volume/COPYING.txt"
Chris@667 83 cp -rp "$source" "$target"
Chris@366 84
Chris@699 85 # update file timestamps so as to make the build date apparent
Chris@699 86 find "$volume" -exec touch \{\} \;
Chris@699 87
Chris@366 88 echo "Done"
Chris@366 89
Chris@699 90 echo
Chris@699 91 echo "Code-signing volume..."
Chris@699 92
Chris@667 93 deploy/osx/sign.sh "$volume" || exit 1
Chris@256 94
Chris@699 95 echo "Done"
Chris@699 96
Chris@256 97 echo
Chris@232 98 echo "Making dmg..."
Chris@232 99
Chris@699 100 hdiutil create -srcfolder "$volume" "$dmg" -volname "$volume" -fs HFS+ &&
Chris@366 101 rm -r "$volume"
Chris@232 102
Chris@699 103 echo
Chris@699 104 echo "Signing dmg..."
Chris@699 105
Chris@699 106 codesign -s "Developer ID Application: Chris Cannam" -fv "$dmg"
Chris@699 107
Chris@232 108 echo "Done"