Skip to content

Commit 1db9fab

Browse files
committed
Do not rebuild LLVM for x.py check
1 parent f31c01c commit 1db9fab

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

src/bootstrap/builder.rs

+6
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,12 @@ impl<'a> Builder<'a> {
552552
.arg("--target")
553553
.arg(target);
554554

555+
// Set a flag for `check` so that certain build scripts can do less work
556+
// (e.g. not building/requiring LLVM).
557+
if cmd == "check" {
558+
cargo.env("RUST_CHECK", "1");
559+
}
560+
555561
// If we were invoked from `make` then that's already got a jobserver
556562
// set up for us so no need to tell Cargo about jobs all over again.
557563
if env::var_os("MAKEFLAGS").is_none() && env::var_os("MFLAGS").is_none() {

src/bootstrap/check.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
//! Implementation of compiling the compiler and standard library, in "check" mode.
1212
1313
use compile::{run_cargo, std_cargo, test_cargo, rustc_cargo, rustc_cargo_env, add_to_sysroot};
14-
use compile::build_codegen_backend;
1514
use builder::{RunConfig, Builder, ShouldRun, Step};
1615
use {Compiler, Mode};
1716
use cache::{INTERNER, Interned};
@@ -138,11 +137,11 @@ impl Step for CodegenBackend {
138137
let backend = self.backend;
139138

140139
let mut cargo = builder.cargo(compiler, Mode::Librustc, target, "check");
141-
let mut features = build.rustc_features().to_string();
140+
let features = build.rustc_features().to_string();
142141
cargo.arg("--manifest-path").arg(build.src.join("src/librustc_trans/Cargo.toml"));
143142
rustc_cargo_env(build, &mut cargo);
144143

145-
features += &build_codegen_backend(&builder, &mut cargo, &compiler, target, backend);
144+
// We won't build LLVM if it's not available, as it shouldn't affect `check`.
146145

147146
let _folder = build.fold_output(|| format!("stage{}-rustc_trans", compiler.stage));
148147
run_cargo(build,

src/librustc_llvm/build.rs

+5
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ fn detect_llvm_link() -> (&'static str, &'static str) {
2828
}
2929

3030
fn main() {
31+
if env::var_os("RUST_CHECK").is_some() {
32+
// If we're just running `check`, there's no need for LLVM to be built.
33+
return;
34+
}
35+
3136
let target = env::var("TARGET").expect("TARGET was not set");
3237
let llvm_config = env::var_os("LLVM_CONFIG")
3338
.map(PathBuf::from)

0 commit comments

Comments
 (0)