Skip to content

Commit 1654a2f

Browse files
Use build.build instead of build.config.build
1 parent 5809a7d commit 1654a2f

File tree

9 files changed

+98
-92
lines changed

9 files changed

+98
-92
lines changed

src/bootstrap/cc.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,13 @@ use config::Target;
4242
pub fn find(build: &mut Build) {
4343
// For all targets we're going to need a C compiler for building some shims
4444
// and such as well as for being a linker for Rust code.
45-
for target in build.config.target.iter() {
45+
//
46+
// This includes targets that aren't necessarily passed on the commandline
47+
// (FIXME: Perhaps it shouldn't?)
48+
for target in &build.config.target {
4649
let mut cfg = gcc::Config::new();
4750
cfg.cargo_metadata(false).opt_level(0).debug(false)
48-
.target(target).host(&build.config.build);
51+
.target(target).host(&build.build);
4952

5053
let config = build.config.target_config.get(target);
5154
if let Some(cc) = config.and_then(|c| c.cc.as_ref()) {
@@ -64,10 +67,13 @@ pub fn find(build: &mut Build) {
6467
}
6568

6669
// For all host triples we need to find a C++ compiler as well
67-
for host in build.config.host.iter() {
70+
//
71+
// This includes hosts that aren't necessarily passed on the commandline
72+
// (FIXME: Perhaps it shouldn't?)
73+
for host in &build.config.host {
6874
let mut cfg = gcc::Config::new();
6975
cfg.cargo_metadata(false).opt_level(0).debug(false).cpp(true)
70-
.target(host).host(&build.config.build);
76+
.target(host).host(&build.build);
7177
let config = build.config.target_config.get(host);
7278
if let Some(cxx) = config.and_then(|c| c.cxx.as_ref()) {
7379
cfg.compiler(cxx);

src/bootstrap/check.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ pub fn compiletest(build: &Build,
196196
cmd.arg("--mode").arg(mode);
197197
cmd.arg("--target").arg(target);
198198
cmd.arg("--host").arg(compiler.host);
199-
cmd.arg("--llvm-filecheck").arg(build.llvm_filecheck(&build.config.build));
199+
cmd.arg("--llvm-filecheck").arg(build.llvm_filecheck(&build.build));
200200

201201
if let Some(ref nodejs) = build.config.nodejs {
202202
cmd.arg("--nodejs").arg(nodejs);
@@ -222,7 +222,7 @@ pub fn compiletest(build: &Build,
222222

223223
cmd.arg("--docck-python").arg(build.python());
224224

225-
if build.config.build.ends_with("apple-darwin") {
225+
if build.build.ends_with("apple-darwin") {
226226
// Force /usr/bin/python on macOS for LLDB tests because we're loading the
227227
// LLDB plugin's compiled module which only works with the system python
228228
// (namely not Homebrew-installed python)
@@ -277,7 +277,7 @@ pub fn compiletest(build: &Build,
277277

278278
if build.remote_tested(target) {
279279
cmd.arg("--remote-test-client")
280-
.arg(build.tool(&Compiler::new(0, &build.config.build),
280+
.arg(build.tool(&Compiler::new(0, &build.build),
281281
"remote-test-client"));
282282
}
283283

@@ -366,7 +366,7 @@ pub fn error_index(build: &Build, compiler: &Compiler) {
366366
"error_index_generator")
367367
.arg("markdown")
368368
.arg(&output)
369-
.env("CFG_BUILD", &build.config.build));
369+
.env("CFG_BUILD", &build.build));
370370

371371
markdown_test(build, compiler, &output);
372372
}
@@ -540,7 +540,7 @@ fn krate_remote(build: &Build,
540540
let out_dir = build.cargo_out(compiler, mode, target);
541541
let tests = find_tests(&out_dir.join("deps"), target);
542542

543-
let tool = build.tool(&Compiler::new(0, &build.config.build),
543+
let tool = build.tool(&Compiler::new(0, &build.build),
544544
"remote-test-client");
545545
for test in tests {
546546
let mut cmd = Command::new(&tool);
@@ -585,7 +585,7 @@ pub fn remote_copy_libs(build: &Build, compiler: &Compiler, target: &str) {
585585
.join(exe("remote-test-server", target));
586586

587587
// Spawn the emulator and wait for it to come online
588-
let tool = build.tool(&Compiler::new(0, &build.config.build),
588+
let tool = build.tool(&Compiler::new(0, &build.build),
589589
"remote-test-client");
590590
let mut cmd = Command::new(&tool);
591591
cmd.arg("spawn-emulator")
@@ -611,7 +611,7 @@ pub fn remote_copy_libs(build: &Build, compiler: &Compiler, target: &str) {
611611

612612
/// Run "distcheck", a 'make check' from a tarball
613613
pub fn distcheck(build: &Build) {
614-
if build.config.build != "x86_64-unknown-linux-gnu" {
614+
if build.build != "x86_64-unknown-linux-gnu" {
615615
return
616616
}
617617
if !build.config.host.iter().any(|s| s == "x86_64-unknown-linux-gnu") {
@@ -636,7 +636,7 @@ pub fn distcheck(build: &Build) {
636636
.args(&build.config.configure_args)
637637
.arg("--enable-vendor")
638638
.current_dir(&dir));
639-
build.run(Command::new(build_helper::make(&build.config.build))
639+
build.run(Command::new(build_helper::make(&build.build))
640640
.arg("check")
641641
.current_dir(&dir));
642642

src/bootstrap/compile.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ pub fn build_startup_objects(build: &Build, for_compiler: &Compiler, target: &st
158158
return
159159
}
160160

161-
let compiler = Compiler::new(0, &build.config.build);
161+
let compiler = Compiler::new(0, &build.build);
162162
let compiler_path = build.compiler_path(&compiler);
163163
let src_dir = &build.src.join("src/rtstartup");
164164
let dst_dir = &build.native_dir(target).join("rtstartup");
@@ -351,7 +351,7 @@ pub fn create_sysroot(build: &Build, compiler: &Compiler) {
351351
/// Prepare a new compiler from the artifacts in `stage`
352352
///
353353
/// This will assemble a compiler in `build/$host/stage$stage`. The compiler
354-
/// must have been previously produced by the `stage - 1` build.config.build
354+
/// must have been previously produced by the `stage - 1` build.build
355355
/// compiler.
356356
pub fn assemble_rustc(build: &Build, stage: u32, host: &str) {
357357
// nothing to do in stage0
@@ -365,7 +365,7 @@ pub fn assemble_rustc(build: &Build, stage: u32, host: &str) {
365365
let target_compiler = Compiler::new(stage, host);
366366

367367
// The compiler that compiled the compiler we're assembling
368-
let build_compiler = Compiler::new(stage - 1, &build.config.build);
368+
let build_compiler = Compiler::new(stage - 1, &build.build);
369369

370370
// Link in all dylibs to the libdir
371371
let sysroot = build.sysroot(&target_compiler);
@@ -423,7 +423,7 @@ fn add_to_sysroot(sysroot_dst: &Path, stamp: &Path) {
423423
/// This will build the specified tool with the specified `host` compiler in
424424
/// `stage` into the normal cargo output directory.
425425
pub fn maybe_clean_tools(build: &Build, stage: u32, target: &str, mode: Mode) {
426-
let compiler = Compiler::new(stage, &build.config.build);
426+
let compiler = Compiler::new(stage, &build.build);
427427

428428
let stamp = match mode {
429429
Mode::Libstd => libstd_stamp(build, &compiler, target),
@@ -443,7 +443,7 @@ pub fn tool(build: &Build, stage: u32, target: &str, tool: &str) {
443443
let _folder = build.fold_output(|| format!("stage{}-{}", stage, tool));
444444
println!("Building stage{} tool {} ({})", stage, tool, target);
445445

446-
let compiler = Compiler::new(stage, &build.config.build);
446+
let compiler = Compiler::new(stage, &build.build);
447447

448448
let mut cargo = build.cargo(&compiler, Mode::Tool, target, "build");
449449
let dir = build.src.join("src/tools").join(tool);

src/bootstrap/dist.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ pub fn tmpdir(build: &Build) -> PathBuf {
5050
}
5151

5252
fn rust_installer(build: &Build) -> Command {
53-
build.tool_cmd(&Compiler::new(0, &build.config.build), "rust-installer")
53+
build.tool_cmd(&Compiler::new(0, &build.build), "rust-installer")
5454
}
5555

5656
/// Builds the `rust-docs` installer component.
@@ -89,7 +89,7 @@ pub fn docs(build: &Build, stage: u32, host: &str) {
8989

9090
// As part of this step, *also* copy the docs directory to a directory which
9191
// buildbot typically uploads.
92-
if host == build.config.build {
92+
if host == build.build {
9393
let dst = distdir(build).join("doc").join(build.rust_package_vers());
9494
t!(fs::create_dir_all(&dst));
9595
cp_r(&src, &dst);
@@ -394,7 +394,7 @@ pub fn std(build: &Build, compiler: &Compiler, target: &str) {
394394

395395
// The only true set of target libraries came from the build triple, so
396396
// let's reduce redundant work by only producing archives from that host.
397-
if compiler.host != build.config.build {
397+
if compiler.host != build.build {
398398
println!("\tskipping, not a build host");
399399
return
400400
}
@@ -440,7 +440,7 @@ pub fn analysis(build: &Build, compiler: &Compiler, target: &str) {
440440
assert!(build.config.extended);
441441
println!("Dist analysis");
442442

443-
if compiler.host != build.config.build {
443+
if compiler.host != build.build {
444444
println!("\tskipping, not a build host");
445445
return;
446446
}
@@ -705,7 +705,7 @@ fn write_file(path: &Path, data: &[u8]) {
705705

706706
pub fn cargo(build: &Build, stage: u32, target: &str) {
707707
println!("Dist cargo stage{} ({})", stage, target);
708-
let compiler = Compiler::new(stage, &build.config.build);
708+
let compiler = Compiler::new(stage, &build.build);
709709

710710
let src = build.src.join("src/tools/cargo");
711711
let etc = src.join("src/etc");
@@ -766,7 +766,7 @@ pub fn cargo(build: &Build, stage: u32, target: &str) {
766766
pub fn rls(build: &Build, stage: u32, target: &str) {
767767
assert!(build.config.extended);
768768
println!("Dist RLS stage{} ({})", stage, target);
769-
let compiler = Compiler::new(stage, &build.config.build);
769+
let compiler = Compiler::new(stage, &build.build);
770770

771771
let src = build.src.join("src/tools/rls");
772772
let release_num = build.release_num("rls");
@@ -1198,7 +1198,7 @@ fn add_env(build: &Build, cmd: &mut Command, target: &str) {
11981198
}
11991199

12001200
pub fn hash_and_sign(build: &Build) {
1201-
let compiler = Compiler::new(0, &build.config.build);
1201+
let compiler = Compiler::new(0, &build.build);
12021202
let mut cmd = build.tool_cmd(&compiler, "build-manifest");
12031203
let sign = build.config.dist_sign_folder.as_ref().unwrap_or_else(|| {
12041204
panic!("\n\nfailed to specify `dist.sign-folder` in `config.toml`\n\n")

src/bootstrap/doc.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ pub fn rustbook_src(build: &Build, target: &str, name: &str, src: &Path) {
4545
t!(fs::create_dir_all(&out));
4646

4747
let out = out.join(name);
48-
let compiler = Compiler::new(0, &build.config.build);
48+
let compiler = Compiler::new(0, &build.build);
4949
let src = src.join(name);
5050
let index = out.join("index.html");
5151
let rustbook = build.tool(&compiler, "rustbook");
@@ -95,7 +95,7 @@ pub fn book(build: &Build, target: &str, name: &str) {
9595
fn invoke_rustdoc(build: &Build, target: &str, markdown: &str) {
9696
let out = build.doc_out(target);
9797

98-
let compiler = Compiler::new(0, &build.config.build);
98+
let compiler = Compiler::new(0, &build.build);
9999

100100
let path = build.src.join("src/doc").join(markdown);
101101

@@ -150,7 +150,7 @@ pub fn standalone(build: &Build, target: &str) {
150150
let out = build.doc_out(target);
151151
t!(fs::create_dir_all(&out));
152152

153-
let compiler = Compiler::new(0, &build.config.build);
153+
let compiler = Compiler::new(0, &build.build);
154154

155155
let favicon = build.src.join("src/doc/favicon.inc");
156156
let footer = build.src.join("src/doc/footer.inc");
@@ -217,7 +217,7 @@ pub fn std(build: &Build, stage: u32, target: &str) {
217217
println!("Documenting stage{} std ({})", stage, target);
218218
let out = build.doc_out(target);
219219
t!(fs::create_dir_all(&out));
220-
let compiler = Compiler::new(stage, &build.config.build);
220+
let compiler = Compiler::new(stage, &build.build);
221221
let compiler = if build.force_use_stage1(&compiler, target) {
222222
Compiler::new(1, compiler.host)
223223
} else {
@@ -276,7 +276,7 @@ pub fn test(build: &Build, stage: u32, target: &str) {
276276
println!("Documenting stage{} test ({})", stage, target);
277277
let out = build.doc_out(target);
278278
t!(fs::create_dir_all(&out));
279-
let compiler = Compiler::new(stage, &build.config.build);
279+
let compiler = Compiler::new(stage, &build.build);
280280
let compiler = if build.force_use_stage1(&compiler, target) {
281281
Compiler::new(1, compiler.host)
282282
} else {
@@ -306,7 +306,7 @@ pub fn rustc(build: &Build, stage: u32, target: &str) {
306306
println!("Documenting stage{} compiler ({})", stage, target);
307307
let out = build.doc_out(target);
308308
t!(fs::create_dir_all(&out));
309-
let compiler = Compiler::new(stage, &build.config.build);
309+
let compiler = Compiler::new(stage, &build.build);
310310
let compiler = if build.force_use_stage1(&compiler, target) {
311311
Compiler::new(1, compiler.host)
312312
} else {
@@ -351,13 +351,13 @@ pub fn error_index(build: &Build, target: &str) {
351351
println!("Documenting error index ({})", target);
352352
let out = build.doc_out(target);
353353
t!(fs::create_dir_all(&out));
354-
let compiler = Compiler::new(0, &build.config.build);
354+
let compiler = Compiler::new(0, &build.build);
355355
let mut index = build.tool_cmd(&compiler, "error_index_generator");
356356
index.arg("html");
357357
index.arg(out.join("error-index.html"));
358358

359359
// FIXME: shouldn't have to pass this env var
360-
index.env("CFG_BUILD", &build.config.build);
360+
index.env("CFG_BUILD", &build.build);
361361

362362
build.run(&mut index);
363363
}
@@ -367,7 +367,7 @@ pub fn unstable_book_gen(build: &Build, target: &str) {
367367
let out = build.md_doc_out(target).join("unstable-book");
368368
t!(fs::create_dir_all(&out));
369369
t!(fs::remove_dir_all(&out));
370-
let compiler = Compiler::new(0, &build.config.build);
370+
let compiler = Compiler::new(0, &build.build);
371371
let mut cmd = build.tool_cmd(&compiler, "unstable-book-gen");
372372
cmd.arg(build.src.join("src"));
373373
cmd.arg(out);

src/bootstrap/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1079,7 +1079,7 @@ impl<'a> Compiler<'a> {
10791079

10801080
/// Returns whether this is a snapshot compiler for `build`'s configuration
10811081
fn is_snapshot(&self, build: &Build) -> bool {
1082-
self.stage == 0 && self.host == build.config.build
1082+
self.stage == 0 && self.host == build.build
10831083
}
10841084

10851085
/// Returns if this compiler should be treated as a final stage one in the

src/bootstrap/native.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ pub fn llvm(build: &Build, target: &str) {
9494
let assertions = if build.config.llvm_assertions {"ON"} else {"OFF"};
9595

9696
cfg.target(target)
97-
.host(&build.config.build)
97+
.host(&build.build)
9898
.out_dir(&out_dir)
9999
.profile(profile)
100100
.define("LLVM_ENABLE_ASSERTIONS", assertions)
@@ -129,11 +129,11 @@ pub fn llvm(build: &Build, target: &str) {
129129
}
130130

131131
// http://llvm.org/docs/HowToCrossCompileLLVM.html
132-
if target != build.config.build {
132+
if target != build.build {
133133
// FIXME: if the llvm root for the build triple is overridden then we
134134
// should use llvm-tblgen from there, also should verify that it
135135
// actually exists most of the time in normal installs of LLVM.
136-
let host = build.llvm_out(&build.config.build).join("bin/llvm-tblgen");
136+
let host = build.llvm_out(&build.build).join("bin/llvm-tblgen");
137137
cfg.define("CMAKE_CROSSCOMPILING", "True")
138138
.define("LLVM_TABLEGEN", &host);
139139
}
@@ -243,7 +243,7 @@ pub fn test_helpers(build: &Build, target: &str) {
243243
cfg.cargo_metadata(false)
244244
.out_dir(&dst)
245245
.target(target)
246-
.host(&build.config.build)
246+
.host(&build.build)
247247
.opt_level(0)
248248
.debug(false)
249249
.file(build.src.join("src/rt/rust_test_helpers.c"))

src/bootstrap/sanity.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,15 +139,15 @@ pub fn check(build: &mut Build) {
139139
}
140140

141141
// Externally configured LLVM requires FileCheck to exist
142-
let filecheck = build.llvm_filecheck(&build.config.build);
142+
let filecheck = build.llvm_filecheck(&build.build);
143143
if !filecheck.starts_with(&build.out) && !filecheck.exists() && build.config.codegen_tests {
144144
panic!("FileCheck executable {:?} does not exist", filecheck);
145145
}
146146

147147
for target in &build.config.target {
148148
// Can't compile for iOS unless we're on macOS
149149
if target.contains("apple-ios") &&
150-
!build.config.build.contains("apple-darwin") {
150+
!build.build.contains("apple-darwin") {
151151
panic!("the iOS target is only supported on macOS");
152152
}
153153

0 commit comments

Comments
 (0)