Skip to content

Commit

Permalink
Sanitize calls to make
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcrichton committed Jun 19, 2017
1 parent 64f93ad commit 58e4dce
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ fn build_zlib() {
.env("CC", compiler.path())
.env("CFLAGS", cflags)
.arg(format!("--prefix={}", dst.display())), "sh");
run(Command::new("make")
.current_dir(&build)
.arg("libz.a"), "make");
run(make()
.current_dir(&build)
.arg("libz.a"), "make");

t!(fs::create_dir_all(dst.join("lib/pkgconfig")));
t!(fs::create_dir_all(dst.join("include")));
Expand All @@ -88,6 +88,17 @@ fn build_zlib() {
println!("cargo:include={}/include", dst.to_string_lossy());
}

fn make() -> Command {
let cmd = if cfg!(target_os = "freebsd") {"gmake"} else {"make"};
let mut cmd = Command::new(cmd);
// We're using the MSYS make which doesn't work with the mingw32-make-style
// MAKEFLAGS, so remove that from the env if present.
if cfg!(windows) {
cmd.env_remove("MAKEFLAGS").env_remove("MFLAGS");
}
return cmd
}

// We have to run a few shell scripts, which choke quite a bit on both `\`
// characters and on `C:\` paths, so normalize both of them away.
fn sanitize_sh(path: &Path) -> String {
Expand Down

0 comments on commit 58e4dce

Please sign in to comment.