Skip to content

About

CEF prebuilt distribution

Topics

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Patched CEF for IronRDP

This repository holds ordered patches and build automation, not a CEF fork. GitHub Actions builds pinned upstream CEF/Chromium with the IronRDP patches on free GitHub-hosted runners and publishes the unmodified CEF --minimal distributions as GitHub releases for a cef-rs fork to consume.

CI verifies patch identity, pinned checkouts and the patched libcef exports. Before publishing, it also loads each library on a native runner and checks the disabled-clipboard getters without initializing CEF. It does not run IronRDP's native tests. Only the upstream IronRDP custom build on macOS ARM64 has been validated at runtime; run those tests (e2e.py, clipboard.py, devices.py, shutdown.py) before relying on any other platform.

Pins and provenance

pins.json records the immutable CEF, Chromium, depot_tools, cef-rs and IronRDP revisions, plus the Git blob of CEF's automate-git.py. It is the source of truth, and the update workflow advances it along the CEF branch:

  • cef_branch, cef_commit and cef_version: the CEF release branch (8078, the 156 milestone) and the release on it.
  • chromium_tag and chromium_commit, checked against CEF's CHROMIUM_BUILD_COMPATIBILITY.txt, and depot_tools_commit from the same file.
  • cef_rs_commit: the cef-rs revision whose exporter the release smoke test uses.
  • ironrdp_commit: the IronRDP revision the patches come from.

The five unchanged patches come from IronRDP ironrdp-browser server/cef/patches at 64168d20. IronRDP's browser e2e suites gate every release (see below), from the revision in ironrdp-tests.json; it is not a build pin, so it can move without changing the manifests of builds already made. IronRDP is licensed under MIT or Apache-2.0; both license texts are included. scripts/candidate.ps1 verifies their Git blob identities; update those deliberately when changing patches.

Order Tree Patch
1 CEF isolated-clipboard.patch
2 CEF remote-devices-cef.patch
3 Chromium remote-devices-chromium.patch
4 Chromium in-process-audio-shutdown.patch
5 Chromium, POSIX only disable-chromium-shutdown-signals.patch

pwsh scripts/check-patches.ps1 (run by the Check workflow) fetches only the touched pinned upstream files and applies all patches in order.

Building in GitHub Actions

Dispatch Build patched CEF (build.yml) on master. Inputs:

  • linux, windows, macos and x64, arm64: the platforms and architectures to build, all ticked by default; every ticked platform builds for every ticked architecture (untick macos to build Linux and Windows only, or x64 to build arm64 only). From the command line, pass for example -f macos=false.
  • publish: create one release when every requested target succeeds.
  • runners: where to build (scripts/runners.ps1).
    • github_free (default): the GitHub free tier's hosted runners (ubuntu-24.04, windows-2025, macos-26).
    • github_large: the Devolutions org's larger GitHub-hosted runners that RDM uses (ubuntu-latest-16-cores, windows-latest-16-cores, macos-26-xlarge), billed per minute and still held to six-hour jobs.
    • warpbuild_8x, warpbuild_16x, warpbuild_32x: Linux and Windows build on the 8, 16 or 32 vCPU x64 runners of the Devolutions warpbuild runner group: warp-ubuntu-latest-x64-<n>x (Ubuntu 24.04) as RDM uses, and warp-windows-2025-x64-<n>x (Windows Server 2025 with Visual Studio 2022, matching the hosted windows-2025); the arm64 targets cross-compile there too. Both macOS targets build on WarpBuild's Apple Silicon warp-macos-26-arm64-12x (12 vCPU, 28 GB) whatever the size, since the 6x has too little disk for a CEF tree. Saved trees record their absolute path and resume only at that path, so a seed saved on other runners whose tree path differs falls back to a fresh sync.
  • stage-minutes: build time per stage; empty (the default) for 280 on GitHub-hosted runners and 600 on WarpBuild, whose jobs are not held to six hours, so most targets finish in one stage (lower only to test resumption). A WarpBuild stage job times out 90 minutes after its build time, a hosted one at 355 minutes. GitHub-hosted macOS stages build at most 150 minutes, because hosted macOS runners start failing file I/O and crashing from about three hours into a job (as early as 2h58m), well inside the six-hour job limit; such a stage ends by about 2h45m.
  • resume-run: an earlier run ID; a target whose run has saved no tree yet restores that run's newest saved tree instead of syncing (use after a run ends without a candidate). A finished build whose distribution step fails also saves its tree, so resuming it retries only the distribution. Trees must have matching host-architecture metadata; older trees without it and Intel macOS trees cannot resume on Apple Silicon.
  • incremental: update the previous build's finished tree in place instead of syncing from scratch (default on; see below).

