This commit is contained in:
@@ -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::<usize>()
|
||||
.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)?;
|
||||
|
||||
Reference in New Issue
Block a user