From 3e7543a16ec6450b8fe0c3d50bc341b5f143cc54 Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Thu, 15 Dec 2016 08:23:33 -0700 Subject: WIP: Cross-compilation for Redox target --- src/liballoc_jemalloc/build.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/liballoc_jemalloc') diff --git a/src/liballoc_jemalloc/build.rs b/src/liballoc_jemalloc/build.rs index fc849e7a50c..e0763276113 100644 --- a/src/liballoc_jemalloc/build.rs +++ b/src/liballoc_jemalloc/build.rs @@ -36,7 +36,8 @@ fn main() { // targets, which means we have to build the alloc_jemalloc crate // for targets like emscripten, even if we don't use it. if target.contains("rumprun") || target.contains("bitrig") || target.contains("openbsd") || - target.contains("msvc") || target.contains("emscripten") || target.contains("fuchsia") { + target.contains("msvc") || target.contains("emscripten") || target.contains("fuchsia") || + target.contains("redox") { println!("cargo:rustc-cfg=dummy_jemalloc"); return; } -- cgit 1.4.1-3-g733a5 From a7d9025e40a55d5d8ddeb2f35075512055c363ca Mon Sep 17 00:00:00 2001 From: Sébastien Marie Date: Sat, 17 Dec 2016 20:09:23 +0100 Subject: let BSD to use gmake for GNU-make 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 --- src/Cargo.lock | 1 + src/bootstrap/check.rs | 4 +++- src/build_helper/lib.rs | 10 ++++++++++ src/liballoc_jemalloc/build.rs | 2 +- src/libstd/build.rs | 2 +- src/tools/compiletest/Cargo.toml | 1 + src/tools/compiletest/src/runtest.rs | 4 +++- 7 files changed, 20 insertions(+), 4 deletions(-) (limited to 'src/liballoc_jemalloc') diff --git a/src/Cargo.lock b/src/Cargo.lock index 9cd77e71b82..01a19a0cca8 100644 --- a/src/Cargo.lock +++ b/src/Cargo.lock @@ -87,6 +87,7 @@ dependencies = [ name = "compiletest" version = "0.0.0" dependencies = [ + "build_helper 0.1.0", "env_logger 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "serialize 0.0.0", diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs index 712c4c52baa..aa15825d829 100644 --- a/src/bootstrap/check.rs +++ b/src/bootstrap/check.rs @@ -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; @@ -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)); } diff --git a/src/build_helper/lib.rs b/src/build_helper/lib.rs index bd036fae689..d0d588f46a7 100644 --- a/src/build_helper/lib.rs +++ b/src/build_helper/lib.rs @@ -63,6 +63,16 @@ pub fn cc2ar(cc: &Path, target: &str) -> Option { } } +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, diff --git a/src/liballoc_jemalloc/build.rs b/src/liballoc_jemalloc/build.rs index fc849e7a50c..60b7875a97c 100644 --- a/src/liballoc_jemalloc/build.rs +++ b/src/liballoc_jemalloc/build.rs @@ -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"); diff --git a/src/libstd/build.rs b/src/libstd/build.rs index 1087d1f2447..b3eba508316 100644 --- a/src/libstd/build.rs +++ b/src/libstd/build.rs @@ -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"))); diff --git a/src/tools/compiletest/Cargo.toml b/src/tools/compiletest/Cargo.toml index 227b695635d..faf0a0eaa81 100644 --- a/src/tools/compiletest/Cargo.toml +++ b/src/tools/compiletest/Cargo.toml @@ -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" } diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 3cc14541fcd..d33a176b914 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -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}; @@ -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) -- cgit 1.4.1-3-g733a5