A Chromium build takes far longer than the 6-hour hosted job limit, so each target runs as a chain of resumable stages generated by scripts/stages.ps1 into build-target.yml (regenerate with pwsh scripts/stages.ps1):

  1. Stage 1 clones depot_tools at its pin and bootstraps it, runs the pinned automate-git.py --no-build --no-distrib (verified by blob hash) without Chromium history, verifies all three checkouts, applies the patches, then runs CEF's gclient_hook.py so CEF's own patches and gn gen follow ours.
  2. Every stage runs ninja (cefclient on macOS, cefclient, bootstrap and bootstrapc on Windows, cefsimple and chrome_sandbox on Linux, where the sysroot build has no GTK for cefclient) until its deadline, then stops it gracefully so its log stays consistent. Ninja runs its default of CPUs + 2 jobs. On the free hosted runners it also runs at most one job per 2 GiB of memory, for the 7 GB macOS runner: 3 jobs there, 6 on Linux and Windows (set CEF_NINJA_JOBS to override). Memory and swap use are logged every 10 minutes while ninja runs.
  3. Unfinished stages save the whole tree as split tar+zstd artifacts that preserve nanosecond mtimes (scripts/tree.ps1; on Windows it streams with .NET TarWriter/TarReader because the system bsdtar crashes on Chromium trees); the next stage restores them at the same absolute path and ninja resumes. Saving records each part's SHA-256 in tree.sha256 and decodes the stored parts, packing once more if they are corrupt; restoring checks those hashes before extracting anything. On macOS a pack is also redone when tar reports entries it could not read, which happens once a hosted runner's file I/O starts failing. Each stage restores the newest tree its run has saved, so when a stage fails or its runner is lost, the next stage retries from the last good tree. Three failed stages in a row stop the target. A retried target's job still shows the failed stage, so the release job runs unless the run was cancelled and publishes only when every target has a candidate.
  4. The finishing stage runs make_distrib.py --minimal, writes the build's SBOM (see SBOM), then scripts/release.ps1 checks the standard archive name and top-level directory, and verifies the 14 patched exports in libcef. The candidate archive, SHA256SUMS, manifest.json and sbom.spdx.json are uploaded. It then saves the finished tree as a seed-<target> artifact (kept 30 days) for the next build, unless the job has too little time left: 40 minutes past the deadline on Linux, Windows and WarpBuild macOS, and 2h25m into the job on GitHub-hosted macOS, where packing the tree takes about 22 minutes and file I/O fails from about three hours. A runner lost while saving the seed does not cost the build: the retry stage finds the candidate already uploaded and stops there. Once the new seed is uploaded, scripts/prune-seeds.ps1 deletes that target's older seeds (about 13 GB each), since only the newest is ever updated; a seed newer than the one just uploaded is left alone.
  5. Incremental builds: when a stage would otherwise sync from scratch and a seed exists, it restores the newest seed instead and moves it to the pins in place with scripts/update.ps1, following the same steps as a fresh sync. scripts/checkouts.py first records and reverts every patched or added file, then gives each one whose content comes out unchanged after re-patching its old mtime back, so ninja rebuilds only what the update changed. Every pinned revision is fetched alone at depth 1 before gclient sync, because gclient would otherwise fetch whole histories into the shallow checkouts. For 156.0.26 to 156.0.31 this rebuilt about a fifth of the Linux build and about a third of the macOS x64 build (measured with the Probe incremental update workflow, which runs the same update on a saved tree and counts what ninja would rebuild). A seed that fails to download, restore or update falls back to a fresh sync. Dispatch Promote tree to seed (seed.yml) to make a tree an earlier run saved, finished or not, the seed for the next build; it deletes the target's older seeds too.
  6. The release workflow (release.yml) first checks that each patched library loads on a native runner. It checks every candidate's checksum and that its manifest carries this checkout's pins and patch blobs and matches the archive actually smoke-tested. scripts/package.sh imports each archive with the pinned cef-rs exporter, checks the resulting library's architecture and essential files, and packs that CEF_PATH directory as cef-<upstream version>-<target>.tar.gz (reproducibly: sorted, owner and mtime fixed). It then publishes a release tagged v<upstream version>, such as v156.0.31; a later release of the same upstream version, after a patch change, is tagged v156.0.31-2, -3 and so on. Older releases were tagged cef-<version>-patched.<n> and carry the original .tar.bz2 distributions. A release missing any of the six targets is marked as a prerelease. Dispatch Publish release directly with a JSON list of run IDs to assemble targets built by different runs (earlier runs win). Set dry-run to verify without publishing, and untick platforms or architectures to release fewer targets (as a prerelease).

