1 |
commit: e45ec73a5094fd09672fbbbd5a49960937e0e6a1 |
2 |
Author: Margarita Manterola <marga <AT> kinvolk <DOT> io> |
3 |
AuthorDate: Thu Jan 14 11:25:26 2021 +0000 |
4 |
Commit: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Feb 2 23:52:15 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e45ec73a |
7 |
|
8 |
dev-lang/rust: bump to 1.49.0 |
9 |
|
10 |
This required a refactor of the gentoo-musl-target-specs.patch, to adopt |
11 |
the new format of the target() method. |
12 |
|
13 |
Closes: https://bugs.gentoo.org/768351 |
14 |
Closes: https://github.com/gentoo/gentoo/pull/19060 |
15 |
|
16 |
Signed-off-by: Margarita Manterola <marga <AT> kinvolk.io> |
17 |
Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org> |
18 |
|
19 |
dev-lang/rust/Manifest | 15 + |
20 |
.../files/1.49.0-gentoo-musl-target-specs.patch | 164 ++++++ |
21 |
dev-lang/rust/rust-1.49.0.ebuild | 615 +++++++++++++++++++++ |
22 |
3 files changed, 794 insertions(+) |
23 |
|
24 |
diff --git a/dev-lang/rust/Manifest b/dev-lang/rust/Manifest |
25 |
index baa93077e9d..e296ab86edf 100644 |
26 |
--- a/dev-lang/rust/Manifest |
27 |
+++ b/dev-lang/rust/Manifest |
28 |
@@ -40,6 +40,21 @@ DIST rust-1.47.0-powerpc64le-unknown-linux-gnu.tar.xz 141965604 BLAKE2B b4b7ce86 |
29 |
DIST rust-1.47.0-s390x-unknown-linux-gnu.tar.xz 146987276 BLAKE2B 1810e7bfbd235613563677449376167700c33960eb57b100e65058f6a00692316db518f2f4b79b39e414f3892c62bb1ec09b0866ff2221641c4a3056659a1668 SHA512 dd5877b6ff5c310ca6aa23c1cc621e6b0675d4c46f5a06b2a0b107641b604a1a2101109ba8e286267bab1158768c601d5d9a922a8da72486c91755ef465720c0 |
30 |
DIST rust-1.47.0-x86_64-unknown-linux-gnu.tar.xz 150891572 BLAKE2B 45ff02465ba82ae96de25dd616fa08abb2396be21236d2f66f831effb349f39b047a380b38cb83254f27e56cecdbea8478f4de8ccc0aa23b11de2f11a28f501b SHA512 f695986ab8e67636b0e92ca7ea223984121e3c22788434a6f1062690e7932f6b30c0c302160fef96831f821acedaf8a909bd3d00a9aa873c7200d2b8fa39013f |
31 |
DIST rust-1.47.0-x86_64-unknown-linux-musl.tar.xz 166456672 BLAKE2B d6ccfc574a81ae3e9e6a96805e6863009970b5c480f35ee0d582a204b782fe513b9c6c7094d1adea509de1a3097a8a0524ac00c2186b968f70f390615904eb5a SHA512 f71b162635955ecd8a6ec322818be69c788c18d4e923d84d901916648f2eb58573b1f97b460209294ee64198e76566b78e472f9cbca8665c59444adfc5ae603c |
32 |
+DIST rust-1.48.0-aarch64-unknown-linux-gnu.tar.xz 133782948 BLAKE2B 95e80db4734a91a1aed6433cb6dcc65358ef713f365216f6c344c4940c2b5e43b7dc5805f53635c4e7585e70c9d5773b6c93034fa2ffd0a28efb2f20a18f1be8 SHA512 6ebbd936b1bc2ccf30b62dbbbc6f3986fb57738d89e33a23d58bab09be57a445c17df7912866add91cc108ef7547d229a08c6206db2d2fb00d72887ff6a0894d |
33 |
+DIST rust-1.48.0-arm-unknown-linux-gnueabi.tar.xz 133293068 BLAKE2B f98129d16e0de958a164233a1cc6317dc64eeeee76aa88b6982af2cb0a4b9f798a989b6bc153dcd55a7a6dfd3a8a6b36330faae82fedc133ae927b75638629aa SHA512 8958b8548711bb393e188d7516a842dcde5e7f9751804a90621d28a787a28b330057f343f14f930bafdcbdd8fa2cf391d6a4c1953f6d33a34bcbc65fd0e24e9b |
34 |
+DIST rust-1.48.0-arm-unknown-linux-gnueabihf.tar.xz 132424008 BLAKE2B ed0aad5dba3eff6ca18eac5e7fc1864d2b72e262b5c8d6b510196653edc505bcb2327d529b326b10279ad19d6e2258e40103ed39067094f6ac2bd9dfed170b35 SHA512 d932676a579eed1849e58c133aa3759750b01436aa6f837098953cc558b9025427bdd54f1f2688aa0022934c48177da34874e27cc319c7bf1c96e219615d2bb2 |
35 |
+DIST rust-1.48.0-armv7-unknown-linux-gnueabihf.tar.xz 134716224 BLAKE2B 1918eadca80dbaacb4700dc5af8c791cc0966a29b4d01bba10e8ec31d5506a2748f4a0c9ed6695e9aa9cd88511e0dc347354a1410b419013757d9ae443e9e9af SHA512 9763b0c5bc5dc7b265b86636ed32947aab98bd9b5732c4b298ade93e9a09bab82ad37fc7ca2d7c97dfd87634756b3c55015d47696c0a6ed2cb44be03659bcf55 |
36 |
+DIST rust-1.48.0-i686-unknown-linux-gnu.tar.xz 161602224 BLAKE2B e4f1d1b51d520f85f7af8ddd12ad716d8c501a25d1bcdf40efd23902da9c35168108ba705c08a7aa3617ac1afb41584180d1d2399732918900f9126158111c25 SHA512 b8b3c5407304a333fc6c10ad70363589a88673640dda7b5fde8971097e679f56a8c733da31b2183044ae2ce30700db923cc3c3cb8c590d785df680b60b199451 |
37 |
+DIST rust-1.48.0-mips-unknown-linux-gnu.tar.xz 96393696 BLAKE2B 6cd06b3b1b8aeb4b251bc14e47dd8b8cd099f9292705402d718657de4efd480f8999bf23694d9be455236e3ebd4d330b2645a0333eeab7f9a189239df5e02698 SHA512 973130e8c0924e4a22e3b803102b96e80d6247328879a92c3bf0d9e80ec185264b980bd481ee79b6f8afe8e47f7fd61b9657a85adb7ae99008357d39e2428a39 |
38 |
+DIST rust-1.48.0-mips64-unknown-linux-gnuabi64.tar.xz 107548156 BLAKE2B 98b481032689f094490689b3af5a0a9162c8bf0ac8a60203b0be2de0f0ac555296e0401d1d534934d2faee852c61b20324aadf0a1696dd57607b71389f03071a SHA512 b3adf893d3e1a36da859bbd3cb39acebb2358522591694e636574ac5a1f81484a60ee53a9de7f348717fbfdaac9f2dd6ec27ea78959cdf94346d251d4a6be877 |
39 |
+DIST rust-1.48.0-mipsel-unknown-linux-gnu.tar.xz 97538116 BLAKE2B c4777428637bf2a08964b0abf048c2ea3b895901130f6b2c4307bfd448c7e09e2d8e862d0a10bab23c73a580aa2e9d868c7716d6a7fd103fa40f0d4207090c71 SHA512 09529c30c2b31317a495b058ee48d8ad7b0c89a59a70e62c9085d59bbd2f22a37223956a13959175cd05b195b7541feac9b8acc49438f575fce3fad26d2bd927 |
40 |
+DIST rust-1.48.0-powerpc-unknown-linux-gnu.tar.xz 106401772 BLAKE2B 2b10bb21198b9104dee49038ca4a7bee9dc93331465166ce9ca451d84c7e759e7bd5635c017223f6a1b96f71430a8240bd65022e9067fb20e5be85d06e79baba SHA512 b77afbca6fe9f1122c863bee14a764adb1dc5f233058292c5aaa72e50f473c1f9cccd1fc08c427485a7edab460fcea595544fd902d5f96d290e208aa03d910a3 |
41 |
+DIST rust-1.48.0-powerpc64-unknown-linux-gnu.tar.xz 120497676 BLAKE2B 6aa1dedcf5953f1292997fa7aac19067a6daa5e676a7e5fb7b7a29707831328b5514a88904edcc00dcf76d32e911646c8a349e40431a531585c373ce755bfb3c SHA512 f79e1f984cc3c4dce08599418be2885666e0b6f73e639b10e97ffff4b900606d880c0596b6c2ab7c5f999cfc364d22b2ca6ab88db6ba38b8b227670b222fe23b |
42 |
+DIST rust-1.48.0-powerpc64le-unknown-linux-gnu.tar.xz 124335896 BLAKE2B fe95cb27e69258d4b0fe471e856bc98d4ddae3d90c7d5bbd723575cb86da28061c8b0ca8f5fd945f0ce4789997f5e7658edf5f40b57aa215d76ffeb3c3207602 SHA512 7ddd2b0599872012f8613ccab456622cb05a0a43587b7d389e8b7fdf9381f0387763726d892da931233c89e8e3ce45c2b303ed00b1cce1f91c88d8f88d6b148d |
43 |
+DIST rust-1.48.0-s390x-unknown-linux-gnu.tar.xz 127221600 BLAKE2B 08511be6aadc0feb36caa19df5914a207565eed3b4b3914cad7fc8f7170011a7431c14d50b1334f5d5e00b4c94e7e84ee59afad179286e889480cc9b21e1f402 SHA512 b2b1565f3b1cc0c3bf4aa06aba1da7df775c6e29c892ca7727d0e549f175b632080433be2586e799c5636231de6c678f0228dedee8358fbf167016a1f7d25389 |
44 |
+DIST rust-1.48.0-x86_64-unknown-linux-gnu.tar.xz 155254844 BLAKE2B 37bce978eb297bb1732f9d513bb6fdcee4aefc42a578496a84b5f8abbb9f90f1c524c73f28c85f33c25a365bf5ba566253b1739009bb112c2e1d46a2ed978e10 SHA512 0784e156e70c47386abfa88ecfeb62b1109364459b1fee225de0749c30379c4eb443ff3ff7faa7dc1a6ff373bc6eb43997007f937889cb35daf940a74641753b |
45 |
+DIST rust-1.48.0-x86_64-unknown-linux-musl.tar.xz 168361012 BLAKE2B efeb9a9812f2fa2cbf1cfd963b5b714cf18d73ca9b7a3de4efa701acf7e2e8fc3b610cd90f7391b10bddd1c9d44b8b0aa910f58ce739750d4e910b063825dc28 SHA512 7188fb0b1bf6fd6ab320089cd17f334867baefec1a9c57a81e6cb729276456e56850938dbd0eafbc52375266a87392ad3045a4dbd2c41689bba6b0da152e4034 |
46 |
DIST rustc-1.46.0-src.tar.xz 101868452 BLAKE2B da9798596b124a10d79c236a871228f05e5f571d22c2259328e7026c91e088c85f5de9c0536a16531e0cb10477bfcd16d3ac11467979f5561cb6199442b877ef SHA512 099857f1d295043587a4e2a65ef3e6a90e12c8b6958e98535a1656c113c553f9a9b621aba8a19cf21bd8d2c79d27cbfa4b8e6fabbcb3cbfee23b545be7b450b4 |
47 |
DIST rustc-1.47.0-src.tar.xz 104143736 BLAKE2B 0454094dde35275488046826da87655e51bf0795481d6d08fd70d644bfc12481bca8641166106ef32f20494906025244715b16ff21a1c023f4bd2818aab42521 SHA512 6ba83c0158f8130ddeae7e070417a2121d8a548c8fe97e28bce116d84048636c75aaee78e0c92cd43a50f5679a1223fc226cc8c5ba9bbd1465e84c5c6034d5c9 |
48 |
DIST rustc-1.48.0-src.tar.xz 105951736 BLAKE2B 42468fc5ac5e80c4793cfe0913cbb8e43a8def28cc8cf5ed25ab989561e2bf33e155c83e180183362535cbc9008f341eb1273087a2364672b1a4032ac2d6ca45 SHA512 4e12baa6893238a8d336ec9ebe891477d18676f271b32763474fa7a6a8b58fb3187dd4e2aa95bce482989b692cc2e1360221669d6811eec71b326f22a1756c23 |
49 |
+DIST rustc-1.49.0-src.tar.xz 108330280 BLAKE2B 65e36253482ded2df225cbbf15253b6c9a8ae935053b071d9fb9e7b1d47d5d3ac47a138876e4a5cfeda455c655ac06ceff2658c8668cef7d2206116906740653 SHA512 fd8bc67ec0a73d3b6bf9c1fabb7ea981ef817644b4e6ced982fa90b12eae9b55de074634a670bdfb38bfee6588603e818ddcbcc2f2a05f83057c061b4194b4b7 |
50 |
|
51 |
diff --git a/dev-lang/rust/files/1.49.0-gentoo-musl-target-specs.patch b/dev-lang/rust/files/1.49.0-gentoo-musl-target-specs.patch |
52 |
new file mode 100644 |
53 |
index 00000000000..25f1f27fcce |
54 |
--- /dev/null |
55 |
+++ b/dev-lang/rust/files/1.49.0-gentoo-musl-target-specs.patch |
56 |
@@ -0,0 +1,164 @@ |
57 |
+From 671ef2d1c228aed031b4232b8bea96f17b825263 Mon Sep 17 00:00:00 2001 |
58 |
+From: Georgy Yakovlev <gyakovlev@g.o> |
59 |
+Date: Mon, 23 Nov 2020 14:52:04 -0800 |
60 |
+Subject: [PATCH] add gentoo musl target specs |
61 |
+ |
62 |
+--- |
63 |
+ .../src/spec/aarch64_gentoo_linux_musl.rs | 11 +++++++++++ |
64 |
+ .../src/spec/armv7_gentoo_linux_musleabihf.rs | 11 +++++++++++ |
65 |
+ .../rustc_target/src/spec/i686_gentoo_linux_musl.rs | 11 +++++++++++ |
66 |
+ compiler/rustc_target/src/spec/mod.rs | 8 ++++++++ |
67 |
+ .../src/spec/powerpc64_gentoo_linux_musl.rs | 11 +++++++++++ |
68 |
+ .../src/spec/powerpc64le_gentoo_linux_musl.rs | 11 +++++++++++ |
69 |
+ .../src/spec/powerpc_gentoo_linux_musl.rs | 11 +++++++++++ |
70 |
+ .../rustc_target/src/spec/x86_64_gentoo_linux_musl.rs | 11 +++++++++++ |
71 |
+ 8 files changed, 85 insertions(+) |
72 |
+ create mode 100644 compiler/rustc_target/src/spec/aarch64_gentoo_linux_musl.rs |
73 |
+ create mode 100644 compiler/rustc_target/src/spec/armv7_gentoo_linux_musleabihf.rs |
74 |
+ create mode 100644 compiler/rustc_target/src/spec/i686_gentoo_linux_musl.rs |
75 |
+ create mode 100644 compiler/rustc_target/src/spec/powerpc64_gentoo_linux_musl.rs |
76 |
+ create mode 100644 compiler/rustc_target/src/spec/powerpc64le_gentoo_linux_musl.rs |
77 |
+ create mode 100644 compiler/rustc_target/src/spec/powerpc_gentoo_linux_musl.rs |
78 |
+ create mode 100644 compiler/rustc_target/src/spec/x86_64_gentoo_linux_musl.rs |
79 |
+ |
80 |
+diff --git a/compiler/rustc_target/src/spec/aarch64_gentoo_linux_musl.rs b/compiler/rustc_target/src/spec/aarch64_gentoo_linux_musl.rs |
81 |
+new file mode 100644 |
82 |
+index 0000000..420fe7c |
83 |
+--- /dev/null |
84 |
++++ b/compiler/rustc_target/src/spec/aarch64_gentoo_linux_musl.rs |
85 |
+@@ -0,0 +1,11 @@ |
86 |
++use crate::spec::Target; |
87 |
++ |
88 |
++pub fn target() -> Target { |
89 |
++ let mut base = super::aarch64_unknown_linux_musl::target(); |
90 |
++ |
91 |
++ base.llvm_target = "aarch64-gentoo-linux-musl".to_string(); |
92 |
++ base.options.vendor = "gentoo".to_string(); |
93 |
++ base.options.crt_static_default = false; |
94 |
++ |
95 |
++ base |
96 |
++} |
97 |
+diff --git a/compiler/rustc_target/src/spec/armv7_gentoo_linux_musleabihf.rs b/compiler/rustc_target/src/spec/armv7_gentoo_linux_musleabihf.rs |
98 |
+new file mode 100644 |
99 |
+index 0000000..067e2d6 |
100 |
+--- /dev/null |
101 |
++++ b/compiler/rustc_target/src/spec/armv7_gentoo_linux_musleabihf.rs |
102 |
+@@ -0,0 +1,11 @@ |
103 |
++use crate::spec::Target; |
104 |
++ |
105 |
++pub fn target() -> Target { |
106 |
++ let mut base = super::armv7_unknown_linux_musleabihf::target(); |
107 |
++ |
108 |
++ base.llvm_target = "armv7-gentoo-linux-musleabihf".to_string(); |
109 |
++ base.options.vendor = "gentoo".to_string(); |
110 |
++ base.options.crt_static_default = false; |
111 |
++ |
112 |
++ base |
113 |
++} |
114 |
+diff --git a/compiler/rustc_target/src/spec/i686_gentoo_linux_musl.rs b/compiler/rustc_target/src/spec/i686_gentoo_linux_musl.rs |
115 |
+new file mode 100644 |
116 |
+index 0000000..1cd39cd |
117 |
+--- /dev/null |
118 |
++++ b/compiler/rustc_target/src/spec/i686_gentoo_linux_musl.rs |
119 |
+@@ -0,0 +1,11 @@ |
120 |
++use crate::spec::Target; |
121 |
++ |
122 |
++pub fn target() -> Target { |
123 |
++ let mut base = super::i686_unknown_linux_musl::target(); |
124 |
++ |
125 |
++ base.llvm_target = "i686-gentoo-linux-musl".to_string(); |
126 |
++ base.options.vendor = "gentoo".to_string(); |
127 |
++ base.options.crt_static_default = false; |
128 |
++ |
129 |
++ base |
130 |
++} |
131 |
+diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs |
132 |
+index f1e8330..d8c0ba0 100644 |
133 |
+--- a/compiler/rustc_target/src/spec/mod.rs |
134 |
++++ b/compiler/rustc_target/src/spec/mod.rs |
135 |
+@@ -490,6 +490,14 @@ macro_rules! supported_targets { |
136 |
+ } |
137 |
+ |
138 |
+ supported_targets! { |
139 |
++ ("aarch64-gentoo-linux-musl", aarch64_gentoo_linux_musl), |
140 |
++ ("armv7-gentoo-linux-musleabihf", armv7_gentoo_linux_musleabihf), |
141 |
++ ("i686-gentoo-linux-musl", i686_gentoo_linux_musl), |
142 |
++ ("powerpc-gentoo-linux-musl", powerpc_gentoo_linux_musl), |
143 |
++ ("powerpc64-gentoo-linux-musl", powerpc64_gentoo_linux_musl), |
144 |
++ ("powerpc64le-gentoo-linux-musl", powerpc64le_gentoo_linux_musl), |
145 |
++ ("x86_64-gentoo-linux-musl", x86_64_gentoo_linux_musl), |
146 |
++ |
147 |
+ ("x86_64-unknown-linux-gnu", x86_64_unknown_linux_gnu), |
148 |
+ ("x86_64-unknown-linux-gnux32", x86_64_unknown_linux_gnux32), |
149 |
+ ("i686-unknown-linux-gnu", i686_unknown_linux_gnu), |
150 |
+diff --git a/compiler/rustc_target/src/spec/powerpc64_gentoo_linux_musl.rs b/compiler/rustc_target/src/spec/powerpc64_gentoo_linux_musl.rs |
151 |
+new file mode 100644 |
152 |
+index 0000000..e840bb2 |
153 |
+--- /dev/null |
154 |
++++ b/compiler/rustc_target/src/spec/powerpc64_gentoo_linux_musl.rs |
155 |
+@@ -0,0 +1,11 @@ |
156 |
++use crate::spec::Target; |
157 |
++ |
158 |
++pub fn target() -> Target { |
159 |
++ let mut base = super::powerpc64_unknown_linux_musl::target(); |
160 |
++ |
161 |
++ base.llvm_target = "powerpc64-gentoo-linux-musl".to_string(); |
162 |
++ base.options.vendor = "gentoo".to_string(); |
163 |
++ base.options.crt_static_default = false; |
164 |
++ |
165 |
++ base |
166 |
++} |
167 |
+diff --git a/compiler/rustc_target/src/spec/powerpc64le_gentoo_linux_musl.rs b/compiler/rustc_target/src/spec/powerpc64le_gentoo_linux_musl.rs |
168 |
+new file mode 100644 |
169 |
+index 0000000..1037d82 |
170 |
+--- /dev/null |
171 |
++++ b/compiler/rustc_target/src/spec/powerpc64le_gentoo_linux_musl.rs |
172 |
+@@ -0,0 +1,11 @@ |
173 |
++use crate::spec::Target; |
174 |
++ |
175 |
++pub fn target() -> Target { |
176 |
++ let mut base = super::powerpc64le_unknown_linux_musl::target(); |
177 |
++ |
178 |
++ base.llvm_target = "powerpc64le-gentoo-linux-musl".to_string(); |
179 |
++ base.options.vendor = "gentoo".to_string(); |
180 |
++ base.options.crt_static_default = false; |
181 |
++ |
182 |
++ base |
183 |
++} |
184 |
+diff --git a/compiler/rustc_target/src/spec/powerpc_gentoo_linux_musl.rs b/compiler/rustc_target/src/spec/powerpc_gentoo_linux_musl.rs |
185 |
+new file mode 100644 |
186 |
+index 0000000..a623ffe |
187 |
+--- /dev/null |
188 |
++++ b/compiler/rustc_target/src/spec/powerpc_gentoo_linux_musl.rs |
189 |
+@@ -0,0 +1,11 @@ |
190 |
++use crate::spec::Target; |
191 |
++ |
192 |
++pub fn target() -> Target { |
193 |
++ let mut base = super::powerpc_unknown_linux_musl::target(); |
194 |
++ |
195 |
++ base.llvm_target = "powerpc-gentoo-linux-musl".to_string(); |
196 |
++ base.options.vendor = "gentoo".to_string(); |
197 |
++ base.options.crt_static_default = false; |
198 |
++ |
199 |
++ base |
200 |
++} |
201 |
+diff --git a/compiler/rustc_target/src/spec/x86_64_gentoo_linux_musl.rs b/compiler/rustc_target/src/spec/x86_64_gentoo_linux_musl.rs |
202 |
+new file mode 100644 |
203 |
+index 0000000..f330473 |
204 |
+--- /dev/null |
205 |
++++ b/compiler/rustc_target/src/spec/x86_64_gentoo_linux_musl.rs |
206 |
+@@ -0,0 +1,11 @@ |
207 |
++use crate::spec::Target; |
208 |
++ |
209 |
++pub fn target() -> Target { |
210 |
++ let mut base = super::x86_64_unknown_linux_musl::target(); |
211 |
++ |
212 |
++ base.llvm_target = "x86_64-gentoo-linux-musl".to_string(); |
213 |
++ base.options.vendor = "gentoo".to_string(); |
214 |
++ base.options.crt_static_default = false; |
215 |
++ |
216 |
++ base |
217 |
++} |
218 |
+-- |
219 |
+2.29.2 |
220 |
+ |
221 |
|
222 |
diff --git a/dev-lang/rust/rust-1.49.0.ebuild b/dev-lang/rust/rust-1.49.0.ebuild |
223 |
new file mode 100644 |
224 |
index 00000000000..a1608e5ceea |
225 |
--- /dev/null |
226 |
+++ b/dev-lang/rust/rust-1.49.0.ebuild |
227 |
@@ -0,0 +1,615 @@ |
228 |
+# Copyright 1999-2020 Gentoo Authors |
229 |
+# Distributed under the terms of the GNU General Public License v2 |
230 |
+ |
231 |
+EAPI=7 |
232 |
+ |
233 |
+PYTHON_COMPAT=( python3_{6..9} ) |
234 |
+ |
235 |
+inherit bash-completion-r1 check-reqs estack flag-o-matic llvm multiprocessing multilib-build python-any-r1 rust-toolchain toolchain-funcs |
236 |
+ |
237 |
+if [[ ${PV} = *beta* ]]; then |
238 |
+ betaver=${PV//*beta} |
239 |
+ BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}" |
240 |
+ MY_P="rustc-beta" |
241 |
+ SLOT="beta/${PV}" |
242 |
+ SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.xz -> rustc-${PV}-src.tar.xz" |
243 |
+else |
244 |
+ ABI_VER="$(ver_cut 1-2)" |
245 |
+ SLOT="stable/${ABI_VER}" |
246 |
+ MY_P="rustc-${PV}" |
247 |
+ SRC="${MY_P}-src.tar.xz" |
248 |
+ KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86" |
249 |
+fi |
250 |
+ |
251 |
+RUST_STAGE0_VERSION="1.$(($(ver_cut 2) - 1)).0" |
252 |
+ |
253 |
+DESCRIPTION="Systems programming language from Mozilla" |
254 |
+HOMEPAGE="https://www.rust-lang.org/" |
255 |
+ |
256 |
+SRC_URI=" |
257 |
+ https://static.rust-lang.org/dist/${SRC} |
258 |
+ !system-bootstrap? ( $(rust_all_arch_uris rust-${RUST_STAGE0_VERSION}) ) |
259 |
+" |
260 |
+ |
261 |
+# keep in sync with llvm ebuild of the same version as bundled one. |
262 |
+ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM AVR BPF Hexagon Lanai Mips MSP430 |
263 |
+ NVPTX PowerPC RISCV Sparc SystemZ WebAssembly X86 XCore ) |
264 |
+ALL_LLVM_TARGETS=( "${ALL_LLVM_TARGETS[@]/#/llvm_targets_}" ) |
265 |
+LLVM_TARGET_USEDEPS=${ALL_LLVM_TARGETS[@]/%/?} |
266 |
+ |
267 |
+LICENSE="|| ( MIT Apache-2.0 ) BSD-1 BSD-2 BSD-4 UoI-NCSA" |
268 |
+ |
269 |
+IUSE="clippy cpu_flags_x86_sse2 debug doc libressl miri nightly parallel-compiler rls rustfmt system-bootstrap system-llvm test wasm ${ALL_LLVM_TARGETS[*]}" |
270 |
+ |
271 |
+# Please keep the LLVM dependency block separate. Since LLVM is slotted, |
272 |
+# we need to *really* make sure we're not pulling more than one slot |
273 |
+# simultaneously. |
274 |
+ |
275 |
+# How to use it: |
276 |
+# 1. List all the working slots (with min versions) in ||, newest first. |
277 |
+# 2. Update the := to specify *max* version, e.g. < 12. |
278 |
+# 3. Specify LLVM_MAX_SLOT, e.g. 11. |
279 |
+LLVM_DEPEND=" |
280 |
+ || ( |
281 |
+ sys-devel/llvm:11[${LLVM_TARGET_USEDEPS// /,}] |
282 |
+ ) |
283 |
+ <sys-devel/llvm-12:= |
284 |
+ wasm? ( sys-devel/lld ) |
285 |
+" |
286 |
+LLVM_MAX_SLOT=11 |
287 |
+ |
288 |
+# to bootstrap we need at least exactly previous version, or same. |
289 |
+# most of the time previous versions fail to bootstrap with newer |
290 |
+# for example 1.47.x, requires at least 1.46.x, 1.47.x is ok, |
291 |
+# but it fails to bootstrap with 1.48.x |
292 |
+# https://github.com/rust-lang/rust/blob/${PV}/src/stage0.txt |
293 |
+BOOTSTRAP_DEPEND="|| |
294 |
+ ( |
295 |
+ =dev-lang/rust-$(ver_cut 1).$(($(ver_cut 2) - 1))* |
296 |
+ =dev-lang/rust-bin-$(ver_cut 1).$(($(ver_cut 2) - 1))* |
297 |
+ =dev-lang/rust-$(ver_cut 1).$(ver_cut 2)* |
298 |
+ =dev-lang/rust-bin-$(ver_cut 1).$(ver_cut 2)* |
299 |
+ ) |
300 |
+" |
301 |
+ |
302 |
+BDEPEND="${PYTHON_DEPS} |
303 |
+ app-eselect/eselect-rust |
304 |
+ || ( |
305 |
+ >=sys-devel/gcc-4.7 |
306 |
+ >=sys-devel/clang-3.5 |
307 |
+ ) |
308 |
+ system-bootstrap? ( ${BOOTSTRAP_DEPEND} ) |
309 |
+ !system-llvm? ( |
310 |
+ dev-util/cmake |
311 |
+ dev-util/ninja |
312 |
+ ) |
313 |
+" |
314 |
+ |
315 |
+DEPEND=" |
316 |
+ >=app-arch/xz-utils-5.2 |
317 |
+ net-misc/curl:=[http2,ssl] |
318 |
+ sys-libs/zlib:= |
319 |
+ !libressl? ( dev-libs/openssl:0= ) |
320 |
+ libressl? ( dev-libs/libressl:0= ) |
321 |
+ elibc_musl? ( sys-libs/libunwind:= ) |
322 |
+ system-llvm? ( |
323 |
+ ${LLVM_DEPEND} |
324 |
+ ) |
325 |
+" |
326 |
+ |
327 |
+# we need to block older versions due to layout changes. |
328 |
+RDEPEND="${DEPEND} |
329 |
+ app-eselect/eselect-rust |
330 |
+ !<dev-lang/rust-1.47.0-r1 |
331 |
+ !<dev-lang/rust-bin-1.47.0-r1 |
332 |
+" |
333 |
+ |
334 |
+REQUIRED_USE="|| ( ${ALL_LLVM_TARGETS[*]} ) |
335 |
+ miri? ( nightly ) |
336 |
+ parallel-compiler? ( nightly ) |
337 |
+ test? ( ${ALL_LLVM_TARGETS[*]} ) |
338 |
+ wasm? ( llvm_targets_WebAssembly ) |
339 |
+ x86? ( cpu_flags_x86_sse2 ) |
340 |
+" |
341 |
+ |
342 |
+# we don't use cmake.eclass, but can get a warnings |
343 |
+CMAKE_WARN_UNUSED_CLI=no |
344 |
+ |
345 |
+QA_FLAGS_IGNORED=" |
346 |
+ usr/lib/${PN}/${PV}/bin/.* |
347 |
+ usr/lib/${PN}/${PV}/lib/lib.*.so |
348 |
+ usr/lib/${PN}/${PV}/lib/rustlib/.*/bin/.* |
349 |
+ usr/lib/${PN}/${PV}/lib/rustlib/.*/lib/lib.*.so |
350 |
+" |
351 |
+ |
352 |
+QA_SONAME=" |
353 |
+ usr/lib/${PN}/${PV}/lib/lib.*.so.* |
354 |
+ usr/lib/${PN}/${PV}/lib/rustlib/.*/lib/lib.*.so |
355 |
+" |
356 |
+ |
357 |
+# causes double bootstrap |
358 |
+RESTRICT="test" |
359 |
+ |
360 |
+PATCHES=( |
361 |
+ "${FILESDIR}"/1.47.0-libressl.patch |
362 |
+ "${FILESDIR}"/1.46.0-don-t-create-prefix-at-time-of-check.patch |
363 |
+ "${FILESDIR}"/1.47.0-ignore-broken-and-non-applicable-tests.patch |
364 |
+ "${FILESDIR}"/1.47.0-llvm-tensorflow-fix.patch |
365 |
+ "${FILESDIR}"/1.49.0-gentoo-musl-target-specs.patch |
366 |
+) |
367 |
+ |
368 |
+S="${WORKDIR}/${MY_P}-src" |
369 |
+ |
370 |
+toml_usex() { |
371 |
+ usex "${1}" true false |
372 |
+} |
373 |
+ |
374 |
+boostrap_rust_version_check() { |
375 |
+ # never call from pkg_pretend. eselect-rust may be not installed yet. |
376 |
+ [[ ${MERGE_TYPE} == binary ]] && return |
377 |
+ local rustc_wanted="$(ver_cut 1).$(($(ver_cut 2) - 1))" |
378 |
+ local rustc_toonew="$(ver_cut 1).$(($(ver_cut 2) + 1))" |
379 |
+ local rustc_version=( $(eselect --brief rust show 2>/dev/null) ) |
380 |
+ rustc_version=${rustc_version[0]#rust-bin-} |
381 |
+ rustc_version=${rustc_version#rust-} |
382 |
+ |
383 |
+ [[ -z "${rustc_version}" ]] && die "Failed to determine rust version, check 'eselect rust' output" |
384 |
+ |
385 |
+ if ver_test "${rustc_version}" -lt "${rustc_wanted}" ; then |
386 |
+ eerror "Rust >=${rustc_wanted} is required" |
387 |
+ eerror "please run 'eselect rust' and set correct rust version" |
388 |
+ die "selected rust version is too old" |
389 |
+ elif ver_test "${rustc_version}" -ge "${rustc_toonew}" ; then |
390 |
+ eerror "Rust <${rustc_toonew} is required" |
391 |
+ eerror "please run 'eselect rust' and set correct rust version" |
392 |
+ die "selected rust version is too new" |
393 |
+ else |
394 |
+ einfo "Using rust ${rustc_version} to build" |
395 |
+ fi |
396 |
+} |
397 |
+ |
398 |
+pre_build_checks() { |
399 |
+ local M=6144 |
400 |
+ M=$(( $(usex clippy 128 0) + ${M} )) |
401 |
+ M=$(( $(usex miri 128 0) + ${M} )) |
402 |
+ M=$(( $(usex rls 512 0) + ${M} )) |
403 |
+ M=$(( $(usex rustfmt 256 0) + ${M} )) |
404 |
+ M=$(( $(usex system-llvm 0 2048) + ${M} )) |
405 |
+ M=$(( $(usex wasm 256 0) + ${M} )) |
406 |
+ M=$(( $(usex debug 15 10) * ${M} / 10 )) |
407 |
+ eshopts_push -s extglob |
408 |
+ if is-flagq '-g?(gdb)?([1-9])'; then |
409 |
+ M=$(( 15 * ${M} / 10 )) |
410 |
+ fi |
411 |
+ eshopts_pop |
412 |
+ M=$(( $(usex system-bootstrap 0 1024) + ${M} )) |
413 |
+ M=$(( $(usex doc 256 0) + ${M} )) |
414 |
+ CHECKREQS_DISK_BUILD=${M}M check-reqs_pkg_${EBUILD_PHASE} |
415 |
+} |
416 |
+ |
417 |
+pkg_pretend() { |
418 |
+ pre_build_checks |
419 |
+} |
420 |
+ |
421 |
+pkg_setup() { |
422 |
+ pre_build_checks |
423 |
+ python-any-r1_pkg_setup |
424 |
+ |
425 |
+ export LIBGIT2_NO_PKG_CONFIG=1 #749381 |
426 |
+ |
427 |
+ use system-bootstrap && boostrap_rust_version_check |
428 |
+ |
429 |
+ if use system-llvm; then |
430 |
+ llvm_pkg_setup |
431 |
+ |
432 |
+ local llvm_config="$(get_llvm_prefix "$LLVM_MAX_SLOT")/bin/llvm-config" |
433 |
+ export LLVM_LINK_SHARED=1 |
434 |
+ export RUSTFLAGS="${RUSTFLAGS} -Lnative=$("${llvm_config}" --libdir)" |
435 |
+ fi |
436 |
+} |
437 |
+ |
438 |
+src_prepare() { |
439 |
+ if ! use system-bootstrap; then |
440 |
+ local rust_stage0_root="${WORKDIR}"/rust-stage0 |
441 |
+ local rust_stage0="rust-${RUST_STAGE0_VERSION}-$(rust_abi)" |
442 |
+ |
443 |
+ "${WORKDIR}/${rust_stage0}"/install.sh --disable-ldconfig \ |
444 |
+ --destdir="${rust_stage0_root}" --prefix=/ || die |
445 |
+ fi |
446 |
+ |
447 |
+ default |
448 |
+} |
449 |
+ |
450 |
+src_configure() { |
451 |
+ local rust_target="" rust_targets="" arch_cflags |
452 |
+ |
453 |
+ # Collect rust target names to compile standard libs for all ABIs. |
454 |
+ for v in $(multilib_get_enabled_abi_pairs); do |
455 |
+ rust_targets="${rust_targets},\"$(rust_abi $(get_abi_CHOST ${v##*.}))\"" |
456 |
+ done |
457 |
+ if use wasm; then |
458 |
+ rust_targets="${rust_targets},\"wasm32-unknown-unknown\"" |
459 |
+ if use system-llvm; then |
460 |
+ # un-hardcode rust-lld linker for this target |
461 |
+ # https://bugs.gentoo.org/715348 |
462 |
+ sed -i '/linker:/ s/rust-lld/wasm-ld/' compiler/rustc_target/src/spec/wasm32_base.rs || die |
463 |
+ fi |
464 |
+ fi |
465 |
+ rust_targets="${rust_targets#,}" |
466 |
+ |
467 |
+ local tools="\"cargo\"," |
468 |
+ if use clippy; then |
469 |
+ tools="\"clippy\",$tools" |
470 |
+ fi |
471 |
+ if use miri; then |
472 |
+ tools="\"miri\",$tools" |
473 |
+ fi |
474 |
+ if use rls; then |
475 |
+ tools="\"rls\",\"analysis\",\"src\",$tools" |
476 |
+ fi |
477 |
+ if use rustfmt; then |
478 |
+ tools="\"rustfmt\",$tools" |
479 |
+ fi |
480 |
+ |
481 |
+ local rust_stage0_root |
482 |
+ if use system-bootstrap; then |
483 |
+ rust_stage0_root="$(rustc --print sysroot)" |
484 |
+ else |
485 |
+ rust_stage0_root="${WORKDIR}"/rust-stage0 |
486 |
+ fi |
487 |
+ |
488 |
+ rust_target="$(rust_abi)" |
489 |
+ |
490 |
+ cat <<- _EOF_ > "${S}"/config.toml |
491 |
+ [llvm] |
492 |
+ optimize = $(toml_usex !debug) |
493 |
+ release-debuginfo = $(toml_usex debug) |
494 |
+ assertions = $(toml_usex debug) |
495 |
+ ninja = true |
496 |
+ targets = "${LLVM_TARGETS// /;}" |
497 |
+ experimental-targets = "" |
498 |
+ link-shared = $(toml_usex system-llvm) |
499 |
+ [build] |
500 |
+ build = "${rust_target}" |
501 |
+ host = ["${rust_target}"] |
502 |
+ target = [${rust_targets}] |
503 |
+ cargo = "${rust_stage0_root}/bin/cargo" |
504 |
+ rustc = "${rust_stage0_root}/bin/rustc" |
505 |
+ docs = $(toml_usex doc) |
506 |
+ compiler-docs = $(toml_usex doc) |
507 |
+ submodules = false |
508 |
+ python = "${EPYTHON}" |
509 |
+ locked-deps = true |
510 |
+ vendor = true |
511 |
+ extended = true |
512 |
+ tools = [${tools}] |
513 |
+ verbose = 2 |
514 |
+ sanitizers = false |
515 |
+ profiler = false |
516 |
+ cargo-native-static = false |
517 |
+ [install] |
518 |
+ prefix = "${EPREFIX}/usr/lib/${PN}/${PV}" |
519 |
+ sysconfdir = "etc" |
520 |
+ docdir = "share/doc/rust" |
521 |
+ bindir = "bin" |
522 |
+ libdir = "lib" |
523 |
+ mandir = "share/man" |
524 |
+ [rust] |
525 |
+ # https://github.com/rust-lang/rust/issues/54872 |
526 |
+ codegen-units-std = 1 |
527 |
+ optimize = true |
528 |
+ debug = $(toml_usex debug) |
529 |
+ debug-assertions = $(toml_usex debug) |
530 |
+ debuginfo-level-rustc = 0 |
531 |
+ backtrace = true |
532 |
+ incremental = false |
533 |
+ default-linker = "$(tc-getCC)" |
534 |
+ parallel-compiler = $(toml_usex parallel-compiler) |
535 |
+ channel = "$(usex nightly nightly stable)" |
536 |
+ rpath = false |
537 |
+ verbose-tests = true |
538 |
+ optimize-tests = $(toml_usex !debug) |
539 |
+ codegen-tests = true |
540 |
+ dist-src = false |
541 |
+ remap-debuginfo = true |
542 |
+ lld = $(usex system-llvm false $(toml_usex wasm)) |
543 |
+ backtrace-on-ice = true |
544 |
+ jemalloc = false |
545 |
+ [dist] |
546 |
+ src-tarball = false |
547 |
+ _EOF_ |
548 |
+ |
549 |
+ for v in $(multilib_get_enabled_abi_pairs); do |
550 |
+ rust_target=$(rust_abi $(get_abi_CHOST ${v##*.})) |
551 |
+ arch_cflags="$(get_abi_CFLAGS ${v##*.})" |
552 |
+ |
553 |
+ cat <<- _EOF_ >> "${S}"/config.env |
554 |
+ CFLAGS_${rust_target}=${arch_cflags} |
555 |
+ _EOF_ |
556 |
+ |
557 |
+ cat <<- _EOF_ >> "${S}"/config.toml |
558 |
+ [target.${rust_target}] |
559 |
+ cc = "$(tc-getBUILD_CC)" |
560 |
+ cxx = "$(tc-getBUILD_CXX)" |
561 |
+ linker = "$(tc-getCC)" |
562 |
+ ar = "$(tc-getAR)" |
563 |
+ _EOF_ |
564 |
+ # librustc_target/spec/linux_musl_base.rs sets base.crt_static_default = true; |
565 |
+ if use elibc_musl; then |
566 |
+ cat <<- _EOF_ >> "${S}"/config.toml |
567 |
+ crt-static = false |
568 |
+ _EOF_ |
569 |
+ fi |
570 |
+ if use system-llvm; then |
571 |
+ cat <<- _EOF_ >> "${S}"/config.toml |
572 |
+ llvm-config = "$(get_llvm_prefix "${LLVM_MAX_SLOT}")/bin/llvm-config" |
573 |
+ _EOF_ |
574 |
+ fi |
575 |
+ done |
576 |
+ if use wasm; then |
577 |
+ cat <<- _EOF_ >> "${S}"/config.toml |
578 |
+ [target.wasm32-unknown-unknown] |
579 |
+ linker = "$(usex system-llvm lld rust-lld)" |
580 |
+ _EOF_ |
581 |
+ fi |
582 |
+ |
583 |
+ if [[ -n ${I_KNOW_WHAT_I_AM_DOING_CROSS} ]]; then # whitespace intentionally shifted below |
584 |
+ # experimental cross support |
585 |
+ # discussion: https://bugs.gentoo.org/679878 |
586 |
+ # TODO: c*flags, clang, system-llvm, cargo.eclass target support |
587 |
+ # it would be much better if we could split out stdlib |
588 |
+ # complilation to separate ebuild and abuse CATEGORY to |
589 |
+ # just install to /usr/lib/rustlib/<target> |
590 |
+ |
591 |
+ # extra targets defined as a bash array |
592 |
+ # spec format: <LLVM target>:<rust-target>:<CTARGET> |
593 |
+ # best place would be /etc/portage/env/dev-lang/rust |
594 |
+ # Example: |
595 |
+ # RUST_CROSS_TARGETS=( |
596 |
+ # "AArch64:aarch64-unknown-linux-gnu:aarch64-unknown-linux-gnu" |
597 |
+ # ) |
598 |
+ # no extra hand holding is done, no target transformations, all |
599 |
+ # values are passed as-is with just basic checks, so it's up to user to supply correct values |
600 |
+ # valid rust targets can be obtained with |
601 |
+ # rustc --print target-list |
602 |
+ # matching cross toolchain has to be installed |
603 |
+ # matching LLVM_TARGET has to be enabled for both rust and llvm (if using system one) |
604 |
+ # only gcc toolchains installed with crossdev are checked for now. |
605 |
+ |
606 |
+ # BUG: we can't pass host flags to cross compiler, so just filter for now |
607 |
+ # BUG: this should be more fine-grained. |
608 |
+ filter-flags '-mcpu=*' '-march=*' '-mtune=*' |
609 |
+ |
610 |
+ local cross_target_spec |
611 |
+ for cross_target_spec in "${RUST_CROSS_TARGETS[@]}";do |
612 |
+ # extracts first element form <LLVM target>:<rust-target>:<CTARGET> |
613 |
+ local cross_llvm_target="${cross_target_spec%%:*}" |
614 |
+ # extracts toolchain triples, <rust-target>:<CTARGET> |
615 |
+ local cross_triples="${cross_target_spec#*:}" |
616 |
+ # extracts first element after before : separator |
617 |
+ local cross_rust_target="${cross_triples%%:*}" |
618 |
+ # extracts last element after : separator |
619 |
+ local cross_toolchain="${cross_triples##*:}" |
620 |
+ use llvm_targets_${cross_llvm_target} || die "need llvm_targets_${cross_llvm_target} target enabled" |
621 |
+ command -v ${cross_toolchain}-gcc > /dev/null 2>&1 || die "need ${cross_toolchain} cross toolchain" |
622 |
+ |
623 |
+ cat <<- _EOF_ >> "${S}"/config.toml |
624 |
+ [target.${cross_rust_target}] |
625 |
+ cc = "${cross_toolchain}-gcc" |
626 |
+ cxx = "${cross_toolchain}-g++" |
627 |
+ linker = "${cross_toolchain}-gcc" |
628 |
+ ar = "${cross_toolchain}-ar" |
629 |
+ _EOF_ |
630 |
+ if use system-llvm; then |
631 |
+ cat <<- _EOF_ >> "${S}"/config.toml |
632 |
+ llvm-config = "$(get_llvm_prefix "${LLVM_MAX_SLOT}")/bin/llvm-config" |
633 |
+ _EOF_ |
634 |
+ fi |
635 |
+ |
636 |
+ # append cross target to "normal" target list |
637 |
+ # example 'target = ["powerpc64le-unknown-linux-gnu"]' |
638 |
+ # becomes 'target = ["powerpc64le-unknown-linux-gnu","aarch64-unknown-linux-gnu"]' |
639 |
+ |
640 |
+ rust_targets="${rust_targets},\"${cross_rust_target}\"" |
641 |
+ sed -i "/^target = \[/ s#\[.*\]#\[${rust_targets}\]#" config.toml || die |
642 |
+ |
643 |
+ ewarn |
644 |
+ ewarn "Enabled ${cross_rust_target} rust target" |
645 |
+ ewarn "Using ${cross_toolchain} cross toolchain" |
646 |
+ ewarn |
647 |
+ if ! has_version -b 'sys-devel/binutils[multitarget]' ; then |
648 |
+ ewarn "'sys-devel/binutils[multitarget]' is not installed" |
649 |
+ ewarn "'strip' will be unable to strip cross libraries" |
650 |
+ ewarn "cross targets will be installed with full debug information" |
651 |
+ ewarn "enable 'multitarget' USE flag for binutils to be able to strip object files" |
652 |
+ ewarn |
653 |
+ ewarn "Alternatively llvm-strip can be used, it supports stripping any target" |
654 |
+ ewarn "define STRIP=\"llvm-strip\" to use it (experimental)" |
655 |
+ ewarn |
656 |
+ fi |
657 |
+ done |
658 |
+ fi # I_KNOW_WHAT_I_AM_DOING_CROSS |
659 |
+ |
660 |
+ einfo "Rust configured with the following settings:" |
661 |
+ cat "${S}"/config.toml || die |
662 |
+} |
663 |
+ |
664 |
+src_compile() { |
665 |
+ # we need \n IFS to have config.env with spaces loaded properly. #734018 |
666 |
+ ( |
667 |
+ IFS=$'\n' |
668 |
+ env $(cat "${S}"/config.env) RUST_BACKTRACE=1\ |
669 |
+ "${EPYTHON}" ./x.py dist -vv --config="${S}"/config.toml -j$(makeopts_jobs) || die |
670 |
+ ) |
671 |
+} |
672 |
+ |
673 |
+src_test() { |
674 |
+ # https://rustc-dev-guide.rust-lang.org/tests/intro.html |
675 |
+ |
676 |
+ # those are basic and codegen tests. |
677 |
+ local tests=( |
678 |
+ codegen |
679 |
+ codegen-units |
680 |
+ compile-fail |
681 |
+ incremental |
682 |
+ mir-opt |
683 |
+ pretty |
684 |
+ run-make |
685 |
+ ) |
686 |
+ |
687 |
+ # fails if llvm is not built with ALL targets. |
688 |
+ # and known to fail with system llvm sometimes. |
689 |
+ use system-llvm || tests+=( assembly ) |
690 |
+ |
691 |
+ # fragile/expensive/less important tests |
692 |
+ # or tests that require extra builds |
693 |
+ # TODO: instead of skipping, just make some nonfatal. |
694 |
+ if [[ ${ERUST_RUN_EXTRA_TESTS:-no} != no ]]; then |
695 |
+ tests+=( |
696 |
+ rustdoc |
697 |
+ rustdoc-js |
698 |
+ rustdoc-js-std |
699 |
+ rustdoc-ui |
700 |
+ run-make-fulldeps |
701 |
+ ui |
702 |
+ ui-fulldeps |
703 |
+ ) |
704 |
+ fi |
705 |
+ |
706 |
+ local i failed=() |
707 |
+ einfo "rust_src_test: enabled tests ${tests[@]/#/src/test/}" |
708 |
+ for i in "${tests[@]}"; do |
709 |
+ local t="src/test/${i}" |
710 |
+ einfo "rust_src_test: running ${t}" |
711 |
+ if ! ( |
712 |
+ IFS=$'\n' |
713 |
+ env $(cat "${S}"/config.env) RUST_BACKTRACE=1 \ |
714 |
+ "${EPYTHON}" ./x.py test -vv --config="${S}"/config.toml \ |
715 |
+ -j$(makeopts_jobs) --no-doc --no-fail-fast "${t}" |
716 |
+ ) |
717 |
+ then |
718 |
+ failed+=( "${t}" ) |
719 |
+ eerror "rust_src_test: ${t} failed" |
720 |
+ fi |
721 |
+ done |
722 |
+ |
723 |
+ if [[ ${#failed[@]} -ne 0 ]]; then |
724 |
+ eerror "rust_src_test: failure summary: ${failed[@]}" |
725 |
+ die "aborting due to test failures" |
726 |
+ fi |
727 |
+} |
728 |
+ |
729 |
+src_install() { |
730 |
+ # https://github.com/rust-lang/rust/issues/77721 |
731 |
+ # also 1.46.0-don-t-create-prefix-at-time-of-check.patch |
732 |
+ dodir "/usr/lib/${PN}/${PV}" |
733 |
+ ( |
734 |
+ IFS=$'\n' |
735 |
+ env $(cat "${S}"/config.env) DESTDIR="${D}" \ |
736 |
+ "${EPYTHON}" ./x.py install -vv --config="${S}"/config.toml || die |
737 |
+ ) |
738 |
+ |
739 |
+ # bug #689562, #689160 |
740 |
+ rm -v "${ED}/usr/lib/${PN}/${PV}/etc/bash_completion.d/cargo" || die |
741 |
+ rmdir -v "${ED}/usr/lib/${PN}/${PV}"/etc{/bash_completion.d,} || die |
742 |
+ dobashcomp build/tmp/dist/cargo-image/etc/bash_completion.d/cargo |
743 |
+ |
744 |
+ local symlinks=( |
745 |
+ cargo |
746 |
+ rustc |
747 |
+ rustdoc |
748 |
+ rust-gdb |
749 |
+ rust-gdbgui |
750 |
+ rust-lldb |
751 |
+ ) |
752 |
+ |
753 |
+ use clippy && symlinks+=( clippy-driver cargo-clippy ) |
754 |
+ use miri && symlinks+=( miri cargo-miri ) |
755 |
+ use rls && symlinks+=( rls ) |
756 |
+ use rustfmt && symlinks+=( rustfmt cargo-fmt ) |
757 |
+ |
758 |
+ einfo "installing eselect-rust symlinks and paths: ${symlinks[@]}" |
759 |
+ local i |
760 |
+ for i in "${symlinks[@]}"; do |
761 |
+ # we need realpath on /usr/bin/* symlink return version-appended binary path. |
762 |
+ # so /usr/bin/rustc should point to /usr/lib/rust/<ver>/bin/rustc-<ver> |
763 |
+ # need to fix eselect-rust to remove this hack. |
764 |
+ local ver_i="${i}-${PV}" |
765 |
+ if [[ -f "${ED}/usr/lib/${PN}/${PV}/bin/${i}" ]]; then |
766 |
+ einfo "Installing ${i} symlink" |
767 |
+ ln -v "${ED}/usr/lib/${PN}/${PV}/bin/${i}" "${ED}/usr/lib/${PN}/${PV}/bin/${ver_i}" || die |
768 |
+ else |
769 |
+ ewarn "${i} symlink requested, but source file not found" |
770 |
+ ewarn "please report this" |
771 |
+ fi |
772 |
+ dosym "../lib/${PN}/${PV}/bin/${ver_i}" "/usr/bin/${ver_i}" |
773 |
+ done |
774 |
+ |
775 |
+ # symlinks to switch components to active rust in eselect |
776 |
+ dosym "${PV}/lib" "/usr/lib/${PN}/lib-${PV}" |
777 |
+ dosym "${PV}/share/man" "/usr/lib/${PN}/man-${PV}" |
778 |
+ dosym "rust/${PV}/lib/rustlib" "/usr/lib/rustlib-${PV}" |
779 |
+ dosym "../../lib/${PN}/${PV}/share/doc/rust" "/usr/share/doc/${P}" |
780 |
+ |
781 |
+ newenvd - "50${P}" <<-_EOF_ |
782 |
+ LDPATH="${EPREFIX}/usr/lib/rust/lib" |
783 |
+ MANPATH="${EPREFIX}/usr/lib/rust/man" |
784 |
+ $(usex elibc_musl 'CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_RUSTFLAGS="-C target-feature=-crt-static"' '') |
785 |
+ _EOF_ |
786 |
+ |
787 |
+ rm -rf "${ED}/usr/lib/${PN}/${PV}"/*.old || die |
788 |
+ rm -rf "${ED}/usr/lib/${PN}/${PV}/doc"/*.old || die |
789 |
+ |
790 |
+ # note: eselect-rust adds EROOT to all paths below |
791 |
+ cat <<-_EOF_ > "${T}/provider-${P}" |
792 |
+ /usr/bin/cargo |
793 |
+ /usr/bin/rustdoc |
794 |
+ /usr/bin/rust-gdb |
795 |
+ /usr/bin/rust-gdbgui |
796 |
+ /usr/bin/rust-lldb |
797 |
+ /usr/lib/rustlib |
798 |
+ /usr/lib/rust/lib |
799 |
+ /usr/lib/rust/man |
800 |
+ /usr/share/doc/rust |
801 |
+ _EOF_ |
802 |
+ |
803 |
+ if use clippy; then |
804 |
+ echo /usr/bin/clippy-driver >> "${T}/provider-${P}" |
805 |
+ echo /usr/bin/cargo-clippy >> "${T}/provider-${P}" |
806 |
+ fi |
807 |
+ if use miri; then |
808 |
+ echo /usr/bin/miri >> "${T}/provider-${P}" |
809 |
+ echo /usr/bin/cargo-miri >> "${T}/provider-${P}" |
810 |
+ fi |
811 |
+ if use rls; then |
812 |
+ echo /usr/bin/rls >> "${T}/provider-${P}" |
813 |
+ fi |
814 |
+ if use rustfmt; then |
815 |
+ echo /usr/bin/rustfmt >> "${T}/provider-${P}" |
816 |
+ echo /usr/bin/cargo-fmt >> "${T}/provider-${P}" |
817 |
+ fi |
818 |
+ |
819 |
+ insinto /etc/env.d/rust |
820 |
+ doins "${T}/provider-${P}" |
821 |
+} |
822 |
+ |
823 |
+pkg_postinst() { |
824 |
+ eselect rust update |
825 |
+ |
826 |
+ if has_version sys-devel/gdb || has_version dev-util/lldb; then |
827 |
+ elog "Rust installs a helper script for calling GDB and LLDB," |
828 |
+ elog "for your convenience it is installed under /usr/bin/rust-{gdb,lldb}-${PV}." |
829 |
+ fi |
830 |
+ |
831 |
+ if has_version app-editors/emacs; then |
832 |
+ elog "install app-emacs/rust-mode to get emacs support for rust." |
833 |
+ fi |
834 |
+ |
835 |
+ if has_version app-editors/gvim || has_version app-editors/vim; then |
836 |
+ elog "install app-vim/rust-vim to get vim support for rust." |
837 |
+ fi |
838 |
+} |
839 |
+ |
840 |
+pkg_postrm() { |
841 |
+ eselect rust cleanup |
842 |
+} |