diff options
| author | Brian Anderson <banderson@mozilla.com> | 2016-09-27 21:27:22 +0000 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2016-09-30 14:03:00 -0700 |
| commit | 4f5e73be1bf439a9881600ad4cdfd5865391eaef (patch) | |
| tree | e8f04e1018d5fb02297fafb8c36f2d857655ce3a /src/liballoc_jemalloc/build.rs | |
| parent | 3c038c0505a5f937aba9a4c3208fe8e0aebdd370 (diff) | |
| download | rust-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/liballoc_jemalloc/build.rs')
| -rw-r--r-- | src/liballoc_jemalloc/build.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/liballoc_jemalloc/build.rs b/src/liballoc_jemalloc/build.rs index 8b31c5a5577..028d742cc83 100644 --- a/src/liballoc_jemalloc/build.rs +++ b/src/liballoc_jemalloc/build.rs @@ -27,6 +27,24 @@ fn main() { let build_dir = PathBuf::from(env::var_os("OUT_DIR").unwrap()); let src_dir = env::current_dir().unwrap(); + // FIXME: 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. + if target.contains("rumprun") || + target.contains("bitrig") || + target.contains("openbsd") || + target.contains("msvc") || + target.contains("emscripten") + { + println!("cargo:rustc-cfg=dummy_jemalloc"); + return; + } + if let Some(jemalloc) = env::var_os("JEMALLOC_OVERRIDE") { let jemalloc = PathBuf::from(jemalloc); println!("cargo:rustc-link-search=native={}", |
