Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

fix(build): réparer les builds Linux et macOS, restés cassés sous `if: false`

Etienne Lescot7caf13abe3cb
diff --git a/electron/native/whisper-stt/CMakeLists.txt b/electron/native/whisper-stt/CMakeLists.txt
index e5358527e..b95baf7d1 100644
--- a/electron/native/whisper-stt/CMakeLists.txt
+++ b/electron/native/whisper-stt/CMakeLists.txt
@@ -127,6 +127,21 @@ set(HTTPLIB_USE_OPENSSL_IF_AVAILABLE OFF CACHE BOOL "" FORCE)
set(HTTPLIB_USE_ZLIB_IF_AVAILABLE OFF CACHE BOOL "" FORCE)
set(HTTPLIB_USE_BROTLI_IF_AVAILABLE OFF CACHE BOOL "" FORCE)
+# ponytail: on Linux, ggml/whisper build as separate shared objects and CMake
+# bakes the absolute build-tree `bin/` path into each RUNPATH. The build script
+# then copies the binary and its libs side by side into
+# `electron/native/bin/linux-x64/`, where that absolute path is meaningless the
+# moment the build cache is wiped or the app is packaged on another machine.
+# Resolve relative to the executable instead. `$ORIGIN/bin` keeps the binary in
+# the build tree runnable too (it lands at the build root while the libs go to
+# `bin/`). Set before MakeAvailable so the whisper/ggml targets inherit it.
+# macOS is left alone: it needs @loader_path rather than $ORIGIN and is not
+# testable from here.
+if(UNIX AND NOT APPLE)
+ set(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
+ set(CMAKE_INSTALL_RPATH "$ORIGIN:$ORIGIN/bin")
+endif()
+
FetchContent_MakeAvailable(whisper httplib json)
add_executable(whisper-stt-server src/main.cpp)
diff --git a/scripts/fetch-ffmpeg-macos.mjs b/scripts/fetch-ffmpeg-macos.mjs
index c3f946812..14330ac24 100644
--- a/scripts/fetch-ffmpeg-macos.mjs
+++ b/scripts/fetch-ffmpeg-macos.mjs
@@ -93,6 +93,19 @@ run(
"--disable-static",
"--disable-doc",
"--disable-debug",
+ // ffmpeg's configure AUTO-DETECTS these from whatever the build machine happens
+ // to have installed, and a GitHub macOS runner has a large Homebrew prefix. That
+ // is how libavformat came to link /opt/homebrew/opt/libx11/lib/libX11.6.dylib and
+ // trip build-macos-compositor-addon.mjs's "no absolute build-machine paths" check,
+ // which is the check doing its job: such a dylib is unresolvable on a user's Mac.
+ // Disabled explicitly rather than left to chance, so the vendored tree depends on
+ // the source tarball and the SDK, never on the runner's incidental packages.
+ // None is used here: xlib/libxcb are X11 capture, sdl2 is only ffplay, and lzma
+ // only reaches decoders we do not ship (we decode mp4/webm).
+ "--disable-xlib",
+ "--disable-libxcb",
+ "--disable-sdl2",
+ "--disable-lzma",
"--enable-videotoolbox",
"--enable-audiotoolbox",
"--disable-x86asm",