Skip to content

feat: add download functionality to barretenberg-rs build.rs#20105

Merged
johnathan79717 merged 4 commits intomerge-train/barretenbergfrom
jh/barretenberg-rs-download
Feb 3, 2026
Merged

feat: add download functionality to barretenberg-rs build.rs#20105
johnathan79717 merged 4 commits intomerge-train/barretenbergfrom
jh/barretenberg-rs-download

Conversation

@johnathan79717
Copy link
Contributor

Summary

This PR adds download functionality to barretenberg-rs build.rs to fetch pre-built static libraries from GitHub releases.

What this PR does:

  • build.rs now downloads libbb-external.a from GitHub releases when local cpp build is not available
  • Add test_download command to bootstrap.sh to verify download path works
  • Uses BARRETENBERG_VERSION env var or falls back to crate version
  • Blocks version 0.0.1 to prevent accidental downloads during development

Download logic:

  1. First checks for local ../../cpp/build/lib/libbb-external.a (for development)
  2. If not found, downloads from https://github.com/AztecProtocol/aztec-packages/releases/download/v{version}/barretenberg-static-{arch}-linux.tar.gz
  3. Extracts to cargo's OUT_DIR

Test command:

BARRETENBERG_VERSION=0.0.1-commit.d431d1c ./bootstrap.sh test_download

Test plan

  • Tested locally with BARRETENBERG_VERSION=0.0.1-commit.d431d1c ./bootstrap.sh test_download
  • Verified FFI tests pass with downloaded library
  • Verified local library is restored after test

johnathan79717 and others added 4 commits February 3, 2026 10:43
…raries

- build.rs now downloads libbb-external.a from GitHub releases when local cpp build is not available
- Add test_download command to bootstrap.sh to verify download path works
- Uses BARRETENBERG_VERSION env var or falls back to crate version
- Blocks version 0.0.1 to prevent accidental downloads during development
- Add BB_LOCAL_BUILD env var to force local build and fail with helpful
  message if libbb-external.a is not found (instead of silently downloading)
- Add retry logic (3 attempts) to test_download for network flakiness

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Now the default behavior is to download from GitHub releases. Set
BB_LOCAL_BUILD=1 to use local cpp/build/lib instead (for monorepo development).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Instead of BB_LOCAL_BUILD=1, use BB_LIB_DIR=/path/to/lib to specify
where libbb-external.a is located. More flexible and explicit.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@johnathan79717 johnathan79717 force-pushed the jh/barretenberg-rs-download branch from d3f5c10 to 78cacb1 Compare February 3, 2026 10:43
@johnathan79717 johnathan79717 merged commit 98d4776 into merge-train/barretenberg Feb 3, 2026
8 checks passed
@johnathan79717 johnathan79717 deleted the jh/barretenberg-rs-download branch February 3, 2026 11:04
johnathan79717 added a commit that referenced this pull request Feb 3, 2026
Re-lands the download functionality from #20105 with the following fixes:
- Check for all 0.x.x development versions, not just 0.0.1
- Set BB_LIB_DIR in build function (ffi feature is on by default)

The build.rs now properly detects development versions and requires either
BARRETENBERG_VERSION to be set to a released version, or BB_LIB_DIR to
point to a local build.
johnathan79717 added a commit that referenced this pull request Feb 3, 2026
Re-lands the download functionality from #20105 with the following fixes:
- Check for all 0.x.x development versions, not just 0.0.1
- Set BB_LIB_DIR in build function (ffi feature is on by default)

The build.rs now properly detects development versions and requires either
BARRETENBERG_VERSION to be set to a released version, or BB_LIB_DIR to
point to a local build.
johnathan79717 added a commit that referenced this pull request Feb 3, 2026
Re-lands the download functionality from #20105 with the following fixes:
- Check for all 0.x.x development versions, not just 0.0.1
- Set BB_LIB_DIR in build function (ffi feature is on by default)

The build.rs now properly detects development versions and requires either
BARRETENBERG_VERSION to be set to a released version, or BB_LIB_DIR to
point to a local build.
johnathan79717 added a commit that referenced this pull request Feb 3, 2026
## Summary
Re-lands the download functionality from #20105 with the following
fixes:
- Check for all 0.x.x development versions, not just 0.0.1
- Set BB_LIB_DIR in build function (ffi feature is on by default)

The build.rs now properly detects development versions and requires
either
BARRETENBERG_VERSION to be set to a released version, or BB_LIB_DIR to
point to a local build.

## Test plan
- CI will verify the build and tests pass
github-merge-queue bot pushed a commit that referenced this pull request Feb 3, 2026
BEGIN_COMMIT_OVERRIDE
cherchore: graph tooling audit 0 (#19691)
chore: opt sol scope renaming (#20123)
feat: add download functionality to barretenberg-rs build.rs (#20105)
fix: set BB_LIB_DIR in build function (ffi feature is on by default)
Revert barretenberg-rs download functionality
feat: re-land barretenberg-rs download functionality with fixes (#20128)
fix: skip FFI feature in PipeBackend tests
fix: skip FFI feature in PipeBackend tests
END_COMMIT_OVERRIDE
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