build: opt-in static libxml2 link via LIBXML2_STATIC (v0.3.13)#202
Merged
Conversation
When LIBXML2_STATIC is set, build.rs probes via pkg-config with .statik(true), emitting static=xml2 (+ transitive -lm), for a SONAME-independent self-contained downstream binary. Default (env unset) is unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Adds runtime (default) / static cargo features selecting how bindgen finds libclang. `--no-default-features --features static` routes bindgen to clang-sys/static for fully static / musl / Alpine builds where dlopen of libclang is unavailable. Orthogonal to LIBXML2_STATIC (which links libxml2 itself); together they close #110. Default behavior unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.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.
Opt-in static linking of libxml2, gated on the
LIBXML2_STATICenv var.When set (with
PKG_CONFIG_PATHpointing at a non-system prefix holding a PIClibxml2.a),build.rsprobes via pkg-config with.statik(true), emittingcargo:rustc-link-lib=static=xml2(+ transitive-lm). This lets a downstream binary avoid any runtimelibxml2.sodependency — relevant now that libxml2 2.14 bumped its SONAME.so.2→.so.16, so a dynamically-linked binary loads on only one side of that split.Default (env unset) is unchanged: a normal dynamic link against the host libxml2. Adds
cargo:rerun-if-env-changed=LIBXML2_STATIC. Bumps version to 0.3.13.🤖 Generated with Claude Code