annotate deploy/osx/deploy.sh @ 715:665da28f1da8

Add pyqt5 and python-crypto dependencies
author Chris Cannam
date Wed, 12 Dec 2018 14:10:20 +0000
parents 646e48a0d3a5
children 5afb26b7575a
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@667 38 echo "Fixing up paths."
Chris@667 39
Chris@667 40 deploy/osx/paths.sh "$app"
Chris@667 41
Chris@667 42 echo
Chris@667 43 echo "Copying in qt.conf to set local-only plugin paths."
Chris@667 44 echo "Make sure all necessary Qt plugins are in $source/Contents/plugins/*"
Chris@667 45 echo "You probably want platforms/, accessible/ and imageformats/ subdirectories."
Chris@667 46 cp deploy/osx/qt.conf "$source"/Contents/Resources/qt.conf
Chris@667 47
Chris@667 48 echo "Writing version $bundleVersion in to bundle."
Chris@667 49 echo "(This should be a three-part number: major.minor.point)"
Chris@667 50
Chris@667 51 perl -p -e "s/EASYHG_VERSION/$bundleVersion/" deploy/osx/Info.plist \
Chris@667 52 > "$source"/Contents/Info.plist
Chris@667 53
Chris@667 54 echo "Done: check $source/Contents/Info.plist for sanity please"
Chris@667 55
Chris@667 56 echo
Chris@670 57 echo "Copying in helper scripts"
Chris@670 58 cp easyhg-extdiff.sh "$source"/Contents/MacOS/
Chris@670 59 cp easyhg-merge.sh "$source"/Contents/MacOS/
Chris@670 60 chmod +x "$source"/Contents/MacOS/easyhg-extdiff.sh "$source"/Contents/MacOS/easyhg-merge.sh
Chris@670 61
Chris@670 62 echo
Chris@366 63 echo "Making target tree."
Chris@366 64
Chris@366 65 volume="$app"-"$version"
Chris@366 66 target="$volume"/"$app".app
Chris@366 67 dmg="$dmg"-"$version".dmg
Chris@366 68
Chris@366 69 mkdir "$volume" || exit 1
Chris@366 70
Chris@366 71 ln -s /Applications "$volume"/Applications
Chris@577 72 cp COPYING "$volume/COPYING.txt"
Chris@667 73 cp -rp "$source" "$target"
Chris@366 74
Chris@699 75 # update file timestamps so as to make the build date apparent
Chris@699 76 find "$volume" -exec touch \{\} \;
Chris@699 77
Chris@366 78 echo "Done"
Chris@366 79
Chris@699 80 echo
Chris@699 81 echo "Code-signing volume..."
Chris@699 82
Chris@667 83 deploy/osx/sign.sh "$volume" || exit 1
Chris@256 84
Chris@699 85 echo "Done"
Chris@699 86
Chris@256 87 echo
Chris@232 88 echo "Making dmg..."
Chris@232 89
Chris@699 90 hdiutil create -srcfolder "$volume" "$dmg" -volname "$volume" -fs HFS+ &&
Chris@366 91 rm -r "$volume"
Chris@232 92
Chris@699 93 echo
Chris@699 94 echo "Signing dmg..."
Chris@699 95
Chris@699 96 codesign -s "Developer ID Application: Chris Cannam" -fv "$dmg"
Chris@699 97
Chris@232 98 echo "Done"