From 13c44daf9ada0f9d6c7f9585c04058880f5aa457 Mon Sep 17 00:00:00 2001 From: Valentin Haudiquet Date: Mon, 26 Jan 2026 10:31:58 +0100 Subject: [PATCH] deb: allow use parallel building --- src/deb/local.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/deb/local.rs b/src/deb/local.rs index 79f8db4..bcf7f30 100644 --- a/src/deb/local.rs +++ b/src/deb/local.rs @@ -24,6 +24,26 @@ pub fn build( let ctx = context::current(); + // Parallel building: find local number of cores, and use that + let num_cores = ctx + .command("nproc") + .output() + .map(|output| { + if output.status.success() { + String::from_utf8_lossy(&output.stdout) + .trim() + .parse::() + .unwrap_or(1) + } else { + 1 // Default to 1 if nproc fails + } + }) + .unwrap_or(1); // Default to 1 if we can't execute the command + env.insert( + "DEB_BUILD_OPTIONS".to_string(), + format!("parallel={}", num_cores), + ); + if cross { log::debug!("Setting up environment for local cross build..."); cross::setup_environment(&mut env, arch)?;