Skip to content

feat(build): enable cargo add boxlite with prebuilt runtime download#241

Merged
DorianZheng merged 3 commits intomainfrom
feat/prebuilt-runtime-download
Feb 12, 2026
Merged

feat(build): enable cargo add boxlite with prebuilt runtime download#241
DorianZheng merged 3 commits intomainfrom
feat/prebuilt-runtime-download

Conversation

@DorianZheng
Copy link
Copy Markdown
Member

Summary

  • Adds BOXLITE_DEPS_STUB=2 (Prebuilt) mode: downloads runtime tarball from GitHub Releases during cargo build, so downstream Rust users can cargo add boxlite without needing LLVM, Go, make, or meson
  • Introduces DepsMode enum in boxlite/build.rs to route between Source/Stub/Prebuilt build paths
  • All -sys crate build scripts now respect BOXLITE_DEPS_STUB for correct incremental rebuilds
  • RuntimeBinaryFinder gains compile-time fallback via option_env!("BOXLITE_RUNTIME_DIR") so runtime binaries (boxlite-shim, boxlite-guest, mke2fs, debugfs) are discoverable without env vars
  • CI workflow updated for tarball publishing

Test plan

  • BOXLITE_DEPS_STUB=1 cargo check -p boxlite — passes (CI lint mode)
  • BOXLITE_DEPS_STUB=1 cargo clippy -p boxlite — passes, no warnings
  • BOXLITE_DEPS_STUB=2 cargo test -p boxlite --lib — 318 tests pass
  • E2E test: downstream project with cargo add boxlite builds and runs (echo "Hello from BoxLite!" inside Alpine VM)
  • CI pipeline passes

Add BOXLITE_DEPS_STUB=2 (Prebuilt) mode that downloads a pre-built
runtime tarball from GitHub Releases during cargo build, eliminating the
need for LLVM, Go, make, or meson on the consumer's machine.

- Introduce DepsMode enum (Source/Stub/Prebuilt) in boxlite/build.rs
- Add download_prebuilt_runtime() and create_library_symlinks() for
  fetching and preparing prebuilt native dependencies
- Emit cargo:rustc-env=BOXLITE_RUNTIME_DIR so RuntimeBinaryFinder can
  locate boxlite-shim/boxlite-guest at compile time via option_env!()
- Add rerun-if-env-changed=BOXLITE_DEPS_STUB to all -sys crate build
  scripts for correct incremental rebuild
- Update build-runtime CI workflow for tarball publishing
Build Linux runtime inside quay.io/pypa/manylinux_2_28 container to
ensure binaries work on older distros (RHEL 8/9, Debian 11, etc.).

- Guest built on host (Ubuntu has musl-tools, manylinux doesn't)
- Runtime/shim/libkrun built in container (glibc 2.28)
- Add actions/cache for manylinux cargo registry (CARGO_HOME mounted
  from host volume since Swatinem/rust-cache can't run in Docker)
- macOS build unchanged (native runner)

Mirrors the established pattern from build-node.yml.
@DorianZheng DorianZheng merged commit 3d4a6f2 into main Feb 12, 2026
14 checks passed
@DorianZheng DorianZheng deleted the feat/prebuilt-runtime-download branch February 12, 2026 14:20
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.

1 participant