Skip to content

Commit 5c90aa4

Browse files
committed
Fix windows build
Do not set MAKEFLAGS when building for windows as the make used doesn't support the --jobserver arg
1 parent e2d4a2c commit 5c90aa4

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

build.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,22 @@ fn main() {
3434
make = OsStr::new("mozmake").to_os_string();
3535
}
3636

37-
let result = Command::new(make)
38-
.env("MAKEFLAGS", env::var("CARGO_MAKEFLAGS").unwrap_or_default())
39-
.args(&["-R", "-f", "makefile.cargo"])
37+
let mut cmd = Command::new(make);
38+
39+
// We're using the MSYS make which doesn't work with the mingw32-make-style
40+
// MAKEFLAGS, so remove that from the env if present.
41+
if cfg!(windows) {
42+
cmd.env_remove("MAKEFLAGS").env_remove("MFLAGS");
43+
} else if let Some(makeflags) = env::var_os("CARGO_MAKEFLAGS") {
44+
cmd.env("MAKEFLAGS", makeflags);
45+
}
46+
47+
let result = cmd.args(&["-R", "-f", "makefile.cargo"])
4048
.stdout(Stdio::inherit())
4149
.stderr(Stdio::inherit())
4250
.status()
4351
.expect("Failed to run `make`");
52+
4453
assert!(result.success());
4554
println!("cargo:rustc-link-search=native={}/js/src", out_dir);
4655
println!("cargo:rustc-link-lib=static=js_static"); // Must come before c++

0 commit comments

Comments
 (0)