Skip to content

Commit

Permalink
Fix build on windows-gnu
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcrichton committed Jun 13, 2017
1 parent d430e21 commit c76778a
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions lzma-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,17 +133,29 @@ fn main() {
}

run(&mut cmd);
run(Command::new("make")
run(make()
.arg(&format!("-j{}", env::var("NUM_JOBS").unwrap()))
.current_dir(&dst.join("build")));
// Unset DESTDIR or liblzma.a ends up in it and cargo can't find it
env::remove_var("DESTDIR");
run(Command::new("make")
run(make()
.arg("install")
.current_dir(&dst.join("build/src/liblzma")));
}
}

fn make() -> Command {
let mut cmd = Command::new("make");

// 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
}

fn try_run(cmd: &mut Command) -> bool {
println!("running: {:?}", cmd);
t!(cmd.status()).success()
Expand Down

0 comments on commit c76778a

Please sign in to comment.