refactor(config): dedup libzstd discovery into auto/zstd (CQ1)#53
Merged
Conversation
filter/config and static/config each carried a full copy of the static/dynamic/pkg-config libzstd discovery sequence, the NGX_LD_OPT append, and (in filter/config only) the version advisory. The copies had drifted: static/config's not-found error claimed the *filter* module was missing. Move the whole probe into a single auto/zstd helper, sourced once from the top-level config before either module is declared. Both module configs now just reuse the exported ngx_zstd_opt_I / ngx_zstd_opt_L. Error text is module-generic so it can't drift again, and the version advisory now also covers static-only builds. Each module sets ngx_module_libs=$ngx_zstd_opt_L explicitly. Addresses audit CQ1.
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.
Issue CQ1 (Low — code quality)
filter/configandstatic/configeach duplicated the entire libzstd static/dynamic/pkg-config discovery sequence. The copies had drifted:static/config's not-found error reported that the filter module was missing. Any future portability/linker/version fix had to be made twice.Fix
auto/zstdholds the discovery probe, theNGX_LD_OPTappend, and the libzstd version advisory.configsources it once before declaring either module.filter/configandstatic/configshrink to module-specific declarations only, reusing exportedngx_zstd_opt_I/ngx_zstd_opt_L; each setsngx_module_libs=\$ngx_zstd_opt_Lexplicitly.Verification
sh -nclean on all four scripts.libzstd-dev; full compile covered by CI runners).