Skip to content

Commit

Permalink
let BSD to use gmake for GNU-make
Browse files Browse the repository at this point in the history
the diff extends build_helper to provide an function to return the
expected name of GNU-make on the host: "make" or "gmake".

Fixes #38429
  • Loading branch information
semarie committed Dec 17, 2016
1 parent 9f8c1e2 commit a7d9025
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion src/bootstrap/check.rs
Expand Up @@ -13,6 +13,8 @@
//! This file implements the various regression test suites that we execute on
//! our CI.

extern crate build_helper;

use std::collections::HashSet;
use std::env;
use std::fmt;
Expand Down Expand Up @@ -543,7 +545,7 @@ pub fn distcheck(build: &Build) {
build.run(&mut cmd);
build.run(Command::new("./configure")
.current_dir(&dir));
build.run(Command::new("make")
build.run(Command::new(build_helper::make(&build.config.build))
.arg("check")
.current_dir(&dir));
}
10 changes: 10 additions & 0 deletions src/build_helper/lib.rs
Expand Up @@ -63,6 +63,16 @@ pub fn cc2ar(cc: &Path, target: &str) -> Option<PathBuf> {
}
}

pub fn make(host: &str) -> PathBuf {
if host.contains("bitrig") || host.contains("dragonfly") ||
host.contains("freebsd") || host.contains("netbsd") ||
host.contains("openbsd") {
PathBuf::from("gmake")
} else {
PathBuf::from("make")
}
}

pub fn output(cmd: &mut Command) -> String {
let output = match cmd.stderr(Stdio::inherit()).output() {
Ok(status) => status,
Expand Down
2 changes: 1 addition & 1 deletion src/liballoc_jemalloc/build.rs
Expand Up @@ -151,7 +151,7 @@ fn main() {
cmd.arg(format!("--build={}", build_helper::gnu_target(&host)));

run(&mut cmd);
let mut make = Command::new("make");
let mut make = Command::new(build_helper::make(&host));
make.current_dir(&build_dir)
.arg("build_lib_static");

Expand Down
2 changes: 1 addition & 1 deletion src/libstd/build.rs
Expand Up @@ -104,7 +104,7 @@ fn build_libbacktrace(host: &str, target: &str) {
.env("AR", &ar)
.env("RANLIB", format!("{} s", ar.display()))
.env("CFLAGS", cflags));
run(Command::new("make")
run(Command::new(build_helper::make(host))
.current_dir(&build_dir)
.arg(format!("INCDIR={}", src_dir.display()))
.arg("-j").arg(env::var("NUM_JOBS").expect("NUM_JOBS was not set")));
Expand Down
1 change: 1 addition & 0 deletions src/tools/compiletest/Cargo.toml
Expand Up @@ -8,3 +8,4 @@ build = "build.rs"
log = "0.3"
env_logger = { version = "0.3.5", default-features = false }
serialize = { path = "../../libserialize" }
build_helper = { path = "../../build_helper" }
4 changes: 3 additions & 1 deletion src/tools/compiletest/src/runtest.rs
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

extern crate build_helper;

use common::Config;
use common::{CompileFail, ParseFail, Pretty, RunFail, RunPass, RunPassValgrind};
use common::{Codegen, DebugInfoLldb, DebugInfoGdb, Rustdoc, CodegenUnits};
Expand Down Expand Up @@ -2108,7 +2110,7 @@ actual:\n\
}
self.create_dir_racy(&tmpdir);

let mut cmd = Command::new("make");
let mut cmd = Command::new(build_helper::make(&self.config.host));
cmd.current_dir(&self.testpaths.file)
.env("TARGET", &self.config.target)
.env("PYTHON", &self.config.docck_python)
Expand Down

0 comments on commit a7d9025

Please sign in to comment.