Skip to content

build: opt-in static libxml2 link via LIBXML2_STATIC (v0.3.13)#202

Merged
dginev merged 2 commits into
masterfrom
feat/static-libxml2
Jun 11, 2026
Merged

build: opt-in static libxml2 link via LIBXML2_STATIC (v0.3.13)#202
dginev merged 2 commits into
masterfrom
feat/static-libxml2

Conversation

@dginev

@dginev dginev commented Jun 11, 2026

Copy link
Copy Markdown
Member

Opt-in static linking of libxml2, gated on the LIBXML2_STATIC env var.

When set (with PKG_CONFIG_PATH pointing at a non-system prefix holding a PIC libxml2.a), build.rs probes via pkg-config with .statik(true), emitting cargo:rustc-link-lib=static=xml2 (+ transitive -lm). This lets a downstream binary avoid any runtime libxml2.so dependency — 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

dginev and others added 2 commits June 11, 2026 15:49
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>
@dginev dginev merged commit a814737 into master Jun 11, 2026
18 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.

1 participant