Skip to content

Commit a702acb

Browse files
committed
---
yaml --- r: 273173 b: refs/heads/beta c: 8cd1c17 h: refs/heads/master i: 273171: e6bb9ed
1 parent 24c3c97 commit a702acb

File tree

7 files changed

+111
-137
lines changed

7 files changed

+111
-137
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ refs/tags/0.9: 36870b185fc5f5486636d4515f0e22677493f225
2323
refs/tags/0.10: ac33f2b15782272ae348dbd7b14b8257b2148b5a
2424
refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
26-
refs/heads/beta: 4a917e050d62e0b5a66c0d392992cc5e1d4b1e5d
26+
refs/heads/beta: 8cd1c17d90c616a530a6e2aed559b3efecb3c2e0
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
2828
refs/heads/tmp: e06d2ad9fcd5027bcaac5b08fc9aa39a49d0ecd3
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

branches/beta/src/bootstrap/build/compile.rs

Lines changed: 33 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -23,26 +23,23 @@ use build::{Build, Compiler, Mode};
2323
/// This will build the standard library for a particular stage of the build
2424
/// using the `compiler` targeting the `target` architecture. The artifacts
2525
/// created will also be linked into the sysroot directory.
26-
pub fn std<'a>(build: &'a Build, stage: u32, target: &str,
27-
compiler: &Compiler<'a>) {
28-
let host = compiler.host;
29-
println!("Building stage{} std artifacts ({} -> {})", stage,
30-
host, target);
26+
pub fn std<'a>(build: &'a Build, target: &str, compiler: &Compiler<'a>) {
27+
println!("Building stage{} std artifacts ({} -> {})", compiler.stage,
28+
compiler.host, target);
3129

3230
// Move compiler-rt into place as it'll be required by the compiler when
3331
// building the standard library to link the dylib of libstd
34-
let libdir = build.sysroot_libdir(stage, &host, target);
32+
let libdir = build.sysroot_libdir(compiler, target);
3533
let _ = fs::remove_dir_all(&libdir);
3634
t!(fs::create_dir_all(&libdir));
3735
t!(fs::hard_link(&build.compiler_rt_built.borrow()[target],
3836
libdir.join(staticlib("compiler-rt", target))));
3937

4038
build_startup_objects(build, target, &libdir);
4139

42-
let out_dir = build.cargo_out(stage, &host, Mode::Libstd, target);
40+
let out_dir = build.cargo_out(compiler, Mode::Libstd, target);
4341
build.clear_if_dirty(&out_dir, &build.compiler_path(compiler));
44-
let mut cargo = build.cargo(stage, compiler, Mode::Libstd, Some(target),
45-
"build");
42+
let mut cargo = build.cargo(compiler, Mode::Libstd, target, "build");
4643
cargo.arg("--features").arg(build.std_features())
4744
.arg("--manifest-path")
4845
.arg(build.src.join("src/rustc/std_shim/Cargo.toml"));
@@ -59,20 +56,20 @@ pub fn std<'a>(build: &'a Build, stage: u32, target: &str,
5956
}
6057

6158
build.run(&mut cargo);
62-
std_link(build, stage, target, compiler, host);
59+
std_link(build, target, compiler, compiler.host);
6360
}
6461

