From b494038c4b66e81dd4150bd031f6e3f7f00c3128 Mon Sep 17 00:00:00 2001 From: Dan Date: Sun, 5 May 2024 17:53:20 -0400 Subject: [PATCH] update portaudio (#190) * update portaudio can't use a modern static portaudio via pkg_config because of https://github.com/rust-lang/pkg-config-rs/issues/102 * allow passing extra args to portaudio configure --------- Co-authored-by: Dan --- rust-portaudio-sys/build.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/rust-portaudio-sys/build.rs b/rust-portaudio-sys/build.rs index af2eb17..09f5840 100644 --- a/rust-portaudio-sys/build.rs +++ b/rust-portaudio-sys/build.rs @@ -33,6 +33,7 @@ fn main() { println!("cargo:rerun-if-changed=build.rs"); println!("cargo:rerun-if-env-changed=PORTAUDIO_ONLY_STATIC"); + println!("cargo:rerun-if-env-changed=PORTAUDIO_CONFIGURE_EXTRA_ARGS"); if env::var("PORTAUDIO_ONLY_STATIC").is_err() { // If pkg-config finds a library on the system, we are done if pkg_config::Config::new().atleast_version("19").find("portaudio-2.0").is_ok() { @@ -83,8 +84,8 @@ mod unix_platform { use super::{err_to_panic, run}; - pub const PORTAUDIO_URL: &'static str = "http://www.portaudio.com/archives/pa_stable_v19_20140130.tgz"; - pub const PORTAUDIO_TAR: &'static str = "pa_stable_v19_20140130.tgz"; + pub const PORTAUDIO_URL: &'static str = "https://files.portaudio.com/archives/pa_stable_v190700_20210406.tgz"; + pub const PORTAUDIO_TAR: &'static str = "pa_stable_v190700_20210406.tgz"; pub const PORTAUDIO_FOLDER: &'static str = "portaudio"; pub fn download() { @@ -99,10 +100,15 @@ mod unix_platform { err_to_panic(env::set_current_dir(PORTAUDIO_FOLDER)); // run portaudio autoconf - run(Command::new("./configure") + let mut cmd = Command::new("./configure"); + cmd .args(&["--disable-shared", "--enable-static"]) // Only build static lib .args(&["--prefix", out_dir.to_str().unwrap()]) // Install on the outdir - .arg("--with-pic")); // Build position-independent code (required by Rust) + .arg("--with-pic"); // Build position-independent code (required by Rust) + if let Ok(extra_args) = env::var("PORTAUDIO_CONFIGURE_EXTRA_ARGS") { + cmd.args(extra_args.split(" ")); + } + run(&mut cmd); // then make run(&mut Command::new("make"));