]> git.lizzy.rs Git - rust.git/commitdiff
rustc_llvm: re-run build script if config.toml changes
authorVenkata Giri Reddy <venkatagirireddy@gmail.com>
Sun, 4 Jun 2017 18:35:57 +0000 (18:35 +0000)
committerVenkata Giri Reddy <venkatagirireddy@gmail.com>
Sun, 4 Jun 2017 18:35:57 +0000 (18:35 +0000)
src/bootstrap/compile.rs
src/librustc_llvm/build.rs

index 9946c93913fe7292fd502c6d2e726831a6af3e5c..9a07e8a8b1091da983213917f9ab46fd7be21630 100644 (file)
@@ -276,6 +276,10 @@ pub fn rustc(build: &Build, target: &str, compiler: &Compiler) {
     if build.is_rust_llvm(target) {
         cargo.env("LLVM_RUSTLLVM", "1");
     }
+    if let Some(ref cfg_file) = build.flags.config {
+        let cfg_path = t!(PathBuf::from(cfg_file).canonicalize());
+        cargo.env("CFG_LLVM_TOML", cfg_path.into_os_string());
+    }
     cargo.env("LLVM_CONFIG", build.llvm_config(target));
     let target_config = build.config.target_config.get(target);
     if let Some(s) = target_config.and_then(|c| c.llvm_config.as_ref()) {
index ba568857959f881eccb8cc31ea96e62c35850d52..bdfc0a2fe855ccf0df522b661f5012ad2557895e 100644 (file)
@@ -61,6 +61,11 @@ fn main() {
 
     println!("cargo:rerun-if-changed={}", llvm_config.display());
 
+    if let Some(cfg_toml) = env::var_os("CFG_LLVM_TOML") {
+        let cfg_path = PathBuf::from(cfg_toml);
+        println!("cargo:rerun-if-changed={}", cfg_path.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
     // what this build script is currently running on.