diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2016-12-20 11:16:40 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2016-12-20 12:59:07 -0800 |
| commit | 60842c1c1fdb69bccc58613e26f1c9661ca8bd39 (patch) | |
| tree | f4c8c604dacf2d9b3fd1d491fb1bd3976238340e | |
| parent | a8e7f9530a623ea7ca37c556c2822ae8c3bfa339 (diff) | |
| parent | 2c39ee12a99f9548a5e379e8bcea4f7923028fee (diff) | |
| download | rust-60842c1c1fdb69bccc58613e26f1c9661ca8bd39.tar.gz rust-60842c1c1fdb69bccc58613e26f1c9661ca8bd39.zip | |
Rollup merge of #38451 - semarie:openbsd-rustbuild, r=alexcrichton
adaptation to rustbuild for openbsd Since the switch to rustbuild, the build for openbsd is broken: - [X] `ar` inference based on compiler name is wrong (OpenBSD usually use `egcc`, but `ear` doesn't exist) - [X] `make` isn't GNU-make under OpenBSD (and others BSD platforms) - [x] `stdc++` isn't the right stdc++ library to link with (it should be `estdc++`) - [x] corrects tests that don't pass anymore (problems related to rustbuild) r? @alexcrichton
| -rw-r--r-- | src/Cargo.lock | 1 | ||||
| -rw-r--r-- | src/bootstrap/check.rs | 4 | ||||
| -rw-r--r-- | src/build_helper/lib.rs | 12 | ||||
| -rw-r--r-- | src/liballoc_jemalloc/build.rs | 2 | ||||
| -rw-r--r-- | src/librustc_llvm/build.rs | 11 | ||||
| -rw-r--r-- | src/libstd/build.rs | 2 | ||||
| -rw-r--r-- | src/test/run-pass/backtrace.rs | 1 | ||||
| -rw-r--r-- | src/tools/compiletest/Cargo.toml | 1 | ||||
| -rw-r--r-- | src/tools/compiletest/src/runtest.rs | 4 |
9 files changed, 32 insertions, 6 deletions
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 881da7b682b..e7b0afeb8ce 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 07f9c91d3c7..d0d588f46a7 100644 --- a/src/build_helper/lib.rs +++ b/src/build_helper/lib.rs @@ -47,6 +47,8 @@ pub fn cc2ar(cc: &Path, target: &str) -> Option<PathBuf> { None } else if target.contains("musl") { Some(PathBuf::from("ar")) + } else if target.contains("openbsd") { + Some(PathBuf::from("ar")) } else { let parent = cc.parent().unwrap(); let file = cc.file_name().unwrap().to_str().unwrap(); @@ -61,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, 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/librustc_llvm/build.rs b/src/librustc_llvm/build.rs index 50bc3e7b624..86c40a0208a 100644 --- a/src/librustc_llvm/build.rs +++ b/src/librustc_llvm/build.rs @@ -230,6 +230,13 @@ fn main() { } } + // OpenBSD has a particular C++ runtime library name + let stdcppname = if target.contains("openbsd") { + "estdc++" + } else { + "stdc++" + }; + // C++ runtime library if !target.contains("msvc") { if let Some(s) = env::var_os("LLVM_STATIC_STDCPP") { @@ -237,11 +244,11 @@ fn main() { let path = PathBuf::from(s); println!("cargo:rustc-link-search=native={}", path.parent().unwrap().display()); - println!("cargo:rustc-link-lib=static=stdc++"); + println!("cargo:rustc-link-lib=static={}", stdcppname); } else if cxxflags.contains("stdlib=libc++") { println!("cargo:rustc-link-lib=c++"); } else { - println!("cargo:rustc-link-lib=stdc++"); + println!("cargo:rustc-link-lib={}", stdcppname); } } } 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/test/run-pass/backtrace.rs b/src/test/run-pass/backtrace.rs index c438c17f51e..75c665b04a1 100644 --- a/src/test/run-pass/backtrace.rs +++ b/src/test/run-pass/backtrace.rs @@ -10,6 +10,7 @@ // ignore-android FIXME #17520 // ignore-emscripten spawning processes is not supported +// ignore-openbsd no support for libbacktrace without filename // compile-flags:-g use std::env; 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 d65205fe65a..9e2416fca81 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) |
