Skip to content

Commit d8e8a50

Browse files
Building librustc_codegen_llvm in a separate directory
This allows clearing it out and building it separately from the compiler. Since it's essentially a different and separate crate this makes sense to do, each cargo invocation should generally happen in its own directory.
1 parent 73c7873 commit d8e8a50

File tree

5 files changed

+10
-54
lines changed

5 files changed

+10
-54
lines changed

src/Cargo.lock

-20
Original file line numberDiff line numberDiff line change
@@ -2184,30 +2184,10 @@ dependencies = [
21842184
name = "rustc_codegen_llvm"
21852185
version = "0.0.0"
21862186
dependencies = [
2187-
"bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
21882187
"cc 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)",
2189-
"env_logger 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)",
2190-
"flate2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
2191-
"jobserver 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
2192-
"libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)",
2193-
"log 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
21942188
"num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
2195-
"rustc 0.0.0",
21962189
"rustc-demangle 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
2197-
"rustc_allocator 0.0.0",
2198-
"rustc_apfloat 0.0.0",
2199-
"rustc_codegen_utils 0.0.0",
2200-
"rustc_data_structures 0.0.0",
2201-
"rustc_errors 0.0.0",
2202-
"rustc_incremental 0.0.0",
22032190
"rustc_llvm 0.0.0",
2204-
"rustc_mir 0.0.0",
2205-
"rustc_platform_intrinsics 0.0.0",
2206-
"rustc_target 0.0.0",
2207-
"serialize 0.0.0",
2208-
"syntax 0.0.0",
2209-
"syntax_pos 0.0.0",
2210-
"tempfile 3.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
22112191
]
22122192

22132193
[[package]]

src/bootstrap/check.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -137,16 +137,18 @@ impl Step for CodegenBackend {
137137
let target = self.target;
138138
let backend = self.backend;
139139

140+
let out_dir = builder.cargo_out(compiler, Mode::Codegen, target);
141+
builder.clear_if_dirty(&out_dir, &librustc_stamp(builder, compiler, target));
142+
140143
let mut cargo = builder.cargo(compiler, Mode::Codegen, target, "check");
141-
let features = builder.rustc_features().to_string();
142144
cargo.arg("--manifest-path").arg(builder.src.join("src/librustc_codegen_llvm/Cargo.toml"));
143145
rustc_cargo_env(builder, &mut cargo);
144146

145147
// We won't build LLVM if it's not available, as it shouldn't affect `check`.
146148

147149
let _folder = builder.fold_output(|| format!("stage{}-rustc_codegen_llvm", compiler.stage));
148150
run_cargo(builder,
149-
cargo.arg("--features").arg(features),
151+
&mut cargo,
150152
&codegen_backend_stamp(builder, compiler, target, backend),
151153
true);
152154
}

src/bootstrap/compile.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -670,16 +670,17 @@ impl Step for CodegenBackend {
670670
return;
671671
}
672672

673+
let out_dir = builder.cargo_out(compiler, Mode::Codegen, target);
674+
builder.clear_if_dirty(&out_dir, &librustc_stamp(builder, compiler, target));
675+
673676
let mut cargo = builder.cargo(compiler, Mode::Codegen, target, "build");
674-
let mut features = builder.rustc_features().to_string();
675677
cargo.arg("--manifest-path")
676678
.arg(builder.src.join("src/librustc_codegen_llvm/Cargo.toml"));
677679
rustc_cargo_env(builder, &mut cargo);
678680

679-
features += &build_codegen_backend(&builder, &mut cargo, &compiler, target, backend);
681+
let features = build_codegen_backend(&builder, &mut cargo, &compiler, target, backend);
680682

681-
let tmp_stamp = builder.cargo_out(compiler, Mode::Codegen, target)
682-
.join(".tmp.stamp");
683+
let tmp_stamp = out_dir.join(".tmp.stamp");
683684

684685
let _folder = builder.fold_output(|| format!("stage{}-rustc_codegen_llvm", compiler.stage));
685686
let files = run_cargo(builder,

src/bootstrap/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -555,8 +555,8 @@ impl Build {
555555
let suffix = match mode {
556556
Mode::Std => "-std",
557557
Mode::Test => "-test",
558-
Mode::Codegen => "-rustc",
559558
Mode::Rustc => "-rustc",
559+
Mode::Codegen => "-codegen",
560560
Mode::ToolBootstrap => "-bootstrap-tools",
561561
Mode::ToolStd => "-tools",
562562
Mode::ToolRustc => "-tools",

src/librustc_codegen_llvm/Cargo.toml

-27
Original file line numberDiff line numberDiff line change
@@ -10,39 +10,12 @@ crate-type = ["dylib"]
1010
test = false
1111

1212
[dependencies]
13-
bitflags = "1.0.1"
1413
cc = "1.0.1"
15-
flate2 = "1.0"
16-
jobserver = "0.1.5"
17-
libc = "0.2"
18-
log = "0.4"
1914
num_cpus = "1.0"
20-
rustc = { path = "../librustc" }
2115
rustc-demangle = "0.1.4"
22-
rustc_allocator = { path = "../librustc_allocator" }
23-
rustc_apfloat = { path = "../librustc_apfloat" }
24-
rustc_target = { path = "../librustc_target" }
25-
rustc_data_structures = { path = "../librustc_data_structures" }
26-
rustc_errors = { path = "../librustc_errors" }
27-
rustc_incremental = { path = "../librustc_incremental" }
2816
rustc_llvm = { path = "../librustc_llvm" }
29-
rustc_platform_intrinsics = { path = "../librustc_platform_intrinsics" }
30-
rustc_codegen_utils = { path = "../librustc_codegen_utils" }
31-
rustc_mir = { path = "../librustc_mir" }
32-
serialize = { path = "../libserialize" }
33-
syntax = { path = "../libsyntax" }
34-
syntax_pos = { path = "../libsyntax_pos" }
35-
tempfile = "3.0"
36-
37-
# not actually used but needed to make sure we enable the same feature set as
38-
# winapi used in librustc
39-
env_logger = { version = "0.5", default-features = false }
4017

4118
[features]
42-
# Used to communicate the feature to `rustc_target` in the same manner that the
43-
# `rustc` driver script communicate this.
44-
jemalloc = ["rustc_target/jemalloc"]
45-
4619
# This is used to convince Cargo to separately cache builds of `rustc_codegen_llvm`
4720
# when this option is enabled or not. That way we can build two, cache two
4821
# artifacts, and have nice speedy rebuilds.

0 commit comments

Comments
 (0)