about summary refs log tree commit diff
path: root/src/librustc_tsan
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2017-03-03 02:15:56 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2017-03-04 21:38:26 +0300
commitaeadc81ddcf25df677f75d781aa2ec9d732bb6f4 (patch)
treed209490ee1c2b510925e19c754ce4b521653c240 /src/librustc_tsan
parenta7c8afd28d45018f3c3af9dec569c36bd4dea10a (diff)
downloadrust-aeadc81ddcf25df677f75d781aa2ec9d732bb6f4.tar.gz
rust-aeadc81ddcf25df677f75d781aa2ec9d732bb6f4.zip
Build compiler-rt and sanitizers only once
Diffstat (limited to 'src/librustc_tsan')
-rw-r--r--src/librustc_tsan/build.rs21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/librustc_tsan/build.rs b/src/librustc_tsan/build.rs
index 95ce237b267..3bd30fd203c 100644
--- a/src/librustc_tsan/build.rs
+++ b/src/librustc_tsan/build.rs
@@ -8,30 +8,33 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#[macro_use]
 extern crate build_helper;
 extern crate cmake;
 
-use std::path::PathBuf;
 use std::env;
+use std::fs::File;
+use build_helper::native_lib_boilerplate;
 
 use cmake::Config;
 
 fn main() {
     if let Some(llvm_config) = env::var_os("LLVM_CONFIG") {
-        let dst = Config::new("../compiler-rt")
+        let native = native_lib_boilerplate("compiler-rt", "tsan", "clang_rt.tsan-x86_64",
+                                            "rustbuild.timestamp", "build/lib/linux");
+        if native.skip_build {
+            return
+        }
+
+        Config::new(&native.src_dir)
             .define("COMPILER_RT_BUILD_SANITIZERS", "ON")
             .define("COMPILER_RT_BUILD_BUILTINS", "OFF")
             .define("COMPILER_RT_BUILD_XRAY", "OFF")
             .define("LLVM_CONFIG_PATH", llvm_config)
+            .out_dir(&native.out_dir)
             .build_target("tsan")
             .build();
 
-        println!("cargo:rustc-link-search=native={}",
-                 dst.join("build/lib/linux").display());
-        println!("cargo:rustc-link-lib=static=clang_rt.tsan-x86_64");
-
-        build_helper::rerun_if_changed_anything_in_dir(&PathBuf::from(env::var("CARGO_MANIFEST_DIR")
-                .unwrap())
-            .join("../compiler-rt"));
+        t!(File::create(&native.timestamp));
     }
 }