6562
/// Link all libstd rlibs/dylibs into the sysroot location.
6663
///
6764
/// Links those artifacts generated in the given `stage` for `target` produced
6865
/// by `compiler` into `host`'s sysroot.
6966
pub fn std_link(build: &Build,
70-
stage: u32,
7167
target: &str,
7268
compiler: &Compiler,
7369
host: &str) {
74-
let libdir = build.sysroot_libdir(stage, host, target);
75-
let out_dir = build.cargo_out(stage, compiler.host, Mode::Libstd, target);
70+
let target_compiler = Compiler::new(compiler.stage, host);
71+
let libdir = build.sysroot_libdir(&target_compiler, target);
72+
let out_dir = build.cargo_out(compiler, Mode::Libstd, target);
7673

7774
// If we're linking one compiler host's output into another, then we weren't
7875
// called from the `std` method above. In that case we clean out what's
@@ -85,7 +82,8 @@ pub fn std_link(build: &Build,
8582
}
8683
add_to_sysroot(&out_dir, &libdir);
8784

88-
if target.contains("musl") && (target.contains("x86_64") || target.contains("i686")) {
85+
if target.contains("musl") &&
86+
(target.contains("x86_64") || target.contains("i686")) {
8987
copy_third_party_objects(build, target, &libdir);
9088
}
9189
}
@@ -130,17 +128,14 @@ fn build_startup_objects(build: &Build, target: &str, into: &Path) {
130128
/// This will build the compiler for a particular stage of the build using
131129
/// the `compiler` targeting the `target` architecture. The artifacts
132130
/// created will also be linked into the sysroot directory.
133-
pub fn rustc<'a>(build: &'a Build, stage: u32, target: &str,
134-
compiler: &Compiler<'a>) {
135-
let host = compiler.host;
136-
println!("Building stage{} compiler artifacts ({} -> {})", stage,
137-
host, target);
131+
pub fn rustc<'a>(build: &'a Build, target: &str, compiler: &Compiler<'a>) {
132+
println!("Building stage{} compiler artifacts ({} -> {})",
133+
compiler.stage, compiler.host, target);
138134

139-
let out_dir = build.cargo_out(stage, &host, Mode::Librustc, target);
140-
build.clear_if_dirty(&out_dir, &libstd_shim(build, stage, &host, target));
135+
let out_dir = build.cargo_out(compiler, Mode::Librustc, target);
136+
build.clear_if_dirty(&out_dir, &libstd_shim(build, compiler, target));
141137

142-
let mut cargo = build.cargo(stage, compiler, Mode::Librustc, Some(target),
143-
"build");
138+
let mut cargo = build.cargo(compiler, Mode::Librustc, target, "build");
144139
cargo.arg("--features").arg(build.rustc_features())
145140
.arg("--manifest-path")
146141
.arg(build.src.join("src/rustc/Cargo.toml"));
@@ -184,27 +179,27 @@ pub fn rustc<'a>(build: &'a Build, stage: u32, target: &str,
184179
}
185180
build.run(&mut cargo);
186181

187-
rustc_link(build, stage, target, compiler, compiler.host);
182+
rustc_link(build, target, compiler, compiler.host);
188183
}
189184

190185
/// Link all librustc rlibs/dylibs into the sysroot location.
191186
///
192187
/// Links those artifacts generated in the given `stage` for `target` produced
193188
/// by `compiler` into `host`'s sysroot.
194189
pub fn rustc_link(build: &Build,
195-
stage: u32,
196190
target: &str,
197191
compiler: &Compiler,
198192
host: &str) {
199-
let libdir = build.sysroot_libdir(stage, host, target);
200-
let out_dir = build.cargo_out(stage, compiler.host, Mode::Librustc, target);
193+
let target_compiler = Compiler::new(compiler.stage, host);
194+
let libdir = build.sysroot_libdir(&target_compiler, target);
195+
let out_dir = build.cargo_out(compiler, Mode::Librustc, target);
201196
add_to_sysroot(&out_dir, &libdir);
202197
}
203198