Runners: ubuntu-24.04 (arm64 is cross-compiled with CEF's sysroot), windows-2025 (installs Windows SDK 10.0.28000 required by Chromium 156) and macos-26 Apple Silicon for both macOS architectures (Xcode 26). The build is an official configuration without ThinLTO, PGO, CFI or symbols (scripts/build-env.ps1), which keeps links within hosted memory; no codec or branding flags are set. A full six-target build can take multiple days depending on runner performance. Tree artifacts (~13 GB per stage) are kept for 7 days, seeds for 30 days and candidates for 14 days. The standard Apple Silicon runner has 7 GiB of RAM, below CEF's recommended 16 GiB; its ability to finish these builds must be established in CI.

Locally, on a native trusted machine with at least 16 GiB RAM and 200 GiB free disk (see CEF's automated build setup):

pwsh scripts/sync.ps1 -Directory /new/owned/dir -Target linux-x64
pwsh scripts/build.ps1 -Directory /new/owned/dir -Target linux-x64 -Deadline 4102444800
pwsh scripts/distrib.ps1 -Directory /new/owned/dir -Target linux-x64

The directory must not already exist; it is never cleaned or reused.

Consuming a release from a cef-rs fork

Each release contains, per target, cef-<upstream version>-<target>.tar.gz, manifest-<target>.json (upstream pins, repository commit, patch identities, the SHA-256 of the CEF distribution it came from and of the package), the package's SBOM cef-<upstream version>-<target>.spdx.json and a combined SHA256SUMS.

Each package is a ready cef-rs CEF_PATH: the unmodified CEF --minimal distribution as imported by export-cef-dir from pinned cef-rs, with Release/Resources flattened and archive.json written. Verify SHA256SUMS, then:

tar -xzf cef-156.0.31-linux-x64.tar.gz -C /path/per/release
export CEF_PATH=/path/per/release/cef-156.0.31-linux-x64

CI checks the packaging with a synthetic archive on every push and the release archives on every release. A cef-rs fork can instead download from the release URL in its build script; either way:

  • Use a distinct CEF_PATH or cache directory per patched release. An invalid or too-new archive.json makes this cef-rs revision silently download stock CEF; IronRDP rejects stock CEF at startup.
  • Never infer patch identity from CEF's API hash or archive.json; use the manifest's patch identities and archive checksum.
  • On macOS, this cef-rs revision copies framework files but not symlinks; the fork must preserve or recreate the framework layout and sandbox/bootstrap resources.
  • Upgrade cef-rs and these pins together.

SBOM

Every build writes an SPDX 2.3 SBOM with scripts/sbom.ps1. It uses Chromium's own tools/licenses/licenses.py, the tool behind about:credits and Chromium's SPDX license files, to find the third-party directories the shipped GN target depends on (//cef:libcef, or //cef:cef_framework on macOS) and to read their README.chromium metadata. scripts/sbom.py then writes one package per dependency with its version (or revision), URL, declared license (comma-separated licenses in README.chromium all apply, so they are joined with AND; names outside the SPDX list become a LicenseRef carrying the license file text), CPE and, for Rust crates, a pkg:cargo purl. The document describes the release package (its file name and SHA-256 are filled in when it is packed), which contains CEF, Chromium (with the cpe:2.3:a:google:chrome CPE that Chromium advisories use) and the third-party packages; this repository's patches are recorded as applied to CEF and Chromium. The scan follows build-time dependencies too, so it lists some tools that are only used to build the library. Probe SBOM (probe-sbom.yml) writes the SBOM of a saved tree without building.

Updates

Every six hours, Follow upstream CEF (watch.yml) reads CEF's builds index (cef-builds.spotifycdn.com/index.json) for the newest release that is stable for all six targets on the pinned branch. scripts/upstream.ps1 resolves its pins from upstream: the CEF commit (which must be on the pinned branch), the Chromium tag and depot_tools commit from that commit's CHROMIUM_BUILD_COMPATIBILITY.txt, the Chromium commit for the tag, and the automate-git.py blob. cef-rs and IronRDP pins stay, because a release on the same branch keeps the CEF API.

If the patches apply unchanged (scripts/check-patches.ps1), the workflow commits the new pins to master and dispatches a published build, so a clean upstream release turns into a release here without intervention. Scheduled runs only do this when the repository variable CEF_AUTO_UPDATE is true; otherwise, and when dispatched without apply, they only report. When the patches no longer apply, it starts Fix patches for that release (below), once per release. When a newer milestone is stable for every target, it keeps one open issue for that decision; moving to a milestone changes the branch, depot_tools and cef-rs, and needs coordinated consumer changes.

To pin a specific release on the branch by hand, run ./scripts/upstream.ps1 -Version <cef version> -Write.

Rebasing patches without a person

Fix patches (fix-patches.yml) carries the patches onto a release they no longer apply to, and publishes it only after automated checks and an automated review:

  1. It claims the release by pushing auto/cef-<version>; a branch that already exists means the release was attempted, so delete it to try again.
  2. scripts/rebase-patches.ps1 applies each patch in order to the new upstream files, and three-way merges it (git merge-file, with the old upstream file as base) when it no longer applies as is. Most upstream drift merges here.
  3. Only when a merge conflicts, it pushes auto/cef-<version>-request with the new pins and a rebase-request.json, and starts a task for GitHub Copilot's cloud agent on it. Copilot's setup steps (copilot-setup-steps.yml) download the upstream files and merge up to the first conflict; the agent resolves conflicts as AGENTS.md describes and commits the rewritten patches. The workflow takes only patches/*.patch from Copilot's branch; nothing else from it is used or run.
  4. It recomputes the patch blob identities, checks that the patches apply to the new upstream files (check-patches.ps1) and that every patch still touches exactly the files it touched before (compare-patches.ps1).
  5. It opens a pull request and requests a Copilot code review, following .github/copilot-instructions.md. Only an approving review continues.
  6. It builds auto/cef-<version> with publishing on. The release checks run as for any release, including IronRDP's browser e2e suites against the Windows x64 candidate, and publishing fast-forwards master to the branch, which also completes the pull request.

Any failure publishes nothing and keeps one open issue for that release.

One-time setup:

  • Secret COPILOT_AGENT_TOKEN: a fine-grained personal access token of a user with Copilot, for this repository, with read and write access to Agent tasks, Contents, Pull requests and Issues. Agent tasks and Copilot reviews only accept user tokens, and they consume that user's Copilot premium requests.
  • Copilot cloud agent enabled for this repository.
  • Copilot code review approvals enabled for this repository (they are off by default); without them the review can only comment, and nothing is published.
  • Optional variable COPILOT_AGENT_MODEL to choose the agent's model.

IronRDP e2e gate

ironrdp-e2e.yml (also run on its own with a list of build run IDs) exports the Windows x64 candidate with the pinned cef-rs exporter, builds IronRDP's CEF browser server, agent and test fixtures at the ironrdp-tests.json revision against it (scripts/ironrdp-e2e.ps1), and runs the browser suites: e2e, clipboard, downloads, devices, RDPDR policy, six media variants and shutdown. The release waits for it, so the runtime behavior the patches add is checked before any release is published.

About

CEF prebuilt distribution

Topics

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages