Skip to content

Commit

Permalink
Merge pull request #1045 from pbor/master
Browse files Browse the repository at this point in the history
Honor the PKG_CONFIG env var in the codegen for abi tests
  • Loading branch information
sdroege committed Jan 31, 2021
2 parents c85699a + d385e76 commit cbdc2e4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/codegen/sys/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ fn generate_abi_rs(

writeln!(w, "use std::env;")?;
writeln!(w, "use std::error::Error;")?;
writeln!(w, "use std::ffi::OsString;")?;
writeln!(w, "use std::path::Path;")?;
writeln!(w, "use std::mem::{{align_of, size_of}};")?;
writeln!(w, "use std::process::Command;")?;
Expand Down Expand Up @@ -342,7 +343,9 @@ fn pkg_config_cflags(packages: &[&str]) -> Result<Vec<String>, Box<dyn Error>> {
if packages.is_empty() {
return Ok(Vec::new());
}
let mut cmd = Command::new("pkg-config");
let pkg_config = env::var_os("PKG_CONFIG")
.unwrap_or_else(|| OsString::from("pkg-config"));
let mut cmd = Command::new(pkg_config);
cmd.arg("--cflags");
cmd.args(packages);
let out = cmd.output()?;
Expand Down

0 comments on commit cbdc2e4

Please sign in to comment.