204199
/// Cargo's output path for the standard library in a given stage, compiled
205200
/// by a particular compiler for the specified target.
206-
fn libstd_shim(build: &Build, stage: u32, host: &str, target: &str) -> PathBuf {
207-
build.cargo_out(stage, host, Mode::Libstd, target).join("libstd_shim.rlib")
201+
fn libstd_shim(build: &Build, compiler: &Compiler, target: &str) -> PathBuf {
202+
build.cargo_out(compiler, Mode::Libstd, target).join("libstd_shim.rlib")
208203
}
209204

210205
fn compiler_file(compiler: &Path, file: &str) -> String {
@@ -219,25 +214,29 @@ fn compiler_file(compiler: &Path, file: &str) -> String {
219214
/// compiler.
220215
pub fn assemble_rustc(build: &Build, stage: u32, host: &str) {
221216
assert!(stage > 0, "the stage0 compiler isn't assembled, it's downloaded");
217+
// The compiler that we're assembling
218+
let target_compiler = Compiler::new(stage, host);
219+
220+
// The compiler that compiled the compiler we're assembling
221+
let build_compiler = Compiler::new(stage - 1, &build.config.build);
222222

223223
// Clear out old files
224-
let sysroot = build.sysroot(stage, host);
224+
let sysroot = build.sysroot(&target_compiler);
225225
let _ = fs::remove_dir_all(&sysroot);
226226
t!(fs::create_dir_all(&sysroot));
227227

228228
// Link in all dylibs to the libdir
229229
let sysroot_libdir = sysroot.join(libdir(host));
230230
t!(fs::create_dir_all(&sysroot_libdir));
231-
let src_libdir = build.sysroot_libdir(stage - 1, &build.config.build, host);
231+
let src_libdir = build.sysroot_libdir(&build_compiler, host);
232232
for f in t!(fs::read_dir(&src_libdir)).map(|f| t!(f)) {
233233
let filename = f.file_name().into_string().unwrap();
234234
if is_dylib(&filename) {
235235
t!(fs::hard_link(&f.path(), sysroot_libdir.join(&filename)));
236236
}
237237
}
238238

239-
let out_dir = build.cargo_out(stage - 1, &build.config.build,
240-
Mode::Librustc, host);
239+
let out_dir = build.cargo_out(&build_compiler, Mode::Librustc, host);
241240

242241
// Link the compiler binary itself into place
243242
let rustc = out_dir.join(exe("rustc", host));
@@ -315,7 +314,7 @@ pub fn tool(build: &Build, stage: u32, host: &str, tool: &str) {
315314
// let out_dir = build.cargo_out(stage, &host, Mode::Librustc, target);
316315
// build.clear_if_dirty(&out_dir, &libstd_shim(build, stage, &host, target));
317316

318-
let mut cargo = build.cargo(stage, &compiler, Mode::Tool, None, "build");
317+
let mut cargo = build.cargo(&compiler, Mode::Tool, host, "build");
319318
cargo.arg("--manifest-path")
320319
.arg(build.src.join(format!("src/tools/{}/Cargo.toml", tool)));
321320
build.run(&mut cargo);

branches/beta/src/bootstrap/build/doc.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ pub fn standalone(build: &Build, stage: u32, host: &str, out: &Path) {
8181
}
8282

8383
let mut cmd = Command::new(&rustdoc);
84+
build.add_rustc_lib_path(&compiler, &mut cmd);
8485
cmd.arg("--html-after-content").arg(&footer)
8586
.arg("--html-before-content").arg(&version_info)
8687
.arg("--html-in-header").arg(&favicon)
@@ -107,14 +108,13 @@ pub fn standalone(build: &Build, stage: u32, host: &str, out: &Path) {
107108
pub fn std(build: &Build, stage: u32, host: &str, out: &Path) {
108109
println!("Documenting stage{} std ({})", stage, host);
109110
let compiler = Compiler::new(stage, host);
110-
let out_dir = build.stage_out(stage, host, Mode::Libstd)
111+
let out_dir = build.stage_out(&compiler, Mode::Libstd)
111112
.join(host).join("doc");
112113
let rustdoc = build.rustdoc(&compiler);
113114

114115
build.clear_if_dirty(&out_dir, &rustdoc);
115116

116-
let mut cargo = build.cargo(stage, &compiler, Mode::Libstd, Some(host),
117-
"doc");
117+
let mut cargo = build.cargo(&compiler, Mode::Libstd, host, "doc");
118118
cargo.arg("--manifest-path")
119119
.arg(build.src.join("src/rustc/std_shim/Cargo.toml"))
120120
.arg("--features").arg(build.std_features());
@@ -125,14 +125,13 @@ pub fn std(build: &Build, stage: u32, host: &str, out: &Path) {
125125
pub fn rustc(build: &Build, stage: u32, host: &str, out: &Path) {
126126
println!("Documenting stage{} compiler ({})", stage, host);
127127
let compiler = Compiler::new(stage, host);
128-
let out_dir = build.stage_out(stage, host, Mode::Librustc)
128+
let out_dir = build.stage_out(&compiler, Mode::Librustc)
129129
.join(host).join("doc");
130130
let rustdoc = build.rustdoc(&compiler);
131131
if !up_to_date(&rustdoc, &out_dir.join("rustc/index.html")) {
132132
t!(fs::remove_dir_all(&out_dir));
133133
}
134-
let mut cargo = build.cargo(stage, &compiler, Mode::Librustc, Some(host),
135-
"doc");
134+
let mut cargo = build.cargo(&compiler, Mode::Librustc, host, "doc");
136135
cargo.arg("--manifest-path")
137136
.arg(build.src.join("src/rustc/Cargo.toml"))
138137
.arg("--features").arg(build.rustc_features());

0 commit comments

Comments
 (0)