mirror of
https://github.com/anomalyco/hex.git
synced 2026-11-27 07:58:01 +01:00
Settings controls commit a full candidate before changing the saved UI choice, so a failed write keeps shortcut capture open and preserves pending debounced edits. The macOS Transcriber owns backend input padding for ordinary, voice-protocol, and segmented transcription. Moonshine stream cleanup and the Linux client share one owner-side path. The command SDK shares capture normalization between constructors and host registration, and the public SDK decodes model progress and dictation levels with one bounded SSE framer. The signing scripts share one identity helper, and historical release evidence moves out of the feature map.
71 lines
3.7 KiB
Shell
Executable file
71 lines
3.7 KiB
Shell
Executable file
#!/bin/sh
|
|
set -eu
|
|
|
|
root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
|
|
team_id=${VOICE_CONTROL_TEAM_ID:?Set VOICE_CONTROL_TEAM_ID to the Apple Developer signing team}
|
|
. "$root/scripts/macos-signing.sh"
|
|
identity=$(hex_codesign_identity "$team_id")
|
|
icon_output="$root/target/AppIcon.assets"
|
|
icon_info="$root/target/AppIcon-info.plist"
|
|
sparkle_dir=$("$root/scripts/setup-sparkle.sh")
|
|
version=${HEX_VERSION:-$(cargo metadata --no-deps --format-version 1 --manifest-path "$root/Cargo.toml" | jq -r '.packages[0].version')}
|
|
build_number=${HEX_BUILD_NUMBER:-$(printf '%s\n' "$version" | awk -F. '{ print ($1 * 10000) + ($2 * 100) + $3 }')}
|
|
bundle_name=Hex.app
|
|
bundle_id=com.kitlangton.hex2
|
|
executable_name=hex
|
|
|
|
bundle="$root/target/app/$bundle_name"
|
|
executable="$bundle/Contents/MacOS/$executable_name"
|
|
frameworks="$bundle/Contents/Frameworks"
|
|
|
|
export MACOSX_DEPLOYMENT_TARGET=15.0
|
|
cargo build --locked --release --manifest-path "$root/Cargo.toml"
|
|
rm -rf "$bundle"
|
|
mkdir -p "$bundle/Contents/MacOS" "$bundle/Contents/Resources" "$frameworks"
|
|
cp "$root/target/release/voice-control" "$executable"
|
|
cp "$root/app/Info.plist" "$bundle/Contents/Info.plist"
|
|
cp "$root/LICENSE" "$root/THIRD_PARTY_NOTICES.md" "$bundle/Contents/Resources/"
|
|
(cd "$root/sdk/commands" && bun run build)
|
|
mkdir -p "$bundle/Contents/Resources/commands-sdk"
|
|
cp "$root/sdk/commands/package.json" "$bundle/Contents/Resources/commands-sdk/"
|
|
/usr/bin/ditto "$root/sdk/commands/dist" "$bundle/Contents/Resources/commands-sdk/dist"
|
|
/usr/bin/ditto "$root/sdk/commands/workspace-template" "$bundle/Contents/Resources/commands-sdk/workspace-template"
|
|
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString $version" "$bundle/Contents/Info.plist"
|
|
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $build_number" "$bundle/Contents/Info.plist"
|
|
/usr/libexec/PlistBuddy -c "Set :CFBundleIdentifier $bundle_id" "$bundle/Contents/Info.plist"
|
|
/usr/libexec/PlistBuddy -c "Set :CFBundleExecutable $executable_name" "$bundle/Contents/Info.plist"
|
|
rm -rf "$icon_output"
|
|
mkdir -p "$icon_output"
|
|
xcrun actool "$root/app/AppIcon.icon" \
|
|
--compile "$icon_output" \
|
|
--platform macosx \
|
|
--minimum-deployment-target 15.0 \
|
|
--app-icon AppIcon \
|
|
--standalone-icon-behavior all \
|
|
--output-partial-info-plist "$icon_info" \
|
|
--output-format human-readable-text \
|
|
--warnings \
|
|
--notices >&2
|
|
cp "$icon_output/AppIcon.icns" "$icon_output/Assets.car" "$bundle/Contents/Resources/"
|
|
|
|
set -- "$root"/.venv/lib/python*/site-packages/moonshine_voice
|
|
moonshine_dir=$1
|
|
if [ ! -d "$moonshine_dir" ]; then
|
|
echo "Moonshine is not installed. Run ./scripts/setup.sh." >&2
|
|
exit 1
|
|
fi
|
|
cp "$moonshine_dir/libmoonshine.dylib" "$frameworks/"
|
|
cp "$moonshine_dir/libonnxruntime.1.23.2.dylib" "$frameworks/"
|
|
/usr/bin/ditto "$sparkle_dir/Sparkle.framework" "$frameworks/Sparkle.framework"
|
|
|
|
sparkle="$frameworks/Sparkle.framework/Versions/B"
|
|
codesign --force --timestamp --options runtime --sign "$identity" "$sparkle/XPCServices/Installer.xpc"
|
|
codesign --force --timestamp --options runtime --preserve-metadata=entitlements --sign "$identity" "$sparkle/XPCServices/Downloader.xpc"
|
|
codesign --force --timestamp --options runtime --sign "$identity" "$sparkle/Autoupdate"
|
|
codesign --force --timestamp --options runtime --sign "$identity" "$sparkle/Updater.app"
|
|
codesign --force --timestamp --options runtime --sign "$identity" "$frameworks/Sparkle.framework"
|
|
codesign --force --timestamp --options runtime --sign "$identity" "$frameworks/libonnxruntime.1.23.2.dylib"
|
|
codesign --force --timestamp --options runtime --sign "$identity" "$frameworks/libmoonshine.dylib"
|
|
codesign --force --timestamp --options runtime --entitlements "$root/app/VoiceControl.entitlements" --sign "$identity" "$bundle"
|
|
codesign --verify --deep --strict --verbose=2 "$bundle"
|
|
echo "$bundle"
|