From 9d3d275dca8e8dc442eb04434c8bd0fdad79bc04 Mon Sep 17 00:00:00 2001
From: Ariver <shanghai3168@gmail.com>
Date: Thu, 04 Jun 2026 00:53:16 +0800
Subject: [PATCH] Freeze 2.1.28 for Mac App Store release

---
 privatevoice.src/scripts/build-appstore-developerid-macos.sh |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/privatevoice.src/scripts/build-appstore-developerid-macos.sh b/privatevoice.src/scripts/build-appstore-developerid-macos.sh
index 3f92273..7cc2d47 100755
--- a/privatevoice.src/scripts/build-appstore-developerid-macos.sh
+++ b/privatevoice.src/scripts/build-appstore-developerid-macos.sh
@@ -19,7 +19,7 @@
 #
 set -euo pipefail
 
-APP_NAME="PrivateVoice Input"
+APP_NAME="PrivateVoice Dictation"
 DEVELOPER_IDENTITY="${PRIVATEVOICE_DEVELOPER_IDENTITY:-Developer ID Application: Ningbo Zhuozhi Innovation Network Technology Co., Ltd. (3HY4G7M2AL)}"
 KEYCHAIN_PROFILE="${PRIVATEVOICE_NOTARY_PROFILE:-privatevoice}"
 SIGNING_KEYCHAIN="${PRIVATEVOICE_SIGNING_KEYCHAIN:-}"
@@ -31,6 +31,7 @@
 INFO_PLIST="$PROJECT_DIR/build/darwin/Info.plist"
 ENTITLEMENTS="$PROJECT_DIR/build/darwin/entitlements-appstore.plist"
 GOMODCACHE="$(go env GOMODCACHE)"
+SHERPA_MACOS_MODULE_VERSION="$(cd "$PROJECT_DIR" && go list -m -f '{{.Version}}' github.com/k2-fsa/sherpa-onnx-go-macos)"
 
 VERSION="$(defaults read "$INFO_PLIST" CFBundleShortVersionString 2>/dev/null || echo "2.1.12")"
 BUILD_ID="$(defaults read "$INFO_PLIST" CFBundleVersion 2>/dev/null || date +%Y%m%d.%H%M)"
@@ -74,7 +75,9 @@
   BUILD_DIR="$PROJECT_DIR/build/appstore-developerid/$OUT_ARCH"
   APP_BUNDLE="$BUILD_DIR/$APP_NAME.app"
   DMG_PATH="$BUILD_DIR/$APP_NAME-$VERSION-build$BUILD_ID-$OUT_ARCH-developerid-sandbox-poc.dmg"
-  SHERPA_LIB_DIR="$GOMODCACHE/github.com/k2-fsa/sherpa-onnx-go-macos@v1.12.24/lib/$SHERPA_ARCH"
+  SHERPA_LIB_DIR="$GOMODCACHE/github.com/k2-fsa/sherpa-onnx-go-macos@$SHERPA_MACOS_MODULE_VERSION/lib/$SHERPA_ARCH"
+  ONNXRUNTIME_DYLIB=""
+  ONNXRUNTIME_DYLIB_NAME=""
 }
 
 sign_plain() {
@@ -105,6 +108,9 @@
   [[ -f "$ENTITLEMENTS" ]] || fail "App Store entitlements not found at $ENTITLEMENTS"
   [[ -f "$PROJECT_DIR/build/darwin/icon.icns" ]] || fail "icon.icns not found"
   [[ -d "$SHERPA_LIB_DIR" ]] || fail "sherpa-onnx dylibs not found at $SHERPA_LIB_DIR"
+  ONNXRUNTIME_DYLIB="$(find "$SHERPA_LIB_DIR" -maxdepth 1 -type f -name 'libonnxruntime.*.dylib' | sort | tail -n 1)"
+  [[ -f "$ONNXRUNTIME_DYLIB" ]] || fail "onnxruntime dylib not found in $SHERPA_LIB_DIR"
+  ONNXRUNTIME_DYLIB_NAME="$(basename "$ONNXRUNTIME_DYLIB")"
   command -v xcrun >/dev/null || fail "xcrun not found"
   security_find_identities | grep -Fq "$DEVELOPER_IDENTITY" ||
     fail "Developer ID signing identity not found: $DEVELOPER_IDENTITY"
@@ -144,19 +150,21 @@
     "$APP_BUNDLE/Contents/Info.plist"
   cp "$BUILD_DIR/$APP_NAME" "$APP_BUNDLE/Contents/MacOS/$APP_NAME"
   cp "$PROJECT_DIR/build/darwin/icon.icns" "$APP_BUNDLE/Contents/Resources/icon.icns"
+  find "$PROJECT_DIR/build/darwin" -maxdepth 1 -type d -name "*.lproj" \
+    -exec cp -R {} "$APP_BUNDLE/Contents/Resources/" \;
   cp "$SHERPA_LIB_DIR/libsherpa-onnx-c-api.dylib" "$APP_BUNDLE/Contents/Frameworks/"
-  cp "$SHERPA_LIB_DIR/libonnxruntime.1.23.2.dylib" "$APP_BUNDLE/Contents/Frameworks/"
+  cp "$ONNXRUNTIME_DYLIB" "$APP_BUNDLE/Contents/Frameworks/"
 
   step "Fixing rpaths"
   install_name_tool -add_rpath @executable_path/../Frameworks \
     "$APP_BUNDLE/Contents/MacOS/$APP_NAME" 2>/dev/null || true
   install_name_tool -id @rpath/libsherpa-onnx-c-api.dylib \
     "$APP_BUNDLE/Contents/Frameworks/libsherpa-onnx-c-api.dylib"
-  install_name_tool -id @rpath/libonnxruntime.1.23.2.dylib \
-    "$APP_BUNDLE/Contents/Frameworks/libonnxruntime.1.23.2.dylib"
+  install_name_tool -id "@rpath/$ONNXRUNTIME_DYLIB_NAME" \
+    "$APP_BUNDLE/Contents/Frameworks/$ONNXRUNTIME_DYLIB_NAME"
 
   step "Code signing with Developer ID"
-  sign_plain "$APP_BUNDLE/Contents/Frameworks/libonnxruntime.1.23.2.dylib"
+  sign_plain "$APP_BUNDLE/Contents/Frameworks/$ONNXRUNTIME_DYLIB_NAME"
   sign_plain "$APP_BUNDLE/Contents/Frameworks/libsherpa-onnx-c-api.dylib"
   sign_sandboxed "$APP_BUNDLE/Contents/MacOS/$APP_NAME"
   sign_sandboxed "$APP_BUNDLE"

--
Gitblit v1.9.3