Skip to content

Commit b494038

Browse files
dansgithubuserDan
andauthored
update portaudio (#190)
* update portaudio can't use a modern static portaudio via pkg_config because of rust-lang/pkg-config-rs#102 * allow passing extra args to portaudio configure --------- Co-authored-by: Dan <[email protected]>
1 parent 9b7dfad commit b494038

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

rust-portaudio-sys/build.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ fn main() {
3333
println!("cargo:rerun-if-changed=build.rs");
3434

3535
println!("cargo:rerun-if-env-changed=PORTAUDIO_ONLY_STATIC");
36+
println!("cargo:rerun-if-env-changed=PORTAUDIO_CONFIGURE_EXTRA_ARGS");
3637
if env::var("PORTAUDIO_ONLY_STATIC").is_err() {
3738
// If pkg-config finds a library on the system, we are done
3839
if pkg_config::Config::new().atleast_version("19").find("portaudio-2.0").is_ok() {
@@ -83,8 +84,8 @@ mod unix_platform {
8384

8485
use super::{err_to_panic, run};
8586

86-
pub const PORTAUDIO_URL: &'static str = "http://www.portaudio.com/archives/pa_stable_v19_20140130.tgz";
87-
pub const PORTAUDIO_TAR: &'static str = "pa_stable_v19_20140130.tgz";
87+
pub const PORTAUDIO_URL: &'static str = "https://files.portaudio.com/archives/pa_stable_v190700_20210406.tgz";
88+
pub const PORTAUDIO_TAR: &'static str = "pa_stable_v190700_20210406.tgz";
8889
pub const PORTAUDIO_FOLDER: &'static str = "portaudio";
8990

9091
pub fn download() {
@@ -99,10 +100,15 @@ mod unix_platform {
99100
err_to_panic(env::set_current_dir(PORTAUDIO_FOLDER));
100101

101102
// run portaudio autoconf
102-
run(Command::new("./configure")
103+
let mut cmd = Command::new("./configure");
104+
cmd
103105
.args(&["--disable-shared", "--enable-static"]) // Only build static lib
104106
.args(&["--prefix", out_dir.to_str().unwrap()]) // Install on the outdir
105-
.arg("--with-pic")); // Build position-independent code (required by Rust)
107+
.arg("--with-pic"); // Build position-independent code (required by Rust)
108+
if let Ok(extra_args) = env::var("PORTAUDIO_CONFIGURE_EXTRA_ARGS") {
109+
cmd.args(extra_args.split(" "));
110+
}
111+
run(&mut cmd);
106112

107113
// then make
108114
run(&mut Command::new("make"));

0 commit comments

Comments
 (0)