build: source rayforce from upstream at pinned SHA#8
Merged
Conversation
added 2 commits
May 1, 2026 16:59
The vendored rayforce/ copy had drifted from upstream and shipped
incomplete (no Makefile). Replace it with an auto-clone flow that
sources rayforce from the pinned SHA in `.rayforce-version`.
Resolution order in build.rs:
1. RAYFORCE_DIR set -> link external librayforce.a (dev mode,
unchanged)
2. vendor/rayforce/ -> source bundled inside the published
Makefile exists .crate tarball (or populated by CI before
`cargo package`); copy to OUT_DIR, build
3. neither -> shallow clone upstream at the pinned SHA
into OUT_DIR, build there
All `make lib` work happens in `OUT_DIR/rayforce-build/`. The source
tree is never modified — required for `cargo package` to verify clean.
CFLAGS override: drop `-march=native` and `-Werror` from the upstream
RELEASE_CFLAGS so the produced .a runs on any CPU of the target arch
and downstream builds don't break on new compiler warnings.
Cargo.toml `include` whitelists vendor/rayforce/{Makefile,LICENSE,
src/**,include/**} so the published .crate ships the source needed
for offline downstream builds. .gitignore drops vendor/ from tracking;
CI populates it explicitly before `cargo package` (publish.yml).
Pin format: single-line hex SHA in .rayforce-version. Bump by editing
the file and running `cargo clean -p raysense && cargo build`.
Verified locally:
- cargo test: 123/123 green
- cargo fmt --check: clean
- cargo package: 167 files, 838 KiB compressed (under crates.io 10
MiB limit). Verification build passes — source dir unmodified.
singaraiona
added a commit
that referenced
this pull request
May 1, 2026
* build: source rayforce from upstream at pinned SHA
The vendored rayforce/ copy had drifted from upstream and shipped
incomplete (no Makefile). Replace it with an auto-clone flow that
sources rayforce from the pinned SHA in `.rayforce-version`.
Resolution order in build.rs:
1. RAYFORCE_DIR set -> link external librayforce.a (dev mode,
unchanged)
2. vendor/rayforce/ -> source bundled inside the published
Makefile exists .crate tarball (or populated by CI before
`cargo package`); copy to OUT_DIR, build
3. neither -> shallow clone upstream at the pinned SHA
into OUT_DIR, build there
All `make lib` work happens in `OUT_DIR/rayforce-build/`. The source
tree is never modified — required for `cargo package` to verify clean.
CFLAGS override: drop `-march=native` and `-Werror` from the upstream
RELEASE_CFLAGS so the produced .a runs on any CPU of the target arch
and downstream builds don't break on new compiler warnings.
Cargo.toml `include` whitelists vendor/rayforce/{Makefile,LICENSE,
src/**,include/**} so the published .crate ships the source needed
for offline downstream builds. .gitignore drops vendor/ from tracking;
CI populates it explicitly before `cargo package` (publish.yml).
Pin format: single-line hex SHA in .rayforce-version. Bump by editing
the file and running `cargo clean -p raysense && cargo build`.
Verified locally:
- cargo test: 123/123 green
- cargo fmt --check: clean
- cargo package: 167 files, 838 KiB compressed (under crates.io 10
MiB limit). Verification build passes — source dir unmodified.
* fmt: collapse read_pin one-liner per rustfmt
---------
Co-authored-by: Anton <anton.kundenko@gmail.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
rayforce/copy with an auto-clone flow pinned to a SHA in.rayforce-version.make libwork now happens inOUT_DIR/rayforce-build/; source tree is never modified — required forcargo packageverification to pass.Cargo.tomlincludewhitelist shipsvendor/rayforce/{Makefile,LICENSE,src/**,include/**}in the published.crateso end userscargo install raysenseoffline. CI populatesvendor/explicitly beforecargo package(publish.yml).Resolution modes (build.rs)
RAYFORCE_DIRsetlibrayforce.a(dev mode, unchanged)vendor/rayforce/MakefileexistsOUT_DIR, build theregit cloneupstream at the pinned SHA intoOUT_DIR, build thereCFLAGS override
Upstream
RELEASE_CFLAGSincludes-march=nativeand-Werror. Both are poison for distribution:-march=nativebakes the build host's CPU into the.a(crashes on older CPUs of the same arch),-Werrorbreaks downstream builds on new compiler warnings.build.rsoverridesRELEASE_CFLAGSto a portable baseline.Verified locally
cargo fmt --checkcleancargo test— 123/123 green (auto-clone path)cargo test— 123/123 green (bundled-vendor path simulating CI publish)cargo package— 167 files, 838 KiB compressed (well under the crates.io 10 MiB ceiling). Verification build passes..o, nolibrayforce.a, novendor/pollution)Test plan for reviewer
cargo build— confirm auto-clone runs and produces a working binaryRAYFORCE_DIR=/abs/path/to/rayforce(with a pre-builtlibrayforce.a) — confirm dev path links external libgh workflow run publish.yml -f dry_run=true— confirm new "Vendor rayforce at pinned SHA" step runs andcargo package --dry-runsucceeds.rayforce-version,cargo clean -p raysense && cargo build— confirm rebuild picks up the new SHAOut of scope / follow-ups
cargo installpath still works; just the docs lag).