The AppImage and the Windows zip now carry whisper-cli, sigil-vocals, ONNX Runtime and the models, so Transcribe works without installing anything. whisper-cli is built from the whisper.cpp source release with static ggml, no OpenMP and no SDL (AVX2/FMA/F16C on): on Linux it needs only glibc, and the mingw cross-build links fully static and needs only the UCRT. ONNX Runtime is Microsoft's prebuilt library, placed next to sigil-vocals, which loads it from there. The models (ggml-base and UVR_MDXNET_1_9703 by default) go in models/ next to the launcher, where it already looks. License files for ONNX Runtime and whisper.cpp are included. Toggles, all cached in ~/.cache/sigil-build: WITH_STT=0 leaves it all out, WITH_MODELS=0 ships the programs only (the launcher downloads models on demand), WHISPER_MODEL / VOCAL_MODEL pick other models, WHISPER_VERSION / ORT_VERSION pin the releases. onnxruntime.dll needs the Visual C++ runtime; VCRT_DIR copies those DLLs into the zip, and the README and sigil-vocals' error point at the redistributable otherwise. Checked: both bundles build; from the extracted AppImage and under wine, sigil-vocals isolates a 15 s clip and whisper-cli transcribes the stem.
151 lines
6.5 KiB
Bash
Executable File
151 lines
6.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
#
|
|
# Cross-build the Windows bundle from Linux → a self-contained zip.
|
|
#
|
|
# Contents: sigil-gui.exe (entry) + sigil.exe (engine) + ffmpeg.exe, and for
|
|
# speech to text: whisper-cli.exe (cross-built from source), sigil-vocals.exe,
|
|
# onnxruntime.dll and the models in models\ (see _common.sh: WITH_STT,
|
|
# WITH_MODELS, ...). onnxruntime.dll is Microsoft's build and needs the Visual
|
|
# C++ runtime; set VCRT_DIR to a folder holding msvcp140*.dll and
|
|
# vcruntime140*.dll to ship those too (Microsoft allows app-local copies).
|
|
# Windows' CreateProcess searches the launching exe's own directory, so the
|
|
# GUI finds sigil.exe and the engine finds ffmpeg.exe with all three sitting
|
|
# side by side — no install, no PATH edits, no DLL hunt.
|
|
#
|
|
# By default we statically link the mingw CRT (+crt-static) so no libgcc /
|
|
# libwinpthread / libstdc++ DLLs need shipping. Set STATIC=0 to link
|
|
# dynamically and copy those DLLs in instead.
|
|
#
|
|
# Run on Linux: scripts/build-windows.sh
|
|
# Needs: rustup target add x86_64-pc-windows-gnu + the mingw-w64 gcc toolchain.
|
|
|
|
source "$(dirname "${BASH_SOURCE[0]}")/_common.sh"
|
|
|
|
need cargo
|
|
need unzip
|
|
need zip
|
|
need x86_64-w64-mingw32-gcc "install the mingw-w64 toolchain"
|
|
|
|
TARGET="x86_64-pc-windows-gnu"
|
|
STATIC="${STATIC:-1}"
|
|
# BtbN static GPL builds; stable 'latest' tag. Override with FFMPEG_WIN_URL.
|
|
FFMPEG_WIN_URL="${FFMPEG_WIN_URL:-https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-win64-gpl.zip}"
|
|
|
|
rustup target list --installed 2>/dev/null | grep -qx "$TARGET" \
|
|
|| die "rust target $TARGET not installed — run: rustup target add $TARGET"
|
|
|
|
# sigil's NvOptimusEnablement / AmdPowerXpressRequestHighPerformance exports
|
|
# make hybrid-GPU laptops run it on the dedicated GPU. audio-visualizer's
|
|
# .cargo/config.toml adds this flag, but cargo reads that file from the cwd
|
|
# (not --manifest-path) and a RUSTFLAGS env var replaces config rustflags
|
|
# anyway — so pass it here explicitly.
|
|
EXPORT="-C link-args=-Wl,--export-all-symbols"
|
|
|
|
# 1. Build the two release .exes.
|
|
if [[ "$STATIC" == "1" ]]; then
|
|
log "cargo build --release --target $TARGET (static CRT)"
|
|
RUSTFLAGS="${RUSTFLAGS:-} -C target-feature=+crt-static $EXPORT" \
|
|
cargo build --release --target "$TARGET" --manifest-path "$ROOT/Cargo.toml" \
|
|
--bin sigil
|
|
if [[ "$WITH_STT" == "1" ]]; then
|
|
RUSTFLAGS="${RUSTFLAGS:-} -C target-feature=+crt-static" \
|
|
cargo build --release --target "$TARGET" --manifest-path "$ROOT/Cargo.toml" \
|
|
-p sigil-vocals
|
|
fi
|
|
RUSTFLAGS="${RUSTFLAGS:-} -C target-feature=+crt-static" \
|
|
cargo build --release --target "$TARGET" --target-dir "$ROOT/target" \
|
|
--manifest-path "$ROOT/sigil-gui/Cargo.toml"
|
|
else
|
|
log "cargo build --release --target $TARGET (dynamic CRT)"
|
|
RUSTFLAGS="${RUSTFLAGS:-} $EXPORT" cargo build --release --target "$TARGET" --manifest-path "$ROOT/Cargo.toml" \
|
|
--bin sigil
|
|
if [[ "$WITH_STT" == "1" ]]; then
|
|
cargo build --release --target "$TARGET" --manifest-path "$ROOT/Cargo.toml" -p sigil-vocals
|
|
fi
|
|
cargo build --release --target "$TARGET" --target-dir "$ROOT/target" \
|
|
--manifest-path "$ROOT/sigil-gui/Cargo.toml"
|
|
fi
|
|
BIN="$ROOT/target/$TARGET/release"
|
|
[[ -f "$BIN/sigil.exe" && -f "$BIN/sigil-gui.exe" ]] || die "expected .exe missing in $BIN"
|
|
|
|
# 2. Fetch + unpack ffmpeg.exe.
|
|
FF_ZIP="$CACHE/ffmpeg-win.zip"
|
|
fetch "$FFMPEG_WIN_URL" "$FF_ZIP"
|
|
FF_DIR="$CACHE/ffmpeg-win"
|
|
rm -rf "$FF_DIR"; mkdir -p "$FF_DIR"
|
|
unzip -q -o "$FF_ZIP" -d "$FF_DIR"
|
|
FFMPEG_EXE=$(find "$FF_DIR" -name ffmpeg.exe -print -quit)
|
|
[[ -n "$FFMPEG_EXE" ]] || die "ffmpeg.exe not found in $FF_ZIP"
|
|
|
|
# 3. Assemble the bundle directory.
|
|
STAGE="$DIST/sigil-win64"
|
|
rm -rf "$STAGE"; mkdir -p "$STAGE"
|
|
cp "$BIN/sigil-gui.exe" "$BIN/sigil.exe" "$STAGE/"
|
|
cp "$FFMPEG_EXE" "$STAGE/ffmpeg.exe"
|
|
|
|
# 4. Speech to text. whisper-cli.exe is linked fully static against the mingw
|
|
# runtime, so it needs nothing but Windows' own UCRT.
|
|
if [[ "$WITH_STT" == "1" ]]; then
|
|
need x86_64-w64-mingw32-g++ "install the mingw-w64 toolchain"
|
|
cp "$BIN/sigil-vocals.exe" "$STAGE/"
|
|
WHISPER_EXE=$(build_whisper "$CACHE/whisper-build-win" \
|
|
-DCMAKE_SYSTEM_NAME=Windows \
|
|
-DCMAKE_C_COMPILER=x86_64-w64-mingw32-gcc \
|
|
-DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-g++ \
|
|
-DCMAKE_EXE_LINKER_FLAGS="-static -static-libgcc -static-libstdc++")
|
|
cp "$WHISPER_EXE" "$STAGE/whisper-cli.exe"
|
|
x86_64-w64-mingw32-strip "$STAGE/whisper-cli.exe" || true
|
|
|
|
ORT_ZIP="$CACHE/onnxruntime-win-x64-$ORT_VERSION.zip"
|
|
fetch "$ORT_URL/onnxruntime-win-x64-$ORT_VERSION.zip" "$ORT_ZIP"
|
|
ORT_DIR="onnxruntime-win-x64-$ORT_VERSION"
|
|
unzip -q -o -j "$ORT_ZIP" "$ORT_DIR/lib/onnxruntime.dll" -d "$STAGE"
|
|
mkdir -p "$STAGE/licenses/onnxruntime" "$STAGE/licenses/whisper.cpp"
|
|
unzip -q -o -j "$ORT_ZIP" "$ORT_DIR/LICENSE" "$ORT_DIR/ThirdPartyNotices.txt" \
|
|
-d "$STAGE/licenses/onnxruntime"
|
|
cp "$(whisper_src)/LICENSE" "$STAGE/licenses/whisper.cpp/LICENSE"
|
|
|
|
if [[ -n "${VCRT_DIR:-}" ]]; then
|
|
for dll in msvcp140.dll msvcp140_1.dll vcruntime140.dll vcruntime140_1.dll; do
|
|
found=$(find "$VCRT_DIR" -maxdepth 1 -iname "$dll" -print -quit)
|
|
if [[ -n "$found" ]]; then cp "$found" "$STAGE/"; else warn "$dll not in $VCRT_DIR"; fi
|
|
done
|
|
fi
|
|
|
|
stt_models "$STAGE/models"
|
|
fi
|
|
|
|
# 5. Dynamic build: copy the mingw runtime DLLs next to the exes.
|
|
if [[ "$STATIC" != "1" ]]; then
|
|
GCC_DIR=$(dirname "$(x86_64-w64-mingw32-gcc -print-libgcc-file-name)")
|
|
for dll in libgcc_s_seh-1.dll libwinpthread-1.dll libstdc++-6.dll; do
|
|
found=$(find /usr -name "$dll" -path '*x86_64-w64-mingw32*' -print -quit 2>/dev/null \
|
|
|| find "$GCC_DIR" -name "$dll" -print -quit 2>/dev/null)
|
|
if [[ -n "$found" ]]; then cp "$found" "$STAGE/"; else warn "DLL not found: $dll"; fi
|
|
done
|
|
fi
|
|
|
|
cat > "$STAGE/README.txt" <<'EOF'
|
|
Sigil Visualizer — Windows bundle
|
|
|
|
Run sigil-gui.exe. Keep all files in the same folder: the launcher spawns
|
|
sigil.exe, and rendering spawns the bundled ffmpeg.exe, both from this folder.
|
|
EOF
|
|
if [[ "$WITH_STT" == "1" ]]; then
|
|
cat >> "$STAGE/README.txt" <<'EOF'
|
|
|
|
Speech to text (Text > Lyrics > Transcribe) uses whisper-cli.exe, and
|
|
sigil-vocals.exe + onnxruntime.dll to pull the vocals out of the mix first.
|
|
The models live in the models folder; the launcher downloads others on
|
|
demand. onnxruntime.dll needs the Microsoft Visual C++ Redistributable (x64),
|
|
which most PCs already have. If vocal isolation reports that ONNX Runtime is
|
|
missing, install it from https://aka.ms/vs/17/release/vc_redist.x64.exe
|
|
EOF
|
|
fi
|
|
|
|
# 6. Zip it.
|
|
OUT="$DIST/sigil-win64.zip"
|
|
rm -f "$OUT"
|
|
( cd "$DIST" && zip -qr "$(basename "$OUT")" "$(basename "$STAGE")" )
|
|
log "done → $OUT ($(du -h "$OUT" | cut -f1))"
|