Change: Let AI developers edit non-editable AI/Game Script Parameters (#8895)
[openttd-github.git] / os / macosx / notarize.sh
blob55405cdd8956fabd05d6a6380f6e8a160209f056
1 #!/bin/bash
2 set -e
4 # This script attempts to notarize the OpenTTD DMG generated by CPack.
5 # If you are building an unofficial branch of OpenTTD, please change the bundle
6 # ID in Info.plist and below.
8 # This uses `gon' to perform notarization:
10 # https://github.com/mitchellh/gon
12 # Follow the setup instructions on the gon site to install.
14 # Before executing this script, you must first configure CMake with at least the following
15 # parameters:
17 # -DCPACK_BUNDLE_APPLE_CERT_APP={certificate ID}
18 # "-DCPACK_BUNDLE_APPLE_CODESIGN_PARAMETER=--deep -f --options runtime"
20 # then run "make package" or "cpack".
22 # This will sign the application with your signing certificate, and will enable
23 # the hardened runtime.
25 # You also need to set your Apple Developer username and password (app-specific password
26 # is recommended) in the AC_USERNAME and AC_PASSWORD environment variables.
28 # Then, ensuring you're in your build directory and that the "bundles" directory
29 # exists with a .dmg in it (clear out any old DMGs first), run:
31 # ../os/macosx/notarize.sh
33 if [ -z "${AC_USERNAME}" ]; then
34 echo AC_USERNAME not set, skipping notarization.
35 exit 0
36 fi;
38 dmg_filename=(bundles/*.dmg)
40 if [ "${dmg_filename}" = "bundles/*.dmg" ]; then
41 echo "No .dmg found in the bundles directory, skipping notarization. Please read this"
42 echo "script's source for execution instructions."
43 exit 1
44 fi;
46 cat <<EOF > notarize.json
48 "notarize": [
50 "path": "${dmg_filename[0]}",
51 "bundle_id": "org.openttd.openttd",
52 "staple": true
56 EOF
58 gon notarize.json
60 app_filename=(_CPack_Packages/*/Bundle/openttd-*/OpenTTD.app)
62 if [ "${app_filename}" = "_CPack_Packages/*/Bundle/openttd-*/OpenTTD.app" ]; then
63 echo "No .app found in the _CPack_Packages directory, skipping stapling."
64 exit 0
65 fi;
67 # Now staple the ticket to the .app
68 xcrun stapler staple "${app_filename[0]}"