Add a LIBGIT2_NO_VENDOR environment variable to build.rs #939
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 does the following things:
if cfg!(feature = "zlib-ng-compat") { ... }
instead of accessing the environment variable, but since this environment variable could also be set from outside of cargo I'm generatingcargo:rerun-if-env-changed=
output to let cargo know it needs to rebuild if they're changedLIBGIT2_NO_VENDOR
environment variable, this variable is supposed to deny vendoring even if the cargo featurelibgit2-sys/vendored
is enabled by any crate. If the system libgit2 is not present or not compatible it errors the build to let the maintainer know something needs to be fixed. This option would be especially useful for Linux package maintainers who always want to link the system library to avoid "shadow copies" of libgit2 embedded in binaries that are not known to the security team.The
LIBGIT2_NO_VENDOR
variable is analogous toOPENSSL_NO_VENDOR
in openssl-sys: sfackler/rust-openssl#1253There's currently no
Error
struct in the build.rs so I'm using aResult<(), ()>
, if you prefer anything else just let me know.