macOS: the input method now has two input modes in Info.plist, 中英自動 ("注")
and 英文 ("A"), each with its own menu-bar icon. A Shift tap with nothing typed
switches the mode (TISSelectInputSource), and choosing a mode in the menu bar
switches the engine (setValue:forTag:). --register enables both modes.
Windows: the taskbar IME icon switches between icon.ico and icon-en.ico.
Linux: the IBus mode property also switches its icon.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
40 lines
1.8 KiB
Bash
Executable File
40 lines
1.8 KiB
Bash
Executable File
#!/bin/bash
|
|
# Builds build/AutoZhuyin.app (release, ad-hoc signed).
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")/.."
|
|
|
|
# Use the full Xcode toolchain (the Command Line Tools SDK may be incomplete).
|
|
export DEVELOPER_DIR="${DEVELOPER_DIR:-/Applications/Xcode.app/Contents/Developer}"
|
|
|
|
CONFIG="${CONFIG:-release}"
|
|
APP="build/AutoZhuyin.app"
|
|
|
|
# Universal binary: runs on both Apple Silicon and Intel Macs.
|
|
ARCH_FLAGS=(--arch arm64 --arch x86_64)
|
|
xcrun swift build -c "$CONFIG" "${ARCH_FLAGS[@]}" --product AutoZhuyin
|
|
BIN="$(xcrun swift build -c "$CONFIG" "${ARCH_FLAGS[@]}" --show-bin-path)/AutoZhuyin"
|
|
|
|
rm -rf "$APP"
|
|
mkdir -p "$APP/Contents/MacOS" "$APP/Contents/Resources"
|
|
cp "$BIN" "$APP/Contents/MacOS/AutoZhuyin"
|
|
cp Resources/Info.plist "$APP/Contents/Info.plist"
|
|
cp Resources/lexicon.txt Resources/english-common.txt Resources/classifier-weights.json "$APP/Contents/Resources/"
|
|
cp THIRD_PARTY_LICENSES.txt "$APP/Contents/Resources/"
|
|
# "AI 選字" language model (CKIP gpt2-tiny-chinese, GPL-3.0), fetched and converted once.
|
|
[ -s build/lm/lm.bin ] || scripts/fetch-lm.sh >/dev/null
|
|
cp build/lm/lm.bin build/lm/lm-vocab.txt licenses/GPL-3.0.txt "$APP/Contents/Resources/"
|
|
# Precomputed English dictionary and bigram table (shared with the Windows build).
|
|
python3 -I windows/tools/build_data.py >/dev/null
|
|
cp windows/autozhuyin/data/english-dict.txt windows/autozhuyin/data/english-bigram.json "$APP/Contents/Resources/"
|
|
|
|
if [ ! -f build/icon.tiff ]; then
|
|
xcrun swift scripts/make-icon.swift build/icon.tiff
|
|
fi
|
|
cp build/icon.tiff "$APP/Contents/Resources/icon.tiff"
|
|
# English-mode icon ("A"), shown in the menu bar while English mode is on.
|
|
[ -f build/icon-en.tiff ] || xcrun swift scripts/make-icon.swift build/icon-en.tiff A
|
|
cp build/icon-en.tiff "$APP/Contents/Resources/icon-en.tiff"
|
|
|
|
codesign --force --sign - "$APP"
|
|
echo "Built $APP"
|