From 5290c6c8f158004b19fa38aab36ac29511ec1a8a Mon Sep 17 00:00:00 2001 From: Mark Simulacrum Date: Sat, 29 Jul 2017 22:45:49 -0600 Subject: [PATCH] Allow overriding build triple via flag. We first check the configuration, then passed parameters (--build), then fall back to the auto-detection that bootstrap.py does. Fixes #39673. --- src/bootstrap/config.rs | 6 +++++- src/bootstrap/flags.rs | 6 ++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index e1c60b5d19143..008dbbe891422 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -290,7 +290,6 @@ impl Config { config.docs = true; config.rust_rpath = true; config.rust_codegen_units = 1; - config.build = flags.build; config.channel = "dev".to_string(); config.codegen_tests = true; config.rust_dist_src = true; @@ -319,6 +318,11 @@ impl Config { let build = toml.build.clone().unwrap_or(Build::default()); set(&mut config.build, build.build.clone().map(|x| INTERNER.intern_string(x))); + set(&mut config.build, flags.build); + if config.build.is_empty() { + // set by bootstrap.py + config.build = INTERNER.intern_str(&env::var("BUILD").unwrap()); + } config.hosts.push(config.build.clone()); for host in build.host.iter() { let host = INTERNER.intern_str(host); diff --git a/src/bootstrap/flags.rs b/src/bootstrap/flags.rs index b20801971f19d..a9cefb65f4963 100644 --- a/src/bootstrap/flags.rs +++ b/src/bootstrap/flags.rs @@ -33,7 +33,7 @@ pub struct Flags { pub on_fail: Option, pub stage: Option, pub keep_stage: Option, - pub build: Interned, + pub build: Option>, pub host: Vec>, pub target: Vec>, @@ -327,9 +327,7 @@ Arguments: stage: stage, on_fail: matches.opt_str("on-fail"), keep_stage: matches.opt_str("keep-stage").map(|j| j.parse().unwrap()), - build: INTERNER.intern_string(matches.opt_str("build").unwrap_or_else(|| { - env::var("BUILD").unwrap() - })), + build: matches.opt_str("build").map(|s| INTERNER.intern_string(s)), host: split(matches.opt_strs("host")) .into_iter().map(|x| INTERNER.intern_string(x)).collect::>(), target: split(matches.opt_strs("target"))