Rollup merge of #64166 - infinity0:master, r=alexcrichton

Better way of conditioning the sanitizer builds

Previously the build would take the presence of the LLVM_CONFIG envvar to
mean that the sanitizers should be built, but this is a common envvar that
could be set for reasons unrelated to the rustc sanitizers.

This commit adds a new envvar RUSTC_BUILD_SANITIZERS and uses it instead.

This PR or similar will be necessary in order to work correctly with https://github.com/rust-lang-nursery/compiler-builtins/pull/296
This commit is contained in:
Mazdak Farrokhzad 2019-09-06 19:00:46 +02:00 committed by GitHub
commit 8bbd71b99a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 0 deletions

View File

@ -212,6 +212,7 @@ pub fn std_cargo(builder: &Builder<'_>,
emscripten: false,
});
cargo.env("LLVM_CONFIG", llvm_config);
cargo.env("RUSTC_BUILD_SANITIZERS", "1");
}
cargo.arg("--features").arg(features)

View File

@ -4,6 +4,9 @@
use cmake::Config;
fn main() {
if env::var("RUSTC_BUILD_SANITIZERS") != Ok("1".to_string()) {
return;
}
if let Some(llvm_config) = env::var_os("LLVM_CONFIG") {
build_helper::restore_library_path();

View File

@ -4,6 +4,9 @@
use cmake::Config;
fn main() {
if env::var("RUSTC_BUILD_SANITIZERS") != Ok("1".to_string()) {
return;
}
if let Some(llvm_config) = env::var_os("LLVM_CONFIG") {
build_helper::restore_library_path();

View File

@ -4,6 +4,9 @@
use cmake::Config;
fn main() {
if env::var("RUSTC_BUILD_SANITIZERS") != Ok("1".to_string()) {
return;
}
if let Some(llvm_config) = env::var_os("LLVM_CONFIG") {
build_helper::restore_library_path();

View File

@ -4,6 +4,9 @@
use cmake::Config;
fn main() {
if env::var("RUSTC_BUILD_SANITIZERS") != Ok("1".to_string()) {
return;
}
if let Some(llvm_config) = env::var_os("LLVM_CONFIG") {
build_helper::restore_library_path();