Allow LIBZ_SYS_STATIC=0 to force system libz - #275
Open
Byron wants to merge 2 commits into
Open
Conversation
<!-- agent --> Describe the complete selection order for stock zlib and zlib-ng, including feature and environment precedence, platform-specific discovery, fallback behavior, bundled compilation details, generated files, and Cargo metadata. Assisted-by: GPT 5.6 Co-authored-by: GPT 5.6 <codex@openai.com>
Issue #201 asks for a build-environment override that reliably links an existing libz instead of falling back to the bundled source. Previously LIBZ_SYS_STATIC=0 only disabled the static preference, so failed discovery still compiled vendored zlib. Make zero override implementation and platform choices while retaining pkg-config and vcpkg metadata. Skip the compiler probe and bundled fallback, then link z directly. Add an Ubuntu CI script that enables the static feature with CC=false, builds tests without running them, requires the system z link directive, rejects a static z directive, and verifies that no bundled libz.a was produced. Validation: ci/test-force-system.bash; cargo test; cargo test --all-features; cargo run --manifest-path systest/Cargo.toml --all-features (264 passed); LIBZ_SYS_STATIC=1 cargo test; rustfmt --check build.rs; git diff --check.
Byron
force-pushed
the
build-rs-docs-and-libz-override
branch
from
August 4, 2026 08:45
cb92551 to
e11f168
Compare
Byron
marked this pull request as ready for review
August 4, 2026 08:49
This was referenced Aug 4, 2026
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.
This PR is an attempt to regain control over the
build.rsscript which is documented only in code, and has no tests beyond what normally executes on CI.To achieve that, it adds module-level documentation to declare the status quo as intent. From there, it makes one change as requested in #201, which seems to make sense and I tend to consider it a fix, rather than a breaking change. But that's quite debatable.
Notes for the Reviewer
I hope we can figure out what to do about build.rs to make it maintainable again, and how to introduce validated changes.
Shortcomings of my review
build.rs, but think the script would most definitely fail as it checks build.rs output.Also, there are many other ways to address #201, including to not change
LIBZ_SYS_STATICbehaviour at all, which this PR currently claims to fix. Otherwise, we'd probably be able to continue with something like #206.An unanswered question is if
LIBZ_SYS_STATIC=1should also be overriding, which to me feels like it.Tasks
This section is for Byron only. Models continuing this PR must not add, remove, check, uncheck, rename, or reorder checkboxes here.
refackiewreviewEverything below this line was generated by Codex GPT-5.
Created by Codex on behalf of Byron. Byron will review before this is ready to merge.
Fixes #201.
Requested follow-up: #201 (comment)
Summary
LIBZ_SYS_STATIC=0override implementation and platform choices so an existing system libz is always usedstaticfeatureValidation
PKG_CONFIG=false CC=false LIBZ_SYS_STATIC=0 cargo test --features staticcargo testcargo test --all-featurescargo run --manifest-path systest/Cargo.toml --all-features(264 tests passed)LIBZ_SYS_STATIC=1 cargo testrustfmt --check build.rsgit diff --checkCodex commit review was run once for each commit hash. The first review was clean; the behavior review identified missing include metadata, which was preserved in the refreshed commit, and the refreshed commit review was clean.