Skip to content

Add gn 0.2511 + bindgen 0.72.1 — chromium-from-source build prerequisites - #588

Merged
twitchyliquid64 merged 4 commits into
mainfrom
add-chromium-build-prereqs
Aug 10, 2026
Merged

Add gn 0.2511 + bindgen 0.72.1 — chromium-from-source build prerequisites#588
twitchyliquid64 merged 4 commits into
mainfrom
add-chromium-build-prereqs

Conversation

@bryan-minimal

@bryan-minimal bryan-minimal commented Aug 10, 2026

Copy link
Copy Markdown
Member

First concrete slice of the chromium source-build spike (pkgmgr-rs#681): the two build tools we don't already package. The spike settled that arm64 must use system toolchains — every prebuilt in Google's official tarball (clang, rustc, bindgen, gn, node) is an x86-64 ELF — and everything else we need (llvm 21.1.8, rust 1.97.1, esbuild 0.28.1, go 1.26.5, ninja, python) already exists at or above the distro-proven floors.

gn 0.2511 (commit 7324363900cc, 2026-08-09):

  • Upstream has no releases — its version IS the commit position; we follow Gentoo's 0.<position> scheme. gn --version prints 2511 (7324363900cc).
  • Source is a git archive of that commit mirrored to gs://minimal-staging-archives/gn/gn/ — gitiles /+archive/ tarballs are generated on the fly and not byte-stable, so they can't be sha256-pinned directly.
  • The smoketest greps the pinned position from --version: gen.py's no-.git fallback is 0 (UNKNOWN), and that must never ship silently.
  • Reproducibility flags per AGENTS.md ride CXXFLAGS/LDFLAGS (gen.py appends env flags); --no-static-libstdc++ links the packaged libstdc++.
  • Surfaced, not hidden: update-dark for now. No provenance category fits googlesource, and repology's gn project is all-noscheme (dates/hashes/positions per distro) so repology_project would propose garbage. Follow-up tracked on pkgmgr-rs#681: a curated NAME_KEYED_VERSION_CHECK entry reading the gitiles API for the latest commit position.

bindgen 0.72.1 — exactly Gentoo's floor for chromium 151:

  • Standard rust-package shape (cargo build --release -p bindgen-cli, remap-path-prefix flags, mirrored GitHub tarball, GithubRepo provenance).
  • libclang + the clang resource headers are runtime deps (subsetOf llvm [\"libclang\", \"libs_clang\"]) — bindgen dlopens libclang to parse headers.

Both packages evaluate cleanly through mip dump locally; CI's build gate is the proof for the compile.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added the bindgen command-line tool, version 0.72.1, for generating Rust bindings from C and C++ headers.
    • Added the gn build configuration tool, version 0.2511, for generating build files and coordinating native builds.
    • Both tools are available as packaged executables with reproducible builds and basic installation checks.

…ites

The #681 spike (pkgmgr-rs) settled that a source-built chromium must use
system toolchains on arm64 — every prebuilt in Google's official tarball
(clang, rustc, bindgen, gn, node) is an x86-64 ELF. These are the two
tools we didn't already package; esbuild/go/llvm/rust/ninja/python all
exist at or above the distro-proven floors.

gn: no upstream releases — its version IS the commit position (Gentoo's
0.<position> scheme; `gn --version` prints "2511 (7324363900cc)").
Source is a git-archive of that commit mirrored to gs:// because gitiles
/+archive/ tarballs are generated on the fly and can't be sha256-pinned.
The smoketest greps the pinned position out of --version so the
no-.git fallback ("0 (UNKNOWN)") can never ship silently. Update-dark
for now, declared in-file: no provenance category fits googlesource and
repology's gn project is all-noscheme; follow-up is a curated
NAME_KEYED_VERSION_CHECK reading the gitiles API.

bindgen: 0.72.1 = exactly Gentoo's floor for chromium 151. libclang +
clang resource headers are RUNTIME deps (bindgen dlopens libclang to
parse headers) — subsetOf llvm.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: e67a791a-0628-4546-9bdc-1560adcd94fd

📥 Commits

Reviewing files that changed from the base of the PR and between 72299b4 and 6d87d01.

📒 Files selected for processing (2)
  • packages/gn/build.ncl
  • packages/gn/build.sh
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/gn/build.sh
  • packages/gn/build.ncl

📝 Walkthrough

Walkthrough

This change adds reproducible package definitions and build scripts for bindgen 0.72.1 and GN 0.2511. Both packages verify source archives, declare dependencies, install binaries, and run version-related smoketests.

Changes

Toolchain package additions

Layer / File(s) Summary
Bindgen package build
packages/bindgen/build.ncl, packages/bindgen/build.sh
The package definition pins and verifies the bindgen source, declares dependencies and metadata, and maps the built binary. The build script configures GCC and Rust reproducibility flags, builds bindgen-cli, and installs bindgen.
GN package build
packages/gn/build.ncl, packages/gn/build.sh
The package definition pins and verifies the GN source, declares dependencies and metadata, and maps the built binary. The build script generates commit metadata, configures GN, builds with Ninja, and installs gn.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested reviewers: twitchyliquid64

Sequence Diagram(s)

sequenceDiagram
  participant BindgenBuildSpec
  participant BindgenBuildScript
  participant RustAndGCC
  participant BindgenOutput
  BindgenBuildSpec->>BindgenBuildScript: Invoke bindgen build
  BindgenBuildScript->>RustAndGCC: Configure tools and build bindgen-cli
  RustAndGCC->>BindgenOutput: Install bindgen
Loading
sequenceDiagram
  participant GNBuildSpec
  participant GNBuildScript
  participant GenAndNinja
  participant GNOutput
  GNBuildSpec->>GNBuildScript: Invoke GN build
  GNBuildScript->>GenAndNinja: Generate metadata and build with Ninja
  GenAndNinja->>GNOutput: Install gn
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely identifies both packages and their role as Chromium source-build prerequisites.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch add-chromium-build-prereqs

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/bindgen/build.ncl`:
- Around line 35-39: Add dns and internet network capabilities to the BuildSpec
for the bindgen Cargo build, alongside the existing runtime_deps declaration, so
cargo build --release -p bindgen-cli can fetch crates. Keep the valid
llvm.libs_clang subsetOf dependency unchanged.
- Around line 23-34: Update the bindgen package definition associated with
build_deps to declare both dns and internet in its needs capabilities, since
build.sh invokes Cargo against non-vendored dependencies. Use the existing needs
configuration rather than adding offline or vendoring changes.

In `@packages/gn/build.ncl`:
- Around line 32-53: Update packages/gn/build.ncl lines 32-53 to declare
build_args forwarding the GN version and pinned commit identifier. In
packages/gn/build.sh lines 12-24, consume those forwarded arguments, derive the
commit position from the forwarded version, and render the generated GN version
header from them instead of hard-coded values.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7c3f3582-0973-4f68-b61c-c52e080f5f4a

📥 Commits

Reviewing files that changed from the base of the PR and between 9a5c791 and c4505b3.

📒 Files selected for processing (4)
  • packages/bindgen/build.ncl
  • packages/bindgen/build.sh
  • packages/gn/build.ncl
  • packages/gn/build.sh

Comment on lines +23 to +34
build_deps = [
{ file = "build.sh" } | Local,
{
url = "gs://minimal-staging-archives/rust-lang/rust-bindgen/v%{version}.tar.gz",
sha256 = "4ffb17061b2d71f19c5062d2e17e64107248f484f9775c0b7d30a16a8238dfd1",
extract = true,
strip_prefix = "rust-bindgen-%{version}",
} | Source,
base,
rust,
toolchain,
],

@coderabbitai coderabbitai Bot Aug 10, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/sh
set -eu

tmp_dir="$(mktemp -d)"
trap 'rm -rf "$tmp_dir"' EXIT

curl -fsSL \
  "https://github.com/rust-lang/rust-bindgen/archive/refs/tags/v0.72.1.tar.gz" \
  -o "$tmp_dir/bindgen.tar.gz"

if tar -tzf "$tmp_dir/bindgen.tar.gz" | grep -Eq '/(vendor/|\.cargo/config(\.toml)?)'; then
  echo "Vendoring or a Cargo source replacement exists; verify that Cargo builds offline."
else
  echo "No vendored Cargo source replacement found; declare dns and internet needs."
fi

Repository: gominimal/pkgs

Length of output: 228


🏁 Script executed:

#!/bin/sh
set -eu

printf '%s\n' '--- build.ncl ---'
cat -n packages/bindgen/build.ncl

printf '%s\n' '--- build.sh ---'
cat -n packages/bindgen/build.sh

printf '%s\n' '--- Cargo manifests and offline configuration ---'
find packages/bindgen -maxdepth 3 -type f \( \
  -name 'Cargo.toml' -o -name 'Cargo.lock' -o -name 'config' -o -name 'config.toml' \
\) -print
rg -n --hidden --glob '!target/**' --glob '!node_modules/**' \
  '(\[source\.|replace|patch\.|vendor|offline|cargo build|cargo fetch)' \
  packages/bindgen

Repository: gominimal/pkgs

Length of output: 3084


🏁 Script executed:

#!/bin/sh
set -eu

printf '%s\n' '--- Needs declarations ---'
rg -n -C 4 '\bNeeds\b|needs[[:space:]]*=' packages --glob 'build.ncl' | head -n 240

printf '%s\n' '--- Upstream Cargo dependency metadata ---'
tmp_dir="$(mktemp -d)"
trap 'rm -rf "$tmp_dir"' EXIT
curl -fsSL \
  "https://github.com/rust-lang/rust-bindgen/archive/refs/tags/v0.72.1.tar.gz" \
  -o "$tmp_dir/bindgen.tar.gz"
tar -xzf "$tmp_dir/bindgen.tar.gz" -C "$tmp_dir"
root="$(find "$tmp_dir" -mindepth 1 -maxdepth 1 -type d -name 'rust-bindgen-*' -print -quit)"
find "$root" -maxdepth 3 -type f \( -name 'Cargo.toml' -o -name 'Cargo.lock' -o -name 'config' -o -name 'config.toml' \) -print
if [ -f "$root/Cargo.lock" ]; then
  rg -n 'source = "registry\+https://github.com/rust-lang/crates.io-index"|source = "registry\+https://github.com/rust-lang/crates.io-index"|source = "sparse\+https://index.crates.io"' "$root/Cargo.lock" | head -n 30
else
  echo "No Cargo.lock at archive root"
fi

Repository: gominimal/pkgs

Length of output: 144


Declare Cargo network capabilities.

packages/bindgen/build.sh runs cargo build --release -p bindgen-cli, and the v0.72.1 archive has no vendored crates or offline Cargo configuration. Add dns and internet to needs, or vendor all crates and force Cargo offline.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/bindgen/build.ncl` around lines 23 - 34, Update the bindgen package
definition associated with build_deps to declare both dns and internet in its
needs capabilities, since build.sh invokes Cargo against non-vendored
dependencies. Use the existing needs configuration rather than adding offline or
vendoring changes.

Source: Coding guidelines

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked against the repo's working precedent: no cargo package here declares needs network (bat, atuin, ast-grep, bandwhich — all plain cargo build from pristine mirrored tarballs, no vendoring), because the fetch layer pre-resolves Cargo.lock dependencies before the sandbox runs. The clean-room minimal build gate on this PR passed with no network declared — that's the empirical proof for this package specifically. Leaving as-is to match every other rust package.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- Comparable Rust package declarations ---'
for package in bat atuin ast-grep bandwhich; do
  build_file="packages/${package}/build.ncl"
  if [ -f "$build_file" ]; then
    printf '\n--- %s ---\n' "$build_file"
    grep -nE 'needs[[:space:]]*=|cargo|rust|Cargo|build_deps[[:space:]]*=' "$build_file" || true
  else
    printf '\n--- packages/%s/build.ncl not found ---\n' "$package"
  fi
done

printf '%s\n' '\n--- Fetch-layer and Cargo-resolution references ---'
rg -n -i -C 3 \
  'pre-resolv|cargo\.lock|cargo (dependency|dependencies)|crate(s)?\.io|cargo.*fetch|fetch.*cargo' \
  README.md packages .github 2>/dev/null || true

Length of output: 3983


🏁 Script executed:

#!/bin/bash
set -euo pipefail

for package in bat atuin ast-grep bandwhich; do
  printf '\n--- packages/%s/build.ncl ---\n' "$package"
  sed -n '1,110p' "packages/${package}/build.ncl"
  if [ -f "packages/${package}/build.sh" ]; then
    printf '\n--- packages/%s/build.sh ---\n' "$package"
    sed -n '1,100p' "packages/${package}/build.sh"
  fi
done

Length of output: 7877


@bryan-minimal, I verified the cited packages. The precedent is mixed.

packages/ast-grep/build.ncl runs Cargo and declares internet.
packages/bandwhich/build.ncl runs Cargo and declares both dns and internet.
packages/libkrun/build.ncl also declares both capabilities for Cargo fetching.

The successful minimal build is useful evidence for the current environment. It does not show that Cargo cannot require a registry lookup in a clean cache state. The bindgen source has no vendored crates or offline Cargo configuration, and the package guideline requires the capabilities in this case.

I will keep the finding open.

You are interacting with an AI system.

Comment thread packages/bindgen/build.ncl
Comment thread packages/gn/build.ncl Outdated
bryan-minimal and others added 3 commits August 10, 2026 12:34
…d.sh renders the header from build_args

CR catch: version (build.ncl) and the header values (build.sh) were two
hardcoded copies of the same fact. Now `position` + `commit` are the only
pins; version = "0.%{position}", the smoketest greps %{position}, and
build.sh renders the header from MINIMAL_ARG_POSITION/COMMIT.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@twitchyliquid64
twitchyliquid64 added this pull request to the merge queue Aug 10, 2026
Merged via the queue into main with commit 18ececd Aug 10, 2026
10 checks passed
@twitchyliquid64
twitchyliquid64 deleted the add-chromium-build-prereqs branch August 10, 2026 22:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants