Skip to content

Commit

Permalink
Remove host and target configuration from config.txt
Browse files Browse the repository at this point in the history
They can still be set using HOST_TRIPLE and TARGET_TRIPLE.
  • Loading branch information
bjorn3 committed Dec 18, 2024
1 parent 88139f0 commit 53bbef8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 38 deletions.
20 changes: 0 additions & 20 deletions build_system/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,3 @@ pub(crate) fn get_bool(name: &str) -> bool {
true
}
}

pub(crate) fn get_value(name: &str) -> Option<String> {
let values = load_config_file()
.into_iter()
.filter(|(key, _)| key == name)
.map(|(_, val)| val)
.collect::<Vec<_>>();
if values.is_empty() {
None
} else if values.len() == 1 {
if values[0].is_none() {
eprintln!("Config `{}` missing value", name);
process::exit(1);
}
values.into_iter().next().unwrap()
} else {
eprintln!("Config `{}` given multiple values: {:?}", name, values);
process::exit(1);
}
}
12 changes: 4 additions & 8 deletions build_system/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,8 @@ fn main() {
let cargo = rustc_info::get_cargo_path();
let rustc = rustc_info::get_rustc_path();
let rustdoc = rustc_info::get_rustdoc_path();
let triple = std::env::var("HOST_TRIPLE")
.ok()
.or_else(|| config::get_value("host"))
.unwrap_or_else(|| rustc_info::get_host_triple(&rustc));
let triple =
std::env::var("HOST_TRIPLE").unwrap_or_else(|_| rustc_info::get_host_triple(&rustc));
Compiler {
cargo,
rustc,
Expand All @@ -170,10 +168,8 @@ fn main() {
runner: vec![],
}
};
let target_triple = std::env::var("TARGET_TRIPLE")
.ok()
.or_else(|| config::get_value("target"))
.unwrap_or_else(|| bootstrap_host_compiler.triple.clone());
let target_triple =
std::env::var("TARGET_TRIPLE").unwrap_or_else(|_| bootstrap_host_compiler.triple.clone());

let dirs = path::Dirs {
source_dir: current_dir.clone(),
Expand Down
10 changes: 0 additions & 10 deletions config.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
# This file allows configuring the build system.

# Which triple to produce a compiler toolchain for.
#
# Defaults to the default triple of rustc on the host system.
#host = x86_64-unknown-linux-gnu

# Which triple to build libraries (core/alloc/std/test/proc_macro) for.
#
# Defaults to `host`.
#target = x86_64-unknown-linux-gnu

# Disables cleaning of the sysroot dir. This will cause old compiled artifacts to be re-used when
# the sysroot source hasn't changed. This is useful when the codegen backend hasn't been modified.
# This option can be changed while the build system is already running for as long as sysroot
Expand Down

0 comments on commit 53bbef8

Please sign in to comment.