Files
transcriptor/scripts/embed-binaries.sh
T
sttlab-tech c2a3944578 build audiotee from the third_party/audiotee submodule, not a sibling dir
The initial commit's embed-binaries.sh still had the pre-submodule logic
(../audiotee sibling checkout) even though third_party/audiotee was
already added and referenced in CLAUDE.md — the edit to actually switch
the script over got made but never re-staged before the first commit.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-09 13:27:40 +02:00

53 lines
2.4 KiB
Bash
Executable File

#!/bin/bash
# Xcode "Run Script" build phase: builds audiotee, transcriptor-ai, and
# qwen_asr and embeds them in this app's bundle — the "one-click install"
# requirement (see CLAUDE.md, "Goal"). Only the AI model is left to fetch
# at runtime; everything else is baked in here.
#
# audiotee is a git submodule (third_party/audiotee, pinned to a commit on
# our own Gitea fork — see CLAUDE.md) — same pattern transcriptor-ai
# already uses for qwen-asr, and for the same reason: this script shouldn't
# depend on a sibling checkout existing at some assumed path on whatever
# machine builds this. transcriptor-ai itself is still a sibling-directory
# dependency (`../transcriptor-ai`) — not converted to a submodule, that
# wasn't asked for and isn't needed to fix the audiotee fragility this was
# about.
#
# Expects Xcode's build environment variables (SRCROOT, BUILT_PRODUCTS_DIR,
# UNLOCALIZED_RESOURCES_FOLDER_PATH). Run manually for debugging via:
# SRCROOT=$(pwd) BUILT_PRODUCTS_DIR=/tmp/embed-test \
# UNLOCALIZED_RESOURCES_FOLDER_PATH=transcriptor.app/Contents/Resources \
# scripts/embed-binaries.sh
set -euo pipefail
# Xcode Run Script phases don't inherit a normal interactive-shell PATH —
# Homebrew's go/etc. aren't found without this (bit us during manual
# testing throughout this session too).
export PATH="/opt/homebrew/bin:/usr/local/bin:$PATH"
SRCROOT="${SRCROOT:?SRCROOT must be set (run via Xcode, or set it manually — see header comment)}"
REPO_ROOT="$(cd "$SRCROOT" && pwd)"
AUDIOTEE_REPO="$REPO_ROOT/third_party/audiotee"
TRANSCRIPTOR_AI_REPO="$(cd "$REPO_ROOT/../transcriptor-ai" && pwd)"
echo "Ensuring audiotee submodule is present (pinned commit)..."
git -C "$REPO_ROOT" submodule update --init --recursive third_party/audiotee
echo "Building audiotee..."
"$AUDIOTEE_REPO/scripts/build-signed.sh"
echo "Building transcriptor-ai + qwen_asr..."
"$TRANSCRIPTOR_AI_REPO/scripts/build-dist.sh"
RESOURCES_DIR="${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
mkdir -p "$RESOURCES_DIR"
cp "$HOME/bin/audiotee" "$RESOURCES_DIR/audiotee"
cp "$TRANSCRIPTOR_AI_REPO/dist/transcriptor-ai" "$RESOURCES_DIR/transcriptor-ai"
cp "$TRANSCRIPTOR_AI_REPO/dist/qwen_asr" "$RESOURCES_DIR/qwen_asr"
chmod +x "$RESOURCES_DIR/audiotee" "$RESOURCES_DIR/transcriptor-ai" "$RESOURCES_DIR/qwen_asr"
echo "Embedded binaries in $RESOURCES_DIR:"
ls -la "$RESOURCES_DIR/audiotee" "$RESOURCES_DIR/transcriptor-ai" "$RESOURCES_DIR/qwen_asr"