annotate deploy/osx/deploy.sh @ 597:5ff3eb39e580

Merge
author Chris Cannam
date Fri, 27 Sep 2019 16:02:44 +0100
parents dd344309667f
children fe1a77d4aeaa
rev   line source
Chris@62 1 #!/bin/bash
Chris@62 2
Chris@439 3 set -e
Chris@437 4
Chris@62 5 # Execute this from the top-level directory of the project (the one
Chris@62 6 # that contains the .app bundle). Supply the name of the .app bundle
Chris@62 7 # as argument (the target will use $app.app regardless, but we need
Chris@62 8 # to know the source)
Chris@62 9
Chris@62 10 source="$1"
Chris@62 11 dmg="$2"
Chris@62 12 if [ -z "$source" ] || [ ! -d "$source" ] || [ -z "$dmg" ]; then
Chris@62 13 echo "Usage: $0 <source.app> <target-dmg-basename>"
Chris@62 14 echo " e.g. $0 MyApplication.app MyApplication"
Chris@62 15 echo " Version number and .dmg will be appended automatically,"
Chris@62 16 echo " but the .app name must include .app"
Chris@62 17 exit 2
Chris@62 18 fi
Chris@62 19 app=`basename "$source" .app`
Chris@62 20
Chris@439 21 set -u
Chris@439 22
Chris@62 23 version=`perl -p -e 's/^[^"]*"([^"]*)".*$/$1/' version.h`
Chris@437 24 stem=${version%%-*}
Chris@437 25 case "$stem" in
Chris@437 26 [0-9].[0-9]) bundleVersion="$stem".0 ;;
Chris@437 27 [0-9].[0-9].[0-9]) bundleVersion="$stem" ;;
Chris@437 28 *) echo "Error: Version stem $stem (of version $version) is neither two- nor three-part number"; exit 1 ;;
Chris@62 29 esac
Chris@62 30
Chris@66 31 echo
cannam@567 32 echo "Copying in plugins from libpyin.dylib and libchp.dylib."
Chris@66 33
Chris@558 34 cp libpyin.dylib "$source/Contents/Resources/pyin.dylib"
Chris@558 35 cp libchp.dylib "$source/Contents/Resources/chp.dylib"
Chris@437 36
Chris@437 37 echo
Chris@437 38 echo "Copying in frameworks and plugins from Qt installation directory."
Chris@437 39
Chris@437 40 deploy/osx/copy-qt.sh "$app" || exit 2
Chris@66 41
Chris@62 42 echo
Chris@62 43 echo "Fixing up paths."
Chris@62 44
Chris@62 45 deploy/osx/paths.sh "$app"
Chris@62 46
Chris@62 47 echo
Chris@503 48 echo "Copying in qt.conf to set local-only plugin paths."
Chris@503 49 echo "Make sure all necessary Qt plugins are in $source/Contents/plugins/*"
Chris@503 50 echo "You probably want platforms/, accessible/ and imageformats/ subdirectories."
Chris@503 51 cp deploy/osx/qt.conf "$source"/Contents/Resources/qt.conf
Chris@503 52
Chris@503 53 echo
Chris@503 54 echo "Writing version $bundleVersion in to bundle."
Chris@503 55 echo "(This should be a three-part number: major.minor.point)"
Chris@503 56
Chris@503 57 perl -p -e "s/TONY_VERSION/$bundleVersion/" deploy/osx/Info.plist \
Chris@503 58 > "$source"/Contents/Info.plist
Chris@503 59
Chris@503 60 echo "Done: check $source/Contents/Info.plist for sanity please"
Chris@503 61
Chris@503 62 echo
Chris@62 63 echo "Making target tree."
Chris@62 64
Chris@62 65 volume="$app"-"$version"
Chris@62 66 target="$volume"/"$app".app
Chris@62 67 dmg="$dmg"-"$version".dmg
Chris@62 68
Chris@62 69 mkdir "$volume" || exit 1
Chris@62 70
Chris@62 71 ln -s /Applications "$volume"/Applications
Chris@538 72 cp README.md "$volume/README.txt"
Chris@538 73 cp COPYING "$volume/COPYING.txt"
Chris@538 74 cp CHANGELOG "$volume/CHANGELOG.txt"
Chris@538 75 cp CITATION "$volume/CITATION.txt"
Chris@437 76 cp -rp "$source" "$target"
Chris@62 77
Chris@62 78 echo "Done"
Chris@62 79
Chris@538 80 echo
Chris@538 81 echo "Code-signing volume..."
Chris@538 82
Chris@62 83 deploy/osx/sign.sh "$volume" || exit 1
Chris@62 84
Chris@538 85 echo "Done"
Chris@538 86
Chris@62 87 echo
Chris@62 88 echo "Making dmg..."
Chris@62 89
Chris@62 90 hdiutil create -srcfolder "$volume" "$dmg" -volname "$volume" &&
Chris@62 91 rm -r "$volume"
Chris@62 92
Chris@62 93 echo "Done"