ci/cd: vendored static OCIO everywhere, ocio-sys tracks upstream main

Policy change (supersedes the system-first probe): build OpenColorIO
from the vendored sources and link it statically on every platform
that can -- packaged binaries carry no OCIO runtime dependency. The
[patch.crates-io] ocio-sys now tracks shaloong/ocio-rs main
explicitly; its vendored yaml-cpp has the <cstdint> include that makes
the vendored build work on GCC >= 16 (verified on GCC 16.2.1).

Windows/MinGW stays the exception (the vendored source needs MSVC-only
constructs): tooling/ocio-env.sh probes the MSYS2 system OCIO there,
static when libOpenColorIO.a ships, dynamic otherwise. The Linux jobs
drop the system OCIO dev packages the system-first policy needed.
This commit is contained in:
2026-08-30 16:02:45 +08:00
parent 91a6accf75
commit 8bf3f1e2df
5 changed files with 48 additions and 45 deletions
+3 -4
View File
@@ -41,7 +41,6 @@ jobs:
# X11, software Mesa Vulkan (lavapipe) and xvfb.
sudo apt-get install -y \
cmake \
libopencolorio-dev \
libpipewire-0.3-dev libspa-0.2-dev libjack-jackd2-dev \
libasound2-dev libpulse-dev libsndfile1-dev \
libgl1-mesa-dev libgl1-mesa-dri mesa-vulkan-drivers \
@@ -53,9 +52,9 @@ jobs:
# ocio-sys builds a stub bridge unless these are set; the oak-common
# ocioutils tests need the real library (see crates/oak-common/.cargo/
# config.toml, which only applies to builds run from that directory).
# tooling/ocio-env.sh picks a system OCIO >= 2.5 when present
# (vendored 2.5.2 fails on GCC >= 16) and otherwise falls back to
# the vendored static build.
# tooling/ocio-env.sh: vendored static OCIO (the [patch.crates-io]
# ocio-sys tracks shaloong/ocio-rs main, whose vendored sources build
# on GCC >= 16).
- name: Configure build environment
run: |
tooling/ocio-env.sh >> "$GITHUB_ENV"
+10 -11
View File
@@ -69,7 +69,7 @@ jobs:
libasound2-dev libpulse-dev libsndfile1-dev \
libgl1-mesa-dev libgl1-mesa-dri mesa-vulkan-drivers \
libvulkan-dev libxkbcommon-dev libxkbcommon-x11-dev \
librsvg2-bin libffnvcodec-dev libopencolorio-dev
librsvg2-bin libffnvcodec-dev
;;
fedora)
dnf install -y \
@@ -79,7 +79,7 @@ jobs:
mesa-libGL-devel mesa-vulkan-drivers \
vulkan-headers vulkan-loader-devel \
libxkbcommon-devel libxkbcommon-x11-devel \
rpm-build librsvg2-tools OpenColorIO-devel
rpm-build librsvg2-tools
# ffnvcodec headers (NVDEC for the project FFmpeg build) are
# not in Fedora's base repos (RPM Fusion only); they are
# distribution-free headers, so install them from source.
@@ -92,15 +92,15 @@ jobs:
pipewire jack2 alsa-lib libpulse libsndfile \
mesa vulkan-headers vulkan-icd-loader \
libxkbcommon libxkbcommon-x11 librsvg \
ffnvcodec-headers opencolorio
ffnvcodec-headers
;;
esac
- name: Configure build environment
run: |
# tooling/ocio-env.sh: use a system OCIO >= 2.5 when present
# (vendored 2.5.2 fails on GCC >= 16), static when the package
# ships libOpenColorIO.a; otherwise the vendored static build.
# tooling/ocio-env.sh: vendored static OCIO everywhere it
# builds (the [patch.crates-io] ocio-sys tracks shaloong/ocio-rs
# main, whose vendored sources build on GCC >= 16).
tooling/ocio-env.sh >> "$GITHUB_ENV"
# TEMP: cache disabled until the Gitea instance cache is provisioned (Cache cargo artifacts)
@@ -172,7 +172,7 @@ jobs:
libasound2-dev libpulse-dev libsndfile1-dev \
libgl1-mesa-dev libgl1-mesa-dri mesa-vulkan-drivers \
libvulkan-dev libxkbcommon-dev libxkbcommon-x11-dev \
libffnvcodec-dev libopencolorio-dev
libffnvcodec-dev
- name: Configure build environment
run: tooling/ocio-env.sh >> "$GITHUB_ENV"
@@ -234,11 +234,10 @@ jobs:
- name: Configure build environment
run: |
# Vendored static OCIO (same as every non-Windows platform via
# tooling/ocio-env.sh); no OCIO_INSTALL_DIR override.
tooling/ocio-env.sh >> "$GITHUB_ENV"
{
# OCIO comes from the ocio-sys vendored source build (same on
# every platform); no OCIO_INSTALL_DIR override.
echo "OCIO_RS_ENABLE_REAL=1"
echo "OCIO_RS_LINK=static"
echo "CFLAGS=-I/opt/homebrew/include"
echo "LDFLAGS=-L/opt/homebrew/lib"
echo "PKG_CONFIG_PATH=/opt/homebrew/lib/pkgconfig/openjpeg"
Generated
+1 -1
View File
@@ -5208,7 +5208,7 @@ dependencies = [
[[package]]
name = "ocio-sys"
version = "0.2.1"
source = "git+https://github.com/shaloong/ocio-rs.git#933c65dc4e8e4e22767174f0e22b07fe7af42e07"
source = "git+https://github.com/shaloong/ocio-rs.git?branch=main#933c65dc4e8e4e22767174f0e22b07fe7af42e07"
dependencies = [
"cc",
"cmake",
+1 -1
View File
@@ -72,4 +72,4 @@ opt-level = 1
# GCC >= 16; the fork carries exactly that fix (d39c509) until a fixed
# release lands on crates.io.
[patch.crates-io]
ocio-sys = { git = "https://github.com/shaloong/ocio-rs.git" }
ocio-sys = { git = "https://github.com/shaloong/ocio-rs.git", branch = "main" }
+33 -28
View File
@@ -19,18 +19,14 @@
# 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.
# Policy: VENDORED OpenColorIO, statically linked, everywhere it builds.
# The [patch.crates-io] ocio-sys tracks shaloong/ocio-rs main, whose
# vendored yaml-cpp carries the <cstdint> include the 0.2.1 crate is
# missing (without it the vendored build fails on GCC >= 16).
# Windows/MinGW is the exception: the vendored OCIO source needs
# MSVC-only constructs, so the MSYS2 system package is used instead —
# statically when it ships libOpenColorIO.a, dynamically otherwise (the
# CD packaging then bundles the DLL next to the binaries).
#
# Pre-set OCIO_RS_LINK / OCIO_INSTALL_DIR are honored, never clobbered.
@@ -45,20 +41,29 @@ 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
case "$(uname -s)" in
MINGW* | MSYS* | CYGWIN*)
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
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"
echo "error: no system OpenColorIO >= 2.5 on Windows, and the vendored" >&2
echo "source does not build with MinGW — cannot configure OCIO." >&2
exit 1
;;
*)
# Vendored-source static build (ocio-sys `bundled`; no
# OCIO_INSTALL_DIR).
echo "OCIO_RS_LINK=static"
;;
esac