-
Notifications
You must be signed in to change notification settings - Fork 6
Add gn 0.2511 + bindgen 0.72.1 — chromium-from-source build prerequisites #588
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
c4505b3
Add gn 0.2511 + bindgen 0.72.1 — chromium-from-source build prerequis…
bryan-minimal 72299b4
gn: drop unused standaloneTest import (import-line checker)
bryan-minimal a181201
gn: single-source the commit position — version derives from it, buil…
bryan-minimal 6d87d01
Merge branch 'main' into add-chromium-build-prereqs
twitchyliquid64 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| let { standaloneTest, subsetOf, Attrs, BuildSpec, Local, OutputBin, Source, Test, .. } = import "minimal.ncl" in | ||
| let base = import "../base/build.ncl" in | ||
| let rust = import "../rust/build.ncl" in | ||
| let toolchain = import "../toolchain/build.ncl" in | ||
|
|
||
| let glibc = import "../glibc/build.ncl" in | ||
| let gcc = import "../gcc/build.ncl" in | ||
| let llvm = import "../llvm/build.ncl" in | ||
|
|
||
| # bindgen — generates Rust FFI bindings from C/C++ headers by driving | ||
| # libclang. Packaged as a chromium-from-source build prerequisite | ||
| # (pkgmgr-rs#681): chromium's gn wires `rust_bindgen_root` and the | ||
| # official tarball's bundled bindgen is an x86-64-only prebuilt, so the | ||
| # arm64 build needs a system one. 0.72.1 is exactly Gentoo's floor for | ||
| # chromium 151. | ||
| # | ||
| # libclang is a RUNTIME dependency: bindgen dlopens libclang.so to parse | ||
| # headers, and needs clang's resource headers (usr/lib/clang/<ver>/) for | ||
| # builtin includes — both from the llvm package. | ||
| let version = "0.72.1" in | ||
| { | ||
| name = "bindgen", | ||
| 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, | ||
| ], | ||
| runtime_deps = [ | ||
| glibc, | ||
| subsetOf gcc ["libgcc"], | ||
| subsetOf llvm ["libclang", "libs_clang"], | ||
| ], | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| cmd = "./build.sh", | ||
|
|
||
| outputs = { | ||
| bindgen = { glob = "usr/bin/bindgen" } | OutputBin, | ||
| }, | ||
|
|
||
| attrs = | ||
| { | ||
| upstream_version = version, | ||
| license_spdx = "BSD-3-Clause", | ||
| source_provenance = { | ||
| category = 'GithubRepo, | ||
| owner = "rust-lang", | ||
| repo = "rust-bindgen", | ||
| }, | ||
| } | Attrs, | ||
|
|
||
| tests = { | ||
| smoketest = standaloneTest "/bin/bindgen --version", | ||
| }, | ||
| } | BuildSpec | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| #!/bin/sh | ||
| set -ex | ||
|
|
||
| export CC=gcc | ||
| export LD=gcc | ||
| export RUSTFLAGS="-C linker=gcc --remap-path-prefix=$(pwd)=/builddir --remap-path-prefix=$HOME/.cargo=/cargo" | ||
|
|
||
| # The workspace's CLI crate; the library crate is what other projects | ||
| # vendor themselves. | ||
| cargo build --release -p bindgen-cli | ||
|
|
||
| install -D -m 0755 target/release/bindgen "$OUTPUT_DIR/usr/bin/bindgen" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| let { subsetOf, Attrs, BuildSpec, Local, OutputBin, Source, Test, .. } = import "minimal.ncl" in | ||
| let base = import "../base/build.ncl" in | ||
| let python = import "../python/build.ncl" in | ||
| let ninja = import "../ninja/build.ncl" in | ||
| let toolchain = import "../toolchain/build.ncl" in | ||
|
|
||
| let glibc = import "../glibc/build.ncl" in | ||
| let gcc = import "../gcc/build.ncl" in | ||
|
|
||
| # gn — Google's meta-build system generator (generates ninja files). | ||
| # Packaged as a chromium-from-source build prerequisite (pkgmgr-rs#681): | ||
| # the official chromium tarball ships only an x86-64 prebuilt gn, so the | ||
| # arm64 build needs a system gn either way, and a package beats | ||
| # re-bootstrapping it inside every chromium build. | ||
| # | ||
| # Versioning: upstream has NO releases or tags beyond `initial-commit`; | ||
| # its version IS the commit position — `gn --version` prints | ||
| # "<position> (<12-char sha>)", derived from `git describe`. We follow | ||
| # Gentoo's scheme: version 0.<position>. Source is a `git archive` of | ||
| # that commit mirrored to gs:// — gitiles' own /+archive/ tarballs are | ||
| # generated on the fly and NOT byte-stable, so they can never be | ||
| # sha256-pinned directly. Bumping = new archive from a newer commit, | ||
| # update `version` here AND the position/sha pinned in build.sh. | ||
| # | ||
| # ⚠ Version-tracking: update-dark for now. Upstream is | ||
| # gn.googlesource.com (no provenance category fits), and repology's | ||
| # `gn` project is all-`noscheme` (each distro invents its own scheme: | ||
| # dates, short hashes, positions) so `repology_project` would propose | ||
| # garbage. The clean fix is a curated NAME_KEYED_VERSION_CHECK entry in | ||
| # pkgmgr-rs reading the gitiles API for the latest commit position — | ||
| # tracked as a follow-up on pkgmgr-rs#681. | ||
| # The two pins. `version` is DERIVED from `position`, and build.sh renders | ||
| # the version header from the forwarded build_args — so a bump edits these | ||
| # two lines (plus the archive sha) and nothing can go stale in lockstep. | ||
| let position = "2511" in | ||
| let commit = "7324363900cc" in | ||
| let version = "0.%{position}" in | ||
| { | ||
| name = "gn", | ||
| build_deps = [ | ||
| { file = "build.sh" } | Local, | ||
| { | ||
| url = "gs://minimal-staging-archives/gn/gn/%{version}.tar.gz", | ||
| sha256 = "3e85ceeb08cdb563a5db995175f9e5173a337f7e0b4822078f514a0bb7c991bf", | ||
| extract = true, | ||
| strip_prefix = "gn-%{version}", | ||
| } | Source, | ||
| base, | ||
| python, | ||
| ninja, | ||
| toolchain, | ||
| ], | ||
| runtime_deps = [ | ||
| glibc, | ||
| subsetOf gcc ["libstdcpp"], | ||
| ], | ||
|
|
||
| cmd = "./build.sh", | ||
| build_args = { | ||
| include position, | ||
| include commit, | ||
| }, | ||
|
|
||
| outputs = { | ||
| gn = { glob = "usr/bin/gn" } | OutputBin, | ||
| }, | ||
|
|
||
| attrs = | ||
| { | ||
| upstream_version = version, | ||
| license_spdx = "BSD-3-Clause", | ||
| } | Attrs, | ||
|
|
||
| tests = { | ||
| # Pins the version header wired in build.sh: `gn --version` must | ||
| # print the pinned commit position, not 0 (UNKNOWN) — the tarball | ||
| # has no .git, so a silent fallback would ship a gn that lies about | ||
| # what it is. | ||
| smoketest = | ||
| { | ||
| class = 'Standalone, | ||
| test_deps = [base], | ||
| cmds = [ | ||
| ["/bin/bash", "-c", "/bin/gn --version | grep -q '^%{position} '"], | ||
| ], | ||
| } | Test, | ||
| }, | ||
| } | BuildSpec |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| #!/bin/sh | ||
| set -ex | ||
|
|
||
| export CXX=g++ | ||
| export AR=ar | ||
| export LD=g++ | ||
| # Reproducibility per AGENTS.md; gen.py appends env CFLAGS/CXXFLAGS/LDFLAGS | ||
| # to its own flag set. | ||
| export CXXFLAGS="-ffile-prefix-map=$(pwd)=/builddir -gno-record-gcc-switches" | ||
| export LDFLAGS="-Wl,--build-id=none" | ||
|
|
||
| # gen.py derives the version header from `git describe`; a tarball has no | ||
| # .git, so render it from the position/commit forwarded by build.ncl's | ||
| # build_args — one source of truth, and the smoketest greps the position | ||
| # out of `gn --version`. | ||
| mkdir -p out | ||
| cat > out/last_commit_position.h <<EOF | ||
| // Generated by build/gen.py. | ||
|
|
||
| #ifndef OUT_LAST_COMMIT_POSITION_H_ | ||
| #define OUT_LAST_COMMIT_POSITION_H_ | ||
|
|
||
| #define LAST_COMMIT_POSITION_NUM $MINIMAL_ARG_POSITION | ||
| #define LAST_COMMIT_POSITION "$MINIMAL_ARG_POSITION ($MINIMAL_ARG_COMMIT)" | ||
|
|
||
| #endif // OUT_LAST_COMMIT_POSITION_H_ | ||
| EOF | ||
|
|
||
| # --no-static-libstdc++: link the system libstdc++ (runtime_deps carries | ||
| # gcc/libstdcpp) instead of gen.py's static default. | ||
| python3 build/gen.py --no-last-commit-position --no-static-libstdc++ --allow-warnings | ||
| ninja -C out gn | ||
|
|
||
| mkdir -p "$OUTPUT_DIR/usr/bin" | ||
| install -m 0755 out/gn "$OUTPUT_DIR/usr/bin/" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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:
Repository: gominimal/pkgs
Length of output: 228
🏁 Script executed:
Repository: gominimal/pkgs
Length of output: 3084
🏁 Script executed:
Repository: gominimal/pkgs
Length of output: 144
Declare Cargo network capabilities.
packages/bindgen/build.shrunscargo build --release -p bindgen-cli, and the v0.72.1 archive has no vendored crates or offline Cargo configuration. Adddnsandinternettoneeds, or vendor all crates and force Cargo offline.🤖 Prompt for AI Agents
Source: Coding guidelines
There was a problem hiding this comment.
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
needsnetwork (bat, atuin, ast-grep, bandwhich — all plaincargo buildfrom pristine mirrored tarballs, no vendoring), because the fetch layer pre-resolves Cargo.lock dependencies before the sandbox runs. The clean-roomminimal buildgate 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.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Length of output: 3983
🏁 Script executed:
Length of output: 7877
@bryan-minimal, I verified the cited packages. The precedent is mixed.packages/ast-grep/build.nclruns Cargo and declaresinternet.packages/bandwhich/build.nclruns Cargo and declares bothdnsandinternet.packages/libkrun/build.nclalso declares both capabilities for Cargo fetching.The successful
minimal buildis 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.