From 09859692ffcf09a9c1e302adcb97f6dc0fb680dc Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 23 May 2016 13:49:37 -0700 Subject: [PATCH] rustbuild: Add support for --enable-local-rust This commit adds support for the `--enable-local-rust` `./configure` switch which uses the locally installed `rustc` to bootstrap the compiler. --- src/bootstrap/build/config.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/bootstrap/build/config.rs b/src/bootstrap/build/config.rs index fb1ad12d914..e155bf356a0 100644 --- a/src/bootstrap/build/config.rs +++ b/src/bootstrap/build/config.rs @@ -65,8 +65,8 @@ pub struct Config { pub build: String, pub host: Vec, pub target: Vec, - pub rustc: Option, - pub cargo: Option, + pub rustc: Option, + pub cargo: Option, pub local_rebuild: bool, // libstd features @@ -208,8 +208,8 @@ impl Config { config.target.push(target.clone()); } } - config.rustc = build.rustc; - config.cargo = build.cargo; + config.rustc = build.rustc.map(PathBuf::from); + config.cargo = build.cargo.map(PathBuf::from); set(&mut config.compiler_docs, build.compiler_docs); set(&mut config.docs, build.docs); @@ -379,6 +379,10 @@ impl Config { .or_insert(Target::default()); target.ndk = Some(PathBuf::from(value)); } + "CFG_LOCAL_RUST_ROOT" if value.len() > 0 => { + self.rustc = Some(PathBuf::from(value).join("bin/rustc")); + self.cargo = Some(PathBuf::from(value).join("bin/cargo")); + } _ => {} } }