-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgo_dmg
executable file
·65 lines (48 loc) · 2.39 KB
/
go_dmg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#! /bin/bash
# Make a new DMG file for SciPDL based on local /Applications/PDL/...
# This is only likely to work on Karl's Mac
version=2.093
# Folder where to put the intermediate files and the final DMG
DEST=/Users/karl/Downloads
# Folder where to find the 'create-dmg' script from https://github.com/create-dmg/create-dmg
CREATE_DMG=~/Dropbox/Software/SciPDL-Own-Perl/create-dmg
# OK get started and nuke any previous versions!
HERE=$PWD
rm $DEST/SciPDL-v$version.dmg
rm -fr $DEST/SciPDL-dist
mkdir $DEST/SciPDL-dist
# Create a Tar file as well for archiving without signature/notarization complexities.
cd /Applications
tar cfz $DEST/SciPDL-v$version.tar.gz PDL
cd $HERE
# Note ditto seems better behaved than cp for this stuff on MacOS
ditto /Applications/PDL $DEST/SciPDL-dist/PDL
ditto README_dmg.rtfd $DEST/SciPDL-dist/README.rtfd
ditto README_dmg.rtfd $DEST/SciPDL-dist/PDL/README.rtfd
# Here is a magic find command to find all regular file executables and bundles and sign them
# Note the --options runtime on the codesign is important for this to work! Takes ~1min for ~200 relevant files
# Note many files ought to be codesigned already as this happens in previous compilation, so use -f to avoid
# notarisation errors
find $DEST/SciPDL-dist/ -type f \( -name "*.bundle" -o -perm +111 \) -exec chmod u+w {} \;
find $DEST/SciPDL-dist/ -type f \( -name "*.bundle" -o -perm +111 \) -exec codesign -f -s "Developer ID Application" --options runtime {} \;
# This gives an entitlement to the perl binary so it can load dynamic libraries even if not signed (e.g. the local users!)
codesign -f --entitlements entitlements.plist -s "Developer ID Application" --options runtime $DEST/SciPDL-dist/PDL/bin/perl
# This creates the DMG and signs it with my Apple Developer credentials in the MacOS keychain and
# notarises it via Apple's servers
# Using create-dmg version 1.2.0 from https://github.com/create-dmg/create-dmg
$CREATE_DMG/create-dmg \
--volname "SciPDL for PDL $version" \
--background "DMG-Background.png" \
--window-pos 200 120 \
--window-size 640 530 \
--icon-size 70 \
--icon PDL 170 260 \
--icon README.rtfd 170 370 \
--app-drop-link 480 260 \
--codesign "Developer ID Application" \
--notarize "AC_PASSWORD" \
$DEST/SciPDL-v$version.dmg \
$DEST/SciPDL-dist
# Useful notarytool commands
# Use a command like this to fetch the log
# xcrun notarytool log -p "AC_PASSWORD" 18a5f61f-7cf7-4765-bbe5-5ac03dce311e