source: josm/trunk/native/macosx/macos-jpackage.sh@ 16776

Last change on this file since 16776 was 16776, checked in by simon04, 4 years ago

see #19370, see #18319 - Enable GitHub Actions and package for macOS (patch by Stereo and thomersch)

  • Property svn:executable set to *
File size: 3.2 KB
Line 
1#!/bin/bash
2
3set -Eeou pipefail
4
5# Don't show one time passwords
6set +x
7
8SIGNING_KEY_NAME="Developer ID Application: FOSSGIS e.V. (P8AAAGN2AM)"
9IMPORT_AND_UNLOCK_KEYCHAIN=${IMPORT_AND_UNLOCK_KEYCHAIN:-1}
10
11if [ -z "${1-}" ]
12then
13 echo "Usage: $0 josm_revision"
14 exit 1
15fi
16
17echo "Building JOSM.app"
18
19jpackage -n "JOSM" --input dist --main-jar josm-custom.jar \
20 --main-class org.openstreetmap.josm.gui.MainApplication \
21 --icon ./native/macosx/JOSM.icns --type app-image --dest dist \
22 --java-options "-Xmx8192m" --app-version $1 \
23 --copyright "JOSM, and all its integral parts, are released under the GNU General Public License v2 or later" \
24 --vendor "https://josm.openstreetmap.de" \
25 --file-associations native/macosx/bz2.properties \
26 --file-associations native/macosx/geojson.properties \
27 --file-associations native/macosx/gpx.properties \
28 --file-associations native/macosx/gz.properties \
29 --file-associations native/macosx/jos.properties \
30 --file-associations native/macosx/joz.properties \
31 --file-associations native/macosx/osm.properties \
32 --file-associations native/macosx/zip.properties \
33 --add-modules java.base,java.datatransfer,java.desktop,java.logging,java.management,java.naming,java.net.http,java.prefs,java.rmi,java.scripting,java.sql,java.transaction.xa,java.xml,jdk.crypto.ec,jdk.jfr,jdk.jsobject,jdk.unsupported,jdk.unsupported.desktop,jdk.xml.dom
34
35echo "Building done."
36
37if [[ $IMPORT_AND_UNLOCK_KEYCHAIN == 1 ]]; then
38 if [ -z "$CERT_MACOS_P12" ]
39 then
40 echo "CERT_MACOS_P12 must be set in the environment. Won't sign app."
41 exit 1
42 fi
43
44
45 if [ -z "$CERT_MACOS_PW" ]
46 then
47 echo "CERT_MACOS_P12 must be set in the environment. Won't sign app."
48 exit 1
49 fi
50
51 echo "Preparing certificates/keychain for signing…"
52
53 KEYCHAIN=build.keychain
54 KEYCHAIN_PW=`head /dev/urandom | base64 | head -c 20`
55 CERTIFICATE_P12=certificate.p12
56
57 echo $CERT_MACOS_P12 | base64 --decode > $CERTIFICATE_P12
58 security create-keychain -p $KEYCHAIN_PW $KEYCHAIN
59 security default-keychain -s $KEYCHAIN
60 security unlock-keychain -p $KEYCHAIN_PW $KEYCHAIN
61 security import $CERTIFICATE_P12 -k $KEYCHAIN -P $CERT_MACOS_PW -T /usr/bin/codesign
62 security set-key-partition-list -S apple-tool:,apple: -s -k $KEYCHAIN_PW $KEYCHAIN
63 rm $CERTIFICATE_P12
64
65 echo "Signing preparation done."
66fi
67
68echo "Signing App Bundle…"
69
70codesign -vvv --timestamp --options runtime --deep --force --sign "$SIGNING_KEY_NAME" \
71 dist/JOSM.app/Contents/MacOS/JOSM \
72 dist/JOSM.app/Contents/MacOS/libapplauncher.dylib \
73 dist/JOSM.app/Contents/runtime/Contents/Home/lib/*.jar \
74 dist/JOSM.app/Contents/runtime/Contents/Home/lib/*.dylib \
75 dist/JOSM.app/Contents/runtime/Contents/MacOS/libjli.dylib
76
77codesign -vvv --timestamp --entitlements native/macosx/josm.entitlements --options runtime --force --sign "$SIGNING_KEY_NAME" dist/JOSM.app
78
79codesign -vvv dist/JOSM.app
80
81echo "Preparing for notarization"
82ditto -c -k --keepParent dist/JOSM.app dist/JOSM.zip
83
84echo "Uploading to Apple"
85xcrun altool --notarize-app -f dist/JOSM.zip -p "$APPLE_ID_PW" -u "thomas.skowron@fossgis.de" --primary-bundle-id de.openstreetmap.josm
86
87# Prepare for upload-artifact
88mkdir dist-macOS
89unzip dist/JOSM.zip -d dist-macOS
Note: See TracBrowser for help on using the repository browser.