Gentoo Archives: gentoo-commits

From: Georgy Yakovlev <gyakovlev@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-lang/rust/files/, dev-lang/rust/
Date: Sun, 26 May 2019 06:27:06
Message-Id: 1558851932.c39dfea3a0cea8f515ddede3d171879ad0df9cf9.gyakovlev@gentoo
1 commit: c39dfea3a0cea8f515ddede3d171879ad0df9cf9
2 Author: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
3 AuthorDate: Sun May 26 06:25:06 2019 +0000
4 Commit: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
5 CommitDate: Sun May 26 06:25:32 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c39dfea3
7
8 dev-lang/rust: fix building 1.35.0 with internal llvm
9
10 Closes: https://bugs.gentoo.org/686656
11 X-Upstream-Issue: https://github.com/rust-lang/rust/issues/61206
12 Package-Manager: Portage-2.3.66, Repoman-2.3.12
13 Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org>
14
15 ...commits-triggering-multiple-llvm-rebuilds.patch | 117 +++++++++++++++++++++
16 dev-lang/rust/rust-1.35.0.ebuild | 1 +
17 2 files changed, 118 insertions(+)
18
19 diff --git a/dev-lang/rust/files/1.35.0-revert-commits-triggering-multiple-llvm-rebuilds.patch b/dev-lang/rust/files/1.35.0-revert-commits-triggering-multiple-llvm-rebuilds.patch
20 new file mode 100644
21 index 00000000000..1c6c8ca404d
22 --- /dev/null
23 +++ b/dev-lang/rust/files/1.35.0-revert-commits-triggering-multiple-llvm-rebuilds.patch
24 @@ -0,0 +1,117 @@
25 +From d6bd0a479ceaf6abdd696c3b955a56f66275c562 Mon Sep 17 00:00:00 2001
26 +From: Georgy Yakovlev <gyakovlev@g.o>
27 +Date: Sat, 25 May 2019 22:21:16 -0700
28 +Subject: [PATCH] revert commits triggering multiple llvm rebuilds
29 +
30 +this reverts the following commits
31 +https://github.com/rust-lang/rust/commit/105692c3ad281c63bf0f75a26a66bb9cff5b4553
32 +https://github.com/rust-lang/rust/commit/975ba58f42b34ff07cd7c2bd73350daed2057186
33 +https://github.com/rust-lang/rust/commit/e1daa36ba7df88788c2684bbe5ff6eb37f1cda69
34 +---
35 + src/bootstrap/llvm-rebuild-trigger | 4 +++
36 + src/bootstrap/native.rs | 46 +++++++++++++-----------------
37 + 2 files changed, 24 insertions(+), 26 deletions(-)
38 + create mode 100644 src/bootstrap/llvm-rebuild-trigger
39 +
40 +diff --git a/src/bootstrap/llvm-rebuild-trigger b/src/bootstrap/llvm-rebuild-trigger
41 +new file mode 100644
42 +index 0000000000..0f18c6a4ac
43 +--- /dev/null
44 ++++ b/src/rustllvm/llvm-rebuild-trigger
45 +@@ -0,0 +1,4 @@
46 ++# If this file is modified, then llvm will be (optionally) cleaned and then rebuilt.
47 ++# The actual contents of this file do not matter, but to trigger a change on the
48 ++# build bots then the contents should be changed so git updates the mtime.
49 ++2019-03-18
50 +diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs
51 +index fde40b0d1b..3babbc9e10 100644
52 +--- a/src/bootstrap/native.rs
53 ++++ b/src/bootstrap/native.rs
54 +@@ -67,40 +67,30 @@ impl Step for Llvm {
55 + }
56 + }
57 +
58 +- let (llvm_info, root, out_dir, llvm_config_ret_dir) = if emscripten {
59 +- let info = &builder.emscripten_llvm_info;
60 ++ let rebuild_trigger = builder.src.join("src/rustllvm/llvm-rebuild-trigger");
61 ++ let rebuild_trigger_contents = t!(fs::read_to_string(&rebuild_trigger));
62 ++
63 ++ let (out_dir, llvm_config_ret_dir) = if emscripten {
64 + let dir = builder.emscripten_llvm_out(target);
65 + let config_dir = dir.join("bin");
66 +- (info, "src/llvm-emscripten", dir, config_dir)
67 ++ (dir, config_dir)
68 + } else {
69 +- let info = &builder.in_tree_llvm_info;
70 + let mut dir = builder.llvm_out(builder.config.build);
71 + if !builder.config.build.contains("msvc") || builder.config.ninja {
72 + dir.push("build");
73 + }
74 +- (info, "src/llvm-project/llvm", builder.llvm_out(target), dir.join("bin"))
75 ++ (builder.llvm_out(target), dir.join("bin"))
76 + };
77 +-
78 +- if !llvm_info.is_git() {
79 +- println!(
80 +- "git could not determine the LLVM submodule commit hash. \
81 +- Assuming that an LLVM build is necessary.",
82 +- );
83 +- }
84 +-
85 ++ let done_stamp = out_dir.join("llvm-finished-building");
86 + let build_llvm_config = llvm_config_ret_dir
87 + .join(exe("llvm-config", &*builder.config.build));
88 +- let done_stamp = out_dir.join("llvm-finished-building");
89 +-
90 +- if let Some(llvm_commit) = llvm_info.sha() {
91 +- if done_stamp.exists() {
92 +- let done_contents = t!(fs::read(&done_stamp));
93 ++ if done_stamp.exists() {
94 ++ let done_contents = t!(fs::read_to_string(&done_stamp));
95 +
96 +- // If LLVM was already built previously and the submodule's commit didn't change
97 +- // from the previous build, then no action is required.
98 +- if done_contents == llvm_commit.as_bytes() {
99 +- return build_llvm_config
100 +- }
101 ++ // If LLVM was already built previously and contents of the rebuild-trigger file
102 ++ // didn't change from the previous build, then no action is required.
103 ++ if done_contents == rebuild_trigger_contents {
104 ++ return build_llvm_config
105 + }
106 + }
107 +
108 +@@ -111,6 +101,7 @@ impl Step for Llvm {
109 + t!(fs::create_dir_all(&out_dir));
110 +
111 + // http://llvm.org/docs/CMake.html
112 ++ let root = if self.emscripten { "src/llvm-emscripten" } else { "src/llvm-project/llvm" };
113 + let mut cfg = cmake::Config::new(builder.src.join(root));
114 +
115 + let profile = match (builder.config.llvm_optimize, builder.config.llvm_release_debuginfo) {
116 +@@ -251,6 +242,11 @@ impl Step for Llvm {
117 + channel::CFG_RELEASE_NUM,
118 + builder.config.channel,
119 + );
120 ++ let llvm_info = if self.emscripten {
121 ++ &builder.emscripten_llvm_info
122 ++ } else {
123 ++ &builder.in_tree_llvm_info
124 ++ };
125 + if let Some(sha) = llvm_info.sha_short() {
126 + default_suffix.push_str("-");
127 + default_suffix.push_str(sha);
128 +@@ -283,9 +279,7 @@ impl Step for Llvm {
129 +
130 + cfg.build();
131 +
132 +- if let Some(llvm_commit) = llvm_info.sha() {
133 +- t!(fs::write(&done_stamp, llvm_commit));
134 +- }
135 ++ t!(fs::write(&done_stamp, &rebuild_trigger_contents));
136 +
137 + build_llvm_config
138 + }
139 +--
140 +2.21.0
141 +
142
143 diff --git a/dev-lang/rust/rust-1.35.0.ebuild b/dev-lang/rust/rust-1.35.0.ebuild
144 index 801838bb704..b5725b81510 100644
145 --- a/dev-lang/rust/rust-1.35.0.ebuild
146 +++ b/dev-lang/rust/rust-1.35.0.ebuild
147 @@ -89,6 +89,7 @@ REQUIRED_USE="|| ( ${ALL_LLVM_TARGETS[*]} )
148
149 PATCHES=(
150 "${FILESDIR}"/0001-llvm-cmake-Add-additional-headers-only-if-they-exist.patch
151 + "${FILESDIR}"/1.35.0-revert-commits-triggering-multiple-llvm-rebuilds.patch
152 )
153
154 S="${WORKDIR}/${MY_P}-src"