diff options
| author | varkor <github@varkor.com> | 2018-04-18 00:50:41 +0100 |
|---|---|---|
| committer | varkor <github@varkor.com> | 2018-04-18 10:49:00 +0100 |
| commit | 1db9fabdf7ba45fcb5ee184254cabd696faf6414 (patch) | |
| tree | 57bd36c42c22e6586bae0f676bff25e1b74a8516 | |
| parent | f31c01c713de320b4f5de7670c6fedfad48401e4 (diff) | |
| download | rust-1db9fabdf7ba45fcb5ee184254cabd696faf6414.tar.gz rust-1db9fabdf7ba45fcb5ee184254cabd696faf6414.zip | |
Do not rebuild LLVM for x.py check
| -rw-r--r-- | src/bootstrap/builder.rs | 6 | ||||
| -rw-r--r-- | src/bootstrap/check.rs | 5 | ||||
| -rw-r--r-- | src/librustc_llvm/build.rs | 5 |
3 files changed, 13 insertions, 3 deletions
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index dcc4134b2f3..872271c453e 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -552,6 +552,12 @@ impl<'a> Builder<'a> { .arg("--target") .arg(target); + // Set a flag for `check` so that certain build scripts can do less work + // (e.g. not building/requiring LLVM). + if cmd == "check" { + cargo.env("RUST_CHECK", "1"); + } + // If we were invoked from `make` then that's already got a jobserver // set up for us so no need to tell Cargo about jobs all over again. if env::var_os("MAKEFLAGS").is_none() && env::var_os("MFLAGS").is_none() { diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs index d7b8fa36b7f..61e02b25e58 100644 --- a/src/bootstrap/check.rs +++ b/src/bootstrap/check.rs @@ -11,7 +11,6 @@ //! Implementation of compiling the compiler and standard library, in "check" mode. use compile::{run_cargo, std_cargo, test_cargo, rustc_cargo, rustc_cargo_env, add_to_sysroot}; -use compile::build_codegen_backend; use builder::{RunConfig, Builder, ShouldRun, Step}; use {Compiler, Mode}; use cache::{INTERNER, Interned}; @@ -138,11 +137,11 @@ impl Step for CodegenBackend { let backend = self.backend; let mut cargo = builder.cargo(compiler, Mode::Librustc, target, "check"); - let mut features = build.rustc_features().to_string(); + let features = build.rustc_features().to_string(); cargo.arg("--manifest-path").arg(build.src.join("src/librustc_trans/Cargo.toml")); rustc_cargo_env(build, &mut cargo); - features += &build_codegen_backend(&builder, &mut cargo, &compiler, target, backend); + // We won't build LLVM if it's not available, as it shouldn't affect `check`. let _folder = build.fold_output(|| format!("stage{}-rustc_trans", compiler.stage)); run_cargo(build, diff --git a/src/librustc_llvm/build.rs b/src/librustc_llvm/build.rs index 54e3f544acb..d09a3e8b9da 100644 --- a/src/librustc_llvm/build.rs +++ b/src/librustc_llvm/build.rs @@ -28,6 +28,11 @@ fn detect_llvm_link() -> (&'static str, &'static str) { } fn main() { + if env::var_os("RUST_CHECK").is_some() { + // If we're just running `check`, there's no need for LLVM to be built. + return; + } + let target = env::var("TARGET").expect("TARGET was not set"); let llvm_config = env::var_os("LLVM_CONFIG") .map(PathBuf::from) |
