1 |
commit: 6ebf0cd98d3702562579c9895bad5f4569f8b8b9 |
2 |
Author: orbea <orbea <AT> riseup <DOT> net> |
3 |
AuthorDate: Sat Jun 26 19:01:15 2021 +0000 |
4 |
Commit: Quentin Retornaz <gentoo <AT> retornaz <DOT> com> |
5 |
CommitDate: Sun Jun 27 00:32:34 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/proj/libressl.git/commit/?id=6ebf0cd9 |
7 |
|
8 |
dev-lang/rust: Version bump |
9 |
|
10 |
Signed-off-by: orbea <orbea <AT> riseup.net> |
11 |
Closes: https://github.com/gentoo/libressl/pull/345 |
12 |
Signed-off-by: Quentin Retornaz <gentoo <AT> retornaz.com> |
13 |
|
14 |
dev-lang/rust/files/1.53.0-miri-vergen.patch | 53 ++ |
15 |
dev-lang/rust/files/1.53.0-rustversion-1.0.5.patch | 234 +++++++ |
16 |
dev-lang/rust/rust-1.53.0.ebuild | 680 +++++++++++++++++++++ |
17 |
3 files changed, 967 insertions(+) |
18 |
|
19 |
diff --git a/dev-lang/rust/files/1.53.0-miri-vergen.patch b/dev-lang/rust/files/1.53.0-miri-vergen.patch |
20 |
new file mode 100644 |
21 |
index 0000000..347f147 |
22 |
--- /dev/null |
23 |
+++ b/dev-lang/rust/files/1.53.0-miri-vergen.patch |
24 |
@@ -0,0 +1,53 @@ |
25 |
+From 64f128c45687d18d64fc6856a30fde585b007e00 Mon Sep 17 00:00:00 2001 |
26 |
+From: Ralf Jung <post@×××××.de> |
27 |
+Date: Sat, 15 May 2021 14:17:30 +0200 |
28 |
+Subject: [PATCH] support building Miri outside a git repo |
29 |
+ |
30 |
+--- |
31 |
+ cargo-miri/bin.rs | 14 ++++++++------ |
32 |
+ cargo-miri/build.rs | 2 +- |
33 |
+ 2 files changed, 9 insertions(+), 7 deletions(-) |
34 |
+ |
35 |
+diff --git a/cargo-miri/bin.rs b/cargo-miri/bin.rs |
36 |
+index e29bdc771..84447b3a1 100644 |
37 |
+--- a/src/tools/miri/cargo-miri/bin.rs |
38 |
++++ b/src/tools/miri/cargo-miri/bin.rs |
39 |
+@@ -6,6 +6,7 @@ use std::io::{self, BufRead, BufReader, BufWriter, Read, Write}; |
40 |
+ use std::ops::Not; |
41 |
+ use std::path::{Path, PathBuf}; |
42 |
+ use std::process::Command; |
43 |
++use std::fmt::{Write as _}; |
44 |
+ |
45 |
+ use serde::{Deserialize, Serialize}; |
46 |
+ |
47 |
+@@ -90,12 +91,13 @@ fn show_help() { |
48 |
+ } |
49 |
+ |
50 |
+ fn show_version() { |
51 |
+- println!( |
52 |
+- "miri {} ({} {})", |
53 |
+- env!("CARGO_PKG_VERSION"), |
54 |
+- env!("VERGEN_GIT_SHA_SHORT"), |
55 |
+- env!("VERGEN_GIT_COMMIT_DATE") |
56 |
+- ); |
57 |
++ let mut version = format!("miri {}", env!("CARGO_PKG_VERSION")); |
58 |
++ // Only use `option_env` on vergen variables to ensure the build succeeds |
59 |
++ // when vergen failed to find the git info. |
60 |
++ if let Some(sha) = option_env!("VERGEN_GIT_SHA_SHORT") { |
61 |
++ write!(&mut version, " ({} {})", sha, option_env!("VERGEN_GIT_COMMIT_DATE").unwrap()).unwrap(); |
62 |
++ } |
63 |
++ println!("{}", version); |
64 |
+ } |
65 |
+ |
66 |
+ fn show_error(msg: String) -> ! { |
67 |
+diff --git a/cargo-miri/build.rs b/cargo-miri/build.rs |
68 |
+index cff135fe4..ebd8e7003 100644 |
69 |
+--- a/src/tools/miri/cargo-miri/build.rs |
70 |
++++ b/src/tools/miri/cargo-miri/build.rs |
71 |
+@@ -7,5 +7,5 @@ fn main() { |
72 |
+ let mut gen_config = vergen::Config::default(); |
73 |
+ *gen_config.git_mut().sha_kind_mut() = vergen::ShaKind::Short; |
74 |
+ *gen_config.git_mut().commit_timestamp_kind_mut() = vergen::TimestampKind::DateOnly; |
75 |
+- vergen(gen_config).expect("Unable to generate vergen keys!"); |
76 |
++ vergen(gen_config).ok(); // Ignore failure (in case we are built outside a git repo) |
77 |
+ } |
78 |
|
79 |
diff --git a/dev-lang/rust/files/1.53.0-rustversion-1.0.5.patch b/dev-lang/rust/files/1.53.0-rustversion-1.0.5.patch |
80 |
new file mode 100644 |
81 |
index 0000000..bc6ae8b |
82 |
--- /dev/null |
83 |
+++ b/dev-lang/rust/files/1.53.0-rustversion-1.0.5.patch |
84 |
@@ -0,0 +1,234 @@ |
85 |
+From 12efa21eb88cb43d3b927952da0c5635373ac92b Mon Sep 17 00:00:00 2001 |
86 |
+From: David Tolnay <dtolnay@×××××.com> |
87 |
+Date: Thu, 17 Jun 2021 22:34:55 -0700 |
88 |
+Subject: [PATCH] Update rustversion to 1.0.5 |
89 |
+ |
90 |
+--- |
91 |
+ Cargo.lock | 4 +-- |
92 |
+ vendor/rustversion/.cargo-checksum.json | 2 +- |
93 |
+ vendor/rustversion/Cargo.toml | 2 +- |
94 |
+ vendor/rustversion/build/build.rs | 6 ++++ |
95 |
+ vendor/rustversion/build/rustc.rs | 30 +++++++++----------- |
96 |
+ vendor/rustversion/src/lib.rs | 15 ++++++++++ |
97 |
+ vendor/rustversion/src/time.rs | 13 +++++++-- |
98 |
+ vendor/rustversion/tests/test_parse.rs | 10 +++++++ |
99 |
+ vendor/rustversion/tests/ui/bad-bound.stderr | 4 +-- |
100 |
+ vendor/rustversion/tests/ui/bad-date.stderr | 4 +-- |
101 |
+ 10 files changed, 63 insertions(+), 27 deletions(-) |
102 |
+ |
103 |
+diff --git a/Cargo.lock b/Cargo.lock |
104 |
+index 0939f19cdfe..26a89caf050 100644 |
105 |
+--- a/Cargo.lock |
106 |
++++ b/Cargo.lock |
107 |
+@@ -4582,9 +4582,9 @@ dependencies = [ |
108 |
+ |
109 |
+ [[package]] |
110 |
+ name = "rustversion" |
111 |
+-version = "1.0.4" |
112 |
++version = "1.0.5" |
113 |
+ source = "registry+https://github.com/rust-lang/crates.io-index" |
114 |
+-checksum = "cb5d2a036dc6d2d8fd16fde3498b04306e29bd193bf306a57427019b823d5acd" |
115 |
++checksum = "61b3909d758bb75c79f23d4736fac9433868679d3ad2ea7a61e3c25cfda9a088" |
116 |
+ |
117 |
+ [[package]] |
118 |
+ name = "ryu" |
119 |
+diff --git a/vendor/rustversion/.cargo-checksum.json b/vendor/rustversion/.cargo-checksum.json |
120 |
+index e1277df7b59..0a134695aaf 100644 |
121 |
+--- a/vendor/rustversion/.cargo-checksum.json |
122 |
++++ b/vendor/rustversion/.cargo-checksum.json |
123 |
+@@ -1 +1 @@ |
124 |
+-{"files":{"Cargo.toml":"1a91782510461d54726e816ae776042b95c79c9949d49c11b8782caefc22ead2","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","README.md":"01dc6a1bf499a12bd0bfbbfe4db2ca8460b2c151235bcf2aad2356de4c2ec50a","build/build.rs":"481daf363b7004c90ffc3e012863a4102e9f26b9aaa2a4a295c2dd78f690be28","build/rustc.rs":"4dc8f1764672137bd15758cc19242740b0d6ab99e4a69171ad0999f9112a15a6","src/attr.rs":"9301cd4aff5a9648c057d5d8de9eb66921f0c3a715c51ada4459576bd49c8b19","src/bound.rs":"44bda74d3aacfeeeac9dae2f7eef3acc844d4c3c7eaa9d3e6288e5aeff269dff","src/constfn.rs":"613b8f53b21cc06b4f619fce9000993d3e7873b650701ca01cef1e53bed5b40a","src/date.rs":"454c749a60db8144a706a813e06fe3ae39c981920ba9832ef82f3f9debe1f052","src/error.rs":"cb37102f03ebbaca313d80f9714fe08dfef92fe956789ee87d93eb6121705f4f","src/expr.rs":"8e8ca76f4f5838436d9d7273f499c698bb41f6c15bc07d32ec5c1cb8bd3dd731","sr |
125 |
c/iter.rs":"8d4b817b9abc4e817105b673e15f29ef9bb8284a010ce01ac2d83387fe136947","src/lib.rs":"f8347832d8072058dbb4af6b8d67a834a02fe9c5460bbaa26defec4b66317f1b","src/release.rs":"abb8ddd877c39a023bf5e7bd67063d6e4144e79758a8bafa338167f9d15b89f1","src/time.rs":"45fb48ff0a0046a5a1b108b9ce53b14885637ad868ede1d66970379c2b7f16ef","src/token.rs":"824ce765f692db73afa02d3ebb0281c750748035efc98fa547be29d3072665ce","src/version.rs":"afdb048bba95bbb885945eba5527b6bf0eca0105642bfc304c2f82a8b7d556df","tests/compiletest.rs":"0a52a44786aea1c299c695bf948b2ed2081e4cc344e5c2cadceab4eb03d0010d","tests/test_const.rs":"a8297ca6559f895a3b2664964a42b6f82bbbc3c8faa9556a513006e6e1827995","tests/test_eval.rs":"6f0ee3f49c9a0d0c374a4d0e9a9dce753cd9fc2ca7725e000a435dbd5f4a9ce3","tests/test_parse.rs":"fbf9695f4208263743715e6c8b6294dfffee21462a65dfeb9339a70c0e18dbc6","tests/ui/bad-bound.rs":"25bde278fcaabf62868417148a5e5f2006bf589d7ebd7bf6004fb8d78e47594f","tests/ui/bad-bound.stderr":"bc9297f758c2541fb0a8b48d5785f4bb |
126 |
cd0d2a07d876ba0baf2fc9de9275e7e6","tests/ui/bad-date.rs":"6e23714dae8b6346fefe50dacd4abba3265248bbadfdd60c739138aa8a0037ba","tests/ui/bad-date.stderr":"1ac3cab13ee900fc8344e8fab21ff4d9cad476aca44925a4c1b2293a6b59b742","tests/ui/bad-not.rs":"f003df8bd245e9dd8edc3a6d94078ee5162fac7a98db881271f0f5b6db98d45d","tests/ui/bad-not.stderr":"d4ef78fae4a82419e737757158796cb103a5920df498956eaf57ed201797b463","tests/ui/bad-version.rs":"f4ea2cd038e6c63deb9c2e3ceffce93dbf179d9ce18c16d88f3b6cd7138a8c8e","tests/ui/bad-version.stderr":"60ed51c62f4c2fb6ff95cff7523cfca379ed434f319da9d82704318588792338","tests/ui/const-not-fn.rs":"10bbe38f0d89391fff0698756e4cfd4e72a41090360393a0c951b67df14d1c35","tests/ui/const-not-fn.stderr":"9551f7f222445b31d7af2415d467301c332d55bb3d5a143846484f2f00047a01"},"package":"cb5d2a036dc6d2d8fd16fde3498b04306e29bd193bf306a57427019b823d5acd"} |
127 |
+\ No newline at end of file |
128 |
++{"files":{"Cargo.toml":"a09ee758f816eddff8a8c7fb5be54dd95e74caad18a207251faedd251ecfaf1c","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","README.md":"01dc6a1bf499a12bd0bfbbfe4db2ca8460b2c151235bcf2aad2356de4c2ec50a","build/build.rs":"bae427f344972e6e0e348ec48dce0947274b3ec6cac0938497a8d3da5c9834e5","build/rustc.rs":"3e4acf7ea679f9331dd4e8dbe42a08a312f58379ea1eee5898793a9848d06d8c","src/attr.rs":"9301cd4aff5a9648c057d5d8de9eb66921f0c3a715c51ada4459576bd49c8b19","src/bound.rs":"44bda74d3aacfeeeac9dae2f7eef3acc844d4c3c7eaa9d3e6288e5aeff269dff","src/constfn.rs":"613b8f53b21cc06b4f619fce9000993d3e7873b650701ca01cef1e53bed5b40a","src/date.rs":"454c749a60db8144a706a813e06fe3ae39c981920ba9832ef82f3f9debe1f052","src/error.rs":"cb37102f03ebbaca313d80f9714fe08dfef92fe956789ee87d93eb6121705f4f","src/expr.rs":"8e8ca76f4f5838436d9d7273f499c698bb41f6c15bc07d32ec5c1cb8bd3dd731","sr |
129 |
c/iter.rs":"8d4b817b9abc4e817105b673e15f29ef9bb8284a010ce01ac2d83387fe136947","src/lib.rs":"5652f6f84fc80136bd29b2125f7676e80e0df7d40aac274b0658c99cecbd871d","src/release.rs":"abb8ddd877c39a023bf5e7bd67063d6e4144e79758a8bafa338167f9d15b89f1","src/time.rs":"bdd05a743b07a6bbfa0dbc9d4e415e051aba4a51a430c3be1e23447eae298c8b","src/token.rs":"824ce765f692db73afa02d3ebb0281c750748035efc98fa547be29d3072665ce","src/version.rs":"afdb048bba95bbb885945eba5527b6bf0eca0105642bfc304c2f82a8b7d556df","tests/compiletest.rs":"0a52a44786aea1c299c695bf948b2ed2081e4cc344e5c2cadceab4eb03d0010d","tests/test_const.rs":"a8297ca6559f895a3b2664964a42b6f82bbbc3c8faa9556a513006e6e1827995","tests/test_eval.rs":"6f0ee3f49c9a0d0c374a4d0e9a9dce753cd9fc2ca7725e000a435dbd5f4a9ce3","tests/test_parse.rs":"cdfe376020b9391330292968046117b0935c828d73385e8faeb2e333ec897088","tests/ui/bad-bound.rs":"25bde278fcaabf62868417148a5e5f2006bf589d7ebd7bf6004fb8d78e47594f","tests/ui/bad-bound.stderr":"a03dc78b380191c10d3b3406b1fd3208 |
130 |
bb2609d4c26b9c33ccd335721e3cd072","tests/ui/bad-date.rs":"6e23714dae8b6346fefe50dacd4abba3265248bbadfdd60c739138aa8a0037ba","tests/ui/bad-date.stderr":"3a607fb950a69f7dc1b503295bce53541f9dee9f4674edc5d13ee3a69ff0e8cd","tests/ui/bad-not.rs":"f003df8bd245e9dd8edc3a6d94078ee5162fac7a98db881271f0f5b6db98d45d","tests/ui/bad-not.stderr":"d4ef78fae4a82419e737757158796cb103a5920df498956eaf57ed201797b463","tests/ui/bad-version.rs":"f4ea2cd038e6c63deb9c2e3ceffce93dbf179d9ce18c16d88f3b6cd7138a8c8e","tests/ui/bad-version.stderr":"60ed51c62f4c2fb6ff95cff7523cfca379ed434f319da9d82704318588792338","tests/ui/const-not-fn.rs":"10bbe38f0d89391fff0698756e4cfd4e72a41090360393a0c951b67df14d1c35","tests/ui/const-not-fn.stderr":"9551f7f222445b31d7af2415d467301c332d55bb3d5a143846484f2f00047a01"},"package":"61b3909d758bb75c79f23d4736fac9433868679d3ad2ea7a61e3c25cfda9a088"} |
131 |
+\ No newline at end of file |
132 |
+diff --git a/vendor/rustversion/Cargo.toml b/vendor/rustversion/Cargo.toml |
133 |
+index 56995ff0792..c72b1b2b343 100644 |
134 |
+--- a/vendor/rustversion/Cargo.toml |
135 |
++++ b/vendor/rustversion/Cargo.toml |
136 |
+@@ -13,7 +13,7 @@ |
137 |
+ [package] |
138 |
+ edition = "2018" |
139 |
+ name = "rustversion" |
140 |
+-version = "1.0.4" |
141 |
++version = "1.0.5" |
142 |
+ authors = ["David Tolnay <dtolnay@×××××.com>"] |
143 |
+ build = "build/build.rs" |
144 |
+ description = "Conditional compilation according to rustc compiler version" |
145 |
+diff --git a/vendor/rustversion/build/build.rs b/vendor/rustversion/build/build.rs |
146 |
+index 2a8bc4af39f..15312510d68 100644 |
147 |
+--- a/vendor/rustversion/build/build.rs |
148 |
++++ b/vendor/rustversion/build/build.rs |
149 |
+@@ -1,3 +1,9 @@ |
150 |
++#![allow( |
151 |
++ clippy::enum_glob_use, |
152 |
++ clippy::must_use_candidate, |
153 |
++ clippy::single_match_else |
154 |
++)] |
155 |
++ |
156 |
+ mod rustc; |
157 |
+ |
158 |
+ use std::env; |
159 |
+diff --git a/vendor/rustversion/build/rustc.rs b/vendor/rustversion/build/rustc.rs |
160 |
+index 723e6bdd0e2..dfc6a05166f 100644 |
161 |
+--- a/vendor/rustversion/build/rustc.rs |
162 |
++++ b/vendor/rustversion/build/rustc.rs |
163 |
+@@ -48,23 +48,21 @@ pub fn parse(string: &str) -> Option<Version> { |
164 |
+ Some(channel) if channel == "dev" => Dev, |
165 |
+ Some(channel) if channel.starts_with("beta") => Beta, |
166 |
+ Some(channel) if channel == "nightly" => match words.next() { |
167 |
+- Some(hash) => { |
168 |
+- if !hash.starts_with('(') { |
169 |
+- return None; |
170 |
++ Some(hash) if hash.starts_with('(') => match words.next() { |
171 |
++ None if hash.ends_with(')') => Dev, |
172 |
++ Some(date) if date.ends_with(')') => { |
173 |
++ let mut date = date[..date.len() - 1].split('-'); |
174 |
++ let year = date.next()?.parse().ok()?; |
175 |
++ let month = date.next()?.parse().ok()?; |
176 |
++ let day = date.next()?.parse().ok()?; |
177 |
++ match date.next() { |
178 |
++ None => Nightly(Date { year, month, day }), |
179 |
++ Some(_) => return None, |
180 |
++ } |
181 |
+ } |
182 |
+- let date = words.next()?; |
183 |
+- if !date.ends_with(')') { |
184 |
+- return None; |
185 |
+- } |
186 |
+- let mut date = date[..date.len() - 1].split('-'); |
187 |
+- let year = date.next()?.parse().ok()?; |
188 |
+- let month = date.next()?.parse().ok()?; |
189 |
+- let day = date.next()?.parse().ok()?; |
190 |
+- match date.next() { |
191 |
+- None => Nightly(Date { year, month, day }), |
192 |
+- Some(_) => return None, |
193 |
+- } |
194 |
+- } |
195 |
++ None | Some(_) => return None, |
196 |
++ }, |
197 |
++ Some(_) => return None, |
198 |
+ None => Dev, |
199 |
+ }, |
200 |
+ Some(_) => return None, |
201 |
+diff --git a/vendor/rustversion/src/lib.rs b/vendor/rustversion/src/lib.rs |
202 |
+index 2614105dd1a..172eb89382f 100644 |
203 |
+--- a/vendor/rustversion/src/lib.rs |
204 |
++++ b/vendor/rustversion/src/lib.rs |
205 |
+@@ -145,6 +145,21 @@ |
206 |
+ //! |
207 |
+ //! <br> |
208 |
+ |
209 |
++#![allow( |
210 |
++ clippy::cast_lossless, |
211 |
++ clippy::cast_possible_truncation, |
212 |
++ clippy::doc_markdown, |
213 |
++ clippy::enum_glob_use, |
214 |
++ clippy::from_iter_instead_of_collect, |
215 |
++ clippy::module_name_repetitions, |
216 |
++ clippy::must_use_candidate, |
217 |
++ clippy::needless_doctest_main, |
218 |
++ clippy::needless_pass_by_value, |
219 |
++ clippy::redundant_else, |
220 |
++ clippy::toplevel_ref_arg, |
221 |
++ clippy::unreadable_literal |
222 |
++)] |
223 |
++ |
224 |
+ extern crate proc_macro; |
225 |
+ |
226 |
+ mod attr; |
227 |
+diff --git a/vendor/rustversion/src/time.rs b/vendor/rustversion/src/time.rs |
228 |
+index 1e6dd9066b4..3c21463dd80 100644 |
229 |
+--- a/vendor/rustversion/src/time.rs |
230 |
++++ b/vendor/rustversion/src/time.rs |
231 |
+@@ -1,4 +1,5 @@ |
232 |
+ use crate::date::Date; |
233 |
++use std::env; |
234 |
+ use std::time::{SystemTime, UNIX_EPOCH}; |
235 |
+ |
236 |
+ // Timestamp of 2016-03-01 00:00:00 in UTC. |
237 |
+@@ -13,14 +14,20 @@ |
238 |
+ |
239 |
+ pub fn today() -> Date { |
240 |
+ let default = Date { |
241 |
+- year: 2019, |
242 |
+- month: 1, |
243 |
+- day: 1, |
244 |
++ year: 2020, |
245 |
++ month: 2, |
246 |
++ day: 25, |
247 |
+ }; |
248 |
+ try_today().unwrap_or(default) |
249 |
+ } |
250 |
+ |
251 |
+ fn try_today() -> Option<Date> { |
252 |
++ if let Some(pkg_name) = env::var_os("CARGO_PKG_NAME") { |
253 |
++ if pkg_name.to_str() == Some("rustversion-tests") { |
254 |
++ return None; // Stable date for ui testing. |
255 |
++ } |
256 |
++ } |
257 |
++ |
258 |
+ let now = SystemTime::now(); |
259 |
+ let since_epoch = now.duration_since(UNIX_EPOCH).ok()?; |
260 |
+ let secs = since_epoch.as_secs(); |
261 |
+diff --git a/vendor/rustversion/tests/test_parse.rs b/vendor/rustversion/tests/test_parse.rs |
262 |
+index 843bd73d3e5..cb39b3179f5 100644 |
263 |
+--- a/vendor/rustversion/tests/test_parse.rs |
264 |
++++ b/vendor/rustversion/tests/test_parse.rs |
265 |
+@@ -1,3 +1,5 @@ |
266 |
++#![allow(clippy::enum_glob_use, clippy::must_use_candidate)] |
267 |
++ |
268 |
+ include!("../build/rustc.rs"); |
269 |
+ |
270 |
+ #[test] |
271 |
+@@ -76,6 +78,14 @@ fn test_parse() { |
272 |
+ }), |
273 |
+ }, |
274 |
+ ), |
275 |
++ ( |
276 |
++ "rustc 1.52.1-nightly (gentoo)", |
277 |
++ Version { |
278 |
++ minor: 52, |
279 |
++ patch: 1, |
280 |
++ channel: Dev, |
281 |
++ }, |
282 |
++ ), |
283 |
+ ]; |
284 |
+ |
285 |
+ for (string, expected) in cases { |
286 |
+diff --git a/vendor/rustversion/tests/ui/bad-bound.stderr b/vendor/rustversion/tests/ui/bad-bound.stderr |
287 |
+index f8c498c8577..2c56acbdb33 100644 |
288 |
+--- a/vendor/rustversion/tests/ui/bad-bound.stderr |
289 |
++++ b/vendor/rustversion/tests/ui/bad-bound.stderr |
290 |
+@@ -1,10 +1,10 @@ |
291 |
+-error: expected rustc release number like 1.31, or nightly date like 2020-10-26 |
292 |
++error: expected rustc release number like 1.31, or nightly date like 2020-02-25 |
293 |
+ --> $DIR/bad-bound.rs:1:22 |
294 |
+ | |
295 |
+ 1 | #[rustversion::since(stable)] |
296 |
+ | ^^^^^^ |
297 |
+ |
298 |
+-error: expected rustc release number like 1.31, or nightly date like 2020-10-26 |
299 |
++error: expected rustc release number like 1.31, or nightly date like 2020-02-25 |
300 |
+ --> $DIR/bad-bound.rs:4:26 |
301 |
+ | |
302 |
+ 4 | #[rustversion::any(since(stable))] |
303 |
+diff --git a/vendor/rustversion/tests/ui/bad-date.stderr b/vendor/rustversion/tests/ui/bad-date.stderr |
304 |
+index 734d7889075..c523ccc02bf 100644 |
305 |
+--- a/vendor/rustversion/tests/ui/bad-date.stderr |
306 |
++++ b/vendor/rustversion/tests/ui/bad-date.stderr |
307 |
+@@ -1,10 +1,10 @@ |
308 |
+-error: expected nightly date, like 2020-10-26 |
309 |
++error: expected nightly date, like 2020-02-25 |
310 |
+ --> $DIR/bad-date.rs:1:24 |
311 |
+ | |
312 |
+ 1 | #[rustversion::nightly(stable)] |
313 |
+ | ^^^^^^ |
314 |
+ |
315 |
+-error: expected nightly date, like 2020-10-26 |
316 |
++error: expected nightly date, like 2020-02-25 |
317 |
+ --> $DIR/bad-date.rs:4:28 |
318 |
+ | |
319 |
+ 4 | #[rustversion::any(nightly(stable))] |
320 |
+-- |
321 |
+2.32.0 |
322 |
+ |
323 |
|
324 |
diff --git a/dev-lang/rust/rust-1.53.0.ebuild b/dev-lang/rust/rust-1.53.0.ebuild |
325 |
new file mode 100644 |
326 |
index 0000000..0507d44 |
327 |
--- /dev/null |
328 |
+++ b/dev-lang/rust/rust-1.53.0.ebuild |
329 |
@@ -0,0 +1,680 @@ |
330 |
+# Copyright 1999-2021 Gentoo Authors |
331 |
+# Distributed under the terms of the GNU General Public License v2 |
332 |
+ |
333 |
+EAPI=7 |
334 |
+ |
335 |
+PYTHON_COMPAT=( python3_{7..9} ) |
336 |
+ |
337 |
+inherit bash-completion-r1 check-reqs estack flag-o-matic llvm multiprocessing \ |
338 |
+ multilib-build python-any-r1 rust-toolchain toolchain-funcs verify-sig |
339 |
+ |
340 |
+if [[ ${PV} = *beta* ]]; then |
341 |
+ betaver=${PV//*beta} |
342 |
+ BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}" |
343 |
+ MY_P="rustc-beta" |
344 |
+ SLOT="beta/${PV}" |
345 |
+ SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.xz -> rustc-${PV}-src.tar.xz" |
346 |
+else |
347 |
+ ABI_VER="$(ver_cut 1-2)" |
348 |
+ SLOT="stable/${ABI_VER}" |
349 |
+ MY_P="rustc-${PV}" |
350 |
+ SRC="${MY_P}-src.tar.xz" |
351 |
+ KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~riscv ~x86" |
352 |
+fi |
353 |
+ |
354 |
+RUST_STAGE0_VERSION="1.$(($(ver_cut 2) - 1)).0" |
355 |
+ |
356 |
+DESCRIPTION="Systems programming language from Mozilla" |
357 |
+HOMEPAGE="https://www.rust-lang.org/" |
358 |
+ |
359 |
+SRC_URI=" |
360 |
+ https://static.rust-lang.org/dist/${SRC} |
361 |
+ verify-sig? ( https://static.rust-lang.org/dist/${SRC}.asc ) |
362 |
+ !system-bootstrap? ( $(rust_all_arch_uris rust-${RUST_STAGE0_VERSION}) ) |
363 |
+" |
364 |
+ |
365 |
+# keep in sync with llvm ebuild of the same version as bundled one. |
366 |
+ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM AVR BPF Hexagon Lanai Mips MSP430 |
367 |
+ NVPTX PowerPC RISCV Sparc SystemZ WebAssembly X86 XCore ) |
368 |
+ALL_LLVM_TARGETS=( "${ALL_LLVM_TARGETS[@]/#/llvm_targets_}" ) |
369 |
+LLVM_TARGET_USEDEPS=${ALL_LLVM_TARGETS[@]/%/(-)?} |
370 |
+ |
371 |
+LICENSE="|| ( MIT Apache-2.0 ) BSD-1 BSD-2 BSD-4 UoI-NCSA" |
372 |
+ |
373 |
+IUSE="clippy cpu_flags_x86_sse2 debug doc miri nightly parallel-compiler rls rustfmt system-bootstrap system-llvm test wasm ${ALL_LLVM_TARGETS[*]}" |
374 |
+ |
375 |
+# Please keep the LLVM dependency block separate. Since LLVM is slotted, |
376 |
+# we need to *really* make sure we're not pulling more than one slot |
377 |
+# simultaneously. |
378 |
+ |
379 |
+# How to use it: |
380 |
+# List all the working slots in LLVM_VALID_SLOTS, newest first. |
381 |
+LLVM_VALID_SLOTS=( 12 ) |
382 |
+LLVM_MAX_SLOT="${LLVM_VALID_SLOTS[0]}" |
383 |
+ |
384 |
+# splitting usedeps needed to avoid CI/pkgcheck's UncheckableDep limitation |
385 |
+# (-) usedep needed because we may build with older llvm without that target |
386 |
+LLVM_DEPEND="|| ( " |
387 |
+for _s in ${LLVM_VALID_SLOTS[@]}; do |
388 |
+ LLVM_DEPEND+=" ( " |
389 |
+ for _x in ${ALL_LLVM_TARGETS[@]}; do |
390 |
+ LLVM_DEPEND+=" |
391 |
+ ${_x}? ( sys-devel/llvm:${_s}[${_x}(-)] )" |
392 |
+ done |
393 |
+ LLVM_DEPEND+=" )" |
394 |
+done |
395 |
+unset _s _x |
396 |
+LLVM_DEPEND+=" ) |
397 |
+ <sys-devel/llvm-$(( LLVM_MAX_SLOT + 1 )):= |
398 |
+ wasm? ( sys-devel/lld ) |
399 |
+" |
400 |
+ |
401 |
+# to bootstrap we need at least exactly previous version, or same. |
402 |
+# most of the time previous versions fail to bootstrap with newer |
403 |
+# for example 1.47.x, requires at least 1.46.x, 1.47.x is ok, |
404 |
+# but it fails to bootstrap with 1.48.x |
405 |
+# https://github.com/rust-lang/rust/blob/${PV}/src/stage0.txt |
406 |
+RUST_DEP_PREV="$(ver_cut 1).$(($(ver_cut 2) - 1))*" |
407 |
+RUST_DEP_CURR="$(ver_cut 1).$(ver_cut 2)*" |
408 |
+BOOTSTRAP_DEPEND="|| |
409 |
+ ( |
410 |
+ =dev-lang/rust-"${RUST_DEP_PREV}" |
411 |
+ =dev-lang/rust-bin-"${RUST_DEP_PREV}" |
412 |
+ =dev-lang/rust-"${RUST_DEP_CURR}" |
413 |
+ =dev-lang/rust-bin-"${RUST_DEP_CURR}" |
414 |
+ ) |
415 |
+" |
416 |
+ |
417 |
+BDEPEND="${PYTHON_DEPS} |
418 |
+ app-eselect/eselect-rust |
419 |
+ || ( |
420 |
+ >=sys-devel/gcc-4.7 |
421 |
+ >=sys-devel/clang-3.5 |
422 |
+ ) |
423 |
+ system-bootstrap? ( ${BOOTSTRAP_DEPEND} ) |
424 |
+ !system-llvm? ( |
425 |
+ >=dev-util/cmake-3.13.4 |
426 |
+ dev-util/ninja |
427 |
+ ) |
428 |
+ test? ( sys-devel/gdb ) |
429 |
+ verify-sig? ( app-crypt/openpgp-keys-rust ) |
430 |
+" |
431 |
+ |
432 |
+DEPEND=" |
433 |
+ >=app-arch/xz-utils-5.2 |
434 |
+ net-misc/curl:=[http2,ssl] |
435 |
+ sys-libs/zlib:= |
436 |
+ dev-libs/openssl:0= |
437 |
+ elibc_musl? ( sys-libs/libunwind:= ) |
438 |
+ system-llvm? ( ${LLVM_DEPEND} ) |
439 |
+" |
440 |
+ |
441 |
+# we need to block older versions due to layout changes. |
442 |
+RDEPEND="${DEPEND} |
443 |
+ app-eselect/eselect-rust |
444 |
+ !<dev-lang/rust-1.47.0-r1 |
445 |
+ !<dev-lang/rust-bin-1.47.0-r1 |
446 |
+" |
447 |
+ |
448 |
+REQUIRED_USE="|| ( ${ALL_LLVM_TARGETS[*]} ) |
449 |
+ miri? ( nightly ) |
450 |
+ parallel-compiler? ( nightly ) |
451 |
+ test? ( ${ALL_LLVM_TARGETS[*]} ) |
452 |
+ wasm? ( llvm_targets_WebAssembly ) |
453 |
+ x86? ( cpu_flags_x86_sse2 ) |
454 |
+" |
455 |
+ |
456 |
+# we don't use cmake.eclass, but can get a warnings |
457 |
+CMAKE_WARN_UNUSED_CLI=no |
458 |
+ |
459 |
+QA_FLAGS_IGNORED=" |
460 |
+ usr/lib/${PN}/${PV}/bin/.* |
461 |
+ usr/lib/${PN}/${PV}/libexec/.* |
462 |
+ usr/lib/${PN}/${PV}/lib/lib.*.so |
463 |
+ usr/lib/${PN}/${PV}/lib/rustlib/.*/bin/.* |
464 |
+ usr/lib/${PN}/${PV}/lib/rustlib/.*/lib/lib.*.so |
465 |
+" |
466 |
+ |
467 |
+QA_SONAME=" |
468 |
+ usr/lib/${PN}/${PV}/lib/lib.*.so.* |
469 |
+ usr/lib/${PN}/${PV}/lib/rustlib/.*/lib/lib.*.so |
470 |
+" |
471 |
+ |
472 |
+# causes double bootstrap |
473 |
+RESTRICT="test" |
474 |
+ |
475 |
+VERIFY_SIG_OPENPGP_KEY_PATH="/usr/share/openpgp-keys/rust.asc" |
476 |
+ |
477 |
+PATCHES=( |
478 |
+ "${FILESDIR}"/1.47.0-libressl.patch |
479 |
+ "${FILESDIR}"/1.47.0-ignore-broken-and-non-applicable-tests.patch |
480 |
+ "${FILESDIR}"/1.49.0-gentoo-musl-target-specs.patch |
481 |
+ "${FILESDIR}"/1.53.0-rustversion-1.0.5.patch # https://github.com/rust-lang/rust/pull/86425 |
482 |
+ "${FILESDIR}"/1.53.0-miri-vergen.patch # https://github.com/rust-lang/rust/issues/84182 |
483 |
+) |
484 |
+ |
485 |
+S="${WORKDIR}/${MY_P}-src" |
486 |
+ |
487 |
+toml_usex() { |
488 |
+ usex "${1}" true false |
489 |
+} |
490 |
+ |
491 |
+bootstrap_rust_version_check() { |
492 |
+ # never call from pkg_pretend. eselect-rust may be not installed yet. |
493 |
+ [[ ${MERGE_TYPE} == binary ]] && return |
494 |
+ local rustc_wanted="$(ver_cut 1).$(($(ver_cut 2) - 1))" |
495 |
+ local rustc_toonew="$(ver_cut 1).$(($(ver_cut 2) + 1))" |
496 |
+ local rustc_version=( $(eselect --brief rust show 2>/dev/null) ) |
497 |
+ rustc_version=${rustc_version[0]#rust-bin-} |
498 |
+ rustc_version=${rustc_version#rust-} |
499 |
+ |
500 |
+ [[ -z "${rustc_version}" ]] && die "Failed to determine rust version, check 'eselect rust' output" |
501 |
+ |
502 |
+ if ver_test "${rustc_version}" -lt "${rustc_wanted}" ; then |
503 |
+ eerror "Rust >=${rustc_wanted} is required" |
504 |
+ eerror "please run 'eselect rust' and set correct rust version" |
505 |
+ die "selected rust version is too old" |
506 |
+ elif ver_test "${rustc_version}" -ge "${rustc_toonew}" ; then |
507 |
+ eerror "Rust <${rustc_toonew} is required" |
508 |
+ eerror "please run 'eselect rust' and set correct rust version" |
509 |
+ die "selected rust version is too new" |
510 |
+ else |
511 |
+ einfo "Using rust ${rustc_version} to build" |
512 |
+ fi |
513 |
+} |
514 |
+ |
515 |
+pre_build_checks() { |
516 |
+ local M=8192 |
517 |
+ # multiply requirements by 1.5 if we are doing x86-multilib |
518 |
+ if use amd64; then |
519 |
+ M=$(( $(usex abi_x86_32 15 10) * ${M} / 10 )) |
520 |
+ fi |
521 |
+ M=$(( $(usex clippy 128 0) + ${M} )) |
522 |
+ M=$(( $(usex miri 128 0) + ${M} )) |
523 |
+ M=$(( $(usex rls 512 0) + ${M} )) |
524 |
+ M=$(( $(usex rustfmt 256 0) + ${M} )) |
525 |
+ # add 2G if we compile llvm and 256M per llvm_target |
526 |
+ if ! use system-llvm; then |
527 |
+ M=$(( 2048 + ${M} )) |
528 |
+ local ltarget |
529 |
+ for ltarget in ${ALL_LLVM_TARGETS[@]}; do |
530 |
+ M=$(( $(usex ${ltarget} 256 0) + ${M} )) |
531 |
+ done |
532 |
+ fi |
533 |
+ M=$(( $(usex wasm 256 0) + ${M} )) |
534 |
+ M=$(( $(usex debug 2 1) * ${M} )) |
535 |
+ eshopts_push -s extglob |
536 |
+ if is-flagq '-g?(gdb)?([1-9])'; then |
537 |
+ M=$(( 15 * ${M} / 10 )) |
538 |
+ fi |
539 |
+ eshopts_pop |
540 |
+ M=$(( $(usex system-bootstrap 0 1024) + ${M} )) |
541 |
+ M=$(( $(usex doc 256 0) + ${M} )) |
542 |
+ CHECKREQS_DISK_BUILD=${M}M check-reqs_pkg_${EBUILD_PHASE} |
543 |
+} |
544 |
+ |
545 |
+llvm_check_deps() { |
546 |
+ has_version -r "sys-devel/llvm:${LLVM_SLOT}[${LLVM_TARGET_USEDEPS// /,}]" |
547 |
+} |
548 |
+ |
549 |
+pkg_pretend() { |
550 |
+ pre_build_checks |
551 |
+} |
552 |
+ |
553 |
+pkg_setup() { |
554 |
+ pre_build_checks |
555 |
+ python-any-r1_pkg_setup |
556 |
+ |
557 |
+ export LIBGIT2_NO_PKG_CONFIG=1 #749381 |
558 |
+ |
559 |
+ use system-bootstrap && bootstrap_rust_version_check |
560 |
+ |
561 |
+ if use system-llvm; then |
562 |
+ llvm_pkg_setup |
563 |
+ |
564 |
+ local llvm_config="$(get_llvm_prefix "${LLVM_MAX_SLOT}")/bin/llvm-config" |
565 |
+ export LLVM_LINK_SHARED=1 |
566 |
+ export RUSTFLAGS="${RUSTFLAGS} -Lnative=$("${llvm_config}" --libdir)" |
567 |
+ fi |
568 |
+} |
569 |
+ |
570 |
+src_prepare() { |
571 |
+ if ! use system-bootstrap; then |
572 |
+ local rust_stage0_root="${WORKDIR}"/rust-stage0 |
573 |
+ local rust_stage0="rust-${RUST_STAGE0_VERSION}-$(rust_abi)" |
574 |
+ |
575 |
+ "${WORKDIR}/${rust_stage0}"/install.sh --disable-ldconfig \ |
576 |
+ --without=rust-docs --destdir="${rust_stage0_root}" --prefix=/ || die |
577 |
+ fi |
578 |
+ |
579 |
+ default |
580 |
+} |
581 |
+ |
582 |
+src_configure() { |
583 |
+ local rust_target="" rust_targets="" arch_cflags |
584 |
+ |
585 |
+ # Collect rust target names to compile standard libs for all ABIs. |
586 |
+ for v in $(multilib_get_enabled_abi_pairs); do |
587 |
+ rust_targets="${rust_targets},\"$(rust_abi $(get_abi_CHOST ${v##*.}))\"" |
588 |
+ done |
589 |
+ if use wasm; then |
590 |
+ rust_targets="${rust_targets},\"wasm32-unknown-unknown\"" |
591 |
+ if use system-llvm; then |
592 |
+ # un-hardcode rust-lld linker for this target |
593 |
+ # https://bugs.gentoo.org/715348 |
594 |
+ sed -i '/linker:/ s/rust-lld/wasm-ld/' compiler/rustc_target/src/spec/wasm_base.rs || die |
595 |
+ fi |
596 |
+ fi |
597 |
+ rust_targets="${rust_targets#,}" |
598 |
+ |
599 |
+ local tools="\"cargo\"," |
600 |
+ if use clippy; then |
601 |
+ tools="\"clippy\",$tools" |
602 |
+ fi |
603 |
+ if use miri; then |
604 |
+ tools="\"miri\",$tools" |
605 |
+ fi |
606 |
+ if use rls; then |
607 |
+ tools="\"rls\",\"analysis\",\"src\",$tools" |
608 |
+ fi |
609 |
+ if use rustfmt; then |
610 |
+ tools="\"rustfmt\",$tools" |
611 |
+ fi |
612 |
+ |
613 |
+ local rust_stage0_root |
614 |
+ if use system-bootstrap; then |
615 |
+ local printsysroot |
616 |
+ printsysroot="$(rustc --print sysroot || die "Can't determine rust's sysroot")" |
617 |
+ rust_stage0_root="${printsysroot}" |
618 |
+ else |
619 |
+ rust_stage0_root="${WORKDIR}"/rust-stage0 |
620 |
+ fi |
621 |
+ # in case of prefix it will be already prefixed, as --print sysroot returns full path |
622 |
+ [[ -d ${rust_stage0_root} ]] || die "${rust_stage0_root} is not a directory" |
623 |
+ |
624 |
+ rust_target="$(rust_abi)" |
625 |
+ |
626 |
+ cat <<- _EOF_ > "${S}"/config.toml |
627 |
+ changelog-seen = 2 |
628 |
+ [llvm] |
629 |
+ download-ci-llvm = false |
630 |
+ optimize = $(toml_usex !debug) |
631 |
+ release-debuginfo = $(toml_usex debug) |
632 |
+ assertions = $(toml_usex debug) |
633 |
+ ninja = true |
634 |
+ targets = "${LLVM_TARGETS// /;}" |
635 |
+ experimental-targets = "" |
636 |
+ link-shared = $(toml_usex system-llvm) |
637 |
+ [build] |
638 |
+ build-stage = 2 |
639 |
+ test-stage = 2 |
640 |
+ doc-stage = 2 |
641 |
+ build = "${rust_target}" |
642 |
+ host = ["${rust_target}"] |
643 |
+ target = [${rust_targets}] |
644 |
+ cargo = "${rust_stage0_root}/bin/cargo" |
645 |
+ rustc = "${rust_stage0_root}/bin/rustc" |
646 |
+ rustfmt = "${rust_stage0_root}/bin/rustfmt" |
647 |
+ docs = $(toml_usex doc) |
648 |
+ compiler-docs = false |
649 |
+ submodules = false |
650 |
+ python = "${EPYTHON}" |
651 |
+ locked-deps = true |
652 |
+ vendor = true |
653 |
+ extended = true |
654 |
+ tools = [${tools}] |
655 |
+ verbose = 2 |
656 |
+ sanitizers = false |
657 |
+ profiler = false |
658 |
+ cargo-native-static = false |
659 |
+ [install] |
660 |
+ prefix = "${EPREFIX}/usr/lib/${PN}/${PV}" |
661 |
+ sysconfdir = "etc" |
662 |
+ docdir = "share/doc/rust" |
663 |
+ bindir = "bin" |
664 |
+ libdir = "lib" |
665 |
+ mandir = "share/man" |
666 |
+ [rust] |
667 |
+ # https://github.com/rust-lang/rust/issues/54872 |
668 |
+ codegen-units-std = 1 |
669 |
+ optimize = true |
670 |
+ debug = $(toml_usex debug) |
671 |
+ debug-assertions = $(toml_usex debug) |
672 |
+ debug-assertions-std = $(toml_usex debug) |
673 |
+ debuginfo-level = $(usex debug 2 0) |
674 |
+ debuginfo-level-rustc = $(usex debug 2 0) |
675 |
+ debuginfo-level-std = $(usex debug 2 0) |
676 |
+ debuginfo-level-tools = $(usex debug 2 0) |
677 |
+ debuginfo-level-tests = 0 |
678 |
+ backtrace = true |
679 |
+ incremental = false |
680 |
+ default-linker = "$(tc-getCC)" |
681 |
+ parallel-compiler = $(toml_usex parallel-compiler) |
682 |
+ channel = "$(usex nightly nightly stable)" |
683 |
+ description = "gentoo" |
684 |
+ rpath = false |
685 |
+ verbose-tests = true |
686 |
+ optimize-tests = $(toml_usex !debug) |
687 |
+ codegen-tests = true |
688 |
+ dist-src = false |
689 |
+ remap-debuginfo = true |
690 |
+ lld = $(usex system-llvm false $(toml_usex wasm)) |
691 |
+ # only deny warnings if doc+wasm are NOT requested, documenting stage0 wasm std fails without it |
692 |
+ # https://github.com/rust-lang/rust/issues/74976 |
693 |
+ # https://github.com/rust-lang/rust/issues/76526 |
694 |
+ deny-warnings = $(usex wasm $(usex doc false true) true) |
695 |
+ backtrace-on-ice = true |
696 |
+ jemalloc = false |
697 |
+ [dist] |
698 |
+ src-tarball = false |
699 |
+ compression-formats = ["gz"] |
700 |
+ _EOF_ |
701 |
+ |
702 |
+ for v in $(multilib_get_enabled_abi_pairs); do |
703 |
+ rust_target=$(rust_abi $(get_abi_CHOST ${v##*.})) |
704 |
+ arch_cflags="$(get_abi_CFLAGS ${v##*.})" |
705 |
+ |
706 |
+ cat <<- _EOF_ >> "${S}"/config.env |
707 |
+ CFLAGS_${rust_target}=${arch_cflags} |
708 |
+ _EOF_ |
709 |
+ |
710 |
+ cat <<- _EOF_ >> "${S}"/config.toml |
711 |
+ [target.${rust_target}] |
712 |
+ cc = "$(tc-getBUILD_CC)" |
713 |
+ cxx = "$(tc-getBUILD_CXX)" |
714 |
+ linker = "$(tc-getCC)" |
715 |
+ ar = "$(tc-getAR)" |
716 |
+ _EOF_ |
717 |
+ # librustc_target/spec/linux_musl_base.rs sets base.crt_static_default = true; |
718 |
+ if use elibc_musl; then |
719 |
+ cat <<- _EOF_ >> "${S}"/config.toml |
720 |
+ crt-static = false |
721 |
+ _EOF_ |
722 |
+ fi |
723 |
+ if use system-llvm; then |
724 |
+ cat <<- _EOF_ >> "${S}"/config.toml |
725 |
+ llvm-config = "$(get_llvm_prefix "${LLVM_MAX_SLOT}")/bin/llvm-config" |
726 |
+ _EOF_ |
727 |
+ fi |
728 |
+ done |
729 |
+ if use wasm; then |
730 |
+ cat <<- _EOF_ >> "${S}"/config.toml |
731 |
+ [target.wasm32-unknown-unknown] |
732 |
+ linker = "$(usex system-llvm lld rust-lld)" |
733 |
+ _EOF_ |
734 |
+ fi |
735 |
+ |
736 |
+ if [[ -n ${I_KNOW_WHAT_I_AM_DOING_CROSS} ]]; then # whitespace intentionally shifted below |
737 |
+ # experimental cross support |
738 |
+ # discussion: https://bugs.gentoo.org/679878 |
739 |
+ # TODO: c*flags, clang, system-llvm, cargo.eclass target support |
740 |
+ # it would be much better if we could split out stdlib |
741 |
+ # complilation to separate ebuild and abuse CATEGORY to |
742 |
+ # just install to /usr/lib/rustlib/<target> |
743 |
+ |
744 |
+ # extra targets defined as a bash array |
745 |
+ # spec format: <LLVM target>:<rust-target>:<CTARGET> |
746 |
+ # best place would be /etc/portage/env/dev-lang/rust |
747 |
+ # Example: |
748 |
+ # RUST_CROSS_TARGETS=( |
749 |
+ # "AArch64:aarch64-unknown-linux-gnu:aarch64-unknown-linux-gnu" |
750 |
+ # ) |
751 |
+ # no extra hand holding is done, no target transformations, all |
752 |
+ # values are passed as-is with just basic checks, so it's up to user to supply correct values |
753 |
+ # valid rust targets can be obtained with |
754 |
+ # rustc --print target-list |
755 |
+ # matching cross toolchain has to be installed |
756 |
+ # matching LLVM_TARGET has to be enabled for both rust and llvm (if using system one) |
757 |
+ # only gcc toolchains installed with crossdev are checked for now. |
758 |
+ |
759 |
+ # BUG: we can't pass host flags to cross compiler, so just filter for now |
760 |
+ # BUG: this should be more fine-grained. |
761 |
+ filter-flags '-mcpu=*' '-march=*' '-mtune=*' |
762 |
+ |
763 |
+ local cross_target_spec |
764 |
+ for cross_target_spec in "${RUST_CROSS_TARGETS[@]}";do |
765 |
+ # extracts first element form <LLVM target>:<rust-target>:<CTARGET> |
766 |
+ local cross_llvm_target="${cross_target_spec%%:*}" |
767 |
+ # extracts toolchain triples, <rust-target>:<CTARGET> |
768 |
+ local cross_triples="${cross_target_spec#*:}" |
769 |
+ # extracts first element after before : separator |
770 |
+ local cross_rust_target="${cross_triples%%:*}" |
771 |
+ # extracts last element after : separator |
772 |
+ local cross_toolchain="${cross_triples##*:}" |
773 |
+ use llvm_targets_${cross_llvm_target} || die "need llvm_targets_${cross_llvm_target} target enabled" |
774 |
+ command -v ${cross_toolchain}-gcc > /dev/null 2>&1 || die "need ${cross_toolchain} cross toolchain" |
775 |
+ |
776 |
+ cat <<- _EOF_ >> "${S}"/config.toml |
777 |
+ [target.${cross_rust_target}] |
778 |
+ cc = "${cross_toolchain}-gcc" |
779 |
+ cxx = "${cross_toolchain}-g++" |
780 |
+ linker = "${cross_toolchain}-gcc" |
781 |
+ ar = "${cross_toolchain}-ar" |
782 |
+ _EOF_ |
783 |
+ if use system-llvm; then |
784 |
+ cat <<- _EOF_ >> "${S}"/config.toml |
785 |
+ llvm-config = "$(get_llvm_prefix "${LLVM_MAX_SLOT}")/bin/llvm-config" |
786 |
+ _EOF_ |
787 |
+ fi |
788 |
+ if [[ "${cross_toolchain}" == *-musl* ]]; then |
789 |
+ cat <<- _EOF_ >> "${S}"/config.toml |
790 |
+ musl-root = "$(${cross_toolchain}-gcc -print-sysroot)/usr" |
791 |
+ _EOF_ |
792 |
+ fi |
793 |
+ |
794 |
+ # append cross target to "normal" target list |
795 |
+ # example 'target = ["powerpc64le-unknown-linux-gnu"]' |
796 |
+ # becomes 'target = ["powerpc64le-unknown-linux-gnu","aarch64-unknown-linux-gnu"]' |
797 |
+ |
798 |
+ rust_targets="${rust_targets},\"${cross_rust_target}\"" |
799 |
+ sed -i "/^target = \[/ s#\[.*\]#\[${rust_targets}\]#" config.toml || die |
800 |
+ |
801 |
+ ewarn |
802 |
+ ewarn "Enabled ${cross_rust_target} rust target" |
803 |
+ ewarn "Using ${cross_toolchain} cross toolchain" |
804 |
+ ewarn |
805 |
+ if ! has_version -b 'sys-devel/binutils[multitarget]' ; then |
806 |
+ ewarn "'sys-devel/binutils[multitarget]' is not installed" |
807 |
+ ewarn "'strip' will be unable to strip cross libraries" |
808 |
+ ewarn "cross targets will be installed with full debug information" |
809 |
+ ewarn "enable 'multitarget' USE flag for binutils to be able to strip object files" |
810 |
+ ewarn |
811 |
+ ewarn "Alternatively llvm-strip can be used, it supports stripping any target" |
812 |
+ ewarn "define STRIP=\"llvm-strip\" to use it (experimental)" |
813 |
+ ewarn |
814 |
+ fi |
815 |
+ done |
816 |
+ fi # I_KNOW_WHAT_I_AM_DOING_CROSS |
817 |
+ |
818 |
+ einfo "Rust configured with the following flags:" |
819 |
+ echo |
820 |
+ echo RUSTFLAGS="${RUSTFLAGS:-}" |
821 |
+ echo RUSTFLAGS_BOOTSTRAP="${RUSTFLAGS_BOOTSTRAP:-}" |
822 |
+ echo RUSTFLAGS_NOT_BOOTSTRAP="${RUSTFLAGS_NOT_BOOTSTRAP:-}" |
823 |
+ env | grep "CARGO_TARGET_.*_RUSTFLAGS=" |
824 |
+ cat "${S}"/config.env || die |
825 |
+ echo |
826 |
+ einfo "config.toml contents:" |
827 |
+ cat "${S}"/config.toml || die |
828 |
+ echo |
829 |
+} |
830 |
+ |
831 |
+src_compile() { |
832 |
+ # we need \n IFS to have config.env with spaces loaded properly. #734018 |
833 |
+ ( |
834 |
+ IFS=$'\n' |
835 |
+ env $(cat "${S}"/config.env) RUST_BACKTRACE=1\ |
836 |
+ "${EPYTHON}" ./x.py build -vv --config="${S}"/config.toml -j$(makeopts_jobs) || die |
837 |
+ ) |
838 |
+} |
839 |
+ |
840 |
+src_test() { |
841 |
+ # https://rustc-dev-guide.rust-lang.org/tests/intro.html |
842 |
+ |
843 |
+ # those are basic and codegen tests. |
844 |
+ local tests=( |
845 |
+ codegen |
846 |
+ codegen-units |
847 |
+ compile-fail |
848 |
+ incremental |
849 |
+ mir-opt |
850 |
+ pretty |
851 |
+ run-make |
852 |
+ ) |
853 |
+ |
854 |
+ # fails if llvm is not built with ALL targets. |
855 |
+ # and known to fail with system llvm sometimes. |
856 |
+ use system-llvm || tests+=( assembly ) |
857 |
+ |
858 |
+ # fragile/expensive/less important tests |
859 |
+ # or tests that require extra builds |
860 |
+ # TODO: instead of skipping, just make some nonfatal. |
861 |
+ if [[ ${ERUST_RUN_EXTRA_TESTS:-no} != no ]]; then |
862 |
+ tests+=( |
863 |
+ rustdoc |
864 |
+ rustdoc-js |
865 |
+ rustdoc-js-std |
866 |
+ rustdoc-ui |
867 |
+ run-make-fulldeps |
868 |
+ ui |
869 |
+ ui-fulldeps |
870 |
+ ) |
871 |
+ fi |
872 |
+ |
873 |
+ local i failed=() |
874 |
+ einfo "rust_src_test: enabled tests ${tests[@]/#/src/test/}" |
875 |
+ for i in "${tests[@]}"; do |
876 |
+ local t="src/test/${i}" |
877 |
+ einfo "rust_src_test: running ${t}" |
878 |
+ if ! ( |
879 |
+ IFS=$'\n' |
880 |
+ env $(cat "${S}"/config.env) RUST_BACKTRACE=1 \ |
881 |
+ "${EPYTHON}" ./x.py test -vv --config="${S}"/config.toml \ |
882 |
+ -j$(makeopts_jobs) --no-doc --no-fail-fast "${t}" |
883 |
+ ) |
884 |
+ then |
885 |
+ failed+=( "${t}" ) |
886 |
+ eerror "rust_src_test: ${t} failed" |
887 |
+ fi |
888 |
+ done |
889 |
+ |
890 |
+ if [[ ${#failed[@]} -ne 0 ]]; then |
891 |
+ eerror "rust_src_test: failure summary: ${failed[@]}" |
892 |
+ die "aborting due to test failures" |
893 |
+ fi |
894 |
+} |
895 |
+ |
896 |
+src_install() { |
897 |
+ ( |
898 |
+ IFS=$'\n' |
899 |
+ env $(cat "${S}"/config.env) DESTDIR="${D}" \ |
900 |
+ "${EPYTHON}" ./x.py install -vv --config="${S}"/config.toml -j$(makeopts_jobs) || die |
901 |
+ ) |
902 |
+ |
903 |
+ # bug #689562, #689160 |
904 |
+ rm -v "${ED}/usr/lib/${PN}/${PV}/etc/bash_completion.d/cargo" || die |
905 |
+ rmdir -v "${ED}/usr/lib/${PN}/${PV}"/etc{/bash_completion.d,} || die |
906 |
+ newbashcomp src/tools/cargo/src/etc/cargo.bashcomp.sh cargo |
907 |
+ |
908 |
+ local symlinks=( |
909 |
+ cargo |
910 |
+ rustc |
911 |
+ rustdoc |
912 |
+ rust-gdb |
913 |
+ rust-gdbgui |
914 |
+ rust-lldb |
915 |
+ ) |
916 |
+ |
917 |
+ use clippy && symlinks+=( clippy-driver cargo-clippy ) |
918 |
+ use miri && symlinks+=( miri cargo-miri ) |
919 |
+ use rls && symlinks+=( rls ) |
920 |
+ use rustfmt && symlinks+=( rustfmt cargo-fmt ) |
921 |
+ |
922 |
+ einfo "installing eselect-rust symlinks and paths: ${symlinks[@]}" |
923 |
+ local i |
924 |
+ for i in "${symlinks[@]}"; do |
925 |
+ # we need realpath on /usr/bin/* symlink return version-appended binary path. |
926 |
+ # so /usr/bin/rustc should point to /usr/lib/rust/<ver>/bin/rustc-<ver> |
927 |
+ # need to fix eselect-rust to remove this hack. |
928 |
+ local ver_i="${i}-${PV}" |
929 |
+ if [[ -f "${ED}/usr/lib/${PN}/${PV}/bin/${i}" ]]; then |
930 |
+ einfo "Installing ${i} symlink" |
931 |
+ ln -v "${ED}/usr/lib/${PN}/${PV}/bin/${i}" "${ED}/usr/lib/${PN}/${PV}/bin/${ver_i}" || die |
932 |
+ else |
933 |
+ ewarn "${i} symlink requested, but source file not found" |
934 |
+ ewarn "please report this" |
935 |
+ fi |
936 |
+ dosym "../lib/${PN}/${PV}/bin/${ver_i}" "/usr/bin/${ver_i}" |
937 |
+ done |
938 |
+ |
939 |
+ # symlinks to switch components to active rust in eselect |
940 |
+ dosym "${PV}/lib" "/usr/lib/${PN}/lib-${PV}" |
941 |
+ dosym "${PV}/libexec" "/usr/lib/${PN}/libexec-${PV}" |
942 |
+ dosym "${PV}/share/man" "/usr/lib/${PN}/man-${PV}" |
943 |
+ dosym "rust/${PV}/lib/rustlib" "/usr/lib/rustlib-${PV}" |
944 |
+ dosym "../../lib/${PN}/${PV}/share/doc/rust" "/usr/share/doc/${P}" |
945 |
+ |
946 |
+ newenvd - "50${P}" <<-_EOF_ |
947 |
+ LDPATH="${EPREFIX}/usr/lib/rust/lib" |
948 |
+ MANPATH="${EPREFIX}/usr/lib/rust/man" |
949 |
+ $(use amd64 && usex elibc_musl 'CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_RUSTFLAGS="-C target-feature=-crt-static"' '') |
950 |
+ $(use arm64 && usex elibc_musl 'CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_RUSTFLAGS="-C target-feature=-crt-static"' '') |
951 |
+ _EOF_ |
952 |
+ |
953 |
+ rm -rf "${ED}/usr/lib/${PN}/${PV}"/*.old || die |
954 |
+ rm -rf "${ED}/usr/lib/${PN}/${PV}/doc"/*.old || die |
955 |
+ |
956 |
+ # note: eselect-rust adds EROOT to all paths below |
957 |
+ cat <<-_EOF_ > "${T}/provider-${P}" |
958 |
+ /usr/bin/cargo |
959 |
+ /usr/bin/rustdoc |
960 |
+ /usr/bin/rust-gdb |
961 |
+ /usr/bin/rust-gdbgui |
962 |
+ /usr/bin/rust-lldb |
963 |
+ /usr/lib/rustlib |
964 |
+ /usr/lib/rust/lib |
965 |
+ /usr/lib/rust/libexec |
966 |
+ /usr/lib/rust/man |
967 |
+ /usr/share/doc/rust |
968 |
+ _EOF_ |
969 |
+ |
970 |
+ if use clippy; then |
971 |
+ echo /usr/bin/clippy-driver >> "${T}/provider-${P}" |
972 |
+ echo /usr/bin/cargo-clippy >> "${T}/provider-${P}" |
973 |
+ fi |
974 |
+ if use miri; then |
975 |
+ echo /usr/bin/miri >> "${T}/provider-${P}" |
976 |
+ echo /usr/bin/cargo-miri >> "${T}/provider-${P}" |
977 |
+ fi |
978 |
+ if use rls; then |
979 |
+ echo /usr/bin/rls >> "${T}/provider-${P}" |
980 |
+ fi |
981 |
+ if use rustfmt; then |
982 |
+ echo /usr/bin/rustfmt >> "${T}/provider-${P}" |
983 |
+ echo /usr/bin/cargo-fmt >> "${T}/provider-${P}" |
984 |
+ fi |
985 |
+ |
986 |
+ insinto /etc/env.d/rust |
987 |
+ doins "${T}/provider-${P}" |
988 |
+} |
989 |
+ |
990 |
+pkg_postinst() { |
991 |
+ eselect rust update |
992 |
+ |
993 |
+ if has_version sys-devel/gdb || has_version dev-util/lldb; then |
994 |
+ elog "Rust installs a helper script for calling GDB and LLDB," |
995 |
+ elog "for your convenience it is installed under /usr/bin/rust-{gdb,lldb}-${PV}." |
996 |
+ fi |
997 |
+ |
998 |
+ if has_version app-editors/emacs; then |
999 |
+ elog "install app-emacs/rust-mode to get emacs support for rust." |
1000 |
+ fi |
1001 |
+ |
1002 |
+ if has_version app-editors/gvim || has_version app-editors/vim; then |
1003 |
+ elog "install app-vim/rust-vim to get vim support for rust." |
1004 |
+ fi |
1005 |
+} |
1006 |
+ |
1007 |
+pkg_postrm() { |
1008 |
+ eselect rust cleanup |
1009 |
+} |