Skip to content

The truly free, open-source, local-first, cross-platform CapCut replacement. Scriptable through a JSON-RPC API & MCP.

workflows updates

Jareer62fa591e29fe
diff --git a/.github/workflows/build-app.yml b/.github/workflows/build-app.yml
index 13408945..d77ca1ca 100644
--- a/.github/workflows/build-app.yml
+++ b/.github/workflows/build-app.yml
@@ -178,6 +178,31 @@ jobs:
"LIBCLANG_PATH=C:\Program Files\LLVM\bin" | Out-File -FilePath $env:GITHUB_ENV -Append
"$dir\bin" | Out-File -FilePath $env:GITHUB_PATH -Append
+ # sherpa-onnx links shared on Windows (see concat-speech's manifest for
+ # why static cannot work here), from a directory holding only the
+ # import libraries. The separation matters: when the sys crate's build
+ # script sees DLLs beside the .lib files it tries to copy them into
+ # the "profile directory", located by searching OUT_DIR's ancestors
+ # for one named after $PROFILE - which panics under the custom `app`
+ # profile, whose directory is not called "release". The DLLs are kept
+ # apart and the packaging step ships them beside the binary.
+ - name: sherpa-onnx shared libraries (Windows)
+ if: matrix.platform == 'windows'
+ shell: pwsh
+ run: |
+ $ErrorActionPreference = "Stop"
+ # The version the lockfile resolved, so a bump cannot desynchronise.
+ $version = (Select-String -Path engine\Cargo.lock -Pattern 'name = "sherpa-onnx-sys"' -Context 0,1).Context.PostContext[0] -replace '.*"(.*)".*', '$1'
+ $arch = if ("${{ matrix.arch }}" -eq "aarch64") { "win-arm64" } else { "win-x64" }
+ $stem = "sherpa-onnx-v$version-$arch-shared-MT-Release-lib"
+ curl.exe -fsSL --retry 5 --retry-all-errors -o sherpa.tar.bz2 "https://github.com/k2-fsa/sherpa-onnx/releases/download/v$version/$stem.tar.bz2"
+ tar -xjf sherpa.tar.bz2
+ New-Item -ItemType Directory -Force sherpa-libs, sherpa-dlls | Out-Null
+ Copy-Item "$stem\lib\*.lib" sherpa-libs\
+ Copy-Item "$stem\lib\*.dll" sherpa-dlls\
+ "SHERPA_ONNX_LIB_DIR=$PWD\sherpa-libs" | Out-File -FilePath $env:GITHUB_ENV -Append
+ "SHERPA_DLL_DIR=$PWD\sherpa-dlls" | Out-File -FilePath $env:GITHUB_ENV -Append
+
# ── Build ──────────────────────────────────────────────────────────
# The shipping profile: fat LTO, panic=abort, stripped. See the
# workspace Cargo.toml for what each knob costs.
@@ -375,6 +400,8 @@ jobs:
New-Item -ItemType Directory -Force "stage\$name" | Out-Null
Copy-Item "engine\target\${{ matrix.target }}\app\concat.exe" "stage\$name\"
Copy-Item "$env:FFMPEG_DIR\bin\*.dll" "stage\$name\"
+ # The sherpa-onnx runtime, set aside by the download step above.
+ Copy-Item "$env:SHERPA_DLL_DIR\*.dll" "stage\$name\"
Copy-Item LICENSE, THIRD_PARTY_NOTICES.md "stage\$name\"
Compress-Archive -Path "stage\$name" -DestinationPath "stage\$name.zip"
Remove-Item -Recurse -Force "stage\$name"
diff --git a/engine/crates/concat-speech/Cargo.toml b/engine/crates/concat-speech/Cargo.toml
index f2eb7a15..66c6ef9f 100644
--- a/engine/crates/concat-speech/Cargo.toml
+++ b/engine/crates/concat-speech/Cargo.toml
@@ -17,10 +17,8 @@ serde_json.workspace = true
# for one GET.
ureq = "2"
-# Text to speech: the official k2-fsa bindings, linked statically so the
-# binary carries no extra dylibs. Kokoro models arrive as tar.bz2 archives,
-# hence tar + bzip2 (pure-Rust decoder) for unpacking them.
-sherpa-onnx = "1.13"
+# Kokoro models arrive as tar.bz2 archives, hence tar + bzip2 (pure-Rust
+# decoder) for unpacking them.
tar = "0.4"
bzip2 = "0.6"
@@ -28,6 +26,27 @@ bzip2 = "0.6"
# time; on macOS with Metal so the encoder runs on the GPU.
whisper-rs = "0.16"
+# Text to speech: the official k2-fsa bindings. Linked statically where that
+# works, so the binary carries no extra dylibs.
+[target.'cfg(not(windows))'.dependencies]
+sherpa-onnx = "1.13"
+
+# On Windows it must be the shared library instead: the only static archives
+# k2-fsa publishes are /MT (static CRT), and MSVC refuses to link those into
+# a binary whose every other object - Rust's own runtime, Skia, whisper - is
+# /MD. LNK2038, on every object pair. The /MT code stays sealed inside the
+# DLLs, which ship beside the binary.
+#
+# Windows builds must also set SHERPA_ONNX_LIB_DIR to a directory holding
+# only the import .lib files (CI does; ~/.cargo/config.toml locally). Left
+# to its own download, the sys crate finds the DLLs next to the import
+# libraries and tries to copy them into the "profile directory" - which it
+# locates by searching for an ancestor named after $PROFILE, a walk that
+# panics under the custom `app` profile. Keeping the DLLs out of the lib
+# directory skips that code path; packaging ships them explicitly.
+[target.'cfg(windows)'.dependencies]
+sherpa-onnx = { version = "1.13", default-features = false, features = ["shared"] }
+
[target.'cfg(target_os = "macos")'.dependencies]
whisper-rs = { version = "0.16", features = ["metal"] }