ci/cd: NVDEC-capable FFmpeg, GCC16-proof OCIO, system-first OCIO env

- Install ffnvcodec headers everywhere the project FFmpeg is built
  (distro packages on Debian/Ubuntu/Arch/MSYS2, nv-codec-headers from
  source on Fedora) so the FFmpeg build picks up NVDEC/NVENC.
- ocio-sys 0.2.1's vendored yaml-cpp misses <cstdint> and fails on
  GCC >= 16 (measured on GCC 16.2.1); patch the dependency to the
  fixed upstream tree (shaloong/ocio-rs, 933c65dc) until a fixed
  release lands on crates.io.
- New tooling/ocio-env.sh decides the OCIO build env per job: system
  OCIO >= 2.5 when present (static when the package ships
  libOpenColorIO.a, dynamic otherwise), vendored static build as the
  fallback. The Arch package gains an 'opencolorio' dependency only
  when the binaries link the system OCIO (build-pkg.sh probes ldd).
- CI 'Build' steps switch from cargo build to cargo check: the Test
  step links the test binaries anyway, and a full build would codegen
  every workspace crate twice.
This commit is contained in:
2026-08-30 00:31:48 +08:00
parent ef01570c5d
commit 5b38d07299
8 changed files with 127 additions and 33 deletions
+3 -2
View File
@@ -78,7 +78,8 @@ case "$(uname -s)" in
libopenh264-dev libopenjp2-7-dev libtheora-dev libwebp-dev \
libmp3lame-dev libopus-dev libvorbis-dev libspeex-dev \
libsnappy-dev libass-dev libfreetype-dev libfribidi-dev \
libfontconfig-dev libgnutls28-dev
libfontconfig-dev libgnutls28-dev \
libffnvcodec-dev
elif command -v dnf >/dev/null; then
run sudo dnf install -y gcc gcc-c++ pkgconf-pkg-config nasm \
x264-devel x265-devel dav1d-devel libvpx-devel \
@@ -90,7 +91,7 @@ case "$(uname -s)" in
run sudo pacman -S --needed --noconfirm base-devel pkgconf nasm \
x264 x265 dav1d libvpx openh264 openjpeg2 libtheora libwebp \
lame opus libvorbis speex snappy libass freetype2 fribidi \
fontconfig gnutls
fontconfig gnutls ffnvcodec-headers
else
echo "Unsupported Linux distribution (need apt-get, dnf or pacman)." >&2
exit 1
+64
View File
@@ -0,0 +1,64 @@
#!/usr/bin/env bash
# Oak Video Editor - Non-Linear Video Editor
# Copyright (C) 2026 Oak Team
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Print the OpenColorIO build environment for cargo, one VAR=value per
# line — append to $GITHUB_ENV in CI/CD (`tooling/ocio-env.sh >> "$GITHUB_ENV"`)
# or eval locally.
#
# Policy:
# 1. Prefer a SYSTEM OpenColorIO >= 2.5 (the bridge's API floor). The
# vendored 2.5.2 source build FAILS on GCC >= 16 — its bundled
# yaml-cpp relied on stdint.h being included transitively, which
# GCC 16 no longer does (measured: yaml-cpp emitterutils.cpp).
# Link the system OCIO STATICALLY when the package ships
# libOpenColorIO.a (e.g. MSYS2); distro packages that only ship the
# shared object (Arch, Debian, Fedora) leave dynamic as the only
# way to use the prebuilt library.
# 2. With no suitable system OCIO (too old or absent), fall back to
# the vendored-source static build (ocio-sys `bundled`, no
# OCIO_INSTALL_DIR) — which needs GCC < 16.
#
# Pre-set OCIO_RS_LINK / OCIO_INSTALL_DIR are honored, never clobbered.
set -euo pipefail
if [ -n "${OCIO_RS_LINK:-}" ]; then
# The caller already chose a link mode; only make sure the real
# bridge (not the stub) is on.
echo "OCIO_RS_ENABLE_REAL=1"
exit 0
fi
echo "OCIO_RS_ENABLE_REAL=1"
if pkg-config --exists 'OpenColorIO >= 2.5' 2>/dev/null; then
libdir=$(pkg-config --variable=libdir OpenColorIO)
prefix=$(pkg-config --variable=prefix OpenColorIO)
link=dynamic
for dir in "$libdir" "$prefix/lib" "$prefix"; do
if [ -f "$dir/libOpenColorIO.a" ]; then
link=static
break
fi
done
echo "OCIO_INSTALL_DIR=$prefix"
echo "OCIO_RS_LINK=$link"
exit 0
fi
# No usable system OCIO: vendored-source static build (needs GCC < 16).
echo "OCIO_RS_LINK=static"
+3 -1
View File
@@ -16,7 +16,9 @@
# Arch package build. The release binaries are built by the caller
# (tooling/package/build-pkg.sh) before makepkg runs; depends lists the
# base-OS packages the binaries link (FFmpeg/OCIO are statically linked).
# base-OS packages the binaries link (FFmpeg is statically linked; OCIO is
# static when built from the vendored source, and build-pkg.sh appends
# 'opencolorio' when the binaries link the system OCIO dynamically).
pkgname=oak-editor
pkgver=@VERSION@
pkgrel=1
+6
View File
@@ -27,6 +27,12 @@ rm -rf "$WORK"
mkdir -p "$WORK"
sed "s/@VERSION@/$VERSION/" tooling/package/PKGBUILD > "$WORK/PKGBUILD"
# OCIO is linked dynamically whenever the build used the system package
# (Arch ships no static libOpenColorIO); declare the dependency then.
if ldd target/release/oak-editor 2>/dev/null | grep -q libOpenColorIO; then
sed -i "s/'fontconfig' 'freetype2')/'fontconfig' 'freetype2' 'opencolorio')/" "$WORK/PKGBUILD"
fi
if [ "$(id -u)" = "0" ]; then
useradd -m builder 2>/dev/null || true
chown -R builder:builder "$WORK" target/release