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 commit is contained in:
Ximin Luo 2019-09-05 00:14:09 -07:00
parent a24f636e60
commit 485697bf42
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 build_helper::sanitizer_lib_boilerplate;
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 build_helper::sanitizer_lib_boilerplate;
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 build_helper::sanitizer_lib_boilerplate;
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 build_helper::sanitizer_lib_boilerplate;
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();