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
+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