Skip to content

Commit

Permalink
Rollup merge of rust-lang#61890 - golddranks:fix_sanity_check_llvm, r…
Browse files Browse the repository at this point in the history
…=Dylan-DPC

Fix some sanity checks

Update: Changes that made it not to work dropped.

* Fix `building_llvm` in sanity check
  * This was subtly broken: we build LLVM if any of the hosts builds LLVM, and not setting the config meant that LLVM is built for that target. Because of filtering away the targets not configured and the semantics of `Iterator::any`, it currently didn't set the `building_llvm` flag even if we indeed build it.
* Add `swig` sanity check
  * This checks whether there is a `swig` executable needed for LLDB.
  • Loading branch information
Centril authored Jul 25, 2019
2 parents 1433a4b + f78cd4d commit 1492b2d
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/bootstrap/sanity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,11 @@ pub fn check(build: &mut Build) {

// We need cmake, but only if we're actually building LLVM or sanitizers.
let building_llvm = build.hosts.iter()
.filter_map(|host| build.config.target_config.get(host))
.any(|config| config.llvm_config.is_none());
.map(|host| build.config.target_config
.get(host)
.map(|config| config.llvm_config.is_none())
.unwrap_or(true))
.any(|build_llvm_ourselves| build_llvm_ourselves);
if building_llvm || build.config.sanitizers {
cmd_finder.must_have("cmake");
}
Expand All @@ -106,6 +109,14 @@ pub fn check(build: &mut Build) {
build.config.ninja = true;
}
}

if build.config.lldb_enabled {
cmd_finder.must_have("swig");
let out = output(Command::new("swig").arg("-version"));
if !out.contains("SWIG Version 3") && !out.contains("SWIG Version 4") {
panic!("Ensure that Swig 3.x.x or 4.x.x is installed.");
}
}
}

build.config.python = build.config.python.take().map(|p| cmd_finder.must_have(p))
Expand Down

0 comments on commit 1492b2d

Please sign in to comment.