1 |
commit: 51563211f1ddc9662e89cad5c1a2495fcdf9f117 |
2 |
Author: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Oct 8 19:32:12 2020 +0000 |
4 |
Commit: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Oct 9 06:23:05 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=51563211 |
7 |
|
8 |
dev-lang/rust: bump to 1.47.0 |
9 |
|
10 |
we now install to /usr/lib/rust/<ver> |
11 |
this is more robust and mirrors how |
12 |
rustup installs rust, also most slotted |
13 |
toolchain projects already to it, so we follow |
14 |
|
15 |
Bug: https://bugs.gentoo.org/734018 |
16 |
PR: https://github.com/gentoo/gentoo/pull/16846 |
17 |
Package-Manager: Portage-3.0.8, Repoman-3.0.1 |
18 |
Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org> |
19 |
|
20 |
dev-lang/rust/Manifest | 15 + |
21 |
...46.0-don-t-create-prefix-at-time-of-check.patch | 31 ++ |
22 |
....0-ignore-broken-and-non-applicable-tests.patch | 75 +++ |
23 |
dev-lang/rust/files/gentoo-musl-target-specs.patch | 168 ++++++ |
24 |
dev-lang/rust/rust-1.47.0.ebuild | 582 +++++++++++++++++++++ |
25 |
5 files changed, 871 insertions(+) |
26 |
|
27 |
diff --git a/dev-lang/rust/Manifest b/dev-lang/rust/Manifest |
28 |
index 9c9eea3dce4..9e09ade946e 100644 |
29 |
--- a/dev-lang/rust/Manifest |
30 |
+++ b/dev-lang/rust/Manifest |
31 |
@@ -40,6 +40,21 @@ DIST rust-1.45.1-powerpc64le-unknown-linux-gnu.tar.xz 119234164 BLAKE2B 4148957f |
32 |
DIST rust-1.45.1-s390x-unknown-linux-gnu.tar.xz 124758156 BLAKE2B ff62e14d5ae9f7213ebc24d694317ff292cb0d7d2a67f0ca284cddd2b9f594547b01a6c647780d47989d4405072f377d37fc03933431a3df804e37bc1248e803 SHA512 278411c6308eaa4d732ff4c0f448d808a5ee74dae5f3eaf04773ccf65c9bc5963153f62346d30de0f577dd6da89c55bed280c2fb0e50d2075e3c30a3649fc4e8 |
33 |
DIST rust-1.45.1-x86_64-unknown-linux-gnu.tar.xz 117764080 BLAKE2B cafe6e4f7c28112879089d75703a1b1ce7c0cf9b5ab5beeb4ddf343f7bc93e8704bc105ba0bd95f1df6d62439f206d8f4ae9090330af857ec0a249540eb63122 SHA512 13ee5ff7cae29440e32fb140404ff01414d66f0ea8d79777fb1586541de1ee6ef8e12f9249c35374501460a2352f7d0f6035b5bdc2f0daa91d772a157657ec0b |
34 |
DIST rust-1.45.1-x86_64-unknown-linux-musl.tar.xz 123820216 BLAKE2B 1afe48589e5eec15d8fdb31d52b2ada49688e78a311298d421a8b2d4c0cc6a708223e5976518d66506584dc2adc63651b62b8c1fc3c3ccfaff80e2ef7ade5078 SHA512 39875878acfeb05d7b72bab2dea51063a523fa7ad136d582ba28603df7f8b1c3360e5838e5f9b08f396969e52bb1fc672fa4c08cf5f8ffc39128af129b6b17a6 |
35 |
+DIST rust-1.46.0-aarch64-unknown-linux-gnu.tar.xz 127384736 BLAKE2B a1efd25cf429a309a454ef5db38c68d642920e859ef6effbe88ace7f3c4050ae7e9cf10d2f5b70405475ffcbbbc80338e3a5e4b3cb632c555e31a0ebc1b76cd4 SHA512 53e5d8afadaa9505286dce4acbb911126d17bc7bf45ea4685070ff07be7f6c7860e543a7686eeac695e7e3e127ca38ba2f09b73467fbf5f92d0b2195467c51f2 |
36 |
+DIST rust-1.46.0-arm-unknown-linux-gnueabi.tar.xz 121741008 BLAKE2B d277cb19c9f9641f216eba9ddb8bdb0a1bf70b7376e82798dad3116ff6d976c6ec8f6442831ae6a3c64cfdb46c59cf47b482df5200af49ba5eeccb663538084b SHA512 74cc1c8f56c88bdb669d52edca69c8aed7500e51498e8bf4099b2edbf85a2beab1e6d447029eb24e12fdfcbf2272f5d8b741eb4aa48fe83dac44759478429284 |
37 |
+DIST rust-1.46.0-arm-unknown-linux-gnueabihf.tar.xz 120726564 BLAKE2B 5ef9c319d4744016e336a8d8bde99b2b9183dd13fc6873d4f0e239a52a86e054d42ee48ca1a84ac42d140b1bbe234f4eeaf90717f14959ad6966681429eef233 SHA512 89972cc03c05dd5bc003f6cf16e062b935b3fda288ae0c3d32a3d08ccdcbf7699c306aa3c017a13e76f13f8dca7a951ec98f23507de978ae87cffb6d6907af5c |
38 |
+DIST rust-1.46.0-armv7-unknown-linux-gnueabihf.tar.xz 123912836 BLAKE2B 97cdb2e8d643826f7dd1554096e14c58c35b38cc2eebb49c478343bf8bc157995a9f1099c014800701d34edbf0f0798ac29babbd2a5bf261d1956bc731b0a99c SHA512 c7e320fd5169c99bf8a12fb5bf1c5fb19a05d14f75ce655e4b64cad3456594ef09be1da7ac34a09b5d84da0c857d1a6e5a0695b5ff04cda491ea92fea15d28dc |
39 |
+DIST rust-1.46.0-i686-unknown-linux-gnu.tar.xz 141319800 BLAKE2B 712227e42b8597ee1c645cb344042e79ca40aef0e22d783c4a0c042bd07f686aafd9b80bebe0dfe69b4b012056509bfe510fffa8ba5357656d459fe5885fe0fe SHA512 b01e9b06c9de50e43bc6b5e1a5e6cc49dab1cf28b9cf0a8b974d2630c7ed4c6a5df6f321c872e11eb622c42f1d8cfaec77c1b67254a84365464fe3415acfa07f |
40 |
+DIST rust-1.46.0-mips-unknown-linux-gnu.tar.xz 110175584 BLAKE2B 23e38e81d281d0df23795ff60e4a7503f63d443d966bc6d5068edc50fc0dd90e2fe45eb90b901a1fb3f8f813375533eaa142d625b661f5d76d2097b0cf572606 SHA512 0635060dd15f548834e5c946ec8deea10bf234f550f6a01d4d491f45e0d5f16e957f99caba14c91225d100e7c59e909869b816dfffe9f8681c09e9e5b6ca2bdd |
41 |
+DIST rust-1.46.0-mips64-unknown-linux-gnuabi64.tar.xz 117357812 BLAKE2B c3118a0b710ceaffda8523840551306d4bbc7c78fc26016fc1ac0037c2a7cd68f56c11999f7e3bc435f93e0dbebf348fdc52255cc5978bdffb2d55dc9d56e23e SHA512 5dc6de40429e72ecad9546390f1f5e626d388938c7bc50a56fb258787b45e8d7363170d8d1a2bff56fbd8bef22060b6cb0c50fb016ccc7d4fb767ba6b7e80c2d |
42 |
+DIST rust-1.46.0-mipsel-unknown-linux-gnu.tar.xz 111804692 BLAKE2B 4779d5602f2107321d5c6042dce1baaf6eec2f60cf2ba4330bf72fda0868d7e8294cf573b3ffab3654a0689d11599f2fc37430005686e91439abc7ae6fefb977 SHA512 3c9d17fa89636d37e125d7665883abc9912330d4a1f5291d44771fd1cbb17d604deccc07685cb567f1b141dde3668d5ef55f3661b04e4506d5337d69acc6738c |
43 |
+DIST rust-1.46.0-powerpc-unknown-linux-gnu.tar.xz 111495200 BLAKE2B d618c61a05507abe13d1294594187a4552896cb61396c2f8bd6e506a71ab4bb5cd26ae3b2b573d1d5a4ea79fb4dd2238a2ae34059357ef397264beb0b67cbc34 SHA512 38df2204bd4bfe7371365266651a84da218ba909c3ae107432f6fef892e71488d193b8f54fe6738edd91aa0ca029038d864806b25289254711bd10f736bcc2d7 |
44 |
+DIST rust-1.46.0-powerpc64-unknown-linux-gnu.tar.xz 124882812 BLAKE2B 2362e25d39cfd2039ce18db08f43bceaaccd208ec113c16f6718803eadda964bb254a6afc606765a00026adc93cf366495d3546d6aac8a7444088f519d421c9b SHA512 40f9423d838cab74b9920372e728c4ca7057005d83af587387dd2b164a0bf93de65cebc035320bce25f80914c63ce65b84218b9a776b0b905428e4cba0821b8b |
45 |
+DIST rust-1.46.0-powerpc64le-unknown-linux-gnu.tar.xz 130200900 BLAKE2B d38a7f131983aee27e6af59ab03999e7420745a0f9256b2623e71f36dd6f12605025dbdc510bd5ffb73e0d31a5c7e56a791bdf718b2eba629d08e2f75221b1c8 SHA512 986f0bf7995f35836b73fb7045cf43ae5efe0c2543c75c66cdcc0f8c1dd3513def3c291e021241e328142deaca690ce113526ffc870c4412a7841f244258a43e |
46 |
+DIST rust-1.46.0-s390x-unknown-linux-gnu.tar.xz 134521076 BLAKE2B d3efd71dd7db812736680929185ad5f58a2dbf7d1b8a6f851834dd7b41713fc171dbcdf2472bedc13751bfeed58070d919d2a1138765ab75c0f4bdf817cb6418 SHA512 b6146695225ff6d0516e7bb6bc4620599356bb89b14f429a09d9d7f8715a94e8e218402346d5c9a10eeb54c0bdc40fb179289216b0cb4edd5bdf886f6b69aab4 |
47 |
+DIST rust-1.46.0-x86_64-unknown-linux-gnu.tar.xz 127200200 BLAKE2B 7d755e0622cda99d111490197b21ff4aaeb7b13292804566bc677b7b1d833eaa644b7a801863a1a01e3aa34be28a80344cae69edc57f8c8788884c78e037b750 SHA512 95f5adc2d2137010c7e5ac8a0fc70485250b4f9a909cb8b164b35fffff76ab88e9b09d305bfac37324ed080c5fc7643001d2abec5454ca911dc3513f1af52c88 |
48 |
+DIST rust-1.46.0-x86_64-unknown-linux-musl.tar.xz 142372372 BLAKE2B 7d3672234b61b772e2311127db569b37296bf3a9bf86841fb78c6d20da6a6abfc6c866ba4aa7cc44c12eebb0744fbeb401b491314db9eb481b926792cadcca22 SHA512 e2599c4c10fe9725e63524d89c0be869d43347620b0f6ff1a93cee5e7219f5560c6171d8eda99e5624eba60b9d488bfe0942c23eacdbac2ba42e4cd63f14b7c9 |
49 |
DIST rustc-1.44.1-src.tar.xz 94756856 BLAKE2B 60f536c3ba0fa1fec4b6333ee57809ee5226090ad5041c14a136b4356ff3b898062e06c3fe54effe873e27931ac8fcb902cd48a38615a8de7eebc6ecb3bdc2bd SHA512 1c17002edae844a710db9b144c17171416330dc565343c65af8a6e112fb61555e2025bb4cf33cac1229d7df689e6ff8858b91ae00552400ccacafaf1de11849b |
50 |
DIST rustc-1.45.2-src.tar.xz 98683036 BLAKE2B a4102a5d4744b7ccc9b076aba00c39d69532f777e7d39e0e4ce2033b663b43e27b55034fdb3a1e13379fae9a16bff9e7748865a84507f7388ef0ebf9d421eac7 SHA512 cc6250c0bc844e77ca6dd7ae013e434ed3009b001914114866ed31f28edf3960221454d131e298b15050e3b8153fb8298d509559c2f7307c64611aa8e36b4d25 |
51 |
DIST rustc-1.46.0-src.tar.xz 101868452 BLAKE2B da9798596b124a10d79c236a871228f05e5f571d22c2259328e7026c91e088c85f5de9c0536a16531e0cb10477bfcd16d3ac11467979f5561cb6199442b877ef SHA512 099857f1d295043587a4e2a65ef3e6a90e12c8b6958e98535a1656c113c553f9a9b621aba8a19cf21bd8d2c79d27cbfa4b8e6fabbcb3cbfee23b545be7b450b4 |
52 |
+DIST rustc-1.47.0-src.tar.xz 104143736 BLAKE2B 0454094dde35275488046826da87655e51bf0795481d6d08fd70d644bfc12481bca8641166106ef32f20494906025244715b16ff21a1c023f4bd2818aab42521 SHA512 6ba83c0158f8130ddeae7e070417a2121d8a548c8fe97e28bce116d84048636c75aaee78e0c92cd43a50f5679a1223fc226cc8c5ba9bbd1465e84c5c6034d5c9 |
53 |
|
54 |
diff --git a/dev-lang/rust/files/1.46.0-don-t-create-prefix-at-time-of-check.patch b/dev-lang/rust/files/1.46.0-don-t-create-prefix-at-time-of-check.patch |
55 |
new file mode 100644 |
56 |
index 00000000000..9064a52ac2d |
57 |
--- /dev/null |
58 |
+++ b/dev-lang/rust/files/1.46.0-don-t-create-prefix-at-time-of-check.patch |
59 |
@@ -0,0 +1,31 @@ |
60 |
+From 6b31232a9d32529e30765108f30365ac48587ce6 Mon Sep 17 00:00:00 2001 |
61 |
+From: Georgy Yakovlev <gyakovlev@g.o> |
62 |
+Date: Thu, 8 Oct 2020 15:48:33 -0700 |
63 |
+Subject: [PATCH] don't create prefix at time of check |
64 |
+ |
65 |
+--- |
66 |
+ src/bootstrap/install.rs | 8 ++------ |
67 |
+ 1 file changed, 2 insertions(+), 6 deletions(-) |
68 |
+ |
69 |
+diff --git a/src/bootstrap/install.rs b/src/bootstrap/install.rs |
70 |
+index d9ee3bc..c5da9ce 100644 |
71 |
+--- a/src/bootstrap/install.rs |
72 |
++++ b/src/bootstrap/install.rs |
73 |
+@@ -73,12 +73,8 @@ fn install_sh( |
74 |
+ let docdir_default = datadir_default.join("doc/rust"); |
75 |
+ let libdir_default = PathBuf::from("lib"); |
76 |
+ let mandir_default = datadir_default.join("man"); |
77 |
+- let prefix = builder.config.prefix.as_ref().map_or(prefix_default, |p| { |
78 |
+- fs::create_dir_all(p) |
79 |
+- .unwrap_or_else(|err| panic!("could not create {}: {}", p.display(), err)); |
80 |
+- fs::canonicalize(p) |
81 |
+- .unwrap_or_else(|err| panic!("could not canonicalize {}: {}", p.display(), err)) |
82 |
+- }); |
83 |
++ |
84 |
++ let prefix = builder.config.prefix.as_ref().unwrap_or(&prefix_default); |
85 |
+ let sysconfdir = builder.config.sysconfdir.as_ref().unwrap_or(&sysconfdir_default); |
86 |
+ let datadir = builder.config.datadir.as_ref().unwrap_or(&datadir_default); |
87 |
+ let docdir = builder.config.docdir.as_ref().unwrap_or(&docdir_default); |
88 |
+-- |
89 |
+2.28.0 |
90 |
+ |
91 |
|
92 |
diff --git a/dev-lang/rust/files/1.47.0-ignore-broken-and-non-applicable-tests.patch b/dev-lang/rust/files/1.47.0-ignore-broken-and-non-applicable-tests.patch |
93 |
new file mode 100644 |
94 |
index 00000000000..ff1707f4b8a |
95 |
--- /dev/null |
96 |
+++ b/dev-lang/rust/files/1.47.0-ignore-broken-and-non-applicable-tests.patch |
97 |
@@ -0,0 +1,75 @@ |
98 |
+From 1879d1d1a284bf51c752e47db284ce22701ed5d0 Mon Sep 17 00:00:00 2001 |
99 |
+From: Samuel Holland <samuel@××××××××.org> |
100 |
+Date: Sun, 16 Sep 2018 16:38:48 +0000 |
101 |
+Subject: [PATCH 12/15] Ignore broken and non-applicable tests |
102 |
+ |
103 |
+c-link-to-rust-va-list-fn: unstable feature, broken on aarch64, #56475 |
104 |
+env-funky-keys: can't handle LD_PRELOAD (e.g. sandbox) |
105 |
+long-linker-command-lines: takes >10 minutes to run (but still passes) |
106 |
+simd-intrinsic-generic-bitmask.rs: broken on BE, #59356 |
107 |
+sparc-struct-abi: no sparc target |
108 |
+sysroot-crates-are-unstable: can't run rustc without RPATH |
109 |
+--- |
110 |
+ src/test/codegen/sparc-struct-abi.rs | 1 + |
111 |
+ src/test/run-make-fulldeps/c-link-to-rust-va-list-fn/Makefile | 2 ++ |
112 |
+ src/test/run-make-fulldeps/long-linker-command-lines/Makefile | 2 ++ |
113 |
+ src/test/run-make-fulldeps/sysroot-crates-are-unstable/Makefile | 2 ++ |
114 |
+ src/test/ui/env-funky-keys.rs | 1 + |
115 |
+ 6 files changed, 10 insertions(+) |
116 |
+ |
117 |
+diff --git a/src/test/codegen/sparc-struct-abi.rs b/src/test/codegen/sparc-struct-abi.rs |
118 |
+index 78e5b14a212..6f93e93286b 100644 |
119 |
+--- a/src/test/codegen/sparc-struct-abi.rs |
120 |
++++ b/src/test/codegen/sparc-struct-abi.rs |
121 |
+@@ -4,6 +4,7 @@ |
122 |
+ |
123 |
+ // only-sparc64 |
124 |
+ // compile-flags: -O --target=sparc64-unknown-linux-gnu --crate-type=rlib |
125 |
++// ignore-test |
126 |
+ #![feature(no_core, lang_items)] |
127 |
+ #![no_core] |
128 |
+ |
129 |
+diff --git a/src/test/run-make-fulldeps/c-link-to-rust-va-list-fn/Makefile b/src/test/run-make-fulldeps/c-link-to-rust-va-list-fn/Makefile |
130 |
+index f124ca2ab61..363b18f0985 100644 |
131 |
+--- a/src/test/run-make-fulldeps/c-link-to-rust-va-list-fn/Makefile |
132 |
++++ b/src/test/run-make-fulldeps/c-link-to-rust-va-list-fn/Makefile |
133 |
+@@ -1,3 +1,5 @@ |
134 |
++# ignore-aarch64 |
135 |
++ |
136 |
+ -include ../tools.mk |
137 |
+ |
138 |
+ all: |
139 |
+diff --git a/src/test/run-make-fulldeps/long-linker-command-lines/Makefile b/src/test/run-make-fulldeps/long-linker-command-lines/Makefile |
140 |
+index 5876fbc94bc..5f167ece1a2 100644 |
141 |
+--- a/src/test/run-make-fulldeps/long-linker-command-lines/Makefile |
142 |
++++ b/src/test/run-make-fulldeps/long-linker-command-lines/Makefile |
143 |
+@@ -1,3 +1,5 @@ |
144 |
++# ignore-test |
145 |
++ |
146 |
+ -include ../tools.mk |
147 |
+ |
148 |
+ all: |
149 |
+diff --git a/src/test/run-make-fulldeps/sysroot-crates-are-unstable/Makefile b/src/test/run-make-fulldeps/sysroot-crates-are-unstable/Makefile |
150 |
+index 9e770706857..6d92ec5cec8 100644 |
151 |
+--- a/src/test/run-make-fulldeps/sysroot-crates-are-unstable/Makefile |
152 |
++++ b/src/test/run-make-fulldeps/sysroot-crates-are-unstable/Makefile |
153 |
+@@ -1,1 +1,3 @@ |
154 |
++# ignore-test |
155 |
++ |
156 |
+ all: |
157 |
+ python2.7 test.py |
158 |
+diff --git a/src/test/ui/env-funky-keys.rs b/src/test/ui/env-funky-keys.rs |
159 |
+index c5c824ac58d..f3fe047a79c 100644 |
160 |
+--- a/src/test/ui/env-funky-keys.rs |
161 |
++++ b/src/test/ui/env-funky-keys.rs |
162 |
+@@ -1,6 +1,7 @@ |
163 |
+ // run-pass |
164 |
+ // Ignore this test on Android, because it segfaults there. |
165 |
+ |
166 |
++// ignore-test |
167 |
+ // ignore-android |
168 |
+ // ignore-windows |
169 |
+ // ignore-cloudabi no execve |
170 |
+-- |
171 |
+2.24.1 |
172 |
+ |
173 |
|
174 |
diff --git a/dev-lang/rust/files/gentoo-musl-target-specs.patch b/dev-lang/rust/files/gentoo-musl-target-specs.patch |
175 |
new file mode 100644 |
176 |
index 00000000000..0661a26841b |
177 |
--- /dev/null |
178 |
+++ b/dev-lang/rust/files/gentoo-musl-target-specs.patch |
179 |
@@ -0,0 +1,168 @@ |
180 |
+From 9fb44efd4a6270443ca2a06a098c83cf9820cc8b Mon Sep 17 00:00:00 2001 |
181 |
+From: Georgy Yakovlev <gyakovlev@g.o> |
182 |
+Date: Thu, 8 Oct 2020 22:38:54 -0700 |
183 |
+Subject: [PATCH] add gentoo musl target specs |
184 |
+ |
185 |
+Directly based on patch by Samuel Holland <samuel@××××××××.org> |
186 |
+Found at: https://github.com/smaeul/portage-overlay/blob/master/dev-lang/rust/files/ |
187 |
+ |
188 |
+Signed-off-by: Georgy Yakovlev <gyakovlev@g.o> |
189 |
+--- |
190 |
+ src/librustc_target/spec/aarch64_gentoo_linux_musl.rs | 11 +++++++++++ |
191 |
+ .../spec/armv7_gentoo_linux_musleabihf.rs | 11 +++++++++++ |
192 |
+ src/librustc_target/spec/i686_gentoo_linux_musl.rs | 11 +++++++++++ |
193 |
+ src/librustc_target/spec/mod.rs | 8 ++++++++ |
194 |
+ .../spec/powerpc64_gentoo_linux_musl.rs | 11 +++++++++++ |
195 |
+ .../spec/powerpc64le_gentoo_linux_musl.rs | 11 +++++++++++ |
196 |
+ src/librustc_target/spec/powerpc_gentoo_linux_musl.rs | 11 +++++++++++ |
197 |
+ src/librustc_target/spec/x86_64_gentoo_linux_musl.rs | 11 +++++++++++ |
198 |
+ 8 files changed, 85 insertions(+) |
199 |
+ create mode 100644 src/librustc_target/spec/aarch64_gentoo_linux_musl.rs |
200 |
+ create mode 100644 src/librustc_target/spec/armv7_gentoo_linux_musleabihf.rs |
201 |
+ create mode 100644 src/librustc_target/spec/i686_gentoo_linux_musl.rs |
202 |
+ create mode 100644 src/librustc_target/spec/powerpc64_gentoo_linux_musl.rs |
203 |
+ create mode 100644 src/librustc_target/spec/powerpc64le_gentoo_linux_musl.rs |
204 |
+ create mode 100644 src/librustc_target/spec/powerpc_gentoo_linux_musl.rs |
205 |
+ create mode 100644 src/librustc_target/spec/x86_64_gentoo_linux_musl.rs |
206 |
+ |
207 |
+diff --git a/src/librustc_target/spec/aarch64_gentoo_linux_musl.rs b/src/librustc_target/spec/aarch64_gentoo_linux_musl.rs |
208 |
+new file mode 100644 |
209 |
+index 0000000..420fe7c |
210 |
+--- /dev/null |
211 |
++++ b/src/librustc_target/spec/aarch64_gentoo_linux_musl.rs |
212 |
+@@ -0,0 +1,11 @@ |
213 |
++use crate::spec::TargetResult; |
214 |
++ |
215 |
++pub fn target() -> TargetResult { |
216 |
++ let mut base = super::aarch64_unknown_linux_musl::target()?; |
217 |
++ |
218 |
++ base.llvm_target = "aarch64-gentoo-linux-musl".to_string(); |
219 |
++ base.target_vendor = "gentoo".to_string(); |
220 |
++ base.options.crt_static_default = false; |
221 |
++ |
222 |
++ Ok(base) |
223 |
++} |
224 |
+diff --git a/src/librustc_target/spec/armv7_gentoo_linux_musleabihf.rs b/src/librustc_target/spec/armv7_gentoo_linux_musleabihf.rs |
225 |
+new file mode 100644 |
226 |
+index 0000000..067e2d6 |
227 |
+--- /dev/null |
228 |
++++ b/src/librustc_target/spec/armv7_gentoo_linux_musleabihf.rs |
229 |
+@@ -0,0 +1,11 @@ |
230 |
++use crate::spec::TargetResult; |
231 |
++ |
232 |
++pub fn target() -> TargetResult { |
233 |
++ let mut base = super::armv7_unknown_linux_musleabihf::target()?; |
234 |
++ |
235 |
++ base.llvm_target = "armv7-gentoo-linux-musleabihf".to_string(); |
236 |
++ base.target_vendor = "gentoo".to_string(); |
237 |
++ base.options.crt_static_default = false; |
238 |
++ |
239 |
++ Ok(base) |
240 |
++} |
241 |
+diff --git a/src/librustc_target/spec/i686_gentoo_linux_musl.rs b/src/librustc_target/spec/i686_gentoo_linux_musl.rs |
242 |
+new file mode 100644 |
243 |
+index 0000000..1cd39cd |
244 |
+--- /dev/null |
245 |
++++ b/src/librustc_target/spec/i686_gentoo_linux_musl.rs |
246 |
+@@ -0,0 +1,11 @@ |
247 |
++use crate::spec::TargetResult; |
248 |
++ |
249 |
++pub fn target() -> TargetResult { |
250 |
++ let mut base = super::i686_unknown_linux_musl::target()?; |
251 |
++ |
252 |
++ base.llvm_target = "i686-gentoo-linux-musl".to_string(); |
253 |
++ base.target_vendor = "gentoo".to_string(); |
254 |
++ base.options.crt_static_default = false; |
255 |
++ |
256 |
++ Ok(base) |
257 |
++} |
258 |
+diff --git a/src/librustc_target/spec/mod.rs b/src/librustc_target/spec/mod.rs |
259 |
+index fa29ff3..a685600 100644 |
260 |
+--- a/src/librustc_target/spec/mod.rs |
261 |
++++ b/src/librustc_target/spec/mod.rs |
262 |
+@@ -490,6 +490,14 @@ macro_rules! supported_targets { |
263 |
+ } |
264 |
+ |
265 |
+ supported_targets! { |
266 |
++ ("aarch64-gentoo-linux-musl", aarch64_gentoo_linux_musl), |
267 |
++ ("armv7-gentoo-linux-musleabihf", armv7_gentoo_linux_musleabihf), |
268 |
++ ("i686-gentoo-linux-musl", i686_gentoo_linux_musl), |
269 |
++ ("powerpc-gentoo-linux-musl", powerpc_gentoo_linux_musl), |
270 |
++ ("powerpc64-gentoo-linux-musl", powerpc64_gentoo_linux_musl), |
271 |
++ ("powerpc64le-gentoo-linux-musl", powerpc64le_gentoo_linux_musl), |
272 |
++ ("x86_64-gentoo-linux-musl", x86_64_gentoo_linux_musl), |
273 |
++ |
274 |
+ ("x86_64-unknown-linux-gnu", x86_64_unknown_linux_gnu), |
275 |
+ ("x86_64-unknown-linux-gnux32", x86_64_unknown_linux_gnux32), |
276 |
+ ("i686-unknown-linux-gnu", i686_unknown_linux_gnu), |
277 |
+diff --git a/src/librustc_target/spec/powerpc64_gentoo_linux_musl.rs b/src/librustc_target/spec/powerpc64_gentoo_linux_musl.rs |
278 |
+new file mode 100644 |
279 |
+index 0000000..e840bb2 |
280 |
+--- /dev/null |
281 |
++++ b/src/librustc_target/spec/powerpc64_gentoo_linux_musl.rs |
282 |
+@@ -0,0 +1,11 @@ |
283 |
++use crate::spec::TargetResult; |
284 |
++ |
285 |
++pub fn target() -> TargetResult { |
286 |
++ let mut base = super::powerpc64_unknown_linux_musl::target()?; |
287 |
++ |
288 |
++ base.llvm_target = "powerpc64-gentoo-linux-musl".to_string(); |
289 |
++ base.target_vendor = "gentoo".to_string(); |
290 |
++ base.options.crt_static_default = false; |
291 |
++ |
292 |
++ Ok(base) |
293 |
++} |
294 |
+diff --git a/src/librustc_target/spec/powerpc64le_gentoo_linux_musl.rs b/src/librustc_target/spec/powerpc64le_gentoo_linux_musl.rs |
295 |
+new file mode 100644 |
296 |
+index 0000000..1037d82 |
297 |
+--- /dev/null |
298 |
++++ b/src/librustc_target/spec/powerpc64le_gentoo_linux_musl.rs |
299 |
+@@ -0,0 +1,11 @@ |
300 |
++use crate::spec::TargetResult; |
301 |
++ |
302 |
++pub fn target() -> TargetResult { |
303 |
++ let mut base = super::powerpc64le_unknown_linux_musl::target()?; |
304 |
++ |
305 |
++ base.llvm_target = "powerpc64le-gentoo-linux-musl".to_string(); |
306 |
++ base.target_vendor = "gentoo".to_string(); |
307 |
++ base.options.crt_static_default = false; |
308 |
++ |
309 |
++ Ok(base) |
310 |
++} |
311 |
+diff --git a/src/librustc_target/spec/powerpc_gentoo_linux_musl.rs b/src/librustc_target/spec/powerpc_gentoo_linux_musl.rs |
312 |
+new file mode 100644 |
313 |
+index 0000000..a623ffe |
314 |
+--- /dev/null |
315 |
++++ b/src/librustc_target/spec/powerpc_gentoo_linux_musl.rs |
316 |
+@@ -0,0 +1,11 @@ |
317 |
++use crate::spec::TargetResult; |
318 |
++ |
319 |
++pub fn target() -> TargetResult { |
320 |
++ let mut base = super::powerpc_unknown_linux_musl::target()?; |
321 |
++ |
322 |
++ base.llvm_target = "powerpc-gentoo-linux-musl".to_string(); |
323 |
++ base.target_vendor = "gentoo".to_string(); |
324 |
++ base.options.crt_static_default = false; |
325 |
++ |
326 |
++ Ok(base) |
327 |
++} |
328 |
+diff --git a/src/librustc_target/spec/x86_64_gentoo_linux_musl.rs b/src/librustc_target/spec/x86_64_gentoo_linux_musl.rs |
329 |
+new file mode 100644 |
330 |
+index 0000000..f330473 |
331 |
+--- /dev/null |
332 |
++++ b/src/librustc_target/spec/x86_64_gentoo_linux_musl.rs |
333 |
+@@ -0,0 +1,11 @@ |
334 |
++use crate::spec::TargetResult; |
335 |
++ |
336 |
++pub fn target() -> TargetResult { |
337 |
++ let mut base = super::x86_64_unknown_linux_musl::target()?; |
338 |
++ |
339 |
++ base.llvm_target = "x86_64-gentoo-linux-musl".to_string(); |
340 |
++ base.target_vendor = "gentoo".to_string(); |
341 |
++ base.options.crt_static_default = false; |
342 |
++ |
343 |
++ Ok(base) |
344 |
++} |
345 |
+-- |
346 |
+2.28.0 |
347 |
+ |
348 |
|
349 |
diff --git a/dev-lang/rust/rust-1.47.0.ebuild b/dev-lang/rust/rust-1.47.0.ebuild |
350 |
new file mode 100644 |
351 |
index 00000000000..bc0dd9a95b4 |
352 |
--- /dev/null |
353 |
+++ b/dev-lang/rust/rust-1.47.0.ebuild |
354 |
@@ -0,0 +1,582 @@ |
355 |
+# Copyright 1999-2020 Gentoo Authors |
356 |
+# Distributed under the terms of the GNU General Public License v2 |
357 |
+ |
358 |
+EAPI=7 |
359 |
+ |
360 |
+PYTHON_COMPAT=( python3_{6..9} ) |
361 |
+ |
362 |
+inherit bash-completion-r1 check-reqs estack flag-o-matic llvm multiprocessing multilib-build python-any-r1 rust-toolchain toolchain-funcs |
363 |
+ |
364 |
+if [[ ${PV} = *beta* ]]; then |
365 |
+ betaver=${PV//*beta} |
366 |
+ BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}" |
367 |
+ MY_P="rustc-beta" |
368 |
+ SLOT="beta/${PV}" |
369 |
+ SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.xz" |
370 |
+else |
371 |
+ ABI_VER="$(ver_cut 1-2)" |
372 |
+ SLOT="stable/${ABI_VER}" |
373 |
+ MY_P="rustc-${PV}" |
374 |
+ SRC="${MY_P}-src.tar.xz" |
375 |
+ KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86" |
376 |
+fi |
377 |
+ |
378 |
+RUST_STAGE0_VERSION="1.$(($(ver_cut 2) - 1)).0" |
379 |
+ |
380 |
+DESCRIPTION="Systems programming language from Mozilla" |
381 |
+HOMEPAGE="https://www.rust-lang.org/" |
382 |
+ |
383 |
+SRC_URI=" |
384 |
+ https://static.rust-lang.org/dist/${SRC} -> rustc-${PV}-src.tar.xz |
385 |
+ !system-bootstrap? ( $(rust_all_arch_uris rust-${RUST_STAGE0_VERSION}) ) |
386 |
+" |
387 |
+ |
388 |
+# keep in sync with llvm ebuild of the same version as bundled one. |
389 |
+ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM AVR BPF Hexagon Lanai Mips MSP430 |
390 |
+ NVPTX PowerPC RISCV Sparc SystemZ WebAssembly X86 XCore ) |
391 |
+ALL_LLVM_TARGETS=( "${ALL_LLVM_TARGETS[@]/#/llvm_targets_}" ) |
392 |
+LLVM_TARGET_USEDEPS=${ALL_LLVM_TARGETS[@]/%/?} |
393 |
+ |
394 |
+LICENSE="|| ( MIT Apache-2.0 ) BSD-1 BSD-2 BSD-4 UoI-NCSA" |
395 |
+ |
396 |
+IUSE="clippy cpu_flags_x86_sse2 debug doc libressl miri nightly parallel-compiler rls rustfmt +system-bootstrap system-llvm test wasm ${ALL_LLVM_TARGETS[*]}" |
397 |
+ |
398 |
+# Please keep the LLVM dependency block separate. Since LLVM is slotted, |
399 |
+# we need to *really* make sure we're not pulling more than one slot |
400 |
+# simultaneously. |
401 |
+ |
402 |
+# How to use it: |
403 |
+# 1. List all the working slots (with min versions) in ||, newest first. |
404 |
+# 2. Update the := to specify *max* version, e.g. < 12. |
405 |
+# 3. Specify LLVM_MAX_SLOT, e.g. 11. |
406 |
+LLVM_DEPEND=" |
407 |
+ || ( |
408 |
+ sys-devel/llvm:11[${LLVM_TARGET_USEDEPS// /,}] |
409 |
+ sys-devel/llvm:10[${LLVM_TARGET_USEDEPS// /,}] |
410 |
+ ) |
411 |
+ <sys-devel/llvm-12:= |
412 |
+ wasm? ( sys-devel/lld ) |
413 |
+" |
414 |
+LLVM_MAX_SLOT=11 |
415 |
+ |
416 |
+BOOTSTRAP_DEPEND="|| ( >=dev-lang/rust-1.$(($(ver_cut 2) - 1)) >=dev-lang/rust-bin-1.$(($(ver_cut 2) - 1)) )" |
417 |
+ |
418 |
+BDEPEND="${PYTHON_DEPS} |
419 |
+ app-eselect/eselect-rust |
420 |
+ || ( |
421 |
+ >=sys-devel/gcc-4.7 |
422 |
+ >=sys-devel/clang-3.5 |
423 |
+ ) |
424 |
+ system-bootstrap? ( ${BOOTSTRAP_DEPEND} ) |
425 |
+ !system-llvm? ( |
426 |
+ dev-util/cmake |
427 |
+ dev-util/ninja |
428 |
+ ) |
429 |
+" |
430 |
+ |
431 |
+# libgit2 should be at least same as bundled into libgit-sys #707746 |
432 |
+DEPEND=" |
433 |
+ >=dev-libs/libgit2-0.99:= |
434 |
+ net-libs/libssh2:= |
435 |
+ net-libs/http-parser:= |
436 |
+ net-misc/curl:=[http2,ssl] |
437 |
+ sys-libs/zlib:= |
438 |
+ !libressl? ( dev-libs/openssl:0= ) |
439 |
+ libressl? ( dev-libs/libressl:0= ) |
440 |
+ elibc_musl? ( sys-libs/libunwind:= ) |
441 |
+ system-llvm? ( |
442 |
+ ${LLVM_DEPEND} |
443 |
+ ) |
444 |
+" |
445 |
+ |
446 |
+RDEPEND="${DEPEND} |
447 |
+ app-eselect/eselect-rust |
448 |
+" |
449 |
+ |
450 |
+REQUIRED_USE="|| ( ${ALL_LLVM_TARGETS[*]} ) |
451 |
+ miri? ( nightly ) |
452 |
+ parallel-compiler? ( nightly ) |
453 |
+ test? ( ${ALL_LLVM_TARGETS[*]} ) |
454 |
+ wasm? ( llvm_targets_WebAssembly ) |
455 |
+ x86? ( cpu_flags_x86_sse2 ) |
456 |
+" |
457 |
+ |
458 |
+# we don't use cmake.eclass, but can get a warnings |
459 |
+CMAKE_WARN_UNUSED_CLI=no |
460 |
+ |
461 |
+QA_FLAGS_IGNORED=" |
462 |
+ usr/lib/${PN}/${PV}/bin/.* |
463 |
+ usr/lib/${PN}/${PV}/lib/lib.*.so |
464 |
+ usr/lib/${PN}/${PV}/lib/rustlib/.*/bin/.* |
465 |
+ usr/lib/${PN}/${PV}/lib/rustlib/.*/lib/lib.*.so |
466 |
+" |
467 |
+ |
468 |
+QA_SONAME=" |
469 |
+ usr/lib/${PN}/${PV}/lib/lib.*.so.* |
470 |
+ usr/lib/${PN}/${PV}/lib/rustlib/.*/lib/lib.*.so |
471 |
+" |
472 |
+ |
473 |
+# causes double bootstrap |
474 |
+RESTRICT="test" |
475 |
+ |
476 |
+PATCHES=( |
477 |
+ "${FILESDIR}"/1.46.0-don-t-create-prefix-at-time-of-check.patch |
478 |
+ "${FILESDIR}"/1.47.0-ignore-broken-and-non-applicable-tests.patch |
479 |
+ "${FILESDIR}"/gentoo-musl-target-specs.patch |
480 |
+) |
481 |
+ |
482 |
+S="${WORKDIR}/${MY_P}-src" |
483 |
+ |
484 |
+toml_usex() { |
485 |
+ usex "$1" true false |
486 |
+} |
487 |
+ |
488 |
+boostrap_rust_version_check() { |
489 |
+ # never call from pkg_pretend. eselect-rust may be not installed yet. |
490 |
+ local rustc_wanted="$(ver_cut 1).$(($(ver_cut 2) - 1))" |
491 |
+ local rustc_version=( $(eselect --brief rust show 2>/dev/null) ) |
492 |
+ rustc_version=${rustc_version[0]#rust-bin-} |
493 |
+ rustc_version=${rustc_version#rust-} |
494 |
+ |
495 |
+ [[ -z "${rustc_version}" ]] && die "Failed to determine rustc version!" |
496 |
+ |
497 |
+ if ver_test "${rustc_version}" -lt "${rustc_wanted}" ; then |
498 |
+ eerror "Rust >=${rustc_wanted} is required" |
499 |
+ eerror "please run \'eselect rust\' and set correct rust version" |
500 |
+ die |
501 |
+ else |
502 |
+ einfo "Using rust ${rustc_version} to build" |
503 |
+ fi |
504 |
+} |
505 |
+ |
506 |
+pre_build_checks() { |
507 |
+ local M=6144 |
508 |
+ M=$(( $(usex clippy 128 0) + ${M} )) |
509 |
+ M=$(( $(usex miri 128 0) + ${M} )) |
510 |
+ M=$(( $(usex rls 512 0) + ${M} )) |
511 |
+ M=$(( $(usex rustfmt 256 0) + ${M} )) |
512 |
+ M=$(( $(usex system-llvm 0 2048) + ${M} )) |
513 |
+ M=$(( $(usex wasm 256 0) + ${M} )) |
514 |
+ M=$(( $(usex debug 15 10) * ${M} / 10 )) |
515 |
+ eshopts_push -s extglob |
516 |
+ if is-flagq '-g?(gdb)?([1-9])'; then |
517 |
+ M=$(( 15 * ${M} / 10 )) |
518 |
+ fi |
519 |
+ eshopts_pop |
520 |
+ M=$(( $(usex system-bootstrap 0 1024) + ${M} )) |
521 |
+ M=$(( $(usex doc 256 0) + ${M} )) |
522 |
+ CHECKREQS_DISK_BUILD=${M}M check-reqs_pkg_${EBUILD_PHASE} |
523 |
+} |
524 |
+ |
525 |
+pkg_pretend() { |
526 |
+ pre_build_checks |
527 |
+} |
528 |
+ |
529 |
+pkg_setup() { |
530 |
+ pre_build_checks |
531 |
+ python-any-r1_pkg_setup |
532 |
+ use system-bootstrap && boostrap_rust_version_check |
533 |
+ |
534 |
+ # required to link agains system libs, otherwise |
535 |
+ # crates use bundled sources and compile own static version |
536 |
+ export LIBGIT2_SYS_USE_PKG_CONFIG=1 |
537 |
+ export LIBSSH2_SYS_USE_PKG_CONFIG=1 |
538 |
+ export PKG_CONFIG_ALLOW_CROSS=1 |
539 |
+ |
540 |
+ if use system-llvm; then |
541 |
+ llvm_pkg_setup |
542 |
+ |
543 |
+ local llvm_config="$(get_llvm_prefix "$LLVM_MAX_SLOT")/bin/llvm-config" |
544 |
+ |
545 |
+ export LLVM_LINK_SHARED=1 |
546 |
+ export RUSTFLAGS="${RUSTFLAGS} -Lnative=$("${llvm_config}" --libdir)" |
547 |
+ fi |
548 |
+} |
549 |
+ |
550 |
+src_prepare() { |
551 |
+ if ! use system-bootstrap; then |
552 |
+ local rust_stage0_root="${WORKDIR}"/rust-stage0 |
553 |
+ local rust_stage0="rust-${RUST_STAGE0_VERSION}-$(rust_abi)" |
554 |
+ |
555 |
+ "${WORKDIR}/${rust_stage0}"/install.sh --disable-ldconfig \ |
556 |
+ --destdir="${rust_stage0_root}" --prefix=/ || die |
557 |
+ fi |
558 |
+ |
559 |
+ default |
560 |
+} |
561 |
+ |
562 |
+src_configure() { |
563 |
+ local rust_target="" rust_targets="" arch_cflags |
564 |
+ |
565 |
+ # Collect rust target names to compile standard libs for all ABIs. |
566 |
+ for v in $(multilib_get_enabled_abi_pairs); do |
567 |
+ rust_targets="${rust_targets},\"$(rust_abi $(get_abi_CHOST ${v##*.}))\"" |
568 |
+ done |
569 |
+ if use wasm; then |
570 |
+ rust_targets="${rust_targets},\"wasm32-unknown-unknown\"" |
571 |
+ if use system-llvm; then |
572 |
+ # un-hardcode rust-lld linker for this target |
573 |
+ # https://bugs.gentoo.org/715348 |
574 |
+ sed -i '/linker:/ s/rust-lld/wasm-ld/' src/librustc_target/spec/wasm32_base.rs || die |
575 |
+ fi |
576 |
+ fi |
577 |
+ rust_targets="${rust_targets#,}" |
578 |
+ |
579 |
+ local tools="\"cargo\"," |
580 |
+ if use clippy; then |
581 |
+ tools="\"clippy\",$tools" |
582 |
+ fi |
583 |
+ if use miri; then |
584 |
+ tools="\"miri\",$tools" |
585 |
+ fi |
586 |
+ if use rls; then |
587 |
+ tools="\"rls\",\"analysis\",\"src\",$tools" |
588 |
+ fi |
589 |
+ if use rustfmt; then |
590 |
+ tools="\"rustfmt\",$tools" |
591 |
+ fi |
592 |
+ |
593 |
+ local rust_stage0_root |
594 |
+ if use system-bootstrap; then |
595 |
+ rust_stage0_root="$(rustc --print sysroot)" |
596 |
+ else |
597 |
+ rust_stage0_root="${WORKDIR}"/rust-stage0 |
598 |
+ fi |
599 |
+ |
600 |
+ rust_target="$(rust_abi)" |
601 |
+ |
602 |
+ cat <<- EOF > "${S}"/config.toml |
603 |
+ [llvm] |
604 |
+ optimize = $(toml_usex !debug) |
605 |
+ release-debuginfo = $(toml_usex debug) |
606 |
+ assertions = $(toml_usex debug) |
607 |
+ ninja = true |
608 |
+ targets = "${LLVM_TARGETS// /;}" |
609 |
+ experimental-targets = "" |
610 |
+ link-shared = $(toml_usex system-llvm) |
611 |
+ [build] |
612 |
+ build = "${rust_target}" |
613 |
+ host = ["${rust_target}"] |
614 |
+ target = [${rust_targets}] |
615 |
+ cargo = "${rust_stage0_root}/bin/cargo" |
616 |
+ rustc = "${rust_stage0_root}/bin/rustc" |
617 |
+ docs = $(toml_usex doc) |
618 |
+ compiler-docs = $(toml_usex doc) |
619 |
+ submodules = false |
620 |
+ python = "${EPYTHON}" |
621 |
+ locked-deps = true |
622 |
+ vendor = true |
623 |
+ extended = true |
624 |
+ tools = [${tools}] |
625 |
+ verbose = 2 |
626 |
+ sanitizers = false |
627 |
+ profiler = false |
628 |
+ cargo-native-static = false |
629 |
+ [install] |
630 |
+ prefix = "${EPREFIX}/usr/lib/${PN}/${PV}" |
631 |
+ sysconfdir = "etc" |
632 |
+ docdir = "share/doc/rust" |
633 |
+ bindir = "bin" |
634 |
+ libdir = "lib" |
635 |
+ mandir = "share/man" |
636 |
+ [rust] |
637 |
+ # https://github.com/rust-lang/rust/issues/54872 |
638 |
+ codegen-units-std = 1 |
639 |
+ optimize = true |
640 |
+ debug = $(toml_usex debug) |
641 |
+ debug-assertions = $(toml_usex debug) |
642 |
+ debuginfo-level-rustc = 0 |
643 |
+ backtrace = true |
644 |
+ incremental = false |
645 |
+ default-linker = "$(tc-getCC)" |
646 |
+ parallel-compiler = $(toml_usex parallel-compiler) |
647 |
+ channel = "$(usex nightly nightly stable)" |
648 |
+ rpath = false |
649 |
+ verbose-tests = true |
650 |
+ optimize-tests = $(toml_usex !debug) |
651 |
+ codegen-tests = true |
652 |
+ dist-src = false |
653 |
+ remap-debuginfo = true |
654 |
+ lld = $(usex system-llvm false $(toml_usex wasm)) |
655 |
+ backtrace-on-ice = true |
656 |
+ jemalloc = false |
657 |
+ [dist] |
658 |
+ src-tarball = false |
659 |
+ EOF |
660 |
+ |
661 |
+ for v in $(multilib_get_enabled_abi_pairs); do |
662 |
+ rust_target=$(rust_abi $(get_abi_CHOST ${v##*.})) |
663 |
+ arch_cflags="$(get_abi_CFLAGS ${v##*.})" |
664 |
+ |
665 |
+ cat <<- EOF >> "${S}"/config.env |
666 |
+ CFLAGS_${rust_target}=${arch_cflags} |
667 |
+ EOF |
668 |
+ |
669 |
+ cat <<- EOF >> "${S}"/config.toml |
670 |
+ [target.${rust_target}] |
671 |
+ cc = "$(tc-getBUILD_CC)" |
672 |
+ cxx = "$(tc-getBUILD_CXX)" |
673 |
+ linker = "$(tc-getCC)" |
674 |
+ ar = "$(tc-getAR)" |
675 |
+ EOF |
676 |
+ # librustc_target/spec/linux_musl_base.rs sets base.crt_static_default = true; |
677 |
+ if use elibc_musl; then |
678 |
+ cat <<- EOF >> "${S}"/config.toml |
679 |
+ crt-static = false |
680 |
+ EOF |
681 |
+ fi |
682 |
+ if use system-llvm; then |
683 |
+ cat <<- EOF >> "${S}"/config.toml |
684 |
+ llvm-config = "$(get_llvm_prefix "${LLVM_MAX_SLOT}")/bin/llvm-config" |
685 |
+ EOF |
686 |
+ fi |
687 |
+ done |
688 |
+ if use wasm; then |
689 |
+ cat <<- EOF >> "${S}"/config.toml |
690 |
+ [target.wasm32-unknown-unknown] |
691 |
+ linker = "$(usex system-llvm lld rust-lld)" |
692 |
+ EOF |
693 |
+ fi |
694 |
+ |
695 |
+ if [[ -n ${I_KNOW_WHAT_I_AM_DOING_CROSS} ]]; then # whitespace intentionally shifted below |
696 |
+ # experimental cross support |
697 |
+ # discussion: https://bugs.gentoo.org/679878 |
698 |
+ # TODO: c*flags, clang, system-llvm, cargo.eclass target support |
699 |
+ # it would be much better if we could split out stdlib |
700 |
+ # complilation to separate ebuild and abuse CATEGORY to |
701 |
+ # just install to /usr/lib/rustlib/<target> |
702 |
+ |
703 |
+ # extra targets defined as a bash array |
704 |
+ # spec format: <LLVM target>:<rust-target>:<CTARGET> |
705 |
+ # best place would be /etc/portage/env/dev-lang/rust |
706 |
+ # Example: |
707 |
+ # RUST_CROSS_TARGETS=( |
708 |
+ # "AArch64:aarch64-unknown-linux-gnu:aarch64-unknown-linux-gnu" |
709 |
+ # ) |
710 |
+ # no extra hand holding is done, no target transformations, all |
711 |
+ # values are passed as-is with just basic checks, so it's up to user to supply correct values |
712 |
+ # valid rust targets can be obtained with |
713 |
+ # rustc --print target-list |
714 |
+ # matching cross toolchain has to be installed |
715 |
+ # matching LLVM_TARGET has to be enabled for both rust and llvm (if using system one) |
716 |
+ # only gcc toolchains installed with crossdev are checked for now. |
717 |
+ |
718 |
+ # BUG: we can't pass host flags to cross compiler, so just filter for now |
719 |
+ # BUG: this should be more fine-grained. |
720 |
+ filter-flags '-mcpu=*' '-march=*' '-mtune=*' |
721 |
+ |
722 |
+ local cross_target_spec |
723 |
+ for cross_target_spec in "${RUST_CROSS_TARGETS[@]}";do |
724 |
+ # extracts first element form <LLVM target>:<rust-target>:<CTARGET> |
725 |
+ local cross_llvm_target="${cross_target_spec%%:*}" |
726 |
+ # extracts toolchain triples, <rust-target>:<CTARGET> |
727 |
+ local cross_triples="${cross_target_spec#*:}" |
728 |
+ # extracts first element after before : separator |
729 |
+ local cross_rust_target="${cross_triples%%:*}" |
730 |
+ # extracts last element after : separator |
731 |
+ local cross_toolchain="${cross_triples##*:}" |
732 |
+ use llvm_targets_${cross_llvm_target} || die "need llvm_targets_${cross_llvm_target} target enabled" |
733 |
+ command -v ${cross_toolchain}-gcc > /dev/null 2>&1 || die "need ${cross_toolchain} cross toolchain" |
734 |
+ |
735 |
+ cat <<- EOF >> "${S}"/config.toml |
736 |
+ [target.${cross_rust_target}] |
737 |
+ cc = "${cross_toolchain}-gcc" |
738 |
+ cxx = "${cross_toolchain}-g++" |
739 |
+ linker = "${cross_toolchain}-gcc" |
740 |
+ ar = "${cross_toolchain}-ar" |
741 |
+ EOF |
742 |
+ if use system-llvm; then |
743 |
+ cat <<- EOF >> "${S}"/config.toml |
744 |
+ llvm-config = "$(get_llvm_prefix "${LLVM_MAX_SLOT}")/bin/llvm-config" |
745 |
+ EOF |
746 |
+ fi |
747 |
+ |
748 |
+ # append cross target to "normal" target list |
749 |
+ # example 'target = ["powerpc64le-unknown-linux-gnu"]' |
750 |
+ # becomes 'target = ["powerpc64le-unknown-linux-gnu","aarch64-unknown-linux-gnu"]' |
751 |
+ |
752 |
+ rust_targets="${rust_targets},\"${cross_rust_target}\"" |
753 |
+ sed -i "/^target = \[/ s#\[.*\]#\[${rust_targets}\]#" config.toml || die |
754 |
+ |
755 |
+ ewarn |
756 |
+ ewarn "Enabled ${cross_rust_target} rust target" |
757 |
+ ewarn "Using ${cross_toolchain} cross toolchain" |
758 |
+ ewarn |
759 |
+ if ! has_version -b 'sys-devel/binutils[multitarget]' ; then |
760 |
+ ewarn "'sys-devel/binutils[multitarget]' is not installed" |
761 |
+ ewarn "'strip' will be unable to strip cross libraries" |
762 |
+ ewarn "cross targets will be installed with full debug information" |
763 |
+ ewarn "enable 'multitarget' USE flag for binutils to be able to strip object files" |
764 |
+ ewarn |
765 |
+ ewarn "Alternatively llvm-strip can be used, it supports stripping any target" |
766 |
+ ewarn "define STRIP=\"llvm-strip\" to use it (experimental)" |
767 |
+ ewarn |
768 |
+ fi |
769 |
+ done |
770 |
+ fi # I_KNOW_WHAT_I_AM_DOING_CROSS |
771 |
+ |
772 |
+ einfo "Rust configured with the following settings:" |
773 |
+ cat "${S}"/config.toml || die |
774 |
+} |
775 |
+ |
776 |
+src_compile() { |
777 |
+ # we need \n IFS to have config.env with spaces loaded properly. #734018 |
778 |
+ ( |
779 |
+ IFS=$'\n' |
780 |
+ env $(cat "${S}"/config.env) RUST_BACKTRACE=1\ |
781 |
+ "${EPYTHON}" ./x.py build -vv --config="${S}"/config.toml -j$(makeopts_jobs) || die |
782 |
+ ) |
783 |
+} |
784 |
+ |
785 |
+src_test() { |
786 |
+ # https://rustc-dev-guide.rust-lang.org/tests/intro.html |
787 |
+ |
788 |
+ # those are basic and codegen tests. |
789 |
+ local tests=( |
790 |
+ codegen |
791 |
+ codegen-units |
792 |
+ compile-fail |
793 |
+ incremental |
794 |
+ mir-opt |
795 |
+ pretty |
796 |
+ run-make |
797 |
+ ) |
798 |
+ |
799 |
+ # fails if llvm is not built with ALL targets. |
800 |
+ # and known to fail with system llvm sometimes. |
801 |
+ use system-llvm || tests+=( assembly ) |
802 |
+ |
803 |
+ # fragile/expensive/less important tests |
804 |
+ # or tests that require extra builds |
805 |
+ # TODO: instead of skipping, just make some nonfatal. |
806 |
+ if [[ ${ERUST_RUN_EXTRA_TESTS:-no} != no ]]; then |
807 |
+ tests+=( |
808 |
+ rustdoc |
809 |
+ rustdoc-js |
810 |
+ rustdoc-js-std |
811 |
+ rustdoc-ui |
812 |
+ run-make-fulldeps |
813 |
+ ui |
814 |
+ ui-fulldeps |
815 |
+ ) |
816 |
+ fi |
817 |
+ |
818 |
+ local i failed=() |
819 |
+ einfo "rust_src_test: enabled tests ${tests[@]/#/src/test/}" |
820 |
+ for i in "${tests[@]}"; do |
821 |
+ local t="src/test/${i}" |
822 |
+ einfo "rust_src_test: running ${t}" |
823 |
+ if ! ( |
824 |
+ IFS=$'\n' |
825 |
+ env $(cat "${S}"/config.env) RUST_BACKTRACE=1 \ |
826 |
+ "${EPYTHON}" ./x.py test -vv --config="${S}"/config.toml \ |
827 |
+ -j$(makeopts_jobs) --no-doc --no-fail-fast "${t}" |
828 |
+ ) |
829 |
+ then |
830 |
+ failed+=( "${t}" ) |
831 |
+ eerror "rust_src_test: ${t} failed" |
832 |
+ fi |
833 |
+ done |
834 |
+ |
835 |
+ if [[ ${#failed[@]} -ne 0 ]]; then |
836 |
+ eerror "rust_src_test: failure summary: ${failed[@]}" |
837 |
+ die "aborting due to test failures" |
838 |
+ fi |
839 |
+} |
840 |
+ |
841 |
+src_install() { |
842 |
+ # https://github.com/rust-lang/rust/issues/77721 |
843 |
+ # also 1.46.0-don-t-create-prefix-at-time-of-check.patch |
844 |
+ dodir "/usr/lib/${PN}/${PV}" |
845 |
+ ( |
846 |
+ IFS=$'\n' |
847 |
+ env $(cat "${S}"/config.env) DESTDIR="${D}" \ |
848 |
+ "${EPYTHON}" ./x.py install -vv --config="${S}"/config.toml || die |
849 |
+ ) |
850 |
+ |
851 |
+ # bug #689562, #689160 |
852 |
+ rm -v "${D}/usr/lib/${PN}/${PV}/etc/bash_completion.d/cargo" || die |
853 |
+ rmdir -v "${D}/usr/lib/${PN}/${PV}"/etc{/bash_completion.d,} || die |
854 |
+ dobashcomp build/tmp/dist/cargo-image/etc/bash_completion.d/cargo |
855 |
+ |
856 |
+ local symlinks=( |
857 |
+ rustc |
858 |
+ rustdoc |
859 |
+ rust-gdb |
860 |
+ rust-gdbgui |
861 |
+ rust-lldb |
862 |
+ cargo |
863 |
+ ) |
864 |
+ |
865 |
+ use clippy && symlinks+=( clippy-driver cargo-clippy ) |
866 |
+ use miri && symlinks+=( miri cargo-miri ) |
867 |
+ use rls && symlinks+=( rls ) |
868 |
+ use rustfmt && symlinks+=( rustfmt cargo-fmt ) |
869 |
+ |
870 |
+ local i |
871 |
+ for i in "${symlinks[@]}"; do |
872 |
+ # we need realpath on /usr/bin/* symlink return version-appended binary path. |
873 |
+ # so /usr/bin/rustc should point to /usr/lib/rust/<ver>/bin/rustc-<ver> |
874 |
+ # need to fix eselect-rust to remove this hack. |
875 |
+ mv -v "${ED}/usr/lib/${PN}/${PV}/bin/${i}" "${ED}/usr/lib/${PN}/${PV}/bin/${i}-${PV}" || die |
876 |
+ ln -v "${ED}/usr/lib/${PN}/${PV}/bin/${i}-${PV}" "${ED}/usr/lib/${PN}/${PV}/bin/${i}" || die |
877 |
+ dosym "../lib/${PN}/${PV}/bin/${i}-${PV}" "/usr/bin/${i}-${PV}" |
878 |
+ done |
879 |
+ dosym "../../lib/${PN}/${PV}/share/doc" "/usr/share/doc/${P}" |
880 |
+ |
881 |
+ newenvd - "50${P}" <<-_EOF_ |
882 |
+ LDPATH="${EPREFIX}/usr/lib/${PN}/${PV}/lib" |
883 |
+ MANPATH="${EPREFIX}/usr/lib/${PN}/${PV}/share/man" |
884 |
+ $(usex elibc_musl 'CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_RUSTFLAGS="-C target-feature=-crt-static"' '') |
885 |
+ _EOF_ |
886 |
+ |
887 |
+ rm -rf "${ED}/usr/lib/${PN}/${PV}"/*.old || die |
888 |
+ rm -rf "${ED}/usr/lib/${PN}/${PV}/doc"/*.old || die |
889 |
+ |
890 |
+ # note: eselect-rust adds EROOT to all paths below |
891 |
+ cat <<-EOF > "${T}/provider-${P}" |
892 |
+ /usr/bin/cargo |
893 |
+ /usr/bin/rustdoc |
894 |
+ /usr/bin/rust-gdb |
895 |
+ /usr/bin/rust-gdbgui |
896 |
+ /usr/bin/rust-lldb |
897 |
+ /usr/share/doc/rust |
898 |
+ EOF |
899 |
+ if use clippy; then |
900 |
+ echo /usr/bin/clippy-driver >> "${T}/provider-${P}" |
901 |
+ echo /usr/bin/cargo-clippy >> "${T}/provider-${P}" |
902 |
+ fi |
903 |
+ if use miri; then |
904 |
+ echo /usr/bin/miri >> "${T}/provider-${P}" |
905 |
+ echo /usr/bin/cargo-miri >> "${T}/provider-${P}" |
906 |
+ fi |
907 |
+ if use rls; then |
908 |
+ echo /usr/bin/rls >> "${T}/provider-${P}" |
909 |
+ fi |
910 |
+ if use rustfmt; then |
911 |
+ echo /usr/bin/rustfmt >> "${T}/provider-${P}" |
912 |
+ echo /usr/bin/cargo-fmt >> "${T}/provider-${P}" |
913 |
+ fi |
914 |
+ |
915 |
+ insinto /etc/env.d/rust |
916 |
+ doins "${T}/provider-${P}" |
917 |
+} |
918 |
+ |
919 |
+pkg_postinst() { |
920 |
+ eselect rust update --if-unset |
921 |
+ |
922 |
+ elog "Rust installs a helper script for calling GDB and LLDB," |
923 |
+ elog "for your convenience it is installed under /usr/bin/rust-{gdb,lldb}-${PV}." |
924 |
+ |
925 |
+ if has_version app-editors/emacs; then |
926 |
+ elog "install app-emacs/rust-mode to get emacs support for rust." |
927 |
+ fi |
928 |
+ |
929 |
+ if has_version app-editors/gvim || has_version app-editors/vim; then |
930 |
+ elog "install app-vim/rust-vim to get vim support for rust." |
931 |
+ fi |
932 |
+} |
933 |
+ |
934 |
+pkg_postrm() { |
935 |
+ eselect rust cleanup |
936 |
+} |