From 2d8dd6c0a53cb25ad2665b03e93bc68dc74d4a14 Mon Sep 17 00:00:00 2001 From: FreezyLemon Date: Sun, 7 Apr 2024 12:37:03 +0200 Subject: [PATCH] Remove num_cpus dependency available_parallelism is stable in Rust 1.59.0 --- ffmpeg-sys-the-third/Cargo.toml | 1 - ffmpeg-sys-the-third/build.rs | 10 +++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ffmpeg-sys-the-third/Cargo.toml b/ffmpeg-sys-the-third/Cargo.toml index 49918ff..a184362 100644 --- a/ffmpeg-sys-the-third/Cargo.toml +++ b/ffmpeg-sys-the-third/Cargo.toml @@ -24,7 +24,6 @@ doctest = false libc = "0.2" [build-dependencies] -num_cpus = "1.11" cc = "1.0" pkg-config = "0.3" bindgen = { version = "0.64", default-features = false, features = ["runtime"] } diff --git a/ffmpeg-sys-the-third/build.rs b/ffmpeg-sys-the-third/build.rs index 7e43063..f84acde 100644 --- a/ffmpeg-sys-the-third/build.rs +++ b/ffmpeg-sys-the-third/build.rs @@ -1,6 +1,5 @@ extern crate bindgen; extern crate cc; -extern crate num_cpus; extern crate pkg_config; use std::env; @@ -465,10 +464,15 @@ fn build() -> io::Result<()> { )); } + let num_jobs = if let Ok(cpus) = std::thread::available_parallelism() { + cpus.to_string() + } else { + "1".to_string() + }; + // run make if !Command::new("make") - .arg("-j") - .arg(num_cpus::get().to_string()) + .arg(format!("-j{num_jobs}")) .current_dir(&source()) .status()? .success()