comparison deploy/osx/build-and-package.sh @ 62:3fd66c30eb28

Mac notarization logic
author Chris Cannam
date Mon, 10 Feb 2020 15:16:10 +0000
parents
children 0c94d3065ecd
comparison
equal deleted inserted replaced
61:48f3eb79fdd0 62:3fd66c30eb28
1 #!/bin/bash
2
3 # Run this from the project root, without arguments, or with the
4 # single argument --no-notarization to skip the notarize step
5
6 set -e
7
8 notarize=yes
9 if [ "$1" = "--no-notarization" ]; then
10 notarize=no
11 elif [ -n "$1" ]; then
12 echo "Usage: $0 [--no-notarization]"
13 exit 2
14 fi
15
16 set -u
17
18 app="Vamp Plugin Pack Installer"
19 identity="Developer ID Application: Chris Cannam"
20
21 version=`perl -p -e 's/^[^"]*"([^"]*)".*$/$1/' version.h`
22
23 qmake=$(grep '^# Command: ' Makefile | awk '{ print $3; }')
24
25 echo "Proceed to rebuild, package, and sign version $version using"
26 echo -n "qmake path \"$qmake\" [Yn] ? "
27 read yn
28 case "$yn" in "") ;; [Yy]) ;; *) exit 3;; esac
29 echo "Proceeding"
30
31 source="$app.app"
32 volume="$app"-"$version"
33 target="$volume"/"$app".app
34 dmg="$volume".dmg
35
36 if [ -d "$volume" ]; then
37 echo "Target directory $volume already exists, not overwriting"
38 exit 2
39 fi
40
41 if [ -f "$dmg" ]; then
42 echo "Target disc image $dmg already exists, not overwriting"
43 exit 2
44 fi
45
46 if [ "$notarize" = no ]; then
47 echo
48 echo "Note: The --no-notarization flag is set: won't be submitting for notarization"
49 fi
50
51 rm -rf "$app.app"
52 rm -rf "$volume"
53 rm -f "$dmg"
54
55 ./repoint install
56 rm -rf .qmake.stash
57 "$qmake" -r
58 make clean
59 rm -rf out
60
61 echo
62 echo "Building plugins..."
63 make -j3 -f Makefile.plugins
64 echo "Done"
65
66 echo
67 echo "Signing plugins..."
68 codesign -s "$identity" -fv --timestamp --options runtime out/*.dylib
69 echo "Done"
70
71 if [ "$notarize" = no ]; then
72 echo
73 echo "The --no-notarization flag was set: not submitting for notarization"
74 else
75 echo
76 echo "Notarizing plugins..."
77 rm -f plugins.zip
78 ditto -c -k out plugins.zip
79 deploy/osx/notarize.sh plugins.zip
80 echo "Done"
81
82 ## No, it doesn't seem to be possible to pass a dylib to stapler
83 # echo
84 # echo "Stapling plugins..."
85 # xcrun stapler staple out/*.dylib
86 # echo "Done"
87 fi
88
89 echo
90 echo "Building installer..."
91 make -j3 -f Makefile.installer
92 echo "Done"
93
94 echo
95 echo "Deploying installer..."
96 deploy/osx/deploy.sh "$app" || exit 1
97 echo "Done"
98
99 echo
100 echo "Making target tree..."
101 mkdir "$volume" || exit 1
102
103 #cp README.md "$volume/README.txt"
104 #cp README.OSC "$volume/README-OSC.txt"
105 #cp COPYING "$volume/COPYING.txt"
106 #cp CHANGELOG "$volume/CHANGELOG.txt"
107 #cp CITATION "$volume/CITATION.txt"
108 cp -rp "$source" "$target"
109
110 # update file timestamps so as to make the build date apparent
111 find "$volume" -exec touch \{\} \;
112 echo "Done"
113
114 echo
115 echo "Signing installer..."
116 codesign -s "$identity" -fv --deep --timestamp --options runtime "$volume"
117 echo "Done"
118
119 echo
120 echo "Making dmg..."
121 rm -f "$dmg"
122 hdiutil create -srcfolder "$volume" "$dmg" -volname "$volume" -fs HFS+ &&
123 rm -r "$volume"
124 echo "Done"
125
126 echo
127 echo "Signing dmg..."
128 codesign -s "$identity" -fv --timestamp "$dmg"
129 echo "Done"
130
131 if [ "$notarize" = no ]; then
132 echo
133 echo "The --no-notarization flag was set: not submitting for notarization"
134 else
135 echo
136 echo "Submitting disk image for notarization..."
137 deploy/osx/notarize.sh "$dmg"
138 echo "Done"
139
140 echo
141 echo "Stapling disk image..."
142 xcrun stapler staple "$dmg"
143 echo "Done"
144 fi
145
146 echo "Done"