summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2016-09-27 21:27:22 +0000
committerBrian Anderson <banderson@mozilla.com>2016-09-30 14:03:00 -0700
commit4f5e73be1bf439a9881600ad4cdfd5865391eaef (patch)
treee8f04e1018d5fb02297fafb8c36f2d857655ce3a /src/bootstrap
parent3c038c0505a5f937aba9a4c3208fe8e0aebdd370 (diff)
downloadrust-4f5e73be1bf439a9881600ad4cdfd5865391eaef.tar.gz
rust-4f5e73be1bf439a9881600ad4cdfd5865391eaef.zip
Build a dummy alloc_jemalloc crate on platforms that don't support it
This is a hack to support building targets that don't support jemalloc
alongside hosts that do. The jemalloc build is controlled by a feature
of the std crate, and if that feature changes between targets, it
invalidates the fingerprint of std's build script (this is a cargo
bug); so we must ensure that the feature set used by std is the same
across all targets, which means we have to build the alloc_jemalloc
crate for targets like emscripten, even if we don't use it.
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/sanity.rs17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/bootstrap/sanity.rs b/src/bootstrap/sanity.rs
index 962d0666f69..9429af56525 100644
--- a/src/bootstrap/sanity.rs
+++ b/src/bootstrap/sanity.rs
@@ -104,6 +104,14 @@ pub fn check(build: &mut Build) {
         need_cmd(build.cxx(host).as_ref());
     }
 
+    // The msvc hosts don't use jemalloc, turn it off globally to
+    // avoid packaging the dummy liballoc_jemalloc on that platform.
+    for host in build.config.host.iter() {
+        if host.contains("msvc") {
+            build.config.use_jemalloc = false;
+        }
+    }
+
     // Externally configured LLVM requires FileCheck to exist
     let filecheck = build.llvm_filecheck(&build.config.build);
     if !filecheck.starts_with(&build.out) && !filecheck.exists() && build.config.codegen_tests {
@@ -111,15 +119,6 @@ pub fn check(build: &mut Build) {
     }
 
     for target in build.config.target.iter() {
-        // Either can't build or don't want to run jemalloc on these targets
-        if target.contains("rumprun") ||
-           target.contains("bitrig") ||
-           target.contains("openbsd") ||
-           target.contains("msvc") ||
-           target.contains("emscripten") {
-            build.config.use_jemalloc = false;
-        }
-
         // Can't compile for iOS unless we're on OSX
         if target.contains("apple-ios") &&
            !build.config.build.contains("apple-darwin") {