Skip to content

Commit

Permalink
Use build.build instead of build.config.build
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark-Simulacrum committed Jun 27, 2017
1 parent ff796e7 commit e04754b
Show file tree
Hide file tree
Showing 9 changed files with 92 additions and 92 deletions.
8 changes: 4 additions & 4 deletions src/bootstrap/cc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ use config::Target;
pub fn find(build: &mut Build) {
// For all targets we're going to need a C compiler for building some shims
// and such as well as for being a linker for Rust code.
for target in build.config.target.iter() {
for target in &build.targets {
let mut cfg = gcc::Config::new();
cfg.cargo_metadata(false).opt_level(0).debug(false)
.target(target).host(&build.config.build);
.target(target).host(&build.build);

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

// For all host triples we need to find a C++ compiler as well
for host in build.config.host.iter() {
for host in &build.hosts {
let mut cfg = gcc::Config::new();
cfg.cargo_metadata(false).opt_level(0).debug(false).cpp(true)
.target(host).host(&build.config.build);
.target(host).host(&build.build);
let config = build.config.target_config.get(host);
if let Some(cxx) = config.and_then(|c| c.cxx.as_ref()) {
cfg.compiler(cxx);
Expand Down
16 changes: 8 additions & 8 deletions src/bootstrap/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ pub fn compiletest(build: &Build,
cmd.arg("--mode").arg(mode);
cmd.arg("--target").arg(target);
cmd.arg("--host").arg(compiler.host);
cmd.arg("--llvm-filecheck").arg(build.llvm_filecheck(&build.config.build));
cmd.arg("--llvm-filecheck").arg(build.llvm_filecheck(&build.build));

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

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

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

if build.remote_tested(target) {
cmd.arg("--remote-test-client")
.arg(build.tool(&Compiler::new(0, &build.config.build),
.arg(build.tool(&Compiler::new(0, &build.build),
"remote-test-client"));
}

Expand Down Expand Up @@ -366,7 +366,7 @@ pub fn error_index(build: &Build, compiler: &Compiler) {
"error_index_generator")
.arg("markdown")
.arg(&output)
.env("CFG_BUILD", &build.config.build));
.env("CFG_BUILD", &build.build));

markdown_test(build, compiler, &output);
}
Expand Down Expand Up @@ -540,7 +540,7 @@ fn krate_remote(build: &Build,
let out_dir = build.cargo_out(compiler, mode, target);
let tests = find_tests(&out_dir.join("deps"), target);

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

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

/// Run "distcheck", a 'make check' from a tarball
pub fn distcheck(build: &Build) {
if build.config.build != "x86_64-unknown-linux-gnu" {
if build.build != "x86_64-unknown-linux-gnu" {
return
}
if !build.config.host.iter().any(|s| s == "x86_64-unknown-linux-gnu") {
Expand All @@ -636,7 +636,7 @@ pub fn distcheck(build: &Build) {
.args(&build.config.configure_args)
.arg("--enable-vendor")
.current_dir(&dir));
build.run(Command::new(build_helper::make(&build.config.build))
build.run(Command::new(build_helper::make(&build.build))
.arg("check")
.current_dir(&dir));

Expand Down
10 changes: 5 additions & 5 deletions src/bootstrap/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ pub fn build_startup_objects(build: &Build, for_compiler: &Compiler, target: &st
return
}

let compiler = Compiler::new(0, &build.config.build);
let compiler = Compiler::new(0, &build.build);
let compiler_path = build.compiler_path(&compiler);
let src_dir = &build.src.join("src/rtstartup");
let dst_dir = &build.native_dir(target).join("rtstartup");
Expand Down Expand Up @@ -355,7 +355,7 @@ pub fn create_sysroot(build: &Build, compiler: &Compiler) {
/// Prepare a new compiler from the artifacts in `stage`
///
/// This will assemble a compiler in `build/$host/stage$stage`. The compiler
/// must have been previously produced by the `stage - 1` build.config.build
/// must have been previously produced by the `stage - 1` build.build
/// compiler.
pub fn assemble_rustc(build: &Build, stage: u32, host: &str) {
// nothing to do in stage0
Expand All @@ -369,7 +369,7 @@ pub fn assemble_rustc(build: &Build, stage: u32, host: &str) {
let target_compiler = Compiler::new(stage, host);

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

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

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

let compiler = Compiler::new(stage, &build.config.build);
let compiler = Compiler::new(stage, &build.build);

let mut cargo = build.cargo(&compiler, Mode::Tool, target, "build");
let dir = build.src.join("src/tools").join(tool);
Expand Down
14 changes: 7 additions & 7 deletions src/bootstrap/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ pub fn tmpdir(build: &Build) -> PathBuf {
}

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

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

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

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

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

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

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

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

pub fn hash_and_sign(build: &Build) {
let compiler = Compiler::new(0, &build.config.build);
let compiler = Compiler::new(0, &build.build);
let mut cmd = build.tool_cmd(&compiler, "build-manifest");
let sign = build.config.dist_sign_folder.as_ref().unwrap_or_else(|| {
panic!("\n\nfailed to specify `dist.sign-folder` in `config.toml`\n\n")
Expand Down
18 changes: 9 additions & 9 deletions src/bootstrap/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub fn rustbook_src(build: &Build, target: &str, name: &str, src: &Path) {
t!(fs::create_dir_all(&out));

let out = out.join(name);
let compiler = Compiler::new(0, &build.config.build);
let compiler = Compiler::new(0, &build.build);
let src = src.join(name);
let index = out.join("index.html");
let rustbook = build.tool(&compiler, "rustbook");
Expand Down Expand Up @@ -95,7 +95,7 @@ pub fn book(build: &Build, target: &str, name: &str) {
fn invoke_rustdoc(build: &Build, target: &str, markdown: &str) {
let out = build.doc_out(target);

let compiler = Compiler::new(0, &build.config.build);
let compiler = Compiler::new(0, &build.build);

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

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

let compiler = Compiler::new(0, &build.config.build);
let compiler = Compiler::new(0, &build.build);

let favicon = build.src.join("src/doc/favicon.inc");
let footer = build.src.join("src/doc/footer.inc");
Expand Down Expand Up @@ -217,7 +217,7 @@ pub fn std(build: &Build, stage: u32, target: &str) {
println!("Documenting stage{} std ({})", stage, target);
let out = build.doc_out(target);
t!(fs::create_dir_all(&out));
let compiler = Compiler::new(stage, &build.config.build);
let compiler = Compiler::new(stage, &build.build);
let compiler = if build.force_use_stage1(&compiler, target) {
Compiler::new(1, compiler.host)
} else {
Expand Down Expand Up @@ -276,7 +276,7 @@ pub fn test(build: &Build, stage: u32, target: &str) {
println!("Documenting stage{} test ({})", stage, target);
let out = build.doc_out(target);
t!(fs::create_dir_all(&out));
let compiler = Compiler::new(stage, &build.config.build);
let compiler = Compiler::new(stage, &build.build);
let compiler = if build.force_use_stage1(&compiler, target) {
Compiler::new(1, compiler.host)
} else {
Expand Down Expand Up @@ -306,7 +306,7 @@ pub fn rustc(build: &Build, stage: u32, target: &str) {
println!("Documenting stage{} compiler ({})", stage, target);
let out = build.doc_out(target);
t!(fs::create_dir_all(&out));
let compiler = Compiler::new(stage, &build.config.build);
let compiler = Compiler::new(stage, &build.build);
let compiler = if build.force_use_stage1(&compiler, target) {
Compiler::new(1, compiler.host)
} else {
Expand Down Expand Up @@ -351,13 +351,13 @@ pub fn error_index(build: &Build, target: &str) {
println!("Documenting error index ({})", target);
let out = build.doc_out(target);
t!(fs::create_dir_all(&out));
let compiler = Compiler::new(0, &build.config.build);
let compiler = Compiler::new(0, &build.build);
let mut index = build.tool_cmd(&compiler, "error_index_generator");
index.arg("html");
index.arg(out.join("error-index.html"));

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

build.run(&mut index);
}
Expand All @@ -367,7 +367,7 @@ pub fn unstable_book_gen(build: &Build, target: &str) {
let out = build.md_doc_out(target).join("unstable-book");
t!(fs::create_dir_all(&out));
t!(fs::remove_dir_all(&out));
let compiler = Compiler::new(0, &build.config.build);
let compiler = Compiler::new(0, &build.build);
let mut cmd = build.tool_cmd(&compiler, "unstable-book-gen");
cmd.arg(build.src.join("src"));
cmd.arg(out);
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1079,7 +1079,7 @@ impl<'a> Compiler<'a> {

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

/// Returns if this compiler should be treated as a final stage one in the
Expand Down
8 changes: 4 additions & 4 deletions src/bootstrap/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ pub fn llvm(build: &Build, target: &str) {
let assertions = if build.config.llvm_assertions {"ON"} else {"OFF"};

cfg.target(target)
.host(&build.config.build)
.host(&build.build)
.out_dir(&out_dir)
.profile(profile)
.define("LLVM_ENABLE_ASSERTIONS", assertions)
Expand Down Expand Up @@ -129,11 +129,11 @@ pub fn llvm(build: &Build, target: &str) {
}

// http://llvm.org/docs/HowToCrossCompileLLVM.html
if target != build.config.build {
if target != build.build {
// FIXME: if the llvm root for the build triple is overridden then we
// should use llvm-tblgen from there, also should verify that it
// actually exists most of the time in normal installs of LLVM.
let host = build.llvm_out(&build.config.build).join("bin/llvm-tblgen");
let host = build.llvm_out(&build.build).join("bin/llvm-tblgen");
cfg.define("CMAKE_CROSSCOMPILING", "True")
.define("LLVM_TABLEGEN", &host);
}
Expand Down Expand Up @@ -243,7 +243,7 @@ pub fn test_helpers(build: &Build, target: &str) {
cfg.cargo_metadata(false)
.out_dir(&dst)
.target(target)
.host(&build.config.build)
.host(&build.build)
.opt_level(0)
.debug(false)
.file(build.src.join("src/rt/rust_test_helpers.c"))
Expand Down
4 changes: 2 additions & 2 deletions src/bootstrap/sanity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,15 @@ pub fn check(build: &mut Build) {
}

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

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

Expand Down
Loading

0 comments on commit e04754b

Please sign in to comment.