mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-15 12:39:31 +03:00
Cache LLVM config invocations
This commit is contained in:
@@ -2022,6 +2022,7 @@ fn run(self, builder: &Builder<'_>) -> Compiler {
|
||||
|
||||
let host_llvm_bin_dir = command(&host_llvm_config)
|
||||
.arg("--bindir")
|
||||
.cached()
|
||||
.run_capture_stdout(builder)
|
||||
.stdout()
|
||||
.trim()
|
||||
|
||||
@@ -2269,6 +2269,7 @@ fn maybe_install_llvm(
|
||||
{
|
||||
trace!("LLVM already built, installing LLVM files");
|
||||
let mut cmd = command(host_llvm_config);
|
||||
cmd.cached();
|
||||
cmd.arg("--libfiles");
|
||||
builder.verbose(|| println!("running {cmd:?}"));
|
||||
let files = cmd.run_capture_stdout(builder).stdout();
|
||||
|
||||
@@ -486,8 +486,11 @@ fn run(self, builder: &Builder<'_>) -> LlvmResult {
|
||||
let LlvmResult { host_llvm_config, .. } =
|
||||
builder.ensure(Llvm { target: builder.config.host_target });
|
||||
if !builder.config.dry_run() {
|
||||
let llvm_bindir =
|
||||
command(&host_llvm_config).arg("--bindir").run_capture_stdout(builder).stdout();
|
||||
let llvm_bindir = command(&host_llvm_config)
|
||||
.arg("--bindir")
|
||||
.cached()
|
||||
.run_capture_stdout(builder)
|
||||
.stdout();
|
||||
let host_bin = Path::new(llvm_bindir.trim());
|
||||
cfg.define(
|
||||
"LLVM_TABLEGEN",
|
||||
@@ -593,7 +596,13 @@ fn metadata(&self) -> Option<StepMetadata> {
|
||||
}
|
||||
|
||||
pub fn get_llvm_version(builder: &Builder<'_>, llvm_config: &Path) -> String {
|
||||
command(llvm_config).arg("--version").run_capture_stdout(builder).stdout().trim().to_owned()
|
||||
command(llvm_config)
|
||||
.arg("--version")
|
||||
.cached()
|
||||
.run_capture_stdout(builder)
|
||||
.stdout()
|
||||
.trim()
|
||||
.to_owned()
|
||||
}
|
||||
|
||||
pub fn get_llvm_version_major(builder: &Builder<'_>, llvm_config: &Path) -> u8 {
|
||||
|
||||
@@ -2043,6 +2043,7 @@ fn run(self, builder: &Builder<'_>) {
|
||||
if !builder.config.dry_run() {
|
||||
let llvm_version = get_llvm_version(builder, &host_llvm_config);
|
||||
let llvm_components = command(&host_llvm_config)
|
||||
.cached()
|
||||
.arg("--components")
|
||||
.run_capture_stdout(builder)
|
||||
.stdout();
|
||||
@@ -2062,8 +2063,11 @@ fn run(self, builder: &Builder<'_>) {
|
||||
// separate compilations. We can add LLVM's library path to the
|
||||
// rustc args as a workaround.
|
||||
if !builder.config.dry_run() && suite.ends_with("fulldeps") {
|
||||
let llvm_libdir =
|
||||
command(&host_llvm_config).arg("--libdir").run_capture_stdout(builder).stdout();
|
||||
let llvm_libdir = command(&host_llvm_config)
|
||||
.cached()
|
||||
.arg("--libdir")
|
||||
.run_capture_stdout(builder)
|
||||
.stdout();
|
||||
let link_llvm = if target.is_msvc() {
|
||||
format!("-Clink-arg=-LIBPATH:{llvm_libdir}")
|
||||
} else {
|
||||
|
||||
@@ -1082,7 +1082,7 @@ fn cargo(
|
||||
&& let Some(llvm_config) = self.llvm_config(target)
|
||||
{
|
||||
let llvm_libdir =
|
||||
command(llvm_config).arg("--libdir").run_capture_stdout(self).stdout();
|
||||
command(llvm_config).cached().arg("--libdir").run_capture_stdout(self).stdout();
|
||||
if target.is_msvc() {
|
||||
rustflags.arg(&format!("-Clink-arg=-LIBPATH:{llvm_libdir}"));
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user