Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
229 changes: 229 additions & 0 deletions .github/workflows/build-angle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,229 @@
name: Build ANGLE
run-name: Build ANGLE
on:
pull_request:
paths:
- '.github/workflows/build-angle.yml'
- 'build-angle.py'
- 'tests/test-angle.cpp'
workflow_dispatch:
inputs:
angle_revision:
description: 'ANGLE git revision to build'
required: false
type: string
default: '107da744f62a319b3c6851694740d9ebf247d048'
release_suffix:
description: 'Build suffix for the release tag. Defaults to the run number.'
required: false
type: string
default: ''
skip_release:
description: 'Skip creating release'
required: false
type: boolean
default: false

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

env:
ANGLE_REVISION: ${{ inputs.angle_revision || '107da744f62a319b3c6851694740d9ebf247d048' }}

jobs:
build-angle:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-24.04
platform: linux
arch: x64
- os: ubuntu-24.04
platform: linux
arch: arm64
- os: macos-15
platform: mac
arch: arm64
- os: macos-15
platform: mac
arch: x64

runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: Install Linux build dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y \
libdrm-dev \
libgbm-dev \
libwayland-dev \
libwayland-egl-backend-dev \
libx11-dev \
libx11-xcb-dev \
libxcb1-dev \
libxext-dev \
libxfixes-dev \
libxi-dev \
libxrandr-dev \
mesa-vulkan-drivers \
pkg-config

- name: Set up arm64 emulation
if: matrix.platform == 'linux' && matrix.arch == 'arm64'
uses: docker/setup-qemu-action@v3
with:
platforms: arm64

- name: Set up Rosetta
if: matrix.platform == 'mac' && matrix.arch == 'x64'
run: sudo softwareupdate --install-rosetta --agree-to-license

- name: Build ANGLE
run: |
python3 build-angle.py ${{ matrix.platform }} \
-archs "${{ matrix.arch }}" \
-revision "$ANGLE_REVISION" \
-out build

- name: Validate ANGLE runtime
shell: bash
run: |
package_dir="build/angle-${{ matrix.platform }}-${{ matrix.arch }}"
test_binary="build/test-angle-${{ matrix.platform }}-${{ matrix.arch }}"

if [[ "$RUNNER_OS" == "Linux" && "${{ matrix.arch }}" == "arm64" ]]; then
docker run --rm --platform linux/arm64 \
-v "$PWD:/workspace" -w /workspace ubuntu:24.04 bash -c '
set -euo pipefail
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install -y g++ libxcb1 mesa-vulkan-drivers
package_dir="build/angle-linux-arm64"
test_binary="build/test-angle-linux-arm64"
c++ -std=c++17 \
-I"$package_dir/include" \
tests/test-angle.cpp \
-L"$package_dir/lib" \
-lEGL -lGLESv2 \
-o "$test_binary"
icd_path=$(find /usr/share/vulkan/icd.d \
-name "lvp_icd*.json" -print -quit)
test -n "$icd_path"
VK_ICD_FILENAMES="$icd_path" \
LD_LIBRARY_PATH="$package_dir/lib" \
"$test_binary"
'
else
compile_options=()
link_options=()
if [[ "$RUNNER_OS" == "macOS" ]]; then
link_options+=(
"-Wl,-rpath,@executable_path/angle-${{ matrix.platform }}-${{ matrix.arch }}/lib"
)
if [[ "${{ matrix.arch }}" == "x64" ]]; then
compile_options+=("-arch" "x86_64")
fi
fi
c++ -std=c++17 \
"${compile_options[@]}" \
-I"$package_dir/include" \
tests/test-angle.cpp \
-L"$package_dir/lib" \
"${link_options[@]}" \
-lEGL -lGLESv2 \
-o "$test_binary"

if [[ "$RUNNER_OS" == "Linux" ]]; then
icd_path=$(find /usr/share/vulkan/icd.d \
-name 'lvp_icd*.json' -print -quit)
test -n "$icd_path"
VK_ICD_FILENAMES="$icd_path" \
LD_LIBRARY_PATH="$package_dir/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" \
"$test_binary"
else
otool -D "$package_dir/lib/libEGL.dylib" | \
grep -Fxq '@rpath/libEGL.dylib'
otool -D "$package_dir/lib/libGLESv2.dylib" | \
grep -Fxq '@rpath/libGLESv2.dylib'
codesign --verify --strict "$package_dir/lib/libEGL.dylib"
codesign --verify --strict "$package_dir/lib/libGLESv2.dylib"
if [[ "${{ matrix.arch }}" == "x64" ]]; then
arch -x86_64 "$test_binary"
else
"$test_binary"
fi
fi
fi

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: angle-${{ matrix.platform }}-${{ matrix.arch }}
path: build/angle-${{ matrix.platform }}-${{ matrix.arch }}/

create-release:
needs: build-angle
if: ${{ github.event_name == 'workflow_dispatch' && !inputs.skip_release }}
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: downloaded_artifacts

