Skip to content

Commit 0985969

Browse files
committed
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.
1 parent dd6e8d4 commit 0985969

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/bootstrap/build/config.rs

+8-4
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ pub struct Config {
6565
pub build: String,
6666
pub host: Vec<String>,
6767
pub target: Vec<String>,
68-
pub rustc: Option<String>,
69-
pub cargo: Option<String>,
68+
pub rustc: Option<PathBuf>,
69+
pub cargo: Option<PathBuf>,
7070
pub local_rebuild: bool,
7171

7272
// libstd features
@@ -208,8 +208,8 @@ impl Config {
208208
config.target.push(target.clone());
209209
}
210210
}
211-
config.rustc = build.rustc;
212-
config.cargo = build.cargo;
211+
config.rustc = build.rustc.map(PathBuf::from);
212+
config.cargo = build.cargo.map(PathBuf::from);
213213
set(&mut config.compiler_docs, build.compiler_docs);
214214
set(&mut config.docs, build.docs);
215215

@@ -379,6 +379,10 @@ impl Config {
379379
.or_insert(Target::default());
380380
target.ndk = Some(PathBuf::from(value));
381381
}
382+
"CFG_LOCAL_RUST_ROOT" if value.len() > 0 => {
383+
self.rustc = Some(PathBuf::from(value).join("bin/rustc"));
384+
self.cargo = Some(PathBuf::from(value).join("bin/cargo"));
385+
}
382386
_ => {}
383387
}
384388
}

0 commit comments

Comments
 (0)