diff mbox series

[v2,3/5] libgit-sys: parallelize build with Cargo's jobserver

Message ID a34e23a83d66feafcd8245419ee3f6681f4c93f3.1742594960.git.steadmon@google.com (mailing list archive)
State New
Headers show
Series Fix `cargo package` for libgit-sys | expand

Commit Message

Josh Steadmon March 21, 2025, 10:14 p.m. UTC
Cargo provides GNU Make flags that can be used to connect to its jobserver for
managing parallel builds. They are not automatically passed to any `make`
invocations, so let's add that to our build.rs script.

Signed-off-by: Josh Steadmon <steadmon@google.com>
---
 contrib/libgit-sys/build.rs | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/contrib/libgit-sys/build.rs b/contrib/libgit-sys/build.rs
index 19407663f5..1237c9a37f 100644
--- a/contrib/libgit-sys/build.rs
+++ b/contrib/libgit-sys/build.rs
@@ -8,9 +8,11 @@  pub fn main() -> std::io::Result<()> {
     let crate_root = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR").unwrap());
     let git_root = crate_root.join("git-src");
     let dst = PathBuf::from(env::var_os("OUT_DIR").unwrap());
+    let makeflags = env::var_os("CARGO_MAKEFLAGS").unwrap();
 
     let make_output = make_cmd::gnu_make()
         .env("DEVELOPER", "1")
+        .env("MAKEFLAGS", &makeflags)
         .env_remove("PROFILE")
         .current_dir(git_root.clone())
         .args([