about summary refs log tree commit diff
path: root/src/bootstrap/lib.rs
diff options
context:
space:
mode:
authorMark Simulacrum <mark.simulacrum@gmail.com>2017-07-29 22:12:53 -0600
committerMark Simulacrum <mark.simulacrum@gmail.com>2017-08-13 05:15:43 +0500
commit44ffb61623741f86fca9f2f51d49dc1778310ee1 (patch)
tree1bdd6613027d648834d3f23f28b04a6fdc0b007b /src/bootstrap/lib.rs
parentf774bced502cf190426f778001a342715acb1d47 (diff)
downloadrust-44ffb61623741f86fca9f2f51d49dc1778310ee1.tar.gz
rust-44ffb61623741f86fca9f2f51d49dc1778310ee1.zip
Unify flags into config.
This introduces a slight change in behavior, where we unilaterally
respect the --host and --target parameters passed for all sanity
checking and runtime configuration.
Diffstat (limited to 'src/bootstrap/lib.rs')
-rw-r--r--src/bootstrap/lib.rs55
1 files changed, 18 insertions, 37 deletions
diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs
index a8485d1d152..e1d2779057f 100644
--- a/src/bootstrap/lib.rs
+++ b/src/bootstrap/lib.rs
@@ -136,13 +136,13 @@ extern crate toml;
 extern crate libc;
 
 use std::cell::Cell;
-use std::cmp;
 use std::collections::{HashSet, HashMap};
 use std::env;
 use std::fs::{self, File};
 use std::io::Read;
 use std::path::{PathBuf, Path};
 use std::process::Command;
+use std::slice;
 
 use build_helper::{run_silent, run_suppressed, try_run_silent, try_run_suppressed, output, mtime};
 
@@ -187,7 +187,7 @@ mod job {
 }
 
 pub use config::Config;
-pub use flags::{Flags, Subcommand};
+use flags::Subcommand;
 use cache::{Interned, INTERNER};
 
 /// A structure representing a Rust compiler.
@@ -215,9 +215,6 @@ pub struct Build {
     // User-specified configuration via config.toml
     config: Config,
 
-    // User-specified configuration via CLI flags
-    flags: Flags,
-
     // Derived properties from the above two configurations
     src: PathBuf,
     out: PathBuf,
@@ -288,9 +285,9 @@ impl Build {
     /// line and the filesystem `config`.
     ///
     /// By default all build output will be placed in the current directory.
-    pub fn new(flags: Flags, config: Config) -> Build {
+    pub fn new(config: Config) -> Build {
         let cwd = t!(env::current_dir());
-        let src = flags.src.clone();
+        let src = config.src.clone();
         let out = cwd.join("build");
 
         let is_sudo = match env::var_os("SUDO_USER") {
@@ -306,39 +303,17 @@ impl Build {
         let cargo_info = channel::GitInfo::new(&src.join("src/tools/cargo"));
         let rls_info = channel::GitInfo::new(&src.join("src/tools/rls"));
 
-        let hosts = if !flags.host.is_empty() {
-            for host in flags.host.iter() {
-                if !config.host.contains(host) {
-                    panic!("specified host `{}` is not in configuration", host);
-                }
-            }
-            flags.host.clone()
-        } else {
-            config.host.clone()
-        };
-        let targets = if !flags.target.is_empty() {
-            for target in flags.target.iter() {
-                if !config.target.contains(target) {
-                    panic!("specified target `{}` is not in configuration", target);
-                }
-            }
-            flags.target.clone()
-        } else {
-            config.target.clone()
-        };
-
         Build {
             initial_rustc: config.initial_rustc.clone(),
             initial_cargo: config.initial_cargo.clone(),
             local_rebuild: config.local_rebuild,
-            fail_fast: flags.cmd.fail_fast(),
-            verbosity: cmp::max(flags.verbose, config.verbose),
+            fail_fast: config.cmd.fail_fast(),
+            verbosity: config.verbose,
 
-            build: config.host[0].clone(),
-            hosts: hosts,
-            targets: targets,
+            build: config.build,
+            hosts: config.hosts.clone(),
+            targets: config.targets.clone(),
 
-            flags: flags,
             config: config,
             src: src,
             out: out,
@@ -357,13 +332,19 @@ impl Build {
         }
     }
 
+    pub fn build_triple(&self) -> &[Interned<String>] {
+        unsafe {
+            slice::from_raw_parts(&self.build, 1)
+        }
+    }
+
     /// Executes the entire build, as configured by the flags and configuration.
     pub fn build(&mut self) {
         unsafe {
             job::setup(self);
         }
 
-        if let Subcommand::Clean = self.flags.cmd {
+        if let Subcommand::Clean = self.config.cmd {
             return clean::clean(self);
         }
 
@@ -608,7 +589,7 @@ impl Build {
     /// Returns the number of parallel jobs that have been configured for this
     /// build.
     fn jobs(&self) -> u32 {
-        self.flags.jobs.unwrap_or_else(|| num_cpus::get() as u32)
+        self.config.jobs.unwrap_or_else(|| num_cpus::get() as u32)
     }
 
     /// Returns the path to the C compiler for the target specified.
@@ -727,7 +708,7 @@ impl Build {
     fn force_use_stage1(&self, compiler: Compiler, target: Interned<String>) -> bool {
         !self.config.full_bootstrap &&
             compiler.stage >= 2 &&
-            self.config.host.iter().any(|h| *h == target)
+            self.hosts.iter().any(|h| *h == target)
     }
 
     /// Returns the directory that OpenSSL artifacts are compiled into if