From 1dc5a77ab0cdb1516b50f496a467a7aefdd7fa59 Mon Sep 17 00:00:00 2001 From: Mike Solar Date: Thu, 24 Sep 2026 18:19:06 +0800 Subject: [PATCH] ci/cd: build vcpkg ports release-only via an overlay triplet vcpkg builds every port twice (release + debug) in manifest mode and the VCPKG_BUILD_TYPE environment variable is ignored there; pin the build type in overlay triplets instead (tooling/vcpkg-triplets/release, one per supported triplet). The release configuration is what both workflows consume: FFMPEG_DIR drives the release layout (lib/pkgconfig) and the C ABI is identical for the debug binary CI tests. Verified locally in debian:12: a release-only overlay builds zlib/libpng/openssl/pkgconf/ libsndfile with zero debug trees. Debug-only is not an option: ports like zlib patch files in the release layout and fail when only the debug configuration is built. --- .github/workflows/cd.yml | 4 ++-- .github/workflows/ci.yml | 4 ++-- tooling/vcpkg-triplets/README.md | 23 +++++++++++++++++++ .../vcpkg-triplets/release/arm64-linux.cmake | 12 ++++++++++ .../vcpkg-triplets/release/arm64-osx.cmake | 13 +++++++++++ .../vcpkg-triplets/release/x64-linux.cmake | 14 +++++++++++ .../vcpkg-triplets/release/x64-windows.cmake | 11 +++++++++ 7 files changed, 77 insertions(+), 4 deletions(-) create mode 100644 tooling/vcpkg-triplets/README.md create mode 100644 tooling/vcpkg-triplets/release/arm64-linux.cmake create mode 100644 tooling/vcpkg-triplets/release/arm64-osx.cmake create mode 100644 tooling/vcpkg-triplets/release/x64-linux.cmake create mode 100644 tooling/vcpkg-triplets/release/x64-windows.cmake diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 6f37de263..a29f112fd 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -274,7 +274,7 @@ jobs: # whole install — vcpkg refuses to retry that class of curl # error — so retry here. for attempt in 1 2 3; do - vcpkg install --triplet ${{ matrix.triplet }} && exit 0 + vcpkg install --triplet ${{ matrix.triplet }} --overlay-triplets tooling/vcpkg-triplets/release && exit 0 echo "vcpkg install failed (attempt $attempt); retrying" sleep 15 done @@ -285,7 +285,7 @@ jobs: shell: pwsh run: | for ($i = 1; $i -le 3; $i++) { - vcpkg install --triplet ${{ matrix.triplet }} + vcpkg install --triplet ${{ matrix.triplet }} --overlay-triplets tooling/vcpkg-triplets/release if ($LASTEXITCODE -eq 0) { exit 0 } Write-Host "vcpkg install failed (attempt $i); retrying" Start-Sleep -Seconds 15 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c8b6f89e3..0ab1d5aa7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -315,7 +315,7 @@ jobs: # error — so retry here. vcpkg resumes from its archive and # download caches, so a repeat attempt is cheap. for attempt in 1 2 3; do - vcpkg install --triplet ${{ matrix.triplet }} && exit 0 + vcpkg install --triplet ${{ matrix.triplet }} --overlay-triplets tooling/vcpkg-triplets/release && exit 0 echo "vcpkg install failed (attempt $attempt); retrying" sleep 15 done @@ -326,7 +326,7 @@ jobs: shell: pwsh run: | for ($i = 1; $i -le 3; $i++) { - vcpkg install --triplet ${{ matrix.triplet }} + vcpkg install --triplet ${{ matrix.triplet }} --overlay-triplets tooling/vcpkg-triplets/release if ($LASTEXITCODE -eq 0) { exit 0 } Write-Host "vcpkg install failed (attempt $i); retrying" Start-Sleep -Seconds 15 diff --git a/tooling/vcpkg-triplets/README.md b/tooling/vcpkg-triplets/README.md new file mode 100644 index 000000000..45539597b --- /dev/null +++ b/tooling/vcpkg-triplets/README.md @@ -0,0 +1,23 @@ +# vcpkg overlay triplets + +Small overlays over vcpkg's builtin triplets, passed to `vcpkg install` +with `--overlay-triplets ` (both workflows, see +`.github/workflows/ci.yml` and `.github/workflows/cd.yml`). + +`release/` pins every supported triplet to the release configuration +(`set(VCPKG_BUILD_TYPE release)`): vcpkg otherwise builds every port +twice — release and debug — which doubles the FFmpeg/port build time in +CI and CD. Our build scripts only ever consume the release layout +(`FFMPEG_DIR=` with `/lib/pkgconfig`, plus the linker +paths those `.pc` files carry), so the debug half was pure waste; the C +libraries' ABI is identical for the debug cargo binary CI tests. + +Notes: + +- The non-build-type settings mirror vcpkg's builtin triplets + (`scripts/triplets/`) so the overlay stays a drop-in replacement; a + vcpkg upgrade that changes a builtin triplet should be mirrored here. +- `VCPKG_BUILD_TYPE` must be set in the triplet: the environment + variable of the same name is ignored in manifest mode. +- Do not try `debug` here: several ports (e.g. zlib) patch files in the + release layout and fail when only the debug configuration is built. diff --git a/tooling/vcpkg-triplets/release/arm64-linux.cmake b/tooling/vcpkg-triplets/release/arm64-linux.cmake new file mode 100644 index 000000000..8c6a75589 --- /dev/null +++ b/tooling/vcpkg-triplets/release/arm64-linux.cmake @@ -0,0 +1,12 @@ +# Oak's build-type overlay triplet for arm64-linux (see the note in +# ../README.md): the settings mirror vcpkg's builtin arm64-linux.cmake and +# only the build type is pinned. Pass this directory with +# `--overlay-triplets tooling/vcpkg-triplets/release`. +set(VCPKG_TARGET_ARCHITECTURE arm64) +set(VCPKG_CRT_LINKAGE dynamic) +set(VCPKG_LIBRARY_LINKAGE static) + +set(VCPKG_CMAKE_SYSTEM_NAME Linux) + +# Build only the release configuration (see x64-linux.cmake). +set(VCPKG_BUILD_TYPE release) diff --git a/tooling/vcpkg-triplets/release/arm64-osx.cmake b/tooling/vcpkg-triplets/release/arm64-osx.cmake new file mode 100644 index 000000000..fab794a90 --- /dev/null +++ b/tooling/vcpkg-triplets/release/arm64-osx.cmake @@ -0,0 +1,13 @@ +# Oak's build-type overlay triplet for arm64-osx (see the note in +# ../README.md): the settings mirror vcpkg's builtin arm64-osx.cmake and +# only the build type is pinned. Pass this directory with +# `--overlay-triplets tooling/vcpkg-triplets/release`. +set(VCPKG_TARGET_ARCHITECTURE arm64) +set(VCPKG_CRT_LINKAGE dynamic) +set(VCPKG_LIBRARY_LINKAGE static) + +set(VCPKG_CMAKE_SYSTEM_NAME Darwin) +set(VCPKG_OSX_ARCHITECTURES arm64) + +# Build only the release configuration (see x64-linux.cmake). +set(VCPKG_BUILD_TYPE release) diff --git a/tooling/vcpkg-triplets/release/x64-linux.cmake b/tooling/vcpkg-triplets/release/x64-linux.cmake new file mode 100644 index 000000000..c63b1f261 --- /dev/null +++ b/tooling/vcpkg-triplets/release/x64-linux.cmake @@ -0,0 +1,14 @@ +# Oak's build-type overlay triplet for x64-linux (see the note in +# ../README.md): the settings mirror vcpkg's builtin x64-linux.cmake and +# only the build type is pinned. Pass this directory with +# `--overlay-triplets tooling/vcpkg-triplets/release`. +set(VCPKG_TARGET_ARCHITECTURE x64) +set(VCPKG_CRT_LINKAGE dynamic) +set(VCPKG_LIBRARY_LINKAGE static) + +set(VCPKG_CMAKE_SYSTEM_NAME Linux) + +# Build only the release configuration. vcpkg otherwise builds every port +# twice (release + debug) and our build scripts/vcpkg caches only ever use +# the release layout (FFMPEG_DIR's lib/pkgconfig). +set(VCPKG_BUILD_TYPE release) diff --git a/tooling/vcpkg-triplets/release/x64-windows.cmake b/tooling/vcpkg-triplets/release/x64-windows.cmake new file mode 100644 index 000000000..97ada31fe --- /dev/null +++ b/tooling/vcpkg-triplets/release/x64-windows.cmake @@ -0,0 +1,11 @@ +# Oak's build-type overlay triplet for x64-windows (see the note in +# ../README.md): the settings mirror vcpkg's builtin x64-windows.cmake and +# only the build type is pinned. Pass this directory with +# `--overlay-triplets tooling/vcpkg-triplets/release`. +set(VCPKG_TARGET_ARCHITECTURE x64) +set(VCPKG_CRT_LINKAGE dynamic) +set(VCPKG_LIBRARY_LINKAGE dynamic) +set(VCPKG_PROVIDED_FORTRAN ON) + +# Build only the release configuration (see x64-linux.cmake). +set(VCPKG_BUILD_TYPE release)