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
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.
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."
46 cat <<EOF > notarize.json
50 "path": "${dmg_filename[0]}",
51 "bundle_id": "org.openttd.openttd",
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."
67 # Now staple the ticket to the .app
68 xcrun stapler staple
"${app_filename[0]}"