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.
This commit is contained in:
Mark Simulacrum 2017-07-29 22:45:49 -06:00
parent 84d9a6ee8c
commit 5290c6c8f1
2 changed files with 7 additions and 5 deletions

View File

@ -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);

View File

@ -33,7 +33,7 @@ pub struct Flags {
pub on_fail: Option<String>,
pub stage: Option<u32>,
pub keep_stage: Option<u32>,
pub build: Interned<String>,
pub build: Option<Interned<String>>,
pub host: Vec<Interned<String>>,
pub target: Vec<Interned<String>>,
@ -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::<Vec<_>>(),
target: split(matches.opt_strs("target"))