summary refs log tree commit diff
path: root/compiler/rustc_llvm/build.rs
diff options
context:
space:
mode:
authorNilstrieb <48135649+Nilstrieb@users.noreply.github.com>2024-03-31 20:51:14 +0200
committerNilstrieb <48135649+Nilstrieb@users.noreply.github.com>2024-03-31 20:51:14 +0200
commitd651baef95276deab03c42a732759f14be0dd076 (patch)
tree05cb170b565deb09b8503b21f1325caf50d40ff8 /compiler/rustc_llvm/build.rs
parenta8cfc83801301c2b4f0fd030192e268eeb15d473 (diff)
downloadrust-d651baef95276deab03c42a732759f14be0dd076.tar.gz
rust-d651baef95276deab03c42a732759f14be0dd076.zip
Require LLVM_CONFIG to be set in rustc_llvm/build.rs
This environment variable should always be set by bootstrap in
`rustc_llvm_env`. The fallback is quite ugly and complicated, so
removing it is nice.
Diffstat (limited to 'compiler/rustc_llvm/build.rs')
-rw-r--r--compiler/rustc_llvm/build.rs22
1 files changed, 2 insertions, 20 deletions
diff --git a/compiler/rustc_llvm/build.rs b/compiler/rustc_llvm/build.rs
index 4b0c1229da1..a2709a8aedd 100644
--- a/compiler/rustc_llvm/build.rs
+++ b/compiler/rustc_llvm/build.rs
@@ -112,28 +112,10 @@ fn main() {
 
     restore_library_path();
 
-    let target = env::var("TARGET").expect("TARGET was not set");
     let llvm_config =
-        tracked_env_var_os("LLVM_CONFIG").map(|x| Some(PathBuf::from(x))).unwrap_or_else(|| {
-            if let Some(dir) = tracked_env_var_os("CARGO_TARGET_DIR").map(PathBuf::from) {
-                let to_test = dir
-                    .parent()
-                    .unwrap()
-                    .parent()
-                    .unwrap()
-                    .join(&target)
-                    .join("llvm/bin/llvm-config");
-                if Command::new(&to_test).output().is_ok() {
-                    return Some(to_test);
-                }
-            }
-            None
-        });
+        PathBuf::from(tracked_env_var_os("LLVM_CONFIG").expect("LLVM_CONFIG was not set"));
 
-    if let Some(llvm_config) = &llvm_config {
-        println!("cargo:rerun-if-changed={}", llvm_config.display());
-    }
-    let llvm_config = llvm_config.unwrap_or_else(|| PathBuf::from("llvm-config"));
+    println!("cargo:rerun-if-changed={}", llvm_config.display());
 
     // Test whether we're cross-compiling LLVM. This is a pretty rare case
     // currently where we're producing an LLVM for a different platform than