annotate deploy/osx/deploy-and-package.sh @ 2517:27dc177e114f

Tidy
author Chris Cannam
date Wed, 29 Apr 2020 13:27:22 +0100
parents 995a4014a5c8
children 19cb6df86ef2
rev   line source
Chris@2374 1 #!/bin/bash
Chris@2374 2
Chris@2377 3 # Run this from the project root, without arguments, or with the
Chris@2377 4 # single argument --no-notarization to skip the notarize step
Chris@2377 5
Chris@2377 6 set -e
Chris@2377 7
Chris@2377 8 notarize=yes
Chris@2377 9 if [ "$1" = "--no-notarization" ]; then
Chris@2377 10 notarize=no
Chris@2377 11 elif [ -n "$1" ]; then
Chris@2377 12 echo "Usage: $0 [--no-notarization]"
Chris@2377 13 exit 2
Chris@2377 14 fi
Chris@2377 15
Chris@2377 16 set -u
Chris@2374 17
Chris@2374 18 app="Sonic Visualiser"
Chris@2374 19
Chris@2374 20 version=`perl -p -e 's/^[^"]*"([^"]*)".*$/$1/' version.h`
Chris@2374 21
Chris@2374 22 source="$app.app"
Chris@2374 23 volume="$app"-"$version"
Chris@2374 24 target="$volume"/"$app".app
Chris@2377 25 dmg="$volume".dmg
Chris@2374 26
Chris@2374 27 if [ -d "$volume" ]; then
Chris@2374 28 echo "Target directory $volume already exists, not overwriting"
Chris@2374 29 exit 2
Chris@2374 30 fi
Chris@2374 31
Chris@2374 32 if [ -f "$dmg" ]; then
Chris@2374 33 echo "Target disc image $dmg already exists, not overwriting"
Chris@2374 34 exit 2
Chris@2374 35 fi
Chris@2374 36
Chris@2377 37 if [ "$notarize" = no ]; then
Chris@2377 38 echo
Chris@2377 39 echo "Note: The --no-notarization flag is set: won't be submitting for notarization"
Chris@2377 40 fi
Chris@2377 41
Chris@2374 42 echo
Chris@2374 43 echo "(Re-)running deploy script..."
Chris@2374 44
Chris@2374 45 deploy/osx/deploy.sh "$app" || exit 1
Chris@2374 46
Chris@2374 47 echo
Chris@2374 48 echo "Making target tree."
Chris@2374 49
Chris@2374 50 mkdir "$volume" || exit 1
Chris@2374 51
Chris@2374 52 ln -s /Applications "$volume"/Applications
Chris@2374 53 cp README.md "$volume/README.txt"
Chris@2374 54 cp README.OSC "$volume/README-OSC.txt"
Chris@2374 55 cp COPYING "$volume/COPYING.txt"
Chris@2374 56 cp CHANGELOG "$volume/CHANGELOG.txt"
Chris@2374 57 cp CITATION "$volume/CITATION.txt"
Chris@2374 58 cp -rp "$source" "$target"
Chris@2374 59
Chris@2374 60 # update file timestamps so as to make the build date apparent
Chris@2374 61 find "$volume" -exec touch \{\} \;
Chris@2374 62
Chris@2374 63 echo "Done"
Chris@2374 64
Chris@2374 65 echo
Chris@2374 66 echo "Code-signing volume..."
Chris@2374 67
Chris@2374 68 deploy/osx/sign.sh "$volume" || exit 1
Chris@2374 69
Chris@2374 70 echo "Done"
Chris@2374 71
Chris@2374 72 echo
Chris@2374 73 echo "Making dmg..."
Chris@2374 74
Chris@2374 75 rm -f "$dmg"
Chris@2374 76
Chris@2374 77 hdiutil create -srcfolder "$volume" "$dmg" -volname "$volume" -fs HFS+ &&
Chris@2374 78 rm -r "$volume"
Chris@2374 79
Chris@2374 80 echo "Done"
Chris@2374 81
Chris@2374 82 echo
Chris@2374 83 echo "Signing dmg..."
Chris@2374 84
Chris@2374 85 codesign -s "Developer ID Application: Chris Cannam" -fv "$dmg"
Chris@2374 86
Chris@2377 87 if [ "$notarize" = no ]; then
Chris@2377 88 echo
Chris@2377 89 echo "The --no-notarization flag was set: not submitting for notarization"
Chris@2377 90 else
Chris@2377 91 echo
Chris@2377 92 echo "Submitting dmg for notarization..."
Chris@2374 93
Chris@2377 94 deploy/osx/notarize.sh "$dmg" || exit 1
Chris@2377 95 fi
Chris@2374 96
Chris@2374 97 echo "Done"