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

Last change on this file since 17276 was 17244, checked in by Don-vip, 12 months ago

see #19937 - Update macOS build process (patch by Stereo)

  • Property svn:executable set to *
File size: 3.1 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
19mkdir app
20jpackage -n "JOSM" --input dist --main-jar josm-custom.jar \
21    --main-class org.openstreetmap.josm.gui.MainApplication \
22    --icon ./native/macosx/JOSM.icns --type app-image --dest app \
23    --java-options "-Xmx8192m" --app-version $1 \
24    --copyright "JOSM, and all its integral parts, are released under the GNU General Public License v2 or later" \
25    --vendor "https://josm.openstreetmap.de" \
26    --file-associations native/macosx/bz2.properties \
27    --file-associations native/macosx/geojson.properties \
28    --file-associations native/macosx/gpx.properties \
29    --file-associations native/macosx/gz.properties \
30    --file-associations native/macosx/jos.properties \
31    --file-associations native/macosx/joz.properties \
32    --file-associations native/macosx/osm.properties \
33    --file-associations native/macosx/zip.properties \
34    --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
35
36echo "Building done."
37
38if [[ $IMPORT_AND_UNLOCK_KEYCHAIN == 1 ]]; then
39    if [ -z "$CERT_MACOS_P12" ]
40    then
41        echo "CERT_MACOS_P12 must be set in the environment. Won't sign app."
42        exit 1
43    fi
44
45
46    if [ -z "$CERT_MACOS_PW" ]
47    then
48        echo "CERT_MACOS_P12 must be set in the environment. Won't sign app."
49        exit 1
50    fi
51
52    echo "Preparing certificates/keychain for signing…"
53
54    KEYCHAIN=build.keychain
55    KEYCHAIN_PW=`head /dev/urandom | base64 | head -c 20`
56    CERTIFICATE_P12=certificate.p12
57
58    echo $CERT_MACOS_P12 | base64 --decode > $CERTIFICATE_P12
59    security create-keychain -p $KEYCHAIN_PW $KEYCHAIN
60    security default-keychain -s $KEYCHAIN
61    security unlock-keychain -p $KEYCHAIN_PW $KEYCHAIN
62    security import $CERTIFICATE_P12 -k $KEYCHAIN -P $CERT_MACOS_PW -T /usr/bin/codesign
63    security set-key-partition-list -S apple-tool:,apple: -s -k $KEYCHAIN_PW $KEYCHAIN
64    rm $CERTIFICATE_P12
65
66    echo "Signing preparation done."
67fi
68
69echo "Signing App Bundle…"
70
71codesign -vvv --timestamp --options runtime --deep --force --sign "$SIGNING_KEY_NAME" \
72    app/JOSM.app/Contents/MacOS/JOSM \
73    app/JOSM.app/Contents/runtime/Contents/Home/lib/*.jar \
74    app/JOSM.app/Contents/runtime/Contents/Home/lib/*.dylib \
75    app/JOSM.app/Contents/runtime/Contents/MacOS/libjli.dylib
76
77codesign -vvv --timestamp --entitlements native/macosx/josm.entitlements --options runtime --force --sign "$SIGNING_KEY_NAME" app/JOSM.app
78
79codesign -vvv app/JOSM.app
80
81echo "Preparing for notarization"
82ditto -c -k --zlibCompressionLevel 9 --keepParent app/JOSM.app app/JOSM.zip
83
84echo "Uploading to Apple"
85xcrun altool --notarize-app -f app/JOSM.zip -p "$APPLE_ID_PW" -u "thomas.skowron@fossgis.de" --primary-bundle-id de.openstreetmap.josm
Note: See TracBrowser for help on using the repository browser.