Skip to content

Support linking against ada via feature#110

Merged
anonrig merged 3 commits into
ada-url:mainfrom
logan-gatlin:main
Jul 1, 2026
Merged

Support linking against ada via feature#110
anonrig merged 3 commits into
ada-url:mainfrom
logan-gatlin:main

Conversation

@logan-gatlin

Copy link
Copy Markdown
Contributor

Summary

Adds the ability to skip compiling the bundled C++ ada sources and instead link against an externally provided ada library. This is useful when ada is already provided by the host build system (e.g. Bazel, CMake, or a distro package), where compiling the bundled copy would otherwise produce a second, duplicate copy of ada in the final binary.

Changes

  • New bundled feature (Cargo.toml): Added to the default feature set. Compiles and statically links the bundled C++ ada sources. Disable via default-features = false to link an external ada instead.
  • build.rs: When bundled is disabled, the build script skips the bundled compile and emits link directives driven by two optional environment variables:
  • ADA_LIB_DIR — directory added to the linker search path (cargo:rustc-link-search=native).
  • ADA_LIB_NAME — library to link, passed verbatim to cargo:rustc-link-lib (e.g. ada or static=ada).
  • If neither is set, no link directive is emitted, leaving the host build system to provide the ada symbols at final link time.
  • README.md: Documents the new bundled feature and a "Linking against an external ada" section with usage examples.

Notes

  • The external ada must expose the same C ABI (ada_*) and be ABI-compatible with this crate's version.
  • Disabling default features also drops std, so consumers should re-enable it explicitly:
    ada-url = { version = "3", default-features = false, features = ["std"] }

@anonrig

anonrig commented Jul 1, 2026

Copy link
Copy Markdown
Member

Hi Logan!

Is there a way to test this, so we don't regress?

@anonrig

anonrig commented Jul 1, 2026

Copy link
Copy Markdown
Member

Also can you update the README.md with this change?

@codspeed-hq

codspeed-hq Bot commented Jul 1, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 16 untouched benchmarks


Comparing logan-gatlin:main (cca7eb5) with main (14b918f)

Open in CodSpeed

@logan-gatlin

Copy link
Copy Markdown
Contributor Author

Hi Yagiz, I updated the existing feature powerset to always use bundled, and put the unbundled tests in their own job. I also updated the README

@anonrig anonrig merged commit 574661d into ada-url:main Jul 1, 2026
10 checks passed
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