build: LIBGIT2_NO_VENDOR
to force to use system libgit2
#966
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.
Specify
LIBGIT2_NO_VENDOR
to force to use system libgit2.Due to the additive nature of Cargo features, if some crate in the
dependency graph activates
vendored
feature, there is no way torevert it back. This env var serves as a workaround for this purpose.
An alternative is having
no_vendored
feature. We still need tomodify
build.rs
to make bothvendored
andno_vendored
playnice with each other (or bail out as they are mutual-exclusive).
However, there is no way to activate a Cargo feature via environment
variable (see rust-lang/cargo#4829). Altering environment variables
may be the only way to interact with some external build systems.
It is also pretty common that people don't want to vendor anything and
rather to see the build fail than vendoring.
Some prior arts:
OPENSSL_NO_VENDOR
inopenssl
crate, which serves the exactpurpose of
LIBGIT2_NO_VENDOR
1.ssh2
has a similarLIBSSH2_SYS_USE_PKG_CONFIG
, but itdoesn't force to do so. It still falls back to vendored lib 2.
curl
has a featureforce-system-lib-on-osx
to trump allothers features. It was created primarily for Rust releases 3.
Footnotes
https://github.com/sfackler/rust-openssl/blob/50787ed35bf9efa9dd3cbb1993a2564014b67489/openssl/src/lib.rs#L65 ↩
https://github.com/alexcrichton/ssh2-rs/blob/d9a1dfac4b8c09c5437eb477606b82aa4f67b092/libssh2-sys/build.rs#L22-L33 ↩
https://github.com/alexcrichton/curl-rust/blob/431babf1dffe205641793353d3d57fdd36fe8534/curl-sys/build.rs#L15-L20 ↩