Thread (15 messages) 15 messages, 3 authors, 2025-03-23
STALE463d
Revisions (2)
  1. v1 current
  2. v2 [diff vs current]

[RFC PATCH v1 3/4] libgit-sys: parallelize build with Cargo's jobserver

From: Josh Steadmon <hidden>
Date: 2025-03-18 23:24:31
Subsystem: the rest · Maintainer: Linus Torvalds

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 <redacted>
---
 contrib/libgit-sys/build.rs | 3 +++
 1 file changed, 3 insertions(+)
diff --git a/contrib/libgit-sys/build.rs b/contrib/libgit-sys/build.rs
index 9d586d272d..16e0d66afb 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([
@@ -33,6 +35,7 @@ pub fn main() -> std::io::Result<()> {
 
     let make_output = make_cmd::gnu_make()
         .env("DEVELOPER", "1")
+        .env("MAKEFLAGS", &makeflags)
         .env_remove("PROFILE")
         .current_dir(git_root.clone())
         .args([
-- 
2.49.0.rc1.451.g8f38331e32-goog
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help