Inline Compiler::bootstrap_with_triple

This commit is contained in:
bjorn3 2023-02-10 10:03:42 +00:00
parent de8a4d5d46
commit 2155c03500
2 changed files with 17 additions and 18 deletions

View File

@ -1,5 +1,5 @@
use std::env;
use std::path::{Path, PathBuf};
use std::path::PathBuf;
use std::process;
use self::utils::{is_ci, is_ci_opt, Compiler};
@ -101,12 +101,24 @@ pub(crate) fn main() {
}
}
let bootstrap_host_compiler = Compiler::bootstrap_with_triple(
std::env::var("HOST_TRIPLE")
let bootstrap_host_compiler = {
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(Path::new("rustc"))),
);
.unwrap_or_else(|| rustc_info::get_host_triple(&rustc));
Compiler {
cargo,
rustc,
rustdoc,
rustflags: String::new(),
rustdocflags: String::new(),
triple,
runner: vec![],
}
};
let target_triple = std::env::var("TARGET_TRIPLE")
.ok()
.or_else(|| config::get_value("target"))

View File

@ -5,7 +5,6 @@ use std::path::{Path, PathBuf};
use std::process::{self, Command, Stdio};
use super::path::{Dirs, RelPath};
use super::rustc_info::{get_cargo_path, get_rustc_path, get_rustdoc_path};
#[derive(Clone, Debug)]
pub(crate) struct Compiler {
@ -19,18 +18,6 @@ pub(crate) struct Compiler {
}
impl Compiler {
pub(crate) fn bootstrap_with_triple(triple: String) -> Compiler {
Compiler {
cargo: get_cargo_path(),
rustc: get_rustc_path(),
rustdoc: get_rustdoc_path(),
rustflags: String::new(),
rustdocflags: String::new(),
triple,
runner: vec![],
}
}
pub(crate) fn set_cross_linker_and_runner(&mut self) {
match self.triple.as_str() {
"aarch64-unknown-linux-gnu" => {