Ariver
2026-06-02 3fbceec8de833416bf1ae049f959f222c3f1a4a0
privatevoice.src/scripts/build-local-macos.sh
File was renamed from VoiceSnapGo/scripts/build-local-macos.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
#
# build-local-macos.sh - Build a locally signed macOS app and DMG for VoiceSnap.
# build-local-macos.sh - Build a locally signed macOS app and DMG for PrivateVoice Input.
#
# This script intentionally does not notarize. It creates or reuses a stable
# local Code Signing identity so macOS TCC permissions, such as Accessibility,
@@ -12,9 +12,11 @@
#
set -euo pipefail
APP_NAME="VoiceSnap"
LOCAL_IDENTITY="${VOICESNAP_LOCAL_SIGN_IDENTITY:-VoiceSnap Local Code Signing}"
KEYCHAIN="${VOICESNAP_LOCAL_KEYCHAIN:-$HOME/Library/Keychains/login.keychain-db}"
APP_NAME="PrivateVoice Input"
DEFAULT_LOCAL_IDENTITY="PrivateVoice Local Code Signing"
LEGACY_LOCAL_IDENTITY="VoiceSnap Local Code Signing"
LOCAL_IDENTITY="${PRIVATEVOICE_LOCAL_SIGN_IDENTITY:-${VOICESNAP_LOCAL_SIGN_IDENTITY:-}}"
KEYCHAIN="${PRIVATEVOICE_LOCAL_KEYCHAIN:-${VOICESNAP_LOCAL_KEYCHAIN:-$HOME/Library/Keychains/login.keychain-db}}"
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
PROJECT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
@@ -78,6 +80,16 @@
SHERPA_LIB_DIR="$GOMODCACHE/github.com/k2-fsa/sherpa-onnx-go-macos@v1.12.24/lib/$SHERPA_ARCH"
ensure_local_identity() {
  if [[ -z "$LOCAL_IDENTITY" ]]; then
    if security find-identity -v -p codesigning "$KEYCHAIN" | grep -Fq "$DEFAULT_LOCAL_IDENTITY"; then
      LOCAL_IDENTITY="$DEFAULT_LOCAL_IDENTITY"
    elif security find-identity -v -p codesigning "$KEYCHAIN" | grep -Fq "$LEGACY_LOCAL_IDENTITY"; then
      LOCAL_IDENTITY="$LEGACY_LOCAL_IDENTITY"
    else
      LOCAL_IDENTITY="$DEFAULT_LOCAL_IDENTITY"
    fi
  fi
  if security find-identity -v -p codesigning "$KEYCHAIN" | grep -Fq "$LOCAL_IDENTITY"; then
    echo "Using existing local signing identity: $LOCAL_IDENTITY"
    return
@@ -103,7 +115,7 @@
[dn]
CN = $LOCAL_IDENTITY
O = VoiceSnap Local
O = PrivateVoice Local
[v3_codesign]
basicConstraints = critical, CA:true