mk: Don't consider LLVM done until it's done

Currently if an LLVM build is interrupted *after* it creates the llvm-config
binary but before it's done it puts us in an inconsistent state where we think
LLVM is compiled but it's not actually. This tweaks our logic to only consider
LLVM done building once it's actually done building.

This should hopefully alleviate problems on the bots where if we interrupt at
the wrong time it doesn't corrupt the build directory.
This commit is contained in:
Alex Crichton 2016-06-29 13:45:18 -07:00
parent c2b56fb7a0
commit 9e2bd921ea
2 changed files with 11 additions and 6 deletions

View File

@ -37,8 +37,11 @@ endif
ifeq ($(CFG_LLVM_ROOT),) ifeq ($(CFG_LLVM_ROOT),)
LLVM_STAMP_$(1) = $$(CFG_LLVM_BUILD_DIR_$(1))/llvm-auto-clean-stamp LLVM_STAMP_$(1) = $$(CFG_LLVM_BUILD_DIR_$(1))/llvm-auto-clean-stamp
LLVM_DONE_$(1) = $$(CFG_LLVM_BUILD_DIR_$(1))/llvm-finished-building
$$(LLVM_CONFIG_$(1)): $$(LLVM_DEPS_TARGET_$(1)) $$(LLVM_STAMP_$(1)) $$(LLVM_CONFIG_$(1)): $$(LLVM_DONE_$(1))
$$(LLVM_DONE_$(1)): $$(LLVM_DEPS_TARGET_$(1)) $$(LLVM_STAMP_$(1))
@$$(call E, cmake: llvm) @$$(call E, cmake: llvm)
ifeq ($$(findstring msvc,$(1)),msvc) ifeq ($$(findstring msvc,$(1)),msvc)
$$(Q)$$(CFG_CMAKE) --build $$(CFG_LLVM_BUILD_DIR_$(1)) \ $$(Q)$$(CFG_CMAKE) --build $$(CFG_LLVM_BUILD_DIR_$(1)) \
@ -46,7 +49,7 @@ ifeq ($$(findstring msvc,$(1)),msvc)
else else
$$(Q)$$(MAKE) -C $$(CFG_LLVM_BUILD_DIR_$(1)) $$(Q)$$(MAKE) -C $$(CFG_LLVM_BUILD_DIR_$(1))
endif endif
$$(Q)touch $$(LLVM_CONFIG_$(1)) $$(Q)touch $$@
ifeq ($$(findstring msvc,$(1)),msvc) ifeq ($$(findstring msvc,$(1)),msvc)
clean-llvm$(1): clean-llvm$(1):

View File

@ -20,14 +20,14 @@
use std::path::Path; use std::path::Path;
use std::process::Command; use std::process::Command;
use std::fs; use std::fs::{self, File};
use build_helper::output; use build_helper::output;
use cmake; use cmake;
use gcc; use gcc;
use build::Build; use build::Build;
use build::util::{exe, staticlib, up_to_date}; use build::util::{staticlib, up_to_date};
/// Compile LLVM for `target`. /// Compile LLVM for `target`.
pub fn llvm(build: &Build, target: &str) { pub fn llvm(build: &Build, target: &str) {
@ -43,9 +43,9 @@ pub fn llvm(build: &Build, target: &str) {
// artifacts are missing) then we keep going, otherwise we bail out. // artifacts are missing) then we keep going, otherwise we bail out.
let dst = build.llvm_out(target); let dst = build.llvm_out(target);
let stamp = build.src.join("src/rustllvm/llvm-auto-clean-trigger"); let stamp = build.src.join("src/rustllvm/llvm-auto-clean-trigger");
let llvm_config = dst.join("bin").join(exe("llvm-config", target)); let done_stamp = dst.join("llvm-finished-building");
build.clear_if_dirty(&dst, &stamp); build.clear_if_dirty(&dst, &stamp);
if fs::metadata(llvm_config).is_ok() { if fs::metadata(&done_stamp).is_ok() {
return return
} }
@ -111,6 +111,8 @@ pub fn llvm(build: &Build, target: &str) {
// tools. Figure out how to filter them down and only build the right // tools. Figure out how to filter them down and only build the right
// tools and libs on all platforms. // tools and libs on all platforms.
cfg.build(); cfg.build();
t!(File::create(&done_stamp));
} }
fn check_llvm_version(build: &Build, llvm_config: &Path) { fn check_llvm_version(build: &Build, llvm_config: &Path) {