ci: rewrite CI/CD for the Rust workspace
- CI: push/PR to main only; ubuntu/macos-15-arm64/windows-ucrt64 matrix; deps via tooling/install-deps.sh; project FFmpeg built once and cached under .cache/ffmpeg keyed on the build script; rust-cache for target/ - CD: tag v* packages with cargo-packager — deb/AppImage/pacman on Linux (rpm converted from the deb with fpm), NSIS on Windows, and a DMG (Apple Silicon) whose .app embeds liboakengine.dylib via install_name_tool; tag pushes publish a GitHub release with all packages attached - root Cargo.toml gains [package.metadata.packager]; the app icon is generated from Oak_Icon.svg with rsvg-convert in CI - root build.rs now also links the app on Linux (link-search + rpath + --export-dynamic); Windows remains blocked on the DLL undefined-symbol problem (oakcore_* host imports), documented in build.rs
This commit is contained in:
+253
-560
@@ -11,15 +11,220 @@ permissions:
|
||||
|
||||
jobs:
|
||||
# ------------------------------------------------------------------
|
||||
# Windows Installer (MSYS2)
|
||||
# Linux: deb + AppImage + pacman in one job. cargo-packager does not
|
||||
# support rpm (its format list is deb/appimage/pacman/nsis/dmg/app/wix),
|
||||
# and its "pacman" format emits a PKGBUILD + source tarball rather than a
|
||||
# compiled pkg.tar.zst — both are upstream limitations.
|
||||
# ------------------------------------------------------------------
|
||||
windows:
|
||||
runs-on: warp-windows-latest-x64-32x
|
||||
linux:
|
||||
name: Linux packages (deb, AppImage, pacman)
|
||||
runs-on: warp-ubuntu-latest-x64-8x
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Install Rust (stable)
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
|
||||
- name: Install system dependencies
|
||||
run: |
|
||||
tooling/install-deps.sh
|
||||
# Real OpenColorIO (ocio-sys real bridge) + rsvg-convert for the
|
||||
# app icon (cargo-packager needs PNG/icns/ico, the repo only has
|
||||
# Oak_Icon.svg).
|
||||
sudo apt-get install -y \
|
||||
libopencolorio-dev \
|
||||
librsvg2-bin \
|
||||
libgl1-mesa-dev libgl1-mesa-dri mesa-vulkan-drivers \
|
||||
libvulkan-dev libxkbcommon-dev
|
||||
|
||||
- name: Configure build environment
|
||||
run: |
|
||||
echo "OCIO_RS_ENABLE_REAL=1" >> "$GITHUB_ENV"
|
||||
echo "OCIO_INSTALL_DIR=/usr" >> "$GITHUB_ENV"
|
||||
echo "OCIO_RS_LINK=dynamic" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Cache cargo artifacts
|
||||
uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
shared-key: oak-workspace
|
||||
|
||||
- name: Cache project FFmpeg
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: .cache/ffmpeg
|
||||
key: ffmpeg-${{ runner.os }}-${{ hashFiles('tooling/ffmpeg/build-ffmpeg.sh') }}
|
||||
|
||||
- name: Build project FFmpeg (static, GPL + free codecs + hwaccel)
|
||||
run: |
|
||||
tooling/ffmpeg/build-ffmpeg.sh
|
||||
echo "FFMPEG_DIR=$PWD/.cache/ffmpeg" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Install cargo-packager
|
||||
run: cargo install cargo-packager --locked
|
||||
|
||||
- name: Generate app icon (PNG from Oak_Icon.svg)
|
||||
run: |
|
||||
mkdir -p icons
|
||||
rsvg-convert -w 1024 -h 1024 Oak_Icon.svg -o icons/icon.png
|
||||
file icons/icon.png
|
||||
|
||||
- name: Build (release)
|
||||
run: cargo build --release --locked
|
||||
|
||||
- name: Package (deb, AppImage, pacman)
|
||||
run: cargo packager --release --formats deb,appimage,pacman
|
||||
|
||||
# cargo-packager has no rpm format; convert the deb with fpm.
|
||||
- name: Package (rpm, via fpm)
|
||||
run: |
|
||||
sudo apt-get install -y ruby ruby-dev rpm
|
||||
sudo gem install --no-document fpm
|
||||
fpm -s deb -t rpm --name oak-editor \
|
||||
--version "$(cargo pkgid | sed 's/.*#//' | cut -d@ -f2-)" \
|
||||
target/release/*.deb
|
||||
mv ./*.rpm target/release/
|
||||
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: oak-linux
|
||||
path: |
|
||||
target/release/*.deb
|
||||
target/release/*.rpm
|
||||
target/release/*.AppImage
|
||||
target/release/*.tar.gz
|
||||
target/release/PKGBUILD
|
||||
if-no-files-found: error
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# macOS: Apple Silicon only. cargo-packager cannot fold liboakengine.dylib
|
||||
# into the bundle (no post-packaging hook; the .app is rebuilt on every
|
||||
# run), so we package the .app with cargo-packager, embed the dylib next
|
||||
# to the binaries with install_name_tool, ad-hoc re-sign, then create the
|
||||
# DMG with hdiutil (the same way the old C++ CD did).
|
||||
# ------------------------------------------------------------------
|
||||
macos:
|
||||
name: macOS DMG (Apple Silicon)
|
||||
runs-on: warp-macos-15-arm64-6x
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Install Rust (stable)
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
|
||||
- name: Install system dependencies
|
||||
run: |
|
||||
tooling/install-deps.sh
|
||||
brew install opencolorio librsvg
|
||||
|
||||
- name: Configure build environment
|
||||
run: |
|
||||
echo "OCIO_RS_ENABLE_REAL=1" >> "$GITHUB_ENV"
|
||||
echo "OCIO_INSTALL_DIR=/opt/homebrew/opt/opencolorio" >> "$GITHUB_ENV"
|
||||
echo "OCIO_RS_LINK=dynamic" >> "$GITHUB_ENV"
|
||||
echo "CFLAGS=-I/opt/homebrew/include" >> "$GITHUB_ENV"
|
||||
echo "LDFLAGS=-L/opt/homebrew/lib" >> "$GITHUB_ENV"
|
||||
echo "PKG_CONFIG_PATH=/opt/homebrew/lib/pkgconfig/openjpeg" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Cache cargo artifacts
|
||||
uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
shared-key: oak-workspace
|
||||
|
||||
- name: Cache project FFmpeg
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: .cache/ffmpeg
|
||||
key: ffmpeg-${{ runner.os }}-${{ hashFiles('tooling/ffmpeg/build-ffmpeg.sh') }}
|
||||
|
||||
- name: Build project FFmpeg (static, GPL + free codecs + hwaccel)
|
||||
run: |
|
||||
tooling/ffmpeg/build-ffmpeg.sh
|
||||
echo "FFMPEG_DIR=$PWD/.cache/ffmpeg" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Install cargo-packager
|
||||
run: cargo install cargo-packager --locked
|
||||
|
||||
- name: Generate app icon (PNG from Oak_Icon.svg)
|
||||
run: |
|
||||
mkdir -p icons
|
||||
rsvg-convert -w 1024 -h 1024 Oak_Icon.svg -o icons/icon.png
|
||||
file icons/icon.png
|
||||
|
||||
- name: Build (release)
|
||||
run: cargo build --release --locked
|
||||
|
||||
- name: Package .app bundle
|
||||
run: cargo packager --release --formats app
|
||||
|
||||
- name: Embed liboakengine.dylib and re-sign
|
||||
run: |
|
||||
set -euo pipefail
|
||||
APP="target/release/Oak.app"
|
||||
MACOS="$APP/Contents/MacOS"
|
||||
# The dylib lands in target/release/deps/ (dependency build) or
|
||||
# target/release/ (workspace-member build), possibly hash-suffixed.
|
||||
DYLIB="$(find target/release -name 'liboakengine.dylib' | head -1)"
|
||||
test -n "$DYLIB" && test -f "$DYLIB"
|
||||
cp "$DYLIB" "$MACOS/liboakengine.dylib"
|
||||
install_name_tool -id "@executable_path/liboakengine.dylib" "$MACOS/liboakengine.dylib"
|
||||
# build.rs links the app against the dylib's absolute build path;
|
||||
# point every binary that references it at the bundled copy.
|
||||
for bin in oak-editor oak-cli oak-worker; do
|
||||
if otool -L "$MACOS/$bin" 2>/dev/null | grep -q "liboakengine.dylib"; then
|
||||
REF="$(otool -L "$MACOS/$bin" | awk '/liboakengine/ {print $1; exit}')"
|
||||
install_name_tool -change "$REF" "@executable_path/liboakengine.dylib" "$MACOS/$bin"
|
||||
fi
|
||||
done
|
||||
# install_name_tool invalidates the packager's ad-hoc signature.
|
||||
codesign --force --deep --sign - "$APP"
|
||||
codesign -dv "$APP" 2>&1 | head -3
|
||||
|
||||
- name: Create DMG
|
||||
run: |
|
||||
rm -rf dmg-staging
|
||||
mkdir -p dmg-staging
|
||||
cp -R target/release/Oak.app dmg-staging/
|
||||
ln -s /Applications dmg-staging/Applications
|
||||
hdiutil create -volname "Oak Video Editor" \
|
||||
-srcfolder dmg-staging -ov -format UDZO Oak-macOS-arm64.dmg
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: oak-macos
|
||||
path: Oak-macOS-arm64.dmg
|
||||
if-no-files-found: error
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# Windows: NSIS installer. cargo-packager downloads its own NSIS
|
||||
# toolchain (SHA-1 verified) — no makensis install needed.
|
||||
# ------------------------------------------------------------------
|
||||
windows:
|
||||
name: Windows installer (NSIS)
|
||||
runs-on: warp-windows-latest-x64-16x
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: msys2 {0}
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Install Rust (stable)
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
|
||||
- name: Setup MSYS2
|
||||
uses: msys2/setup-msys2@v2
|
||||
with:
|
||||
@@ -27,578 +232,66 @@ jobs:
|
||||
update: true
|
||||
install: >-
|
||||
git
|
||||
mingw-w64-ucrt-x86_64-cmake
|
||||
mingw-w64-ucrt-x86_64-ninja
|
||||
mingw-w64-ucrt-x86_64-gcc
|
||||
mingw-w64-ucrt-x86_64-qt6-base
|
||||
mingw-w64-ucrt-x86_64-qt6-tools
|
||||
mingw-w64-ucrt-x86_64-ffmpeg
|
||||
mingw-w64-ucrt-x86_64-openimageio
|
||||
mingw-w64-ucrt-x86_64-opencolorio
|
||||
mingw-w64-ucrt-x86_64-openexr
|
||||
mingw-w64-ucrt-x86_64-fmt
|
||||
mingw-w64-ucrt-x86_64-expat
|
||||
mingw-w64-ucrt-x86_64-portaudio
|
||||
mingw-w64-ucrt-x86_64-vulkan-headers
|
||||
mingw-w64-ucrt-x86_64-vulkan-loader
|
||||
mingw-w64-ucrt-x86_64-nsis
|
||||
mingw-w64-ucrt-x86_64-ntldd
|
||||
|
||||
- name: Build OpenTimelineIO
|
||||
shell: msys2 {0}
|
||||
- name: Install system dependencies
|
||||
run: |
|
||||
git clone --depth 1 --branch v0.16.0 https://github.com/PixarAnimationStudios/OpenTimelineIO.git
|
||||
cmake -S OpenTimelineIO -B OpenTimelineIO/build -G Ninja \
|
||||
-DOTIO_SHARED_LIBS=ON \
|
||||
-DOTIO_PYTHON_BINDINGS=OFF \
|
||||
-DOTIO_FIND_IMATH=ON \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_INSTALL_PREFIX="${PWD}/otio-install"
|
||||
cmake --build OpenTimelineIO/build
|
||||
cmake --install OpenTimelineIO/build
|
||||
bash tooling/install-deps.sh
|
||||
pacman -S --needed --noconfirm \
|
||||
mingw-w64-ucrt-x86_64-opencolorio \
|
||||
mingw-w64-ucrt-x86_64-librsvg
|
||||
|
||||
- name: Configure
|
||||
shell: msys2 {0}
|
||||
- name: Configure build environment
|
||||
run: |
|
||||
cmake -S . -B build -G Ninja \
|
||||
-DBUILD_QT6=ON \
|
||||
-DOTIO_LOCATION="${PWD}/otio-install" \
|
||||
-DCMAKE_BUILD_TYPE=Release
|
||||
echo "OCIO_RS_ENABLE_REAL=1" >> "$GITHUB_ENV"
|
||||
echo "OCIO_INSTALL_DIR=/ucrt64" >> "$GITHUB_ENV"
|
||||
echo "OCIO_RS_LINK=dynamic" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Build
|
||||
shell: msys2 {0}
|
||||
run: cmake --build build --config Release
|
||||
- name: Cache cargo artifacts
|
||||
uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
shared-key: oak-workspace
|
||||
|
||||
- name: Deploy dependencies
|
||||
shell: msys2 {0}
|
||||
- name: Cache project FFmpeg
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: .cache/ffmpeg
|
||||
key: ffmpeg-${{ runner.os }}-${{ hashFiles('tooling/ffmpeg/build-ffmpeg.sh') }}
|
||||
|
||||
- name: Build project FFmpeg (static, GPL + free codecs + hwaccel)
|
||||
run: |
|
||||
# Let ntldd discover the OTIO DLLs (no rpath on Windows)
|
||||
export PATH="${GITHUB_WORKSPACE}/otio-install/bin:${PATH}"
|
||||
mkdir -p app/packaging/windows/nsis/oak-editor
|
||||
cp build/app/oak-editor.exe app/packaging/windows/nsis/oak-editor/
|
||||
cp build/worker/oak-render-worker.exe app/packaging/windows/nsis/oak-editor/
|
||||
cp build/app/oakgl.dll app/packaging/windows/nsis/oak-editor/
|
||||
if [ -f build/app/oakvulkan.dll ]; then
|
||||
cp build/app/oakvulkan.dll app/packaging/windows/nsis/oak-editor/
|
||||
fi
|
||||
# The FFmpeg bridge DLL is built outside app/ and is not reachable
|
||||
# via PATH, so ntldd cannot discover it from the executables alone
|
||||
cp build/ffmpeg_bridge/bin/ffmpeg_bridge.dll app/packaging/windows/nsis/oak-editor/
|
||||
# Same for the liboakcore DLL
|
||||
cp build/core/oakcore.dll app/packaging/windows/nsis/oak-editor/
|
||||
# Same for the liboakengine DLL
|
||||
cp build/engine/oakengine.dll app/packaging/windows/nsis/oak-editor/
|
||||
windeployqt6 app/packaging/windows/nsis/oak-editor/oak-editor.exe
|
||||
# Copy all non-Qt MSYS2 DLLs recursively for every binary we ship
|
||||
cd app/packaging/windows/nsis/oak-editor
|
||||
for binary in oak-editor.exe oak-render-worker.exe oakgl.dll oakvulkan.dll ffmpeg_bridge.dll oakcore.dll oakengine.dll; do
|
||||
[ -f "$binary" ] || continue
|
||||
for l in $(ntldd -R "$binary" | grep -E 'mingw64|ucrt64|clang64' | sed 's/^[ \t]*//' | cut -d' ' -f3); do
|
||||
cp -v "$l" .
|
||||
done
|
||||
done
|
||||
bash tooling/ffmpeg/build-ffmpeg.sh
|
||||
echo "FFMPEG_DIR=$(cygpath -m "$PWD/.cache/ffmpeg")" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Build installer
|
||||
shell: msys2 {0}
|
||||
- name: Install cargo-packager
|
||||
run: cargo install cargo-packager --locked
|
||||
|
||||
- name: Generate app icon (PNG from Oak_Icon.svg)
|
||||
run: |
|
||||
cd app/packaging/windows/nsis
|
||||
cp "${GITHUB_WORKSPACE}"/LICENSE .
|
||||
makensis oak.nsi
|
||||
mv setup.exe "${GITHUB_WORKSPACE}"/Oak-Video-Editor-Windows-x64.exe
|
||||
mkdir -p icons
|
||||
rsvg-convert -w 1024 -h 1024 Oak_Icon.svg -o icons/icon.png
|
||||
|
||||
- name: Build (release)
|
||||
run: cargo build --release --locked
|
||||
|
||||
- name: Package (NSIS)
|
||||
run: cargo packager --release --formats nsis
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: oak-windows-installer
|
||||
path: Oak-Video-Editor-Windows-x64.exe
|
||||
name: oak-windows
|
||||
path: target/release/*-setup.exe
|
||||
if-no-files-found: error
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# macOS DMG
|
||||
# ------------------------------------------------------------------
|
||||
macos:
|
||||
runs-on: warp-macos-15-arm64-12x
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
brew update
|
||||
brew install cmake ninja pkg-config qt@6 ffmpeg openimageio opencolorio openexr portaudio expat molten-vk vulkan-headers vulkan-loader dylibbundler
|
||||
|
||||
- name: Build OpenTimelineIO
|
||||
run: |
|
||||
git clone --depth 1 --branch v0.16.0 https://github.com/PixarAnimationStudios/OpenTimelineIO.git
|
||||
cmake -S OpenTimelineIO -B OpenTimelineIO/build -G Ninja \
|
||||
-DOTIO_SHARED_LIBS=ON \
|
||||
-DOTIO_PYTHON_BINDINGS=OFF \
|
||||
-DOTIO_FIND_IMATH=ON \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_INSTALL_PREFIX="${PWD}/otio-install"
|
||||
cmake --build OpenTimelineIO/build
|
||||
cmake --install OpenTimelineIO/build
|
||||
|
||||
- name: Configure
|
||||
run: |
|
||||
export PATH="$(brew --prefix qt@6)/bin:$PATH"
|
||||
export CMAKE_PREFIX_PATH="$(brew --prefix qt@6)"
|
||||
# CMake's FindVulkan locates the Homebrew loader via VULKAN_SDK
|
||||
export VULKAN_SDK="$(brew --prefix vulkan-loader)"
|
||||
cmake -S . -B build -G Ninja \
|
||||
-DBUILD_QT6=ON \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DOTIO_LOCATION="${PWD}/otio-install" \
|
||||
-DOCIO_LOCATION="$(brew --prefix opencolorio)"
|
||||
|
||||
- name: Build
|
||||
run: cmake --build build --config Release
|
||||
|
||||
- name: Deploy Qt dependencies
|
||||
run: |
|
||||
export PATH="$(brew --prefix qt@6)/bin:$PATH"
|
||||
macdeployqt build/app/Oak.app \
|
||||
-verbose=2 \
|
||||
-executable=build/app/Oak.app/Contents/MacOS/oak-render-worker
|
||||
# Re-sign after macdeployqt (it breaks signatures when modifying libs)
|
||||
codesign --force --deep --sign - build/app/Oak.app
|
||||
|
||||
- name: Verify macOS bundle plugins
|
||||
run: |
|
||||
ls -la build/app/Oak.app/Contents/PlugIns/platforms/ || (echo "Missing platform plugins!" && exit 1)
|
||||
ls -la build/app/Oak.app/Contents/PlugIns/imageformats/ || true
|
||||
echo "=== otool -L main binary ==="
|
||||
otool -L build/app/Oak.app/Contents/MacOS/Oak | head -30
|
||||
echo "=== otool -L worker ==="
|
||||
otool -L build/app/Oak.app/Contents/MacOS/oak-render-worker | head -30
|
||||
|
||||
- name: Bundle non-Qt libraries
|
||||
run: |
|
||||
mkdir -p build/app/Oak.app/Contents/Frameworks
|
||||
python3 << 'PYEOF'
|
||||
import os, shutil, subprocess
|
||||
|
||||
APP = "build/app/Oak.app"
|
||||
MACOS_DIR = f"{APP}/Contents/MacOS"
|
||||
DEST = f"{APP}/Contents/Frameworks"
|
||||
os.makedirs(DEST, exist_ok=True)
|
||||
|
||||
QT_PREFIXES = ("Qt", "libQt")
|
||||
|
||||
def is_qt_lib(name):
|
||||
return name.startswith(QT_PREFIXES)
|
||||
|
||||
def get_rpaths(binary):
|
||||
out = subprocess.run(["otool", "-l", binary], capture_output=True, text=True).stdout
|
||||
rpaths = []
|
||||
for i, line in enumerate(out.splitlines()):
|
||||
if "cmd LC_RPATH" in line and i + 2 < len(out.splitlines()):
|
||||
parts = out.splitlines()[i + 2].strip().split()
|
||||
if len(parts) >= 2:
|
||||
rpaths.append(parts[1])
|
||||
return rpaths
|
||||
|
||||
def get_deps(binary):
|
||||
out = subprocess.run(["otool", "-L", binary], capture_output=True, text=True).stdout
|
||||
deps = []
|
||||
for line in out.splitlines()[1:]:
|
||||
line = line.strip()
|
||||
if not line:
|
||||
continue
|
||||
dep = line.split()[0]
|
||||
if dep.startswith("/usr/lib/") or dep.startswith("/System/"):
|
||||
continue
|
||||
deps.append(dep)
|
||||
return deps
|
||||
|
||||
def resolve(ref, rpaths, loader_dir=""):
|
||||
if ref.startswith("/"):
|
||||
return ref if os.path.isfile(ref) else None
|
||||
if ref.startswith("@rpath/"):
|
||||
for rp in rpaths:
|
||||
p = os.path.join(rp, ref[7:])
|
||||
if os.path.isfile(p):
|
||||
return p
|
||||
if ref.startswith("@loader_path/") and loader_dir:
|
||||
p = os.path.join(loader_dir, ref[13:])
|
||||
if os.path.isfile(p):
|
||||
return p
|
||||
if ref.startswith("@executable_path/"):
|
||||
p = os.path.join(APP, "Contents/MacOS", ref[17:])
|
||||
if os.path.isfile(p):
|
||||
return p
|
||||
return None
|
||||
|
||||
PROCESSED = set()
|
||||
|
||||
def process(target, exec_rpaths):
|
||||
tdir = os.path.dirname(target)
|
||||
print(f"Processing: {target}")
|
||||
for dep in get_deps(target):
|
||||
# Skip Qt frameworks and Qt dylibs; macdeployqt already deploys them.
|
||||
dep_base = os.path.basename(dep)
|
||||
if is_qt_lib(dep_base):
|
||||
continue
|
||||
resolved = resolve(dep, exec_rpaths, tdir)
|
||||
if not resolved or not os.path.isfile(resolved):
|
||||
continue
|
||||
resolved = os.path.realpath(resolved)
|
||||
if not (resolved.startswith("/opt/homebrew/") or resolved.startswith("/usr/local/") or resolved.startswith(os.path.realpath(os.getcwd()))):
|
||||
continue
|
||||
base = os.path.basename(resolved)
|
||||
if is_qt_lib(base):
|
||||
continue
|
||||
if base in PROCESSED:
|
||||
subprocess.run(["install_name_tool", "-change", dep, f"@rpath/{base}", target], capture_output=True)
|
||||
continue
|
||||
PROCESSED.add(base)
|
||||
dst = os.path.join(DEST, base)
|
||||
if os.path.abspath(resolved) == os.path.abspath(dst):
|
||||
subprocess.run(["install_name_tool", "-id", f"@rpath/{base}", dst], capture_output=True)
|
||||
subprocess.run(["install_name_tool", "-change", dep, f"@rpath/{base}", target], capture_output=True)
|
||||
process(dst, exec_rpaths)
|
||||
continue
|
||||
print(f" Copying: {resolved} -> {dst}")
|
||||
shutil.copy2(resolved, dst)
|
||||
subprocess.run(["install_name_tool", "-id", f"@rpath/{base}", dst], capture_output=True)
|
||||
subprocess.run(["install_name_tool", "-change", dep, f"@rpath/{base}", target], capture_output=True)
|
||||
process(dst, exec_rpaths)
|
||||
|
||||
binaries = [os.path.join(MACOS_DIR, f) for f in os.listdir(MACOS_DIR)
|
||||
if os.path.isfile(os.path.join(MACOS_DIR, f))]
|
||||
if not binaries:
|
||||
raise RuntimeError(f"No binaries found in {MACOS_DIR}")
|
||||
|
||||
main_binary = os.path.join(MACOS_DIR, "Oak")
|
||||
main_rpaths = get_rpaths(main_binary)
|
||||
|
||||
for binary in binaries:
|
||||
process(binary, main_rpaths)
|
||||
# Ensure every binary can find libraries in Frameworks
|
||||
for rp in get_rpaths(binary):
|
||||
subprocess.run(["install_name_tool", "-delete_rpath", rp, binary], capture_output=True)
|
||||
subprocess.run(["install_name_tool", "-add_rpath", "@executable_path/../Frameworks", binary], capture_output=True)
|
||||
|
||||
subprocess.run(["codesign", "--force", "--deep", "--sign", "-", APP], check=True)
|
||||
print("Done. Frameworks:")
|
||||
for f in sorted(os.listdir(DEST)):
|
||||
print(f" {f}")
|
||||
PYEOF
|
||||
|
||||
- name: Debug bundle contents
|
||||
run: |
|
||||
echo "=== otool -L ==="
|
||||
otool -L build/app/Oak.app/Contents/MacOS/Oak
|
||||
echo "=== Frameworks dir ==="
|
||||
ls -la build/app/Oak.app/Contents/Frameworks/ || echo "(empty)"
|
||||
echo "=== App bundle size ==="
|
||||
du -sh build/app/Oak.app
|
||||
|
||||
- name: Create DMG
|
||||
run: |
|
||||
mkdir -p build/app/dmg-staging
|
||||
cp -R build/app/Oak.app build/app/dmg-staging/
|
||||
ln -s /Applications build/app/dmg-staging/Applications
|
||||
hdiutil create \
|
||||
-srcfolder build/app/dmg-staging \
|
||||
-volname "Oak Video Editor" \
|
||||
-fs HFS+ \
|
||||
-format UDZO \
|
||||
Oak-Video-Editor-macOS.dmg
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: oak-macos-dmg
|
||||
path: Oak-Video-Editor-macOS.dmg
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# Linux AppImage (Ubuntu 24.04 — distro FFmpeg 6.x)
|
||||
# ------------------------------------------------------------------
|
||||
appimage:
|
||||
runs-on: warp-ubuntu-latest-x64-16x
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y \
|
||||
cmake ninja-build pkg-config \
|
||||
qt6-base-dev qt6-base-dev-tools qt6-base-private-dev qt6-tools-dev qt6-tools-dev-tools \
|
||||
libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libswresample-dev libavfilter-dev \
|
||||
libopencolorio-dev libopenimageio-dev libopenexr-dev libexpat1-dev \
|
||||
portaudio19-dev libgl1-mesa-dev libxkbcommon-dev \
|
||||
libvulkan-dev \
|
||||
wget fuse3 desktop-file-utils
|
||||
|
||||
- name: Build OpenTimelineIO
|
||||
run: |
|
||||
git clone --depth 1 --branch v0.16.0 https://github.com/PixarAnimationStudios/OpenTimelineIO.git
|
||||
cmake -S OpenTimelineIO -B OpenTimelineIO/build -G Ninja \
|
||||
-DOTIO_SHARED_LIBS=ON \
|
||||
-DOTIO_PYTHON_BINDINGS=OFF \
|
||||
-DOTIO_FIND_IMATH=ON \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_INSTALL_PREFIX="${PWD}/otio-install"
|
||||
cmake --build OpenTimelineIO/build
|
||||
cmake --install OpenTimelineIO/build
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
cmake -S . -B build -G Ninja \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_INSTALL_PREFIX=/usr \
|
||||
-DOTIO_LOCATION="${PWD}/otio-install" \
|
||||
-DBUILD_QT6=ON
|
||||
cmake --build build
|
||||
|
||||
- name: Install to AppDir
|
||||
run: |
|
||||
DESTDIR="${PWD}"/AppDir cmake --install build
|
||||
# Copy custom AppRun
|
||||
cp app/packaging/linux/AppRun AppDir/
|
||||
|
||||
- name: Create AppImage
|
||||
env:
|
||||
APPIMAGE_EXTRACT_AND_RUN: 1
|
||||
run: |
|
||||
wget -q "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage"
|
||||
wget -q "https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage"
|
||||
wget -q "https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage"
|
||||
chmod +x linuxdeploy-x86_64.AppImage linuxdeploy-plugin-qt-x86_64.AppImage appimagetool-x86_64.AppImage
|
||||
export PATH="${PWD}:${PATH}"
|
||||
DEPLOY_ARGS=""
|
||||
# The Vulkan backend is dlopen'ed at runtime, so linuxdeploy cannot
|
||||
# discover it (and its dependencies) from the executable alone
|
||||
if [ -f AppDir/usr/lib/liboakvulkan.so ]; then
|
||||
DEPLOY_ARGS="--library AppDir/usr/lib/liboakvulkan.so"
|
||||
fi
|
||||
./linuxdeploy-x86_64.AppImage \
|
||||
--appdir AppDir \
|
||||
--plugin qt \
|
||||
$DEPLOY_ARGS \
|
||||
--desktop-file AppDir/usr/share/applications/org.oakvideoeditor.Oak.desktop \
|
||||
--icon-file AppDir/usr/share/icons/hicolor/512x512/apps/org.oakvideoeditor.Oak.png \
|
||||
--output appimage
|
||||
|
||||
- name: Verify bundled libraries
|
||||
run: |
|
||||
# Ensure FFmpeg shared libraries are present inside the AppDir
|
||||
ls AppDir/usr/lib/libavcodec.so* || (echo "Missing libavcodec" && exit 1)
|
||||
ls AppDir/usr/lib/libavformat.so* || (echo "Missing libavformat" && exit 1)
|
||||
ls AppDir/usr/lib/libavutil.so* || (echo "Missing libavutil" && exit 1)
|
||||
ls AppDir/usr/lib/libswscale.so* || (echo "Missing libswscale" && exit 1)
|
||||
ls AppDir/usr/lib/libswresample.so* || (echo "Missing libswresample" && exit 1)
|
||||
# Ensure other runtime dependencies are present
|
||||
ls AppDir/usr/lib/libOpenImageIO.so* || (echo "Missing libOpenImageIO" && exit 1)
|
||||
ls AppDir/usr/lib/libOpenColorIO.so* || (echo "Missing libOpenColorIO" && exit 1)
|
||||
ls AppDir/usr/lib/libportaudio.so* || (echo "Missing libportaudio" && exit 1)
|
||||
ls AppDir/usr/lib/libOpenEXR*.so* || (echo "Missing libOpenEXR" && exit 1)
|
||||
ls AppDir/usr/lib/libopentimelineio.so* || (echo "Missing libopentimelineio" && exit 1)
|
||||
ls AppDir/usr/lib/libopentime.so* || (echo "Missing libopentime" && exit 1)
|
||||
# Ensure Oak's own binaries and shared libraries are present
|
||||
ls AppDir/usr/bin/oak-editor || (echo "Missing oak-editor" && exit 1)
|
||||
ls AppDir/usr/bin/oak-render-worker || (echo "Missing oak-render-worker" && exit 1)
|
||||
ls AppDir/usr/lib/liboakgl.so || (echo "Missing liboakgl.so" && exit 1)
|
||||
ls AppDir/usr/lib/liboakvulkan.so || (echo "Missing liboakvulkan.so" && exit 1)
|
||||
ls AppDir/usr/lib/libvulkan.so* || (echo "Missing libvulkan" && exit 1)
|
||||
ls AppDir/usr/lib/libffmpeg_bridge.so || (echo "Missing libffmpeg_bridge.so" && exit 1)
|
||||
ls AppDir/usr/lib/liboakcore.so || (echo "Missing liboakcore.so" && exit 1)
|
||||
ls AppDir/usr/lib/liboakengine.so || (echo "Missing liboakengine.so" && exit 1)
|
||||
# Ensure every shipped binary resolves all of its dependencies
|
||||
! ldd AppDir/usr/bin/oak-editor | grep "not found"
|
||||
! ldd AppDir/usr/bin/oak-render-worker | grep "not found"
|
||||
! ldd AppDir/usr/lib/liboakcore.so | grep "not found"
|
||||
! ldd AppDir/usr/lib/liboakengine.so | grep "not found"
|
||||
! ldd AppDir/usr/lib/liboakgl.so | grep "not found"
|
||||
! ldd AppDir/usr/lib/liboakvulkan.so | grep "not found"
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: oak-linux-appimage
|
||||
path: Oak_Video_Editor-*.AppImage
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# Debian package (.deb)
|
||||
# ------------------------------------------------------------------
|
||||
deb:
|
||||
runs-on: warp-ubuntu-latest-x64-16x
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y \
|
||||
cmake ninja-build pkg-config \
|
||||
qt6-base-dev qt6-base-dev-tools qt6-base-private-dev qt6-tools-dev qt6-tools-dev-tools \
|
||||
libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libswresample-dev libavfilter-dev \
|
||||
libopencolorio-dev libopenimageio-dev libopenexr-dev libexpat1-dev \
|
||||
portaudio19-dev libgl1-mesa-dev libxkbcommon-dev \
|
||||
libvulkan-dev
|
||||
|
||||
- name: Build OpenTimelineIO
|
||||
run: |
|
||||
git clone --depth 1 --branch v0.16.0 https://github.com/PixarAnimationStudios/OpenTimelineIO.git
|
||||
cmake -S OpenTimelineIO -B OpenTimelineIO/build -G Ninja \
|
||||
-DOTIO_SHARED_LIBS=ON \
|
||||
-DOTIO_PYTHON_BINDINGS=OFF \
|
||||
-DOTIO_FIND_IMATH=ON \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_INSTALL_PREFIX="${PWD}/otio-install"
|
||||
cmake --build OpenTimelineIO/build
|
||||
cmake --install OpenTimelineIO/build
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
cmake -S . -B build -G Ninja \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_INSTALL_PREFIX=/usr \
|
||||
-DOTIO_LOCATION="${PWD}/otio-install" \
|
||||
-DBUILD_QT6=ON
|
||||
cmake --build build
|
||||
|
||||
- name: Create DEB package
|
||||
run: |
|
||||
cd build
|
||||
cpack -G DEB
|
||||
mv *.deb "${GITHUB_WORKSPACE}/"
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: oak-deb-package
|
||||
path: oak-video-editor_*.deb
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# RPM package (.rpm)
|
||||
# ------------------------------------------------------------------
|
||||
rpm:
|
||||
runs-on: warp-ubuntu-latest-x64-16x
|
||||
container:
|
||||
image: fedora:latest
|
||||
steps:
|
||||
- name: Install Git
|
||||
run: dnf install -y git
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
dnf install -y \
|
||||
cmake ninja-build pkgconf-pkg-config \
|
||||
qt6-qtbase-devel qt6-qtbase-private-devel qt6-qttools-devel \
|
||||
ffmpeg-free-devel \
|
||||
OpenImageIO-devel \
|
||||
OpenColorIO-devel \
|
||||
openexr-devel \
|
||||
expat-devel \
|
||||
portaudio-devel \
|
||||
mesa-libGL-devel \
|
||||
vulkan-headers \
|
||||
vulkan-loader-devel \
|
||||
libxkbcommon-devel \
|
||||
gcc-c++ \
|
||||
bzip2-devel \
|
||||
rpm-build
|
||||
|
||||
- name: Build OpenTimelineIO
|
||||
run: |
|
||||
git clone --depth 1 --branch v0.16.0 https://github.com/PixarAnimationStudios/OpenTimelineIO.git
|
||||
cmake -S OpenTimelineIO -B OpenTimelineIO/build -G Ninja \
|
||||
-DOTIO_SHARED_LIBS=ON \
|
||||
-DOTIO_PYTHON_BINDINGS=OFF \
|
||||
-DOTIO_FIND_IMATH=ON \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_INSTALL_PREFIX="${PWD}/otio-install"
|
||||
cmake --build OpenTimelineIO/build
|
||||
cmake --install OpenTimelineIO/build
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
cmake -S . -B build -G Ninja \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_INSTALL_PREFIX=/usr \
|
||||
-DOTIO_LOCATION="${PWD}/otio-install" \
|
||||
-DBUILD_QT6=ON
|
||||
cmake --build build
|
||||
|
||||
- name: Create RPM package
|
||||
run: |
|
||||
cd build
|
||||
cpack -G RPM
|
||||
mv *.rpm "${GITHUB_WORKSPACE}/"
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: oak-rpm-package
|
||||
path: oak-video-editor-*.rpm
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# Arch Linux package (.pkg.tar.zst)
|
||||
# ------------------------------------------------------------------
|
||||
archlinux:
|
||||
runs-on: warp-ubuntu-latest-x64-16x
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Prepare source tarball and PKGBUILD
|
||||
run: |
|
||||
VERSION="${GITHUB_REF_NAME#v}"
|
||||
# Arch pkgver cannot contain hyphens
|
||||
PKGVER="${VERSION//-/_}"
|
||||
TARBALL="oak-video-editor-${PKGVER}.tar.gz"
|
||||
tar czf "/tmp/${TARBALL}" \
|
||||
--transform "s,^,oak-video-editor-${PKGVER}/," \
|
||||
--exclude='.git' \
|
||||
--exclude='build' \
|
||||
--exclude='*.tar.gz' \
|
||||
.
|
||||
mv "/tmp/${TARBALL}" "${TARBALL}"
|
||||
sed "s/@VERSION@/${PKGVER}/g" app/packaging/arch/PKGBUILD.in > PKGBUILD
|
||||
|
||||
- name: Build package in Arch Linux container
|
||||
run: |
|
||||
docker run --rm \
|
||||
-v "${PWD}:/build" \
|
||||
-w /build \
|
||||
archlinux:base-devel \
|
||||
bash -c '
|
||||
set -e
|
||||
pacman-key --init
|
||||
pacman -Syu --noconfirm
|
||||
pacman -S --noconfirm --needed \
|
||||
cmake ninja git pkgconf \
|
||||
qt6-base qt6-tools ffmpeg openimageio opencolorio openexr expat portaudio \
|
||||
mesa vulkan-headers vulkan-icd-loader libxkbcommon fmt \
|
||||
opentimelineio
|
||||
useradd -m builder
|
||||
chown -R builder /build
|
||||
su builder -c "makepkg -s --noconfirm"
|
||||
'
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: oak-arch-package
|
||||
path: oak-video-editor-*.pkg.tar.zst
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# Create Draft Release
|
||||
# Publish: attach every platform package to the v* tag's GitHub release
|
||||
# (skipped on workflow_dispatch, which only uploads artifacts).
|
||||
# ------------------------------------------------------------------
|
||||
release:
|
||||
needs: [windows, macos, appimage, deb, rpm, archlinux]
|
||||
name: Publish GitHub release
|
||||
needs: [linux, macos, windows]
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Download all artifacts
|
||||
@@ -607,10 +300,10 @@ jobs:
|
||||
path: artifacts
|
||||
merge-multiple: true
|
||||
|
||||
- name: Create Draft Release
|
||||
- name: Publish release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
draft: true
|
||||
tag_name: ${{ github.ref_name }}
|
||||
name: ${{ github.ref_name }}
|
||||
draft: false
|
||||
files: artifacts/*
|
||||
|
||||
+106
-310
@@ -7,376 +7,172 @@ on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
schedule:
|
||||
# Daily at 03:17 UTC to keep ccache/dependency caches warm
|
||||
- cron: '17 3 * * *'
|
||||
|
||||
concurrency:
|
||||
group: ci-${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build-test:
|
||||
name: Build & test (${{ matrix.os }})
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [warp-ubuntu-latest-x64-8x, warp-macos-15-arm64-6x, warp-windows-latest-x64-16x]
|
||||
env:
|
||||
CMAKE_BUILD_TYPE: Release
|
||||
CCACHE_DIR: ${{ github.workspace }}/.ccache
|
||||
CCACHE_MAXSIZE: 1G
|
||||
# Enable OFX integration tests that require external plugin bundles
|
||||
RUN_OFX_ITEST: "1"
|
||||
# Enable plugin subsystem smoke tests
|
||||
OAK_PLUGIN_SMOKE_TEST: "1"
|
||||
os:
|
||||
- warp-ubuntu-latest-x64-8x
|
||||
- warp-macos-15-arm64-6x
|
||||
- warp-windows-latest-x64-16x
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: 'true'
|
||||
# gpui/ is a git submodule; its crates are workspace members of
|
||||
# their own repo and build as path dependencies of oakapp.
|
||||
submodules: true
|
||||
|
||||
- name: Install Rust (stable)
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# Linux dependencies
|
||||
# System dependencies
|
||||
# ------------------------------------------------------------------
|
||||
- name: Install dependencies (Linux)
|
||||
- name: Install system dependencies (Linux)
|
||||
if: runner.os == 'Linux'
|
||||
run: |
|
||||
sudo apt-get update
|
||||
# Codec/filter libraries for the ffmpeg-sys-next build feature
|
||||
# (see tooling/install-deps.sh).
|
||||
tooling/install-deps.sh
|
||||
# Real OpenColorIO (ocio-sys real bridge) plus the headless test
|
||||
# infra gpui needs: X11, software Mesa Vulkan (lavapipe) and xvfb.
|
||||
sudo apt-get install -y \
|
||||
ninja-build pkg-config nasm \
|
||||
qt6-base-dev qt6-base-dev-tools qt6-base-private-dev qt6-tools-dev qt6-tools-dev-tools \
|
||||
libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libswresample-dev libavfilter-dev \
|
||||
ffmpeg \
|
||||
libopencolorio-dev libopenimageio-dev libopenexr-dev libexpat1-dev \
|
||||
portaudio19-dev libgl1-mesa-dev libgl1-mesa-dri libxkbcommon-dev ccache \
|
||||
xvfb libvulkan-dev mesa-vulkan-drivers vulkan-tools libshaderc-dev
|
||||
libopencolorio-dev \
|
||||
libgl1-mesa-dev libgl1-mesa-dri mesa-vulkan-drivers \
|
||||
libvulkan-dev libxkbcommon-dev xvfb
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# macOS dependencies
|
||||
# ------------------------------------------------------------------
|
||||
- name: Install dependencies (macOS)
|
||||
- name: Install system dependencies (macOS)
|
||||
if: runner.os == 'macOS'
|
||||
run: |
|
||||
brew update
|
||||
brew install ninja pkg-config ccache qt@6 ffmpeg openimageio opencolorio openexr portaudio expat molten-vk vulkan-headers
|
||||
echo "$(brew --prefix qt@6)/bin" >> "$GITHUB_PATH"
|
||||
echo "CMAKE_PREFIX_PATH=$(brew --prefix qt@6)" >> "$GITHUB_ENV"
|
||||
tooling/install-deps.sh
|
||||
brew install opencolorio
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# OpenTimelineIO (required dependency, built from source; cached)
|
||||
# ------------------------------------------------------------------
|
||||
- name: Cache OpenTimelineIO (Unix)
|
||||
if: runner.os != 'Windows'
|
||||
id: otio-cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: otio-install
|
||||
key: otio-0.16.0-${{ runner.os }}-v2
|
||||
|
||||
- name: Set OTIO location (Unix)
|
||||
if: runner.os != 'Windows'
|
||||
run: |
|
||||
echo "OTIO_LOCATION=${PWD}/otio-install" >> "$GITHUB_ENV"
|
||||
# With OTIO_FIND_IMATH=ON the system (brew/apt) Imath must be the
|
||||
# only Imath header set in play; drop any bundled headers a stale
|
||||
# cache entry may have brought back (they collide with the system
|
||||
# include guards and break ImathBox.h).
|
||||
rm -rf "${PWD}/otio-install/include/Imath"
|
||||
|
||||
- name: Build OpenTimelineIO (Unix)
|
||||
if: runner.os != 'Windows' && steps.otio-cache.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
git clone --depth 1 --branch v0.16.0 https://github.com/PixarAnimationStudios/OpenTimelineIO.git
|
||||
cmake -S OpenTimelineIO -B OpenTimelineIO/build -G Ninja \
|
||||
-DOTIO_SHARED_LIBS=ON \
|
||||
-DOTIO_PYTHON_BINDINGS=OFF \
|
||||
-DOTIO_FIND_IMATH=ON \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_INSTALL_PREFIX="${PWD}/otio-install"
|
||||
cmake --build OpenTimelineIO/build
|
||||
cmake --install OpenTimelineIO/build
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# Windows dependencies (MSYS2)
|
||||
# ------------------------------------------------------------------
|
||||
- name: Setup MSYS2
|
||||
- name: Setup MSYS2 (Windows)
|
||||
if: runner.os == 'Windows'
|
||||
uses: msys2/setup-msys2@v2
|
||||
with:
|
||||
msystem: UCRT64
|
||||
update: true
|
||||
cache: true
|
||||
install: >-
|
||||
git
|
||||
mingw-w64-ucrt-x86_64-cmake
|
||||
mingw-w64-ucrt-x86_64-ninja
|
||||
mingw-w64-ucrt-x86_64-gcc
|
||||
mingw-w64-ucrt-x86_64-qt6-base
|
||||
mingw-w64-ucrt-x86_64-qt6-tools
|
||||
mingw-w64-ucrt-x86_64-ffmpeg
|
||||
mingw-w64-ucrt-x86_64-openimageio
|
||||
mingw-w64-ucrt-x86_64-opencolorio
|
||||
mingw-w64-ucrt-x86_64-openexr
|
||||
mingw-w64-ucrt-x86_64-fmt
|
||||
mingw-w64-ucrt-x86_64-expat
|
||||
mingw-w64-ucrt-x86_64-portaudio
|
||||
mingw-w64-ucrt-x86_64-vulkan-headers
|
||||
mingw-w64-ucrt-x86_64-vulkan-loader
|
||||
mingw-w64-ucrt-x86_64-make
|
||||
mingw-w64-ucrt-x86_64-ccache
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# OpenTimelineIO (required dependency, built from source; cached).
|
||||
# Must come after Setup MSYS2 (uses the msys2 shell).
|
||||
# ------------------------------------------------------------------
|
||||
- name: Cache OpenTimelineIO (Windows)
|
||||
if: runner.os == 'Windows'
|
||||
id: otio-cache-win
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: otio-install
|
||||
key: otio-0.16.0-${{ runner.os }}-v2
|
||||
|
||||
- name: Set OTIO location (Windows)
|
||||
- name: Install system dependencies (Windows)
|
||||
if: runner.os == 'Windows'
|
||||
shell: msys2 {0}
|
||||
run: |
|
||||
echo "OTIO_LOCATION=${PWD}/otio-install" >> "$GITHUB_ENV"
|
||||
# No rpath on Windows: test executables need the OTIO DLLs on PATH.
|
||||
# OTIO's MinGW install puts the DLLs in lib/, not bin/.
|
||||
echo "$(cygpath -w "${PWD}/otio-install/lib")" >> "$GITHUB_PATH"
|
||||
|
||||
- name: Build OpenTimelineIO (Windows)
|
||||
if: runner.os == 'Windows' && steps.otio-cache-win.outputs.cache-hit != 'true'
|
||||
shell: msys2 {0}
|
||||
run: |
|
||||
git clone --depth 1 --branch v0.16.0 https://github.com/PixarAnimationStudios/OpenTimelineIO.git
|
||||
cmake -S OpenTimelineIO -B OpenTimelineIO/build -G Ninja \
|
||||
-DOTIO_SHARED_LIBS=ON \
|
||||
-DOTIO_PYTHON_BINDINGS=OFF \
|
||||
-DOTIO_FIND_IMATH=ON \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_INSTALL_PREFIX="${PWD}/otio-install"
|
||||
cmake --build OpenTimelineIO/build
|
||||
cmake --install OpenTimelineIO/build
|
||||
bash tooling/install-deps.sh
|
||||
pacman -S --needed --noconfirm mingw-w64-ucrt-x86_64-opencolorio
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# Compile cache (ccache) — restored before configure so the launcher
|
||||
# flags below pick it up on all three platforms
|
||||
# Build environment
|
||||
# ------------------------------------------------------------------
|
||||
- name: Restore ccache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ github.workspace }}/.ccache
|
||||
key: ccache-${{ runner.os }}-${{ github.ref_name }}-${{ github.sha }}
|
||||
restore-keys: |
|
||||
ccache-${{ runner.os }}-${{ github.ref_name }}-
|
||||
ccache-${{ runner.os }}-
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# Configure
|
||||
# ------------------------------------------------------------------
|
||||
- name: Configure (Linux)
|
||||
# ocio-sys builds a stub bridge unless these are set; the oakcommon
|
||||
# ocioutils tests need the real library (see crates/oakcommon/.cargo/
|
||||
# config.toml, which only applies to builds run from that directory).
|
||||
- name: Configure build environment (Linux)
|
||||
if: runner.os == 'Linux'
|
||||
run: |
|
||||
cmake -S . -B build -G Ninja \
|
||||
-DBUILD_TESTS=ON \
|
||||
-DBUILD_QT6=ON \
|
||||
-DOCIO_LOCATION=/usr \
|
||||
-DOTIO_LOCATION=${OTIO_LOCATION} \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
|
||||
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
|
||||
echo "OCIO_RS_ENABLE_REAL=1" >> "$GITHUB_ENV"
|
||||
echo "OCIO_INSTALL_DIR=/usr" >> "$GITHUB_ENV"
|
||||
echo "OCIO_RS_LINK=dynamic" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Configure (macOS)
|
||||
- name: Configure build environment (macOS)
|
||||
if: runner.os == 'macOS'
|
||||
run: |
|
||||
cmake -S . -B build -G Ninja \
|
||||
-DBUILD_TESTS=ON \
|
||||
-DBUILD_QT6=ON \
|
||||
-DOCIO_LOCATION=$(brew --prefix opencolorio) \
|
||||
-DOTIO_LOCATION=${OTIO_LOCATION} \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
|
||||
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
|
||||
echo "OCIO_RS_ENABLE_REAL=1" >> "$GITHUB_ENV"
|
||||
echo "OCIO_INSTALL_DIR=/opt/homebrew/opt/opencolorio" >> "$GITHUB_ENV"
|
||||
echo "OCIO_RS_LINK=dynamic" >> "$GITHUB_ENV"
|
||||
# Homebrew quirks: lame.pc / snappy / libopenjp2.pc live off the
|
||||
# default pkg-config search paths (see docs/build.md).
|
||||
echo "CFLAGS=-I/opt/homebrew/include" >> "$GITHUB_ENV"
|
||||
echo "LDFLAGS=-L/opt/homebrew/lib" >> "$GITHUB_ENV"
|
||||
echo "PKG_CONFIG_PATH=/opt/homebrew/lib/pkgconfig/openjpeg" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Configure (Windows)
|
||||
- name: Configure build environment (Windows)
|
||||
if: runner.os == 'Windows'
|
||||
shell: msys2 {0}
|
||||
run: |
|
||||
cmake -S . -B build -G Ninja \
|
||||
-DBUILD_TESTS=ON \
|
||||
-DBUILD_QT6=ON \
|
||||
-DOTIO_LOCATION=${OTIO_LOCATION} \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
|
||||
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
|
||||
echo "OCIO_RS_ENABLE_REAL=1" >> "$GITHUB_ENV"
|
||||
echo "OCIO_INSTALL_DIR=/ucrt64" >> "$GITHUB_ENV"
|
||||
echo "OCIO_RS_LINK=dynamic" >> "$GITHUB_ENV"
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# Build Oak
|
||||
# Caches
|
||||
# ------------------------------------------------------------------
|
||||
- name: Build
|
||||
# Covers the whole target/ dir plus ~/.cargo; shared across branches
|
||||
# of the same OS.
|
||||
- name: Cache cargo artifacts
|
||||
uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
shared-key: oak-workspace
|
||||
|
||||
# The project FFmpeg (release/8.0, static, all free codecs + hwaccel)
|
||||
# is built by tooling/ffmpeg/build-ffmpeg.sh — 10-20 min on a cold
|
||||
# cache. It does not depend on the Rust toolchain, so key it on the
|
||||
# script itself and keep it out of rust-cache.
|
||||
- name: Cache project FFmpeg
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: .cache/ffmpeg
|
||||
key: ffmpeg-${{ runner.os }}-${{ hashFiles('tooling/ffmpeg/build-ffmpeg.sh') }}
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# Project FFmpeg (script + FFMPEG_DIR; see docs/build.md)
|
||||
# ------------------------------------------------------------------
|
||||
- name: Build project FFmpeg (Linux/macOS)
|
||||
if: runner.os != 'Windows'
|
||||
run: |
|
||||
cmake --build build --config ${{ env.CMAKE_BUILD_TYPE }}
|
||||
ccache -s
|
||||
tooling/ffmpeg/build-ffmpeg.sh
|
||||
echo "FFMPEG_DIR=$PWD/.cache/ffmpeg" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Build project FFmpeg (Windows)
|
||||
if: runner.os == 'Windows'
|
||||
shell: msys2 {0}
|
||||
run: |
|
||||
bash tooling/ffmpeg/build-ffmpeg.sh
|
||||
echo "FFMPEG_DIR=$(cygpath -m "$PWD/.cache/ffmpeg")" >> "$GITHUB_ENV"
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# Build & test
|
||||
# ------------------------------------------------------------------
|
||||
- name: Build (Linux)
|
||||
if: runner.os == 'Linux'
|
||||
run: cargo build --workspace --locked
|
||||
|
||||
- name: Build (macOS)
|
||||
if: runner.os == 'macOS'
|
||||
run: cargo build --workspace --locked
|
||||
|
||||
- name: Build (Windows)
|
||||
if: runner.os == 'Windows'
|
||||
shell: msys2 {0}
|
||||
run: |
|
||||
cmake --build build --config ${{ env.CMAKE_BUILD_TYPE }}
|
||||
ccache -s
|
||||
run: cargo build --workspace --locked
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# Clone and build OpenFX-Misc plugins (used by OFX integration tests)
|
||||
# ------------------------------------------------------------------
|
||||
- name: Clone OpenFX-Misc
|
||||
run: git clone --recursive --depth 1 https://github.com/NatronGitHub/openfx-misc.git
|
||||
|
||||
- name: Build OpenFX-Misc plugins (Unix)
|
||||
if: runner.os != 'Windows'
|
||||
run: |
|
||||
cd openfx-misc
|
||||
make -j"$(nproc)"
|
||||
sudo make install
|
||||
PLUGIN_FILE=$(find /usr/OFX/Plugins /usr/local/OFX/Plugins . -name "*.ofx.bundle" -print -quit 2>/dev/null | head -1)
|
||||
if [ -n "$PLUGIN_FILE" ]; then
|
||||
PLUGIN_DIR=$(dirname "$PLUGIN_FILE")
|
||||
else
|
||||
PLUGIN_DIR="$PWD"
|
||||
fi
|
||||
echo "OAK_OFX_ITEST=1" >> "$GITHUB_ENV"
|
||||
echo "OAK_OFX_PLUGIN_PATH=$PLUGIN_DIR" >> "$GITHUB_ENV"
|
||||
echo "OAK_OFX_PLUGIN_ID=net.sf.openfx.ChromaKeyerPlugin" >> "$GITHUB_ENV"
|
||||
|
||||
# The Windows runners have no GPU: WGL falls back to the GDI software
|
||||
# OpenGL 1.1 implementation and every render worker dies calling 3.2
|
||||
# core entry points. Drop Mesa's llvmpipe opengl32.dll next to every
|
||||
# binary that creates a GL context (the application directory wins the
|
||||
# DLL search order over System32).
|
||||
- name: Install Mesa software OpenGL (Windows)
|
||||
if: runner.os == 'Windows'
|
||||
shell: msys2 {0}
|
||||
run: |
|
||||
curl -sSL -o /tmp/mesa.7z \
|
||||
https://github.com/pal1000/mesa-dist-win/releases/download/26.1.5/mesa3d-26.1.5-release-mingw.7z
|
||||
"/c/Program Files/7-Zip/7z.exe" x /tmp/mesa.7z -o/tmp/mesa > /dev/null
|
||||
ls -la /tmp/mesa /tmp/mesa/x64
|
||||
for d in build/engine build/worker build/cli build/tests/gtest build/app; do
|
||||
if [ -d "$d" ]; then
|
||||
cp /tmp/mesa/x64/*.dll "$d/"
|
||||
# Qt ignores an app-local opengl32.dll for WGL (it always binds
|
||||
# the System32 one); its documented software-GL override is
|
||||
# opengl32sw.dll, loaded when QT_OPENGL=software.
|
||||
cp "$d/opengl32.dll" "$d/opengl32sw.dll"
|
||||
ls "$d"/opengl32sw.dll "$d"/libgallium_wgl.dll
|
||||
fi
|
||||
done
|
||||
echo "QT_OPENGL=software" >> "$GITHUB_ENV"
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# Run all tests (including previously environment-gated OFX tests)
|
||||
# ------------------------------------------------------------------
|
||||
# xvfb + 24-bit screen: the gpui #[gpui::test] tests open real windows
|
||||
# and render through wgpu on Mesa's software Vulkan (lavapipe).
|
||||
- name: Test (Linux)
|
||||
if: runner.os == 'Linux'
|
||||
env:
|
||||
QT_QPA_PLATFORM: offscreen
|
||||
run: xvfb-run -a ctest --test-dir build --output-on-failure -C ${{ env.CMAKE_BUILD_TYPE }}
|
||||
|
||||
# Diagnostic: if the Linux test run failed, re-run the suspect gtest
|
||||
# filter under gdb to capture a native backtrace of the segfault.
|
||||
# Also break on dlclose to see who unloads the render backend library
|
||||
# before RenderManager's destructor calls into it.
|
||||
- name: gtest segfault backtrace (Linux)
|
||||
if: runner.os == 'Linux' && failure()
|
||||
env:
|
||||
QT_QPA_PLATFORM: offscreen
|
||||
run: |
|
||||
sudo apt-get update && sudo apt-get install -y gdb
|
||||
xvfb-run -a gdb -batch \
|
||||
-ex run \
|
||||
-ex 'bt full' \
|
||||
-ex 'info proc mappings' \
|
||||
-ex 'info symbol $pc' \
|
||||
--args ./build/tests/gtest/olive-gtest \
|
||||
--gtest_filter='MainWindow.ConstructsOffscreenWithPanelsAndMenus' || true
|
||||
run: xvfb-run -a -s "-screen 0 1920x1080x24" cargo test --workspace --locked
|
||||
|
||||
- name: Test (macOS)
|
||||
if: runner.os == 'macOS'
|
||||
run: ctest --test-dir build --output-on-failure -C ${{ env.CMAKE_BUILD_TYPE }}
|
||||
run: cargo test --workspace --locked
|
||||
|
||||
- name: Test (Windows)
|
||||
if: runner.os == 'Windows'
|
||||
shell: msys2 {0}
|
||||
run: ctest --test-dir build --output-on-failure -C ${{ env.CMAKE_BUILD_TYPE }}
|
||||
|
||||
# Diagnostic: if the Windows test run failed, show which DLLs the
|
||||
# engine test executables cannot resolve (0xc0000135).
|
||||
- name: Missing DLL diagnosis (Windows)
|
||||
if: runner.os == 'Windows' && failure()
|
||||
shell: msys2 {0}
|
||||
run: |
|
||||
echo "PATH=$PATH"
|
||||
ldd build/engine/oakengine_ipc_test.exe | grep -i "not found" || true
|
||||
objdump -p build/engine/oakengine_ipc_test.exe | grep "DLL Name" | sort -u
|
||||
ls otio-install/lib otio-install/bin 2>/dev/null || true
|
||||
echo "=== render worker stderr logs ==="
|
||||
for f in "$TEMP"/oak-render-worker-*.stderr.log "$TMP"/oak-render-worker-*.stderr.log /tmp/oak-render-worker-*.stderr.log; do
|
||||
[ -f "$f" ] && { echo "--- $f"; tail -50 "$f"; }
|
||||
done
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# Filtered gtest runs for clearer CI output
|
||||
# ------------------------------------------------------------------
|
||||
- name: Plugin Smoke Tests (Linux)
|
||||
if: runner.os == 'Linux'
|
||||
env:
|
||||
QT_QPA_PLATFORM: offscreen
|
||||
run: xvfb-run -a ./build/tests/gtest/olive-gtest --gtest_filter="PluginSmoke*"
|
||||
|
||||
- name: Plugin Smoke Tests (macOS)
|
||||
if: runner.os == 'macOS'
|
||||
run: ./build/tests/gtest/olive-gtest --gtest_filter="PluginSmoke*"
|
||||
|
||||
- name: Plugin Smoke Tests (Windows)
|
||||
if: runner.os == 'Windows'
|
||||
shell: msys2 {0}
|
||||
run: ./build/tests/gtest/olive-gtest --gtest_filter="PluginSmoke*"
|
||||
|
||||
- name: OFX Integration Tests (Linux)
|
||||
if: runner.os == 'Linux'
|
||||
env:
|
||||
QT_QPA_PLATFORM: offscreen
|
||||
run: xvfb-run -a ./build/tests/gtest/olive-gtest --gtest_filter="PluginIntegration.*:PluginMisc.*"
|
||||
|
||||
- name: OFX Integration Tests (macOS)
|
||||
if: runner.os == 'macOS'
|
||||
run: ./build/tests/gtest/olive-gtest --gtest_filter="PluginIntegration.*:PluginMisc.*"
|
||||
|
||||
- name: Audio Smoke Tests (Linux)
|
||||
if: runner.os == 'Linux'
|
||||
env:
|
||||
QT_QPA_PLATFORM: offscreen
|
||||
run: xvfb-run -a ./build/tests/gtest/olive-gtest --gtest_filter="AudioSmoke*"
|
||||
|
||||
- name: Audio Smoke Tests (macOS)
|
||||
if: runner.os == 'macOS'
|
||||
run: ./build/tests/gtest/olive-gtest --gtest_filter="AudioSmoke*"
|
||||
|
||||
- name: Audio Smoke Tests (Windows)
|
||||
if: runner.os == 'Windows'
|
||||
shell: msys2 {0}
|
||||
run: ./build/tests/gtest/olive-gtest --gtest_filter="AudioSmoke*"
|
||||
|
||||
- name: Viewer Smoke Tests (Linux)
|
||||
if: runner.os == 'Linux'
|
||||
env:
|
||||
QT_QPA_PLATFORM: offscreen
|
||||
run: xvfb-run -a ./build/tests/gtest/olive-gtest --gtest_filter="ViewerSmoke*"
|
||||
|
||||
- name: Viewer Smoke Tests (macOS)
|
||||
if: runner.os == 'macOS'
|
||||
run: ./build/tests/gtest/olive-gtest --gtest_filter="ViewerSmoke*"
|
||||
|
||||
- name: Viewer Smoke Tests (Windows)
|
||||
if: runner.os == 'Windows'
|
||||
shell: msys2 {0}
|
||||
run: ./build/tests/gtest/olive-gtest --gtest_filter="ViewerSmoke*"
|
||||
run: cargo test --workspace --locked
|
||||
|
||||
+32
@@ -110,3 +110,35 @@ gpui_platform = { path = "gpui/crates/gpui_platform", features = ["test-support"
|
||||
# Screenshot capture: `examples/screenshot.rs` saves the rendered window PNG
|
||||
# (the `image` crate is already in the lockfile through gpui).
|
||||
image = "0.25"
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# cargo-packager metadata (the CD workflow, .github/workflows/cd.yml, packages
|
||||
# the release binaries with `cargo packager`; the schema lives at
|
||||
# https://docs.crabnebula.dev/packager/configuration/).
|
||||
#
|
||||
# Binaries are resolved relative to `target/<profile>` (oak-editor is the
|
||||
# main binary; oak-cli / oak-worker are bundled alongside). They must exist
|
||||
# before packaging runs — `cargo packager` does NOT build the app itself, so
|
||||
# CD builds with `cargo build --release` first.
|
||||
#
|
||||
# `icons/icon.png` is NOT committed: it is generated from `Oak_Icon.svg`
|
||||
# (rsvg-convert) in CD right before packaging, because cargo-packager needs a
|
||||
# bitmap (it converts a square PNG into .icns / .ico / hicolor PNGs itself).
|
||||
# Keep the path here in sync with the CD workflow.
|
||||
# ---------------------------------------------------------------------------
|
||||
[package.metadata.packager]
|
||||
name = "oak"
|
||||
productName = "Oak"
|
||||
identifier = "org.oakvideoeditor.Oak"
|
||||
description = "Oak Video Editor"
|
||||
longDescription = "Oak Video Editor: a free, open-source non-linear video editor written in Rust."
|
||||
authors = ["Oak Team"]
|
||||
copyright = "Copyright (C) 2026 Oak Team"
|
||||
licenseFile = "LICENSE"
|
||||
category = "Video"
|
||||
icons = ["icons/icon.png"]
|
||||
binaries = [
|
||||
{ path = "oak-editor", main = true },
|
||||
{ path = "oak-cli", main = false },
|
||||
{ path = "oak-worker", main = false },
|
||||
]
|
||||
|
||||
@@ -32,28 +32,25 @@
|
||||
//! * `target/<profile>/liboakengine.dylib` — when built as a workspace
|
||||
//! member (`cargo build -p oakengine`).
|
||||
//!
|
||||
//! Both copies carry the same Mach-O install name pointing back into
|
||||
//! `target/<profile>/deps/`, so dyld finds the dylib by that absolute path
|
||||
//! at load time; the `-rpath` flag covers configurations where the install
|
||||
//! name is `@rpath`-relative instead.
|
||||
//! macOS: the dylib carries a Mach-O install name pointing back into
|
||||
//! `target/<profile>/deps/`, so dyld finds it by that absolute path at
|
||||
//! load time; the `-rpath` flag covers `@rpath`-relative configurations.
|
||||
//!
|
||||
//! # Host symbols (`-export_dynamic`)
|
||||
//! Linux: undefined symbols in a `.so` need no link-time flag; the app's
|
||||
//! own link only needs the search path plus `-Wl,--export-dynamic` (the
|
||||
//! ELF equivalent of `-export_dynamic`) so the host symbols resolve from
|
||||
//! the binary at runtime. An `$ORIGIN`-relative rpath lets a packaged
|
||||
//! binary find a sibling `liboakengine.so`.
|
||||
//!
|
||||
//! The dylib is linked with `-Wl,-undefined,dynamic_lookup` (see
|
||||
//! crates/oakengine/build.rs), so its remaining undefined imports — the
|
||||
//! C++ host symbols `oakcore_audioparams_*`, `oakcore_rational_*` and
|
||||
//! `fb_*` that [`host_syms`](crate::oakui::host_syms) provides — are
|
||||
//! resolved at runtime from the app binary. `-Wl,-export_dynamic` makes
|
||||
//! the binary's own symbols visible to dyld for that resolution.
|
||||
//!
|
||||
//! macOS-specific: this is the only platform the app targets (the dylib
|
||||
//! mechanism is a Mach-O feature); on any other target the script does
|
||||
//! nothing.
|
||||
//! Windows: NOT SUPPORTED YET — a DLL cannot carry the undefined
|
||||
//! `oakcore_*` imports (they need a stub import library or delay-load
|
||||
//! plumbing that does not exist yet), so the app does not link there.
|
||||
|
||||
use std::path::PathBuf;
|
||||
|
||||
fn main() {
|
||||
if std::env::var("CARGO_CFG_TARGET_OS").as_deref() != Ok("macos") {
|
||||
let os = std::env::var("CARGO_CFG_TARGET_OS").unwrap_or_default();
|
||||
if os != "macos" && os != "linux" {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -63,52 +60,67 @@ fn main() {
|
||||
let profile = std::env::var("PROFILE").unwrap_or_else(|_| "debug".to_string());
|
||||
let profile_dir = target_dir.join(&profile);
|
||||
let deps_dir = profile_dir.join("deps");
|
||||
let dylib = if os == "macos" { "liboakengine.dylib" } else { "liboakengine.so" };
|
||||
|
||||
// The un-hashed dependency artifact is the normal case; the
|
||||
// workspace-member copy is the fallback. If only the hashed artifact
|
||||
// exists (liboakengine-<hash>.dylib), link it by full path.
|
||||
if deps_dir.join("liboakengine.dylib").exists() {
|
||||
link_search(&deps_dir);
|
||||
} else if profile_dir.join("liboakengine.dylib").exists() {
|
||||
link_search(&profile_dir);
|
||||
} else if let Some(hashed) = find_hashed_dylib(&deps_dir) {
|
||||
// exists (liboakengine-<hash>.so), link it by full path.
|
||||
if deps_dir.join(dylib).exists() {
|
||||
link_search(&deps_dir, os == "macos");
|
||||
} else if profile_dir.join(dylib).exists() {
|
||||
link_search(&profile_dir, os == "macos");
|
||||
} else if let Some(hashed) = find_hashed_dylib(&deps_dir, os == "macos") {
|
||||
println!("cargo:rustc-link-arg={}", hashed.display());
|
||||
println!("cargo:rustc-link-arg=-Wl,-rpath,{}", deps_dir.display());
|
||||
println!("cargo:rustc-link-arg=-Wl,-export_dynamic");
|
||||
rpath_and_export(&deps_dir, os == "macos");
|
||||
} else {
|
||||
panic!(
|
||||
"liboakengine.dylib not found under {}: build the workspace from the repo root \
|
||||
"{dylib} not found under {}: build the workspace from the repo root \
|
||||
(cargo build -p oakengine) so the liboakengine cdylib is produced before the app links",
|
||||
profile_dir.display()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Emits the link-search path plus `-loakengine`, the runtime `-rpath` and
|
||||
/// Emits the link-search path plus `-loakengine`, the runtime rpath and
|
||||
/// the host-symbol export flag (see the module docs).
|
||||
fn link_search(dir: &std::path::Path) {
|
||||
fn link_search(dir: &std::path::Path, macos: bool) {
|
||||
println!("cargo:rustc-link-search=native={}", dir.display());
|
||||
println!("cargo:rustc-link-lib=dylib=oakengine");
|
||||
println!("cargo:rustc-link-arg=-Wl,-rpath,{}", dir.display());
|
||||
println!("cargo:rustc-link-arg=-Wl,-export_dynamic");
|
||||
// gpui_macos reaches the IOSurface API through the `core-video` crate,
|
||||
// which depends on `io-surface` with `default-features = false` — that
|
||||
// disables io-surface's `link` feature, so nothing adds the
|
||||
// IOSurface.framework to the final link and the binary fails with
|
||||
// undefined `_IOSurface*` symbols. The app's build script is the
|
||||
// single place that configures the macOS link, so link the framework
|
||||
// here.
|
||||
println!("cargo:rustc-link-lib=framework=IOSurface");
|
||||
rpath_and_export(dir, macos);
|
||||
if macos {
|
||||
// gpui_macos reaches the IOSurface API through the `core-video`
|
||||
// crate, which depends on `io-surface` with `default-features =
|
||||
// false` — that disables io-surface's `link` feature, so nothing
|
||||
// adds the IOSurface.framework to the final link and the binary
|
||||
// fails with undefined `_IOSurface*` symbols. The app's build
|
||||
// script is the single place that configures the macOS link, so
|
||||
// link the framework here.
|
||||
println!("cargo:rustc-link-lib=framework=IOSurface");
|
||||
}
|
||||
}
|
||||
|
||||
/// Finds `liboakengine-<hash>.dylib` in `deps/` (some cargo configurations
|
||||
/// name dependency cdylibs with a hash suffix).
|
||||
fn find_hashed_dylib(deps_dir: &std::path::Path) -> Option<PathBuf> {
|
||||
/// The rpath (absolute deps dir + `$ORIGIN` on Linux) and the flag that
|
||||
/// exports the binary's own symbols for the dylib's runtime lookups.
|
||||
fn rpath_and_export(dir: &std::path::Path, macos: bool) {
|
||||
if macos {
|
||||
println!("cargo:rustc-link-arg=-Wl,-rpath,{}", dir.display());
|
||||
println!("cargo:rustc-link-arg=-Wl,-export_dynamic");
|
||||
} else {
|
||||
println!("cargo:rustc-link-arg=-Wl,-rpath,{}", dir.display());
|
||||
println!("cargo:rustc-link-arg=-Wl,-rpath,$ORIGIN");
|
||||
println!("cargo:rustc-link-arg=-Wl,--export-dynamic");
|
||||
}
|
||||
}
|
||||
|
||||
/// Finds `liboakengine-<hash>.{dylib,so}` in `deps/` (some cargo
|
||||
/// configurations name dependency cdylibs with a hash suffix).
|
||||
fn find_hashed_dylib(deps_dir: &std::path::Path, macos: bool) -> Option<PathBuf> {
|
||||
let suffix = if macos { ".dylib" } else { ".so" };
|
||||
let entries = std::fs::read_dir(deps_dir).ok()?;
|
||||
for entry in entries.flatten() {
|
||||
let name = entry.file_name();
|
||||
let name = name.to_string_lossy();
|
||||
if name.starts_with("liboakengine-") && name.ends_with(".dylib") {
|
||||
if name.starts_with("liboakengine-") && name.ends_with(suffix) {
|
||||
return Some(entry.path());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user