From c85f5785fd0837ba2a28ee129b8eb332da042fdd Mon Sep 17 00:00:00 2001 From: Yuriy Panov Date: Thu, 15 Oct 2026 18:15:27 +0600 Subject: [PATCH] chore: singing --- README.md | 8 +++++--- tool/bundle-macos.sh | 16 ++++++++++++---- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 844894c..58ff105 100644 --- a/README.md +++ b/README.md @@ -35,10 +35,12 @@ each rebuild, because the keychain ties access to the binary's signature. tool/bundle-macos.sh --install ``` -This builds a release `Musyx.app` (ad-hoc signed) into `target/release/bundle/`. With +This builds a release `Musyx.app` into `target/release/bundle/`, signed with the +`Developer ID Application` certificate of team `H33L24BGUH` and the hardened runtime. With `--install`, it also copies the app to `/Applications`. The icon comes from -`crates/musyx/assets/icon/musyx.png`, which `tool/make_icon.py` draws. Each new build is a new -code identity to the keychain, so macOS asks once to allow access to the saved sign-in. +`crates/musyx/assets/icon/musyx.png`, which `tool/make_icon.py` draws. Set +`MUSYX_SIGN_IDENTITY` to sign with another identity, or to `-` for an ad-hoc signature +(each ad-hoc build is a new code identity, so macOS asks again for keychain access). ## Settings diff --git a/tool/bundle-macos.sh b/tool/bundle-macos.sh index 8697659..9df7df8 100755 --- a/tool/bundle-macos.sh +++ b/tool/bundle-macos.sh @@ -1,7 +1,8 @@ #!/usr/bin/env bash -# Builds Musyx.app (release, ad-hoc signed) into target/release/bundle/. +# Builds Musyx.app (release, Developer ID signed) into target/release/bundle/. # tool/bundle-macos.sh # build the bundle # tool/bundle-macos.sh --install # and copy it to /Applications +# MUSYX_SIGN_IDENTITY picks another signing identity; "-" signs ad hoc. set -euo pipefail root="$(cd "$(dirname "$0")/.." && pwd)" @@ -9,6 +10,7 @@ cd "$root" version="$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -1)" bundle="target/release/bundle/Musyx.app" +identity="${MUSYX_SIGN_IDENTITY:-Developer ID Application: Yuriy Panov (H33L24BGUH)}" cargo build --release -p musyx @@ -48,9 +50,15 @@ cat > "$bundle/Contents/Info.plist" < PLIST -# Ad-hoc signature: enough to run locally. Each new build is a new identity to the -# keychain, so macOS may ask once to allow access to the saved sign-in. -codesign --force --deep --sign - "$bundle" +# Developer ID with the hardened runtime and a secure timestamp, as notarization requires. +# The identity stays the same across builds, so keychain access to the saved sign-in is +# granted once. An ad-hoc signature is a new identity on every build. +if [[ "$identity" == "-" ]]; then + codesign --force --sign - "$bundle" +else + codesign --force --options runtime --timestamp --sign "$identity" "$bundle" +fi +codesign --verify --strict --verbose=2 "$bundle" echo "Built $bundle ($version)" if [[ "${1:-}" == "--install" ]]; then