File rust-revert-llvm-build-info.patch of Package rust
From c821ad60e834f03537b407f58139e6362e0d0a2e Mon Sep 17 00:00:00 2001
From: Federico Mena Quintero <federico@gnome.org>
Date: Sat, 17 Aug 2019 12:09:40 -0500
Subject: [PATCH] Revert commits to the llvm build info
This reverts the following commits:
105692c
975ba58
e1daa36
See https://github.com/rust-lang/rust/issues/61206 for more information.
---
src/bootstrap/native.rs | 46 ++++++++++++++-----------------
src/rustllvm/llvm-rebuild-trigger | 4 +++
2 files changed, 24 insertions(+), 26 deletions(-)
create mode 100644 src/rustllvm/llvm-rebuild-trigger
diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs
index da2e03a1a..b332f3211 100644
--- a/src/bootstrap/native.rs
+++ b/src/bootstrap/native.rs
@@ -67,40 +67,30 @@ impl Step for Llvm {
}
}
- let (llvm_info, root, out_dir, llvm_config_ret_dir) = if emscripten {
- let info = &builder.emscripten_llvm_info;
+ let rebuild_trigger = builder.src.join("src/rustllvm/llvm-rebuild-trigger");
+ let rebuild_trigger_contents = t!(fs::read_to_string(&rebuild_trigger));
+
+ let (out_dir, llvm_config_ret_dir) = if emscripten {
let dir = builder.emscripten_llvm_out(target);
let config_dir = dir.join("bin");
- (info, "src/llvm-emscripten", dir, config_dir)
+ (dir, config_dir)
} else {
- let info = &builder.in_tree_llvm_info;
let mut dir = builder.llvm_out(builder.config.build);
if !builder.config.build.contains("msvc") || builder.config.ninja {
dir.push("build");
}
- (info, "src/llvm-project/llvm", builder.llvm_out(target), dir.join("bin"))
+ (builder.llvm_out(target), dir.join("bin"))
};
-
- if !llvm_info.is_git() {
- println!(
- "git could not determine the LLVM submodule commit hash. \
- Assuming that an LLVM build is necessary.",
- );
- }
-
+ let done_stamp = out_dir.join("llvm-finished-building");
let build_llvm_config = llvm_config_ret_dir
.join(exe("llvm-config", &*builder.config.build));
- let done_stamp = out_dir.join("llvm-finished-building");
-
- if let Some(llvm_commit) = llvm_info.sha() {
- if done_stamp.exists() {
- let done_contents = t!(fs::read(&done_stamp));
+ if done_stamp.exists() {
+ let done_contents = t!(fs::read_to_string(&done_stamp));
- // If LLVM was already built previously and the submodule's commit didn't change
- // from the previous build, then no action is required.
- if done_contents == llvm_commit.as_bytes() {
- return build_llvm_config
- }
+ // If LLVM was already built previously and contents of the rebuild-trigger file
+ // didn't change from the previous build, then no action is required.
+ if done_contents == rebuild_trigger_contents {
+ return build_llvm_config
}
}
@@ -111,6 +101,7 @@ impl Step for Llvm {
t!(fs::create_dir_all(&out_dir));
// http://llvm.org/docs/CMake.html
+ let root = if self.emscripten { "src/llvm-emscripten" } else { "src/llvm-project/llvm" };
let mut cfg = cmake::Config::new(builder.src.join(root));
let profile = match (builder.config.llvm_optimize, builder.config.llvm_release_debuginfo) {
@@ -253,6 +244,11 @@ impl Step for Llvm {
channel::CFG_RELEASE_NUM,
builder.config.channel,
);
+ let llvm_info = if self.emscripten {
+ &builder.emscripten_llvm_info
+ } else {
+ &builder.in_tree_llvm_info
+ };
if let Some(sha) = llvm_info.sha_short() {
default_suffix.push_str("-");
default_suffix.push_str(sha);
@@ -285,9 +281,7 @@ impl Step for Llvm {
cfg.build();
- if let Some(llvm_commit) = llvm_info.sha() {
- t!(fs::write(&done_stamp, llvm_commit));
- }
+ t!(fs::write(&done_stamp, &rebuild_trigger_contents));
build_llvm_config
}
diff --git a/src/rustllvm/llvm-rebuild-trigger b/src/rustllvm/llvm-rebuild-trigger
new file mode 100644
index 000000000..0f18c6a4a
--- /dev/null
+++ b/src/rustllvm/llvm-rebuild-trigger
@@ -0,0 +1,4 @@
+# If this file is modified, then llvm will be (optionally) cleaned and then rebuilt.
+# The actual contents of this file do not matter, but to trigger a change on the
+# build bots then the contents should be changed so git updates the mtime.
+2019-03-18
--
2.20.1