Files
oak-editor/tooling/package/build-pkg.sh
T
Mike-Solar 5b38d07299 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.
2026-08-30 00:31:48 +08:00

46 lines
1.9 KiB
Bash
Executable File

#!/bin/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/>.
# Build the Arch package: substitute the version into the PKGBUILD and
# run makepkg (as a non-root user — makepkg refuses root, and CI
# containers are root). Run from the repo root after
# `cargo build --release`. Usage: tooling/package/build-pkg.sh <version>
set -euo pipefail
VERSION="${1:?usage: build-pkg.sh <version>}"
WORK=target/pkg/arch
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
su builder -c "cd '$PWD/$WORK' && OAK_BIN='$PWD/target/release' OAK_ROOT='$PWD' makepkg -f --nodeps"
else
(cd "$WORK" && OAK_BIN="$PWD/target/release" OAK_ROOT="$PWD" makepkg -f --nodeps)
fi
find "$WORK" -name '*.pkg.tar.zst' -exec mv {} target/release/ \;
ls target/release/*.pkg.tar.zst