chore(pack): add CPack configuration to build a deb package

Add install rules and CPack settings so cpack produces an installable
.deb. Dependencies are derived with dpkg-shlibdeps, so they follow the
binaries. The sherpa-onnx runtime the streaming backend needs is bundled
because no distro package provides it. The fetch-models script now also
locates its registry when installed system-wide.

增加 CPack 配置,可直接用 cpack 打出 deb:安装规则含桌面入口、应用图标、
模型注册表与下载脚本、用户文档;依赖由 dpkg-shlibdeps 自动推导;流式后端
需要的 sherpa-onnx 运行时(发行版无对应包)随包携带;fetch-models 脚本
装到系统后也能找到注册表。
This commit is contained in:
blumia committed 2026-10-13 11:53:07 +08:00
1 parent 898763eb74
commit 8b9a8c420e
9 files changed
+401 -5

No files matched your search

+18 -3
View File
@@ -10,11 +10,26 @@
# ${XDG_DATA_HOME:-~/.local/share}/live-caption/models/<id>/
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
REG="$ROOT/data/models.json"
SELF="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# 注册表位置:既支持在源码树里跑(<repo>/scripts/ 与 <repo>/data/),
# 也支持装到系统之后跑(/usr/bin/ 与 /usr/share/live-caption/)。
REG="${LIVE_CAPTION_REGISTRY:-}"
if [ -z "$REG" ]; then
for cand in "$SELF/../data/models.json" \
"$SELF/../share/live-caption/models.json" \
"/usr/share/live-caption/models.json" \
"/usr/local/share/live-caption/models.json"; do
if [ -f "$cand" ]; then REG="$(cd "$(dirname "$cand")" && pwd)/$(basename "$cand")"; break; fi
done
fi
DEST="${XDG_DATA_HOME:-$HOME/.local/share}/live-caption/models"
[ -f "$REG" ] || { echo "找不到注册表: $REG" >&2; exit 1; }
[ -n "$REG" ] && [ -f "$REG" ] || {
echo "找不到模型注册表(models.json)。" >&2
echo "可用 LIVE_CAPTION_REGISTRY=<path> 指定。" >&2
exit 1
}
ids=$(python3 -c "
import json,sys