Do not rebuild LLVM for x.py check

This commit is contained in:
varkor 2018-04-18 00:50:41 +01:00
parent f31c01c713
commit 1db9fabdf7
3 changed files with 13 additions and 3 deletions

View File

@ -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() {

View File

@ -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,

View File

@ -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)