You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
74 lines
2.5 KiB
74 lines
2.5 KiB
From 16924a64fa662d649590a0a26d7f280616651435 Mon Sep 17 00:00:00 2001
|
|
From: Fabio Valentini <decathorpe@gmail.com>
|
|
Date: Tue, 19 Sep 2023 22:02:24 +0200
|
|
Subject: [PATCH] build with vendored libgit2 unconditionally
|
|
|
|
---
|
|
build.rs | 47 -----------------------------------------------
|
|
1 file changed, 47 deletions(-)
|
|
|
|
diff --git a/build.rs b/build.rs
|
|
index b497005..4bf1136 100644
|
|
--- a/build.rs
|
|
+++ b/build.rs
|
|
@@ -4,56 +4,9 @@ use std::io;
|
|
use std::path::{Path, PathBuf};
|
|
use std::process::Command;
|
|
|
|
-/// Tries to use system libgit2 and emits necessary build script instructions.
|
|
-fn try_system_libgit2() -> Result<pkg_config::Library, pkg_config::Error> {
|
|
- let mut cfg = pkg_config::Config::new();
|
|
- match cfg.range_version("1.7.1".."1.8.0").probe("libgit2") {
|
|
- Ok(lib) => {
|
|
- for include in &lib.include_paths {
|
|
- println!("cargo:root={}", include.display());
|
|
- }
|
|
- Ok(lib)
|
|
- }
|
|
- Err(e) => {
|
|
- println!("cargo:warning=failed to probe system libgit2: {e}");
|
|
- Err(e)
|
|
- }
|
|
- }
|
|
-}
|
|
-
|
|
fn main() {
|
|
let https = env::var("CARGO_FEATURE_HTTPS").is_ok();
|
|
let ssh = env::var("CARGO_FEATURE_SSH").is_ok();
|
|
- let vendored = env::var("CARGO_FEATURE_VENDORED").is_ok();
|
|
- let zlib_ng_compat = env::var("CARGO_FEATURE_ZLIB_NG_COMPAT").is_ok();
|
|
-
|
|
- // 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 to revert
|
|
- // it back. This env var serves as a workaround for this purpose.
|
|
- println!("cargo:rerun-if-env-changed=LIBGIT2_NO_VENDOR");
|
|
- let forced_no_vendor = env::var_os("LIBGIT2_NO_VENDOR").map_or(false, |s| s != "0");
|
|
-
|
|
- if forced_no_vendor {
|
|
- if try_system_libgit2().is_err() {
|
|
- panic!(
|
|
- "\
|
|
-The environment variable `LIBGIT2_NO_VENDOR` has been set but no compatible system libgit2 could be found.
|
|
-The build is now aborting. To disable, unset the variable or use `LIBGIT2_NO_VENDOR=0`.
|
|
-",
|
|
- );
|
|
- }
|
|
-
|
|
- // We've reached here, implying we're using system libgit2.
|
|
- return;
|
|
- }
|
|
-
|
|
- // To use zlib-ng in zlib-compat mode, we have to build libgit2 ourselves.
|
|
- let try_to_use_system_libgit2 = !vendored && !zlib_ng_compat;
|
|
- if try_to_use_system_libgit2 && try_system_libgit2().is_ok() {
|
|
- // using system libgit2 has worked
|
|
- return;
|
|
- }
|
|
|
|
println!("cargo:rustc-cfg=libgit2_vendored");
|
|
|
|
--
|
|
2.41.0
|
|
|