- name: Package release
run: |
mkdir -p release
for dir in downloaded_artifacts/*/; do
name=$(basename "$dir")
(cd "$dir" && zip -r "../../release/${name}.zip" .)
done

- name: Resolve release metadata
id: metadata
shell: bash
run: |
echo "revision_short=${ANGLE_REVISION:0:12}" >> "$GITHUB_OUTPUT"

- name: Create release
uses: softprops/action-gh-release@v2
with:
tag_name: angle-${{ steps.metadata.outputs.revision_short }}-${{ inputs.release_suffix || github.run_number }}
name: ANGLE ${{ steps.metadata.outputs.revision_short }} Build ${{ inputs.release_suffix || github.run_number }}
body: |
Automated ANGLE shared runtime builds for MystralNative WebGL 2.

**Revision:** `${{ env.ANGLE_REVISION }}`

## Platforms
- Linux x64 and arm64: Vulkan backend with X11 and Wayland support
- macOS arm64 and x64: Metal backend

## Package layout
- `include/EGL`, `include/GLES2`, `include/GLES3`, `include/KHR`
- `lib/libEGL.so` and `lib/libGLESv2.so` on Linux
- `lib/libEGL.dylib` and `lib/libGLESv2.dylib` on macOS
- `LICENSE.angle` and `ANGLE_REVISION`

## Runtime requirements
- Linux: system Vulkan loader, Vulkan driver, and XCB runtime; Wayland runtime for Wayland presentation
- macOS: Metal-capable macOS host
files: release/*.zip
draft: false
prerelease: false
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ example/build-*
monitor_build.py
third_party/swc-static/target/

# Python bytecode
__pycache__/

# Test binaries and outputs
tests/test_moshi
tests/*.wav
4 changes: 2 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ This file describes how AI coding agents can effectively work with this reposito

## Repository Context

This is a **build automation repository** for cross-platform static libraries. The primary artifacts are:
- Pre-built libraries (`.a`, `.lib` files)
This is a **build automation repository** for cross-platform native libraries. The primary artifacts are:
- Pre-built static and shared libraries (`.a`, `.lib`, `.so`, `.dylib` files)
- Headers
- GitHub Actions workflows for CI/CD

Expand Down
3 changes: 3 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ This repository (mystralengine/library-builder) provides Python scripts and GitH
| `build-swc.py` | Build SWC TypeScript compiler | macOS (arm64, x86_64), Linux, Windows |
| `build-moshi.py` | Build Moshi/Mimi speech AI codec | macOS (arm64, Metal), Linux (x64), Windows (x64) |
| `build-quiche.py` | Build quiche (QUIC + HTTP/3) for WebTransport | macOS (arm64, x86_64), Linux (x64), Windows (x64), iOS (device + sim), Android (arm64/armv7/x64) |
| `build-angle.py` | Build ANGLE EGL/OpenGL ES shared runtimes | macOS (arm64, x86_64), Linux (x64, arm64) |

## Build Commands

Expand All @@ -41,6 +42,8 @@ python3 build-skia.py win # Windows x64 (static CRT)
python3 build-skia.py linux # Linux x64
python3 build-skia.py wasm # WebAssembly
python3 build-skia.py xcframework # Apple XCFramework (macOS + iOS)
python3 build-angle.py linux -archs x64 # ANGLE Vulkan runtime
python3 build-angle.py mac -archs arm64 # ANGLE Metal runtime

# Options
python3 build-skia.py <platform> -config Debug # Debug build (default: Release)
Expand Down
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Mystral Engine Library Builder

This repository provides automated builds of static libraries for [Mystral Engine](https://github.com/mystralengine) dependencies.
This repository provides automated builds of native libraries for [Mystral Engine](https://github.com/mystralengine) dependencies.

**Currently supported:**
- [Skia](https://skia.org/) - 2D graphics library with Dawn/Graphite support
Expand All @@ -9,10 +9,10 @@ This repository provides automated builds of static libraries for [Mystral Engin
- [libuv](https://libuv.org/) - Async I/O event loop (non-blocking network, file, timers).
- [Draco](https://github.com/google/draco) - Mesh compression (native glTF Draco decoding).
- [quiche](https://github.com/cloudflare/quiche) - QUIC + HTTP/3, the native backend for the WebTransport API. Built with the `ffi` feature plus a small patch exposing WebTransport SETTINGS; bundles BoringSSL.
- [ANGLE](https://chromium.googlesource.com/angle/angle) - EGL and OpenGL ES shared runtimes for WebGL 2. Linux packages use Vulkan with X11 and Wayland; macOS packages use Metal.

**Planned:**
- V8 - JavaScript engine. Currently using older build from https://github.com/kuoruan/libv8
- ANGLE - OpenGL ES to other backends - no good cross platform solution yet (individual repos w/ Windows & Linux builds, but no cross platform support).

**Dependencies with existing prebuilt libraries**
- Dawn - https://github.com/google/dawn/releases - Google / Chrome's WebGPU implementation. Note however that this doesn't have iOS releases, while the Skia build above does have a Dawn iOS release associated.
Expand Down Expand Up @@ -61,8 +61,14 @@ python3 build-skia.py win -crt dynamic # Windows x64 (dynamic CRT)
python3 build-skia.py linux # Linux x64
python3 build-skia.py wasm # WebAssembly
python3 build-skia.py xcframework # Apple XCFramework

# Build ANGLE WebGL 2 runtimes (must run on the target operating system)
python3 build-angle.py linux -archs x64 # Vulkan, X11, and Wayland
python3 build-angle.py mac -archs arm64 # Metal
```

ANGLE packages are written to `build/angle-<platform>-<architecture>`. Linux runtimes use the host's Vulkan loader, Vulkan driver, and XCB runtime; Wayland presentation additionally uses the system Wayland runtime libraries. macOS libraries use relocatable `@rpath` install names and are ad-hoc signed after packaging. The macOS x64 package is cross-built on Apple Silicon and render-tested under Rosetta because GitHub's Intel runner does not expose Metal. The ANGLE workflow builds each package and verifies a headless triangle render with pixel readback before publishing it.

### Options

```bash
Expand Down
Loading
Loading