Skip to content

Open source CapCut alternative.

TypeScript

build: bundle ffmpeg 9.0.2 in the Mac app

David Lec8eaa559fc99
diff --git a/.github/workflows/promote-donkey-release.yml b/.github/workflows/promote-donkey-release.yml
index aabaf5ea..61bd6379 100644
--- a/.github/workflows/promote-donkey-release.yml
+++ b/.github/workflows/promote-donkey-release.yml
@@ -8,10 +8,10 @@ on:
# the hosted page, so a path list either releases site-only edits or misses app ones.
# Every push runs the gate; only a labelled one reaches the build.
#
- # The tools recipe (tools/**, fetch-bundled-tools.sh) goes the long way round. Those
- # changes go to Publish Bundled Tools first, which builds the new bundle, commits the
- # manifest pinning it, and then dispatches this workflow. Releasing on the recipe push
- # too would ship a build that still stages the previous bundle.
+ # The tools recipe (tools/**, fetch-bundled-tools.sh, ffmpeg-release) goes the long
+ # way round. Those changes go to Publish Bundled Tools first, which builds the new
+ # bundle, commits the manifest pinning it, and then dispatches this workflow. Releasing
+ # on the recipe push too would ship a build that still stages the previous bundle.
push:
branches:
- main
diff --git a/.github/workflows/publish-bundled-tools.yml b/.github/workflows/publish-bundled-tools.yml
index 4332ecb2..41eb98a1 100644
--- a/.github/workflows/publish-bundled-tools.yml
+++ b/.github/workflows/publish-bundled-tools.yml
@@ -17,6 +17,7 @@ on:
branches: [main]
paths:
- scripts/fetch-bundled-tools.sh
+ - site/src/cut/worker/ffmpeg-release
- tools/**
permissions:
@@ -56,7 +57,7 @@ jobs:
uses: actions/cache@v6
with:
path: vendor/donkey-tools
- key: donkey-tools-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('scripts/fetch-bundled-tools.sh', 'tools/**') }}
+ key: donkey-tools-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('scripts/fetch-bundled-tools.sh', 'site/src/cut/worker/ffmpeg-release', 'tools/**') }}
# Import the Developer ID cert into a throwaway keychain and stage the notary API key, so the tools
# are production-signed + notarized. Absent the secrets this no-ops to ad-hoc signing (still runnable,
diff --git a/scripts/fetch-bundled-tools.sh b/scripts/fetch-bundled-tools.sh
index 1b519b05..479bbbc6 100755
--- a/scripts/fetch-bundled-tools.sh
+++ b/scripts/fetch-bundled-tools.sh
@@ -93,10 +93,14 @@ build_libass() {
# above). Built shared, then dylibbundled. ffmpeg is MANDATORY: any failure here aborts
# the whole vendoring run, because a bundle without ffmpeg is not shippable.
build_lgpl_ffmpeg() {
- if [ -x "$VENDOR_DIR/ffmpeg" ] && [ -x "$VENDOR_DIR/ffprobe" ]; then
+ # The release and tarball checksum the cloud worker's image builds too.
+ . "$ROOT_DIR/site/src/cut/worker/ffmpeg-release"
+ local ver="$FFMPEG_VERSION"
+ # A vendored build of another version is rebuilt, so a bump here reaches the bundle.
+ if [ -x "$VENDOR_DIR/ffmpeg" ] && [ -x "$VENDOR_DIR/ffprobe" ] \
+ && "$VENDOR_DIR/ffmpeg" -version 2>/dev/null | head -1 | grep -q "^ffmpeg version $ver "; then
ok "ffmpeg (cached)"; ok "ffprobe (cached)"; return 0
fi
- local ver="7.1.1"
local work="/tmp/ffmpeg-lgpl-build"
local brew_prefix; brew_prefix="$(brew --prefix)"
command -v nasm >/dev/null 2>&1 || brew install nasm >/dev/null 2>&1
@@ -109,6 +113,8 @@ build_lgpl_ffmpeg() {
rm -rf "$work"; mkdir -p "$work"
curl -fsSL -o "$work/ffmpeg.tar.xz" "https://ffmpeg.org/releases/ffmpeg-${ver}.tar.xz" \
|| { echo "FATAL: ffmpeg source download failed" >&2; exit 1; }
+ echo "$FFMPEG_SHA256 $work/ffmpeg.tar.xz" | shasum -a 256 -c - >/dev/null \
+ || { echo "FATAL: ffmpeg source does not match the checksum in ffmpeg-release" >&2; exit 1; }
tar -xJf "$work/ffmpeg.tar.xz" -C "$work" --strip-components=1
( cd "$work" \
&& PKG_CONFIG_PATH="$ASS_PREFIX/lib/pkgconfig:$brew_prefix/lib/pkgconfig:$brew_prefix/share/pkgconfig" \