Skip to content

Commit

Permalink
Allow overriding build triple via flag.
Browse files Browse the repository at this point in the history
We first check the configuration, then passed parameters (--build), then
fall back to the auto-detection that bootstrap.py does.

Fixes #39673.
  • Loading branch information
Mark-Simulacrum committed Aug 13, 2017
1 parent 84d9a6e commit 5290c6c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 5 additions & 1 deletion src/bootstrap/config.rs
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 2 additions & 4 deletions src/bootstrap/flags.rs
Expand Up @@ -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>>,
Expand Down Expand Up @@ -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"))
Expand Down

0 comments on commit 5290c6c

Please sign in to comment.