parent
4edc68c05c
commit
985d718af2
@ -1,35 +1,73 @@
|
|||||||
From 9da92f6c0981aae2f4e6267e4a1cb4eaf0b92357 Mon Sep 17 00:00:00 2001
|
From 16924a64fa662d649590a0a26d7f280616651435 Mon Sep 17 00:00:00 2001
|
||||||
From: Fabio Valentini <decathorpe@gmail.com>
|
From: Fabio Valentini <decathorpe@gmail.com>
|
||||||
Date: Thu, 13 Jul 2023 13:53:24 +0200
|
Date: Tue, 19 Sep 2023 22:02:24 +0200
|
||||||
Subject: [PATCH] build with vendored libgit2 unconditionally
|
Subject: [PATCH] build with vendored libgit2 unconditionally
|
||||||
|
|
||||||
---
|
---
|
||||||
build.rs | 12 ------------
|
build.rs | 47 -----------------------------------------------
|
||||||
1 file changed, 12 deletions(-)
|
1 file changed, 47 deletions(-)
|
||||||
|
|
||||||
diff --git a/build.rs b/build.rs
|
diff --git a/build.rs b/build.rs
|
||||||
index 24df572..7b551a7 100644
|
index b497005..4bf1136 100644
|
||||||
--- a/build.rs
|
--- a/build.rs
|
||||||
+++ b/build.rs
|
+++ b/build.rs
|
||||||
@@ -10,18 +10,6 @@ fn main() {
|
@@ -4,56 +4,9 @@ use std::io;
|
||||||
let vendored = env::var("CARGO_FEATURE_VENDORED").is_ok();
|
use std::path::{Path, PathBuf};
|
||||||
let zlib_ng_compat = env::var("CARGO_FEATURE_ZLIB_NG_COMPAT").is_ok();
|
use std::process::Command;
|
||||||
|
|
||||||
- // To use zlib-ng in zlib-compat mode, we have to build libgit2 ourselves.
|
-/// Tries to use system libgit2 and emits necessary build script instructions.
|
||||||
- let try_to_use_system_libgit2 = !vendored && !zlib_ng_compat;
|
-fn try_system_libgit2() -> Result<pkg_config::Library, pkg_config::Error> {
|
||||||
- if try_to_use_system_libgit2 {
|
|
||||||
- let mut cfg = pkg_config::Config::new();
|
- let mut cfg = pkg_config::Config::new();
|
||||||
- if let Ok(lib) = cfg.range_version("1.6.4".."1.7.0").probe("libgit2") {
|
- match cfg.range_version("1.7.1".."1.8.0").probe("libgit2") {
|
||||||
|
- Ok(lib) => {
|
||||||
- for include in &lib.include_paths {
|
- for include in &lib.include_paths {
|
||||||
- println!("cargo:root={}", include.display());
|
- println!("cargo:root={}", include.display());
|
||||||
- }
|
- }
|
||||||
- return;
|
- 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");
|
println!("cargo:rustc-cfg=libgit2_vendored");
|
||||||
|
|
||||||
if !Path::new("libgit2/src").exists() {
|
|
||||||
--
|
--
|
||||||
2.41.0
|
2.41.0
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
SHA512 (libgit2-sys-0.15.2+1.6.4.crate) = 28b66ffe6da956bd1127aef295b222b55681b25c1820e016284802531f5360e6d21c11c695be569d26a318321868a0ce0b2c848bfcc887f09f47fbaadb13b478
|
SHA512 (libgit2-sys-0.16.1+1.7.1.crate) = 746e80309af40af7f6d11a7d45721054a6b7f456e10af5b25ea5ddc3ae1f8d934196e9e3b9948f7d7b41b6d9dc45a660874029a39c1c3d67307daebae3f2cb69
|
||||||
|
Loading…
Reference in new issue