1 |
commit: 7143e787e95fae9cfb9969d0596842ea1fe570c0 |
2 |
Author: orbea <orbea <AT> riseup <DOT> net> |
3 |
AuthorDate: Fri Aug 20 19:46:02 2021 +0000 |
4 |
Commit: Quentin Retornaz <gentoo <AT> retornaz <DOT> com> |
5 |
CommitDate: Fri Aug 20 23:56:08 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/proj/libressl.git/commit/?id=7143e787 |
7 |
|
8 |
dev-lang/rust: Version bump for 1.54.0 |
9 |
|
10 |
Signed-off-by: orbea <orbea <AT> riseup.net> |
11 |
Closes: https://github.com/gentoo/libressl/pull/347 |
12 |
Signed-off-by: Quentin Retornaz <gentoo <AT> retornaz.com> |
13 |
|
14 |
dev-lang/rust/files/1.54.0-libressl.patch | 43 ++ |
15 |
dev-lang/rust/files/1.54.0-parallel-miri.patch | 43 ++ |
16 |
dev-lang/rust/rust-1.54.0.ebuild | 680 +++++++++++++++++++++++++ |
17 |
3 files changed, 766 insertions(+) |
18 |
|
19 |
diff --git a/dev-lang/rust/files/1.54.0-libressl.patch b/dev-lang/rust/files/1.54.0-libressl.patch |
20 |
new file mode 100644 |
21 |
index 0000000..8899786 |
22 |
--- /dev/null |
23 |
+++ b/dev-lang/rust/files/1.54.0-libressl.patch |
24 |
@@ -0,0 +1,43 @@ |
25 |
+From 137d2bcff8f7eca2207fe5899ba2bd0c83833dca Mon Sep 17 00:00:00 2001 |
26 |
+From: Stefan Strogin <steils@g.o> |
27 |
+Date: Fri, 20 Aug 2021 12:23:13 -0700 |
28 |
+Subject: [PATCH] Support LibreSSL 3.3.x |
29 |
+ |
30 |
+Signed-off-by: orbea <orbea@××××××.net> |
31 |
+--- |
32 |
+ vendor/openssl-sys/.cargo-checksum.json | 2 +- |
33 |
+ vendor/openssl-sys/build/main.rs | 3 ++- |
34 |
+ 2 files changed, 3 insertions(+), 2 deletions(-) |
35 |
+ |
36 |
+diff --git a/vendor/openssl-sys/.cargo-checksum.json b/vendor/openssl-sys/.cargo-checksum.json |
37 |
+index 4e9f9c71b..003be66d4 100644 |
38 |
+--- a/vendor/openssl-sys/.cargo-checksum.json |
39 |
++++ b/vendor/openssl-sys/.cargo-checksum.json |
40 |
+@@ -1 +1 @@ |
41 |
+-{"files":{"CHANGELOG.md":"3c38e78f95e359924f839c6f3738c75b91149af81c23688dfaf37618a3332755","Cargo.toml":"d25f5ed8a445b5efc5bb81d51d7409e6b7e0abb90ceffe623dfa0da00c3f4ebb","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"18071782a20c51379733d7c2041c6755a11326d0153d8c7c3073875d7870da42","build/cfgs.rs":"9f92d008cf0db1cc2728f2b67c24a719840a4c8645d11dc560eadd8e9b0adeac","build/expando.c":"14d2de522d6ef7214c3f1ca73b9231229420b8ba95bdcf01cac93bf775aed15e","build/find_normal.rs":"1c5f996f44e77311d7e4c0e6bdfa212de427f569c19c790c119b88d472977700","build/find_vendored.rs":"7bf0e59c5646d72ee5a4392ad970fdf5c20288ddaf54dd86a8caff49583b38f5","build/main.rs":"c7485a16dd676de00d9ef42e3e41c5217cc6d5f5783f492a61b9c118e9f3bf18","src/aes.rs":"822bf666db351fe6ef9607c918081d6ad378fc1cedb05290bb746f86980c6088","src/asn1.rs":"801c254afc76b0c29b756bd86a149361609f82ec33c1f1fad39a512fbe4e87ee","src/bio.rs":"3aac4e38ccf8d832b4156908cd3f1ff9c56f84c05d2f07ed7a3e3fcc |
42 |
abe965e9","src/bn.rs":"c71b9c79f704a94a889d27bf75e7e5b1f9f10b0df0aeb485aef509cf05d7467f","src/cms.rs":"f21a403fea95e7b7efe0539a429831cfa51c8818adb79c7ebf73ae2a6f2dc87e","src/conf.rs":"511e008c18039f54d856d70b80009426fc7f4ce34fe4304e2c58ebf465031de0","src/crypto.rs":"a1279719ade9704be3d9af55ff679abbe918d525f332ca15810146d45e9080cf","src/dh.rs":"280fd508756b8013368a4233465f681a1339ad4e415569c14762e5dad0441cbe","src/dsa.rs":"ae79baf231681900ea76304285b3ffacf5298c90b8c04d371269cf4adbb5b9fa","src/dtls1.rs":"45e1dbf94a42d587fd948d553dc30187aa6aa2b5b82d554cf725ff36df768aa0","src/ec.rs":"c215a564373e8de1da63b698fbafc187d738fe90b77f998713a91180e178e350","src/err.rs":"3edf1379b3277df32e047a52553d243d4a4001111a277cf4b12f7297f2fe2bf0","src/evp.rs":"e82deaaf6d76c3dc52fd574fa131ac4f64dc6c5f173cf38dfd0a24b2f878c5be","src/hmac.rs":"fa3976d94a1383f300bdec228270afb8b47c97bb019d727c7d59ba783be3c42e","src/lib.rs":"57291110117331f5d6733da1421267e47cf891e0e0411b0720a04fdbc0686700","src/macros.rs":"7ed99c |
43 |
00c53ee12ea92634d4ace0af84845ebf98819869746e7896c8eaff23db","src/obj_mac.rs":"42019b142e523d7695d8c14ee7f72fa4b5702c07dee98fa12e70ab7dfcc95459","src/object.rs":"210d91fc81414da4cd3afa0127cabffef1640fa85e65635bc489e0f721ee929f","src/ocsp.rs":"154e416aa14df8d5aa962f3352ca72bab00716f0834413c78dfa663e0880e9dd","src/ossl_typ.rs":"4379b8327a1efbae1c784ad576c98ac7708bf62cab1c373845d9ca948b5e401b","src/pem.rs":"ba80937125618cd0e7073d69be6aff3b619ede74e227a158cb0a68af27f69640","src/pkcs12.rs":"f1a3f32f128fa8ce94391c1957a0e535387cebc0e25d21743888b172518dd636","src/pkcs7.rs":"0c5a0f85323a1e5a4d7edcc433166de8614b44f545758d926cf95e9626d4af2b","src/rand.rs":"469601b4fbb56d4dbf5cf5d7bb8483e3bde411edea18601e7d1ed6ef27180fd3","src/rsa.rs":"aa984781f19d3e88527bec9db5338b19051313b01589018c5bb86923f058c6c6","src/safestack.rs":"6c39e28565d34efad707d77561d4caa99e3f028fcac3a2ef6fd403a78de1190c","src/sha.rs":"1a6b028a63654d2419417a9a8af790cd22409a4643682a0686ecdb9441264eba","src/srtp.rs":"1c4dee9e6c139cc70 |
44 |
416207786e385f199321624fb9fbf3cbf39a8160c0c405d","src/ssl.rs":"5970b21a47668f7efb8130f22110d9ab65c571a45681c02d8ab596b7068db963","src/ssl3.rs":"9336c816e00847d552dea22587d4ac72ff3cbd469fa5ff750423a19ea11e68eb","src/stack.rs":"1a509907283e5a2bf88cf193ce607f49ce7d2d95547c2ce2abc0fd4567aad334","src/tls1.rs":"60ca3dea1bbfda645bde563b4a878dac129c3f760e3ad572381000fc7a8ef522","src/x509.rs":"7ffbf8687f650dd9678eab61871913579539f78ebf69f005f07f7a40017b26cb","src/x509_vfy.rs":"a5fc69e3ef3565c8d9196768c0b84bd876edfb019688dc4487dbb88f6a89293d","src/x509v3.rs":"520253195097d134e553c6378c1db2510eae6ccfcab6f6fb08919697bc0f023b"},"package":"313752393519e876837e09e1fa183ddef0be7735868dced3196f4472d536277f"} |
45 |
+\ No newline at end of file |
46 |
++{"files":{"CHANGELOG.md":"3c38e78f95e359924f839c6f3738c75b91149af81c23688dfaf37618a3332755","Cargo.toml":"d25f5ed8a445b5efc5bb81d51d7409e6b7e0abb90ceffe623dfa0da00c3f4ebb","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"18071782a20c51379733d7c2041c6755a11326d0153d8c7c3073875d7870da42","build/cfgs.rs":"9f92d008cf0db1cc2728f2b67c24a719840a4c8645d11dc560eadd8e9b0adeac","build/expando.c":"14d2de522d6ef7214c3f1ca73b9231229420b8ba95bdcf01cac93bf775aed15e","build/find_normal.rs":"1c5f996f44e77311d7e4c0e6bdfa212de427f569c19c790c119b88d472977700","build/find_vendored.rs":"7bf0e59c5646d72ee5a4392ad970fdf5c20288ddaf54dd86a8caff49583b38f5","build/main.rs":"93ac710e06c9db872b47de99a61bc4aa058ac99e3d734a27a77332a47cca2f75","src/aes.rs":"822bf666db351fe6ef9607c918081d6ad378fc1cedb05290bb746f86980c6088","src/asn1.rs":"801c254afc76b0c29b756bd86a149361609f82ec33c1f1fad39a512fbe4e87ee","src/bio.rs":"3aac4e38ccf8d832b4156908cd3f1ff9c56f84c05d2f07ed7a3e3fcc |
47 |
abe965e9","src/bn.rs":"c71b9c79f704a94a889d27bf75e7e5b1f9f10b0df0aeb485aef509cf05d7467f","src/cms.rs":"f21a403fea95e7b7efe0539a429831cfa51c8818adb79c7ebf73ae2a6f2dc87e","src/conf.rs":"511e008c18039f54d856d70b80009426fc7f4ce34fe4304e2c58ebf465031de0","src/crypto.rs":"a1279719ade9704be3d9af55ff679abbe918d525f332ca15810146d45e9080cf","src/dh.rs":"280fd508756b8013368a4233465f681a1339ad4e415569c14762e5dad0441cbe","src/dsa.rs":"ae79baf231681900ea76304285b3ffacf5298c90b8c04d371269cf4adbb5b9fa","src/dtls1.rs":"45e1dbf94a42d587fd948d553dc30187aa6aa2b5b82d554cf725ff36df768aa0","src/ec.rs":"c215a564373e8de1da63b698fbafc187d738fe90b77f998713a91180e178e350","src/err.rs":"3edf1379b3277df32e047a52553d243d4a4001111a277cf4b12f7297f2fe2bf0","src/evp.rs":"e82deaaf6d76c3dc52fd574fa131ac4f64dc6c5f173cf38dfd0a24b2f878c5be","src/hmac.rs":"fa3976d94a1383f300bdec228270afb8b47c97bb019d727c7d59ba783be3c42e","src/lib.rs":"57291110117331f5d6733da1421267e47cf891e0e0411b0720a04fdbc0686700","src/macros.rs":"7ed99c |
48 |
00c53ee12ea92634d4ace0af84845ebf98819869746e7896c8eaff23db","src/obj_mac.rs":"42019b142e523d7695d8c14ee7f72fa4b5702c07dee98fa12e70ab7dfcc95459","src/object.rs":"210d91fc81414da4cd3afa0127cabffef1640fa85e65635bc489e0f721ee929f","src/ocsp.rs":"154e416aa14df8d5aa962f3352ca72bab00716f0834413c78dfa663e0880e9dd","src/ossl_typ.rs":"4379b8327a1efbae1c784ad576c98ac7708bf62cab1c373845d9ca948b5e401b","src/pem.rs":"ba80937125618cd0e7073d69be6aff3b619ede74e227a158cb0a68af27f69640","src/pkcs12.rs":"f1a3f32f128fa8ce94391c1957a0e535387cebc0e25d21743888b172518dd636","src/pkcs7.rs":"0c5a0f85323a1e5a4d7edcc433166de8614b44f545758d926cf95e9626d4af2b","src/rand.rs":"469601b4fbb56d4dbf5cf5d7bb8483e3bde411edea18601e7d1ed6ef27180fd3","src/rsa.rs":"aa984781f19d3e88527bec9db5338b19051313b01589018c5bb86923f058c6c6","src/safestack.rs":"6c39e28565d34efad707d77561d4caa99e3f028fcac3a2ef6fd403a78de1190c","src/sha.rs":"1a6b028a63654d2419417a9a8af790cd22409a4643682a0686ecdb9441264eba","src/srtp.rs":"1c4dee9e6c139cc70 |
49 |
416207786e385f199321624fb9fbf3cbf39a8160c0c405d","src/ssl.rs":"5970b21a47668f7efb8130f22110d9ab65c571a45681c02d8ab596b7068db963","src/ssl3.rs":"9336c816e00847d552dea22587d4ac72ff3cbd469fa5ff750423a19ea11e68eb","src/stack.rs":"1a509907283e5a2bf88cf193ce607f49ce7d2d95547c2ce2abc0fd4567aad334","src/tls1.rs":"60ca3dea1bbfda645bde563b4a878dac129c3f760e3ad572381000fc7a8ef522","src/x509.rs":"7ffbf8687f650dd9678eab61871913579539f78ebf69f005f07f7a40017b26cb","src/x509_vfy.rs":"a5fc69e3ef3565c8d9196768c0b84bd876edfb019688dc4487dbb88f6a89293d","src/x509v3.rs":"520253195097d134e553c6378c1db2510eae6ccfcab6f6fb08919697bc0f023b"},"package":"313752393519e876837e09e1fa183ddef0be7735868dced3196f4472d536277f"} |
50 |
+diff --git a/vendor/openssl-sys/build/main.rs b/vendor/openssl-sys/build/main.rs |
51 |
+index df03e01f6..1d813f7d5 100644 |
52 |
+--- a/vendor/openssl-sys/build/main.rs |
53 |
++++ b/vendor/openssl-sys/build/main.rs |
54 |
+@@ -232,6 +232,7 @@ See rust-openssl README for more information: |
55 |
+ (3, 2, _) => ('3', '2', 'x'), |
56 |
+ (3, 3, 0) => ('3', '3', '0'), |
57 |
+ (3, 3, 1) => ('3', '3', '1'), |
58 |
++ (3, 3, _) => ('3', '3', 'x'), |
59 |
+ _ => version_error(), |
60 |
+ }; |
61 |
+ |
62 |
+@@ -272,7 +273,7 @@ fn version_error() -> ! { |
63 |
+ " |
64 |
+ |
65 |
+ This crate is only compatible with OpenSSL 1.0.1 through 1.1.1, or LibreSSL 2.5 |
66 |
+-through 3.3.1, but a different version of OpenSSL was found. The build is now aborting |
67 |
++through 3.3.x, but a different version of OpenSSL was found. The build is now aborting |
68 |
+ due to this version mismatch. |
69 |
+ |
70 |
+ " |
71 |
+-- |
72 |
+2.31.1 |
73 |
+ |
74 |
|
75 |
diff --git a/dev-lang/rust/files/1.54.0-parallel-miri.patch b/dev-lang/rust/files/1.54.0-parallel-miri.patch |
76 |
new file mode 100644 |
77 |
index 0000000..68239d9 |
78 |
--- /dev/null |
79 |
+++ b/dev-lang/rust/files/1.54.0-parallel-miri.patch |
80 |
@@ -0,0 +1,43 @@ |
81 |
+From a789b49e4c0e7d742cc39713484596293d844537 Mon Sep 17 00:00:00 2001 |
82 |
+From: hyd-dev <yd-huang@×××××××.com> |
83 |
+Date: Fri, 30 Jul 2021 21:28:34 +0800 |
84 |
+Subject: [PATCH] Use `Lrc` instead of `Rc` in `MiriCompilerCalls::config()` |
85 |
+ |
86 |
+--- |
87 |
+ src/bin/miri.rs | 5 +++-- |
88 |
+ 1 file changed, 3 insertions(+), 2 deletions(-) |
89 |
+ |
90 |
+diff --git a/src/tools/miri/src/bin/miri.rs b/src/tools/miri/src/bin/miri.rs |
91 |
+index 5a8f07263..18c393815 100644 |
92 |
+--- a/src/tools/miri/src/bin/miri.rs |
93 |
++++ b/src/tools/miri/src/bin/miri.rs |
94 |
+@@ -1,5 +1,6 @@ |
95 |
+ #![feature(rustc_private, bool_to_option, stmt_expr_attributes)] |
96 |
+ |
97 |
++extern crate rustc_data_structures; |
98 |
+ extern crate rustc_driver; |
99 |
+ extern crate rustc_errors; |
100 |
+ extern crate rustc_hir; |
101 |
+@@ -12,12 +13,12 @@ use std::convert::TryFrom; |
102 |
+ use std::env; |
103 |
+ use std::num::NonZeroU64; |
104 |
+ use std::path::PathBuf; |
105 |
+-use std::rc::Rc; |
106 |
+ use std::str::FromStr; |
107 |
+ |
108 |
+ use hex::FromHexError; |
109 |
+ use log::debug; |
110 |
+ |
111 |
++use rustc_data_structures::sync::Lrc; |
112 |
+ use rustc_driver::Compilation; |
113 |
+ use rustc_errors::emitter::{ColorConfig, HumanReadableErrorType}; |
114 |
+ use rustc_hir::{self as hir, def_id::LOCAL_CRATE, Node}; |
115 |
+@@ -42,7 +43,7 @@ impl rustc_driver::Callbacks for MiriCompilerCalls { |
116 |
+ // HACK: rustc will emit "crate ... required to be available in rlib format, but |
117 |
+ // was not found in this form" errors once we use `tcx.dependency_formats()` if |
118 |
+ // there's no rlib provided, so setting a dummy path here to workaround those errors. |
119 |
+- Rc::make_mut(&mut crate_source).rlib = Some((PathBuf::new(), PathKind::All)); |
120 |
++ Lrc::make_mut(&mut crate_source).rlib = Some((PathBuf::new(), PathKind::All)); |
121 |
+ crate_source |
122 |
+ }; |
123 |
+ }); |
124 |
|
125 |
diff --git a/dev-lang/rust/rust-1.54.0.ebuild b/dev-lang/rust/rust-1.54.0.ebuild |
126 |
new file mode 100644 |
127 |
index 0000000..5295278 |
128 |
--- /dev/null |
129 |
+++ b/dev-lang/rust/rust-1.54.0.ebuild |
130 |
@@ -0,0 +1,680 @@ |
131 |
+# Copyright 1999-2021 Gentoo Authors |
132 |
+# Distributed under the terms of the GNU General Public License v2 |
133 |
+ |
134 |
+EAPI=7 |
135 |
+ |
136 |
+PYTHON_COMPAT=( python3_{7..9} ) |
137 |
+ |
138 |
+inherit bash-completion-r1 check-reqs estack flag-o-matic llvm multiprocessing \ |
139 |
+ multilib-build python-any-r1 rust-toolchain toolchain-funcs verify-sig |
140 |
+ |
141 |
+if [[ ${PV} = *beta* ]]; then |
142 |
+ betaver=${PV//*beta} |
143 |
+ BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}" |
144 |
+ MY_P="rustc-beta" |
145 |
+ SLOT="beta/${PV}" |
146 |
+ SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.xz -> rustc-${PV}-src.tar.xz" |
147 |
+else |
148 |
+ ABI_VER="$(ver_cut 1-2)" |
149 |
+ SLOT="stable/${ABI_VER}" |
150 |
+ MY_P="rustc-${PV}" |
151 |
+ SRC="${MY_P}-src.tar.xz" |
152 |
+ KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~riscv ~x86" |
153 |
+fi |
154 |
+ |
155 |
+RUST_STAGE0_VERSION="1.$(($(ver_cut 2) - 1)).0" |
156 |
+ |
157 |
+DESCRIPTION="Systems programming language from Mozilla" |
158 |
+HOMEPAGE="https://www.rust-lang.org/" |
159 |
+ |
160 |
+SRC_URI=" |
161 |
+ https://static.rust-lang.org/dist/${SRC} |
162 |
+ verify-sig? ( https://static.rust-lang.org/dist/${SRC}.asc ) |
163 |
+ !system-bootstrap? ( $(rust_all_arch_uris rust-${RUST_STAGE0_VERSION}) ) |
164 |
+" |
165 |
+ |
166 |
+# keep in sync with llvm ebuild of the same version as bundled one. |
167 |
+ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM AVR BPF Hexagon Lanai Mips MSP430 |
168 |
+ NVPTX PowerPC RISCV Sparc SystemZ WebAssembly X86 XCore ) |
169 |
+ALL_LLVM_TARGETS=( "${ALL_LLVM_TARGETS[@]/#/llvm_targets_}" ) |
170 |
+LLVM_TARGET_USEDEPS=${ALL_LLVM_TARGETS[@]/%/(-)?} |
171 |
+ |
172 |
+LICENSE="|| ( MIT Apache-2.0 ) BSD-1 BSD-2 BSD-4 UoI-NCSA" |
173 |
+ |
174 |
+IUSE="clippy cpu_flags_x86_sse2 debug doc miri nightly parallel-compiler rls rustfmt system-bootstrap system-llvm test wasm ${ALL_LLVM_TARGETS[*]}" |
175 |
+ |
176 |
+# Please keep the LLVM dependency block separate. Since LLVM is slotted, |
177 |
+# we need to *really* make sure we're not pulling more than one slot |
178 |
+# simultaneously. |
179 |
+ |
180 |
+# How to use it: |
181 |
+# List all the working slots in LLVM_VALID_SLOTS, newest first. |
182 |
+LLVM_VALID_SLOTS=( 12 ) |
183 |
+LLVM_MAX_SLOT="${LLVM_VALID_SLOTS[0]}" |
184 |
+ |
185 |
+# splitting usedeps needed to avoid CI/pkgcheck's UncheckableDep limitation |
186 |
+# (-) usedep needed because we may build with older llvm without that target |
187 |
+LLVM_DEPEND="|| ( " |
188 |
+for _s in ${LLVM_VALID_SLOTS[@]}; do |
189 |
+ LLVM_DEPEND+=" ( " |
190 |
+ for _x in ${ALL_LLVM_TARGETS[@]}; do |
191 |
+ LLVM_DEPEND+=" |
192 |
+ ${_x}? ( sys-devel/llvm:${_s}[${_x}(-)] )" |
193 |
+ done |
194 |
+ LLVM_DEPEND+=" )" |
195 |
+done |
196 |
+unset _s _x |
197 |
+LLVM_DEPEND+=" ) |
198 |
+ <sys-devel/llvm-$(( LLVM_MAX_SLOT + 1 )):= |
199 |
+ wasm? ( sys-devel/lld ) |
200 |
+" |
201 |
+ |
202 |
+# to bootstrap we need at least exactly previous version, or same. |
203 |
+# most of the time previous versions fail to bootstrap with newer |
204 |
+# for example 1.47.x, requires at least 1.46.x, 1.47.x is ok, |
205 |
+# but it fails to bootstrap with 1.48.x |
206 |
+# https://github.com/rust-lang/rust/blob/${PV}/src/stage0.txt |
207 |
+RUST_DEP_PREV="$(ver_cut 1).$(($(ver_cut 2) - 1))*" |
208 |
+RUST_DEP_CURR="$(ver_cut 1).$(ver_cut 2)*" |
209 |
+BOOTSTRAP_DEPEND="|| |
210 |
+ ( |
211 |
+ =dev-lang/rust-"${RUST_DEP_PREV}" |
212 |
+ =dev-lang/rust-bin-"${RUST_DEP_PREV}" |
213 |
+ =dev-lang/rust-"${RUST_DEP_CURR}" |
214 |
+ =dev-lang/rust-bin-"${RUST_DEP_CURR}" |
215 |
+ ) |
216 |
+" |
217 |
+ |
218 |
+BDEPEND="${PYTHON_DEPS} |
219 |
+ app-eselect/eselect-rust |
220 |
+ || ( |
221 |
+ >=sys-devel/gcc-4.7 |
222 |
+ >=sys-devel/clang-3.5 |
223 |
+ ) |
224 |
+ system-bootstrap? ( ${BOOTSTRAP_DEPEND} ) |
225 |
+ !system-llvm? ( |
226 |
+ >=dev-util/cmake-3.13.4 |
227 |
+ dev-util/ninja |
228 |
+ ) |
229 |
+ test? ( sys-devel/gdb ) |
230 |
+ verify-sig? ( app-crypt/openpgp-keys-rust ) |
231 |
+" |
232 |
+ |
233 |
+DEPEND=" |
234 |
+ >=app-arch/xz-utils-5.2 |
235 |
+ net-misc/curl:=[http2,ssl] |
236 |
+ sys-libs/zlib:= |
237 |
+ dev-libs/openssl:0= |
238 |
+ elibc_musl? ( sys-libs/libunwind:= ) |
239 |
+ system-llvm? ( ${LLVM_DEPEND} ) |
240 |
+" |
241 |
+ |
242 |
+# we need to block older versions due to layout changes. |
243 |
+RDEPEND="${DEPEND} |
244 |
+ app-eselect/eselect-rust |
245 |
+ !<dev-lang/rust-1.47.0-r1 |
246 |
+ !<dev-lang/rust-bin-1.47.0-r1 |
247 |
+" |
248 |
+ |
249 |
+REQUIRED_USE="|| ( ${ALL_LLVM_TARGETS[*]} ) |
250 |
+ miri? ( nightly ) |
251 |
+ parallel-compiler? ( nightly ) |
252 |
+ test? ( ${ALL_LLVM_TARGETS[*]} ) |
253 |
+ wasm? ( llvm_targets_WebAssembly ) |
254 |
+ x86? ( cpu_flags_x86_sse2 ) |
255 |
+" |
256 |
+ |
257 |
+# we don't use cmake.eclass, but can get a warnings |
258 |
+CMAKE_WARN_UNUSED_CLI=no |
259 |
+ |
260 |
+QA_FLAGS_IGNORED=" |
261 |
+ usr/lib/${PN}/${PV}/bin/.* |
262 |
+ usr/lib/${PN}/${PV}/libexec/.* |
263 |
+ usr/lib/${PN}/${PV}/lib/lib.*.so |
264 |
+ usr/lib/${PN}/${PV}/lib/rustlib/.*/bin/.* |
265 |
+ usr/lib/${PN}/${PV}/lib/rustlib/.*/lib/lib.*.so |
266 |
+" |
267 |
+ |
268 |
+QA_SONAME=" |
269 |
+ usr/lib/${PN}/${PV}/lib/lib.*.so.* |
270 |
+ usr/lib/${PN}/${PV}/lib/rustlib/.*/lib/lib.*.so |
271 |
+" |
272 |
+ |
273 |
+# causes double bootstrap |
274 |
+RESTRICT="test" |
275 |
+ |
276 |
+VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/rust.asc |
277 |
+ |
278 |
+PATCHES=( |
279 |
+ "${FILESDIR}"/1.47.0-ignore-broken-and-non-applicable-tests.patch |
280 |
+ "${FILESDIR}"/1.49.0-gentoo-musl-target-specs.patch |
281 |
+ "${FILESDIR}"/1.53.0-rustversion-1.0.5.patch # https://github.com/rust-lang/rust/pull/86425 |
282 |
+ "${FILESDIR}"/1.54.0-parallel-miri.patch # https://github.com/rust-lang/miri/pull/1863 |
283 |
+ "${FILESDIR}"/1.54.0-libressl.patch |
284 |
+) |
285 |
+ |
286 |
+S="${WORKDIR}/${MY_P}-src" |
287 |
+ |
288 |
+toml_usex() { |
289 |
+ usex "${1}" true false |
290 |
+} |
291 |
+ |
292 |
+bootstrap_rust_version_check() { |
293 |
+ # never call from pkg_pretend. eselect-rust may be not installed yet. |
294 |
+ [[ ${MERGE_TYPE} == binary ]] && return |
295 |
+ local rustc_wanted="$(ver_cut 1).$(($(ver_cut 2) - 1))" |
296 |
+ local rustc_toonew="$(ver_cut 1).$(($(ver_cut 2) + 1))" |
297 |
+ local rustc_version=( $(eselect --brief rust show 2>/dev/null) ) |
298 |
+ rustc_version=${rustc_version[0]#rust-bin-} |
299 |
+ rustc_version=${rustc_version#rust-} |
300 |
+ |
301 |
+ [[ -z "${rustc_version}" ]] && die "Failed to determine rust version, check 'eselect rust' output" |
302 |
+ |
303 |
+ if ver_test "${rustc_version}" -lt "${rustc_wanted}" ; then |
304 |
+ eerror "Rust >=${rustc_wanted} is required" |
305 |
+ eerror "please run 'eselect rust' and set correct rust version" |
306 |
+ die "selected rust version is too old" |
307 |
+ elif ver_test "${rustc_version}" -ge "${rustc_toonew}" ; then |
308 |
+ eerror "Rust <${rustc_toonew} is required" |
309 |
+ eerror "please run 'eselect rust' and set correct rust version" |
310 |
+ die "selected rust version is too new" |
311 |
+ else |
312 |
+ einfo "Using rust ${rustc_version} to build" |
313 |
+ fi |
314 |
+} |
315 |
+ |
316 |
+pre_build_checks() { |
317 |
+ local M=4096 |
318 |
+ # multiply requirements by 1.5 if we are doing x86-multilib |
319 |
+ if use amd64; then |
320 |
+ M=$(( $(usex abi_x86_32 15 10) * ${M} / 10 )) |
321 |
+ fi |
322 |
+ M=$(( $(usex clippy 128 0) + ${M} )) |
323 |
+ M=$(( $(usex miri 128 0) + ${M} )) |
324 |
+ M=$(( $(usex rls 512 0) + ${M} )) |
325 |
+ M=$(( $(usex rustfmt 256 0) + ${M} )) |
326 |
+ # add 2G if we compile llvm and 256M per llvm_target |
327 |
+ if ! use system-llvm; then |
328 |
+ M=$(( 2048 + ${M} )) |
329 |
+ local ltarget |
330 |
+ for ltarget in ${ALL_LLVM_TARGETS[@]}; do |
331 |
+ M=$(( $(usex ${ltarget} 256 0) + ${M} )) |
332 |
+ done |
333 |
+ fi |
334 |
+ M=$(( $(usex wasm 256 0) + ${M} )) |
335 |
+ M=$(( $(usex debug 2 1) * ${M} )) |
336 |
+ eshopts_push -s extglob |
337 |
+ if is-flagq '-g?(gdb)?([1-9])'; then |
338 |
+ M=$(( 15 * ${M} / 10 )) |
339 |
+ fi |
340 |
+ eshopts_pop |
341 |
+ M=$(( $(usex system-bootstrap 0 1024) + ${M} )) |
342 |
+ M=$(( $(usex doc 256 0) + ${M} )) |
343 |
+ CHECKREQS_DISK_BUILD=${M}M check-reqs_pkg_${EBUILD_PHASE} |
344 |
+} |
345 |
+ |
346 |
+llvm_check_deps() { |
347 |
+ has_version -r "sys-devel/llvm:${LLVM_SLOT}[${LLVM_TARGET_USEDEPS// /,}]" |
348 |
+} |
349 |
+ |
350 |
+pkg_pretend() { |
351 |
+ pre_build_checks |
352 |
+} |
353 |
+ |
354 |
+pkg_setup() { |
355 |
+ pre_build_checks |
356 |
+ python-any-r1_pkg_setup |
357 |
+ |
358 |
+ export LIBGIT2_NO_PKG_CONFIG=1 #749381 |
359 |
+ |
360 |
+ use system-bootstrap && bootstrap_rust_version_check |
361 |
+ |
362 |
+ if use system-llvm; then |
363 |
+ llvm_pkg_setup |
364 |
+ |
365 |
+ local llvm_config="$(get_llvm_prefix "${LLVM_MAX_SLOT}")/bin/llvm-config" |
366 |
+ export LLVM_LINK_SHARED=1 |
367 |
+ export RUSTFLAGS="${RUSTFLAGS} -Lnative=$("${llvm_config}" --libdir)" |
368 |
+ fi |
369 |
+} |
370 |
+ |
371 |
+src_prepare() { |
372 |
+ if ! use system-bootstrap; then |
373 |
+ local rust_stage0_root="${WORKDIR}"/rust-stage0 |
374 |
+ local rust_stage0="rust-${RUST_STAGE0_VERSION}-$(rust_abi)" |
375 |
+ |
376 |
+ "${WORKDIR}/${rust_stage0}"/install.sh --disable-ldconfig \ |
377 |
+ --without=rust-docs --destdir="${rust_stage0_root}" --prefix=/ || die |
378 |
+ fi |
379 |
+ |
380 |
+ default |
381 |
+} |
382 |
+ |
383 |
+src_configure() { |
384 |
+ local rust_target="" rust_targets="" arch_cflags |
385 |
+ |
386 |
+ # Collect rust target names to compile standard libs for all ABIs. |
387 |
+ for v in $(multilib_get_enabled_abi_pairs); do |
388 |
+ rust_targets="${rust_targets},\"$(rust_abi $(get_abi_CHOST ${v##*.}))\"" |
389 |
+ done |
390 |
+ if use wasm; then |
391 |
+ rust_targets="${rust_targets},\"wasm32-unknown-unknown\"" |
392 |
+ if use system-llvm; then |
393 |
+ # un-hardcode rust-lld linker for this target |
394 |
+ # https://bugs.gentoo.org/715348 |
395 |
+ sed -i '/linker:/ s/rust-lld/wasm-ld/' compiler/rustc_target/src/spec/wasm_base.rs || die |
396 |
+ fi |
397 |
+ fi |
398 |
+ rust_targets="${rust_targets#,}" |
399 |
+ |
400 |
+ local tools="\"cargo\"," |
401 |
+ if use clippy; then |
402 |
+ tools="\"clippy\",$tools" |
403 |
+ fi |
404 |
+ if use miri; then |
405 |
+ tools="\"miri\",$tools" |
406 |
+ fi |
407 |
+ if use rls; then |
408 |
+ tools="\"rls\",\"analysis\",\"src\",$tools" |
409 |
+ fi |
410 |
+ if use rustfmt; then |
411 |
+ tools="\"rustfmt\",$tools" |
412 |
+ fi |
413 |
+ |
414 |
+ local rust_stage0_root |
415 |
+ if use system-bootstrap; then |
416 |
+ local printsysroot |
417 |
+ printsysroot="$(rustc --print sysroot || die "Can't determine rust's sysroot")" |
418 |
+ rust_stage0_root="${printsysroot}" |
419 |
+ else |
420 |
+ rust_stage0_root="${WORKDIR}"/rust-stage0 |
421 |
+ fi |
422 |
+ # in case of prefix it will be already prefixed, as --print sysroot returns full path |
423 |
+ [[ -d ${rust_stage0_root} ]] || die "${rust_stage0_root} is not a directory" |
424 |
+ |
425 |
+ rust_target="$(rust_abi)" |
426 |
+ |
427 |
+ cat <<- _EOF_ > "${S}"/config.toml |
428 |
+ changelog-seen = 2 |
429 |
+ [llvm] |
430 |
+ download-ci-llvm = false |
431 |
+ optimize = $(toml_usex !debug) |
432 |
+ release-debuginfo = $(toml_usex debug) |
433 |
+ assertions = $(toml_usex debug) |
434 |
+ ninja = true |
435 |
+ targets = "${LLVM_TARGETS// /;}" |
436 |
+ experimental-targets = "" |
437 |
+ link-shared = $(toml_usex system-llvm) |
438 |
+ [build] |
439 |
+ build-stage = 2 |
440 |
+ test-stage = 2 |
441 |
+ doc-stage = 2 |
442 |
+ build = "${rust_target}" |
443 |
+ host = ["${rust_target}"] |
444 |
+ target = [${rust_targets}] |
445 |
+ cargo = "${rust_stage0_root}/bin/cargo" |
446 |
+ rustc = "${rust_stage0_root}/bin/rustc" |
447 |
+ rustfmt = "${rust_stage0_root}/bin/rustfmt" |
448 |
+ docs = $(toml_usex doc) |
449 |
+ compiler-docs = false |
450 |
+ submodules = false |
451 |
+ python = "${EPYTHON}" |
452 |
+ locked-deps = true |
453 |
+ vendor = true |
454 |
+ extended = true |
455 |
+ tools = [${tools}] |
456 |
+ verbose = 2 |
457 |
+ sanitizers = false |
458 |
+ profiler = false |
459 |
+ cargo-native-static = false |
460 |
+ [install] |
461 |
+ prefix = "${EPREFIX}/usr/lib/${PN}/${PV}" |
462 |
+ sysconfdir = "etc" |
463 |
+ docdir = "share/doc/rust" |
464 |
+ bindir = "bin" |
465 |
+ libdir = "lib" |
466 |
+ mandir = "share/man" |
467 |
+ [rust] |
468 |
+ # https://github.com/rust-lang/rust/issues/54872 |
469 |
+ codegen-units-std = 1 |
470 |
+ optimize = true |
471 |
+ debug = $(toml_usex debug) |
472 |
+ debug-assertions = $(toml_usex debug) |
473 |
+ debug-assertions-std = $(toml_usex debug) |
474 |
+ debuginfo-level = $(usex debug 2 0) |
475 |
+ debuginfo-level-rustc = $(usex debug 2 0) |
476 |
+ debuginfo-level-std = $(usex debug 2 0) |
477 |
+ debuginfo-level-tools = $(usex debug 2 0) |
478 |
+ debuginfo-level-tests = 0 |
479 |
+ backtrace = true |
480 |
+ incremental = false |
481 |
+ default-linker = "$(tc-getCC)" |
482 |
+ parallel-compiler = $(toml_usex parallel-compiler) |
483 |
+ channel = "$(usex nightly nightly stable)" |
484 |
+ description = "gentoo" |
485 |
+ rpath = false |
486 |
+ verbose-tests = true |
487 |
+ optimize-tests = $(toml_usex !debug) |
488 |
+ codegen-tests = true |
489 |
+ dist-src = false |
490 |
+ remap-debuginfo = true |
491 |
+ lld = $(usex system-llvm false $(toml_usex wasm)) |
492 |
+ # only deny warnings if doc+wasm are NOT requested, documenting stage0 wasm std fails without it |
493 |
+ # https://github.com/rust-lang/rust/issues/74976 |
494 |
+ # https://github.com/rust-lang/rust/issues/76526 |
495 |
+ deny-warnings = $(usex wasm $(usex doc false true) true) |
496 |
+ backtrace-on-ice = true |
497 |
+ jemalloc = false |
498 |
+ [dist] |
499 |
+ src-tarball = false |
500 |
+ compression-formats = ["gz"] |
501 |
+ _EOF_ |
502 |
+ |
503 |
+ for v in $(multilib_get_enabled_abi_pairs); do |
504 |
+ rust_target=$(rust_abi $(get_abi_CHOST ${v##*.})) |
505 |
+ arch_cflags="$(get_abi_CFLAGS ${v##*.})" |
506 |
+ |
507 |
+ cat <<- _EOF_ >> "${S}"/config.env |
508 |
+ CFLAGS_${rust_target}=${arch_cflags} |
509 |
+ _EOF_ |
510 |
+ |
511 |
+ cat <<- _EOF_ >> "${S}"/config.toml |
512 |
+ [target.${rust_target}] |
513 |
+ cc = "$(tc-getBUILD_CC)" |
514 |
+ cxx = "$(tc-getBUILD_CXX)" |
515 |
+ linker = "$(tc-getCC)" |
516 |
+ ar = "$(tc-getAR)" |
517 |
+ _EOF_ |
518 |
+ # librustc_target/spec/linux_musl_base.rs sets base.crt_static_default = true; |
519 |
+ if use elibc_musl; then |
520 |
+ cat <<- _EOF_ >> "${S}"/config.toml |
521 |
+ crt-static = false |
522 |
+ _EOF_ |
523 |
+ fi |
524 |
+ if use system-llvm; then |
525 |
+ cat <<- _EOF_ >> "${S}"/config.toml |
526 |
+ llvm-config = "$(get_llvm_prefix "${LLVM_MAX_SLOT}")/bin/llvm-config" |
527 |
+ _EOF_ |
528 |
+ fi |
529 |
+ done |
530 |
+ if use wasm; then |
531 |
+ cat <<- _EOF_ >> "${S}"/config.toml |
532 |
+ [target.wasm32-unknown-unknown] |
533 |
+ linker = "$(usex system-llvm lld rust-lld)" |
534 |
+ _EOF_ |
535 |
+ fi |
536 |
+ |
537 |
+ if [[ -n ${I_KNOW_WHAT_I_AM_DOING_CROSS} ]]; then # whitespace intentionally shifted below |
538 |
+ # experimental cross support |
539 |
+ # discussion: https://bugs.gentoo.org/679878 |
540 |
+ # TODO: c*flags, clang, system-llvm, cargo.eclass target support |
541 |
+ # it would be much better if we could split out stdlib |
542 |
+ # complilation to separate ebuild and abuse CATEGORY to |
543 |
+ # just install to /usr/lib/rustlib/<target> |
544 |
+ |
545 |
+ # extra targets defined as a bash array |
546 |
+ # spec format: <LLVM target>:<rust-target>:<CTARGET> |
547 |
+ # best place would be /etc/portage/env/dev-lang/rust |
548 |
+ # Example: |
549 |
+ # RUST_CROSS_TARGETS=( |
550 |
+ # "AArch64:aarch64-unknown-linux-gnu:aarch64-unknown-linux-gnu" |
551 |
+ # ) |
552 |
+ # no extra hand holding is done, no target transformations, all |
553 |
+ # values are passed as-is with just basic checks, so it's up to user to supply correct values |
554 |
+ # valid rust targets can be obtained with |
555 |
+ # rustc --print target-list |
556 |
+ # matching cross toolchain has to be installed |
557 |
+ # matching LLVM_TARGET has to be enabled for both rust and llvm (if using system one) |
558 |
+ # only gcc toolchains installed with crossdev are checked for now. |
559 |
+ |
560 |
+ # BUG: we can't pass host flags to cross compiler, so just filter for now |
561 |
+ # BUG: this should be more fine-grained. |
562 |
+ filter-flags '-mcpu=*' '-march=*' '-mtune=*' |
563 |
+ |
564 |
+ local cross_target_spec |
565 |
+ for cross_target_spec in "${RUST_CROSS_TARGETS[@]}";do |
566 |
+ # extracts first element form <LLVM target>:<rust-target>:<CTARGET> |
567 |
+ local cross_llvm_target="${cross_target_spec%%:*}" |
568 |
+ # extracts toolchain triples, <rust-target>:<CTARGET> |
569 |
+ local cross_triples="${cross_target_spec#*:}" |
570 |
+ # extracts first element after before : separator |
571 |
+ local cross_rust_target="${cross_triples%%:*}" |
572 |
+ # extracts last element after : separator |
573 |
+ local cross_toolchain="${cross_triples##*:}" |
574 |
+ use llvm_targets_${cross_llvm_target} || die "need llvm_targets_${cross_llvm_target} target enabled" |
575 |
+ command -v ${cross_toolchain}-gcc > /dev/null 2>&1 || die "need ${cross_toolchain} cross toolchain" |
576 |
+ |
577 |
+ cat <<- _EOF_ >> "${S}"/config.toml |
578 |
+ [target.${cross_rust_target}] |
579 |
+ cc = "${cross_toolchain}-gcc" |
580 |
+ cxx = "${cross_toolchain}-g++" |
581 |
+ linker = "${cross_toolchain}-gcc" |
582 |
+ ar = "${cross_toolchain}-ar" |
583 |
+ _EOF_ |
584 |
+ if use system-llvm; then |
585 |
+ cat <<- _EOF_ >> "${S}"/config.toml |
586 |
+ llvm-config = "$(get_llvm_prefix "${LLVM_MAX_SLOT}")/bin/llvm-config" |
587 |
+ _EOF_ |
588 |
+ fi |
589 |
+ if [[ "${cross_toolchain}" == *-musl* ]]; then |
590 |
+ cat <<- _EOF_ >> "${S}"/config.toml |
591 |
+ musl-root = "$(${cross_toolchain}-gcc -print-sysroot)/usr" |
592 |
+ _EOF_ |
593 |
+ fi |
594 |
+ |
595 |
+ # append cross target to "normal" target list |
596 |
+ # example 'target = ["powerpc64le-unknown-linux-gnu"]' |
597 |
+ # becomes 'target = ["powerpc64le-unknown-linux-gnu","aarch64-unknown-linux-gnu"]' |
598 |
+ |
599 |
+ rust_targets="${rust_targets},\"${cross_rust_target}\"" |
600 |
+ sed -i "/^target = \[/ s#\[.*\]#\[${rust_targets}\]#" config.toml || die |
601 |
+ |
602 |
+ ewarn |
603 |
+ ewarn "Enabled ${cross_rust_target} rust target" |
604 |
+ ewarn "Using ${cross_toolchain} cross toolchain" |
605 |
+ ewarn |
606 |
+ if ! has_version -b 'sys-devel/binutils[multitarget]' ; then |
607 |
+ ewarn "'sys-devel/binutils[multitarget]' is not installed" |
608 |
+ ewarn "'strip' will be unable to strip cross libraries" |
609 |
+ ewarn "cross targets will be installed with full debug information" |
610 |
+ ewarn "enable 'multitarget' USE flag for binutils to be able to strip object files" |
611 |
+ ewarn |
612 |
+ ewarn "Alternatively llvm-strip can be used, it supports stripping any target" |
613 |
+ ewarn "define STRIP=\"llvm-strip\" to use it (experimental)" |
614 |
+ ewarn |
615 |
+ fi |
616 |
+ done |
617 |
+ fi # I_KNOW_WHAT_I_AM_DOING_CROSS |
618 |
+ |
619 |
+ einfo "Rust configured with the following flags:" |
620 |
+ echo |
621 |
+ echo RUSTFLAGS="${RUSTFLAGS:-}" |
622 |
+ echo RUSTFLAGS_BOOTSTRAP="${RUSTFLAGS_BOOTSTRAP:-}" |
623 |
+ echo RUSTFLAGS_NOT_BOOTSTRAP="${RUSTFLAGS_NOT_BOOTSTRAP:-}" |
624 |
+ env | grep "CARGO_TARGET_.*_RUSTFLAGS=" |
625 |
+ cat "${S}"/config.env || die |
626 |
+ echo |
627 |
+ einfo "config.toml contents:" |
628 |
+ cat "${S}"/config.toml || die |
629 |
+ echo |
630 |
+} |
631 |
+ |
632 |
+src_compile() { |
633 |
+ # we need \n IFS to have config.env with spaces loaded properly. #734018 |
634 |
+ ( |
635 |
+ IFS=$'\n' |
636 |
+ env $(cat "${S}"/config.env) RUST_BACKTRACE=1\ |
637 |
+ "${EPYTHON}" ./x.py build -vv --config="${S}"/config.toml -j$(makeopts_jobs) || die |
638 |
+ ) |
639 |
+} |
640 |
+ |
641 |
+src_test() { |
642 |
+ # https://rustc-dev-guide.rust-lang.org/tests/intro.html |
643 |
+ |
644 |
+ # those are basic and codegen tests. |
645 |
+ local tests=( |
646 |
+ codegen |
647 |
+ codegen-units |
648 |
+ compile-fail |
649 |
+ incremental |
650 |
+ mir-opt |
651 |
+ pretty |
652 |
+ run-make |
653 |
+ ) |
654 |
+ |
655 |
+ # fails if llvm is not built with ALL targets. |
656 |
+ # and known to fail with system llvm sometimes. |
657 |
+ use system-llvm || tests+=( assembly ) |
658 |
+ |
659 |
+ # fragile/expensive/less important tests |
660 |
+ # or tests that require extra builds |
661 |
+ # TODO: instead of skipping, just make some nonfatal. |
662 |
+ if [[ ${ERUST_RUN_EXTRA_TESTS:-no} != no ]]; then |
663 |
+ tests+=( |
664 |
+ rustdoc |
665 |
+ rustdoc-js |
666 |
+ rustdoc-js-std |
667 |
+ rustdoc-ui |
668 |
+ run-make-fulldeps |
669 |
+ ui |
670 |
+ ui-fulldeps |
671 |
+ ) |
672 |
+ fi |
673 |
+ |
674 |
+ local i failed=() |
675 |
+ einfo "rust_src_test: enabled tests ${tests[@]/#/src/test/}" |
676 |
+ for i in "${tests[@]}"; do |
677 |
+ local t="src/test/${i}" |
678 |
+ einfo "rust_src_test: running ${t}" |
679 |
+ if ! ( |
680 |
+ IFS=$'\n' |
681 |
+ env $(cat "${S}"/config.env) RUST_BACKTRACE=1 \ |
682 |
+ "${EPYTHON}" ./x.py test -vv --config="${S}"/config.toml \ |
683 |
+ -j$(makeopts_jobs) --no-doc --no-fail-fast "${t}" |
684 |
+ ) |
685 |
+ then |
686 |
+ failed+=( "${t}" ) |
687 |
+ eerror "rust_src_test: ${t} failed" |
688 |
+ fi |
689 |
+ done |
690 |
+ |
691 |
+ if [[ ${#failed[@]} -ne 0 ]]; then |
692 |
+ eerror "rust_src_test: failure summary: ${failed[@]}" |
693 |
+ die "aborting due to test failures" |
694 |
+ fi |
695 |
+} |
696 |
+ |
697 |
+src_install() { |
698 |
+ ( |
699 |
+ IFS=$'\n' |
700 |
+ env $(cat "${S}"/config.env) DESTDIR="${D}" \ |
701 |
+ "${EPYTHON}" ./x.py install -vv --config="${S}"/config.toml -j$(makeopts_jobs) || die |
702 |
+ ) |
703 |
+ |
704 |
+ # bug #689562, #689160 |
705 |
+ rm -v "${ED}/usr/lib/${PN}/${PV}/etc/bash_completion.d/cargo" || die |
706 |
+ rmdir -v "${ED}/usr/lib/${PN}/${PV}"/etc{/bash_completion.d,} || die |
707 |
+ newbashcomp src/tools/cargo/src/etc/cargo.bashcomp.sh cargo |
708 |
+ |
709 |
+ local symlinks=( |
710 |
+ cargo |
711 |
+ rustc |
712 |
+ rustdoc |
713 |
+ rust-gdb |
714 |
+ rust-gdbgui |
715 |
+ rust-lldb |
716 |
+ ) |
717 |
+ |
718 |
+ use clippy && symlinks+=( clippy-driver cargo-clippy ) |
719 |
+ use miri && symlinks+=( miri cargo-miri ) |
720 |
+ use rls && symlinks+=( rls ) |
721 |
+ use rustfmt && symlinks+=( rustfmt cargo-fmt ) |
722 |
+ |
723 |
+ einfo "installing eselect-rust symlinks and paths: ${symlinks[@]}" |
724 |
+ local i |
725 |
+ for i in "${symlinks[@]}"; do |
726 |
+ # we need realpath on /usr/bin/* symlink return version-appended binary path. |
727 |
+ # so /usr/bin/rustc should point to /usr/lib/rust/<ver>/bin/rustc-<ver> |
728 |
+ # need to fix eselect-rust to remove this hack. |
729 |
+ local ver_i="${i}-${PV}" |
730 |
+ if [[ -f "${ED}/usr/lib/${PN}/${PV}/bin/${i}" ]]; then |
731 |
+ einfo "Installing ${i} symlink" |
732 |
+ ln -v "${ED}/usr/lib/${PN}/${PV}/bin/${i}" "${ED}/usr/lib/${PN}/${PV}/bin/${ver_i}" || die |
733 |
+ else |
734 |
+ ewarn "${i} symlink requested, but source file not found" |
735 |
+ ewarn "please report this" |
736 |
+ fi |
737 |
+ dosym "../lib/${PN}/${PV}/bin/${ver_i}" "/usr/bin/${ver_i}" |
738 |
+ done |
739 |
+ |
740 |
+ # symlinks to switch components to active rust in eselect |
741 |
+ dosym "${PV}/lib" "/usr/lib/${PN}/lib-${PV}" |
742 |
+ dosym "${PV}/libexec" "/usr/lib/${PN}/libexec-${PV}" |
743 |
+ dosym "${PV}/share/man" "/usr/lib/${PN}/man-${PV}" |
744 |
+ dosym "rust/${PV}/lib/rustlib" "/usr/lib/rustlib-${PV}" |
745 |
+ dosym "../../lib/${PN}/${PV}/share/doc/rust" "/usr/share/doc/${P}" |
746 |
+ |
747 |
+ newenvd - "50${P}" <<-_EOF_ |
748 |
+ LDPATH="${EPREFIX}/usr/lib/rust/lib" |
749 |
+ MANPATH="${EPREFIX}/usr/lib/rust/man" |
750 |
+ $(use amd64 && usex elibc_musl 'CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_RUSTFLAGS="-C target-feature=-crt-static"' '') |
751 |
+ $(use arm64 && usex elibc_musl 'CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_RUSTFLAGS="-C target-feature=-crt-static"' '') |
752 |
+ _EOF_ |
753 |
+ |
754 |
+ rm -rf "${ED}/usr/lib/${PN}/${PV}"/*.old || die |
755 |
+ rm -rf "${ED}/usr/lib/${PN}/${PV}/doc"/*.old || die |
756 |
+ |
757 |
+ # note: eselect-rust adds EROOT to all paths below |
758 |
+ cat <<-_EOF_ > "${T}/provider-${P}" |
759 |
+ /usr/bin/cargo |
760 |
+ /usr/bin/rustdoc |
761 |
+ /usr/bin/rust-gdb |
762 |
+ /usr/bin/rust-gdbgui |
763 |
+ /usr/bin/rust-lldb |
764 |
+ /usr/lib/rustlib |
765 |
+ /usr/lib/rust/lib |
766 |
+ /usr/lib/rust/libexec |
767 |
+ /usr/lib/rust/man |
768 |
+ /usr/share/doc/rust |
769 |
+ _EOF_ |
770 |
+ |
771 |
+ if use clippy; then |
772 |
+ echo /usr/bin/clippy-driver >> "${T}/provider-${P}" |
773 |
+ echo /usr/bin/cargo-clippy >> "${T}/provider-${P}" |
774 |
+ fi |
775 |
+ if use miri; then |
776 |
+ echo /usr/bin/miri >> "${T}/provider-${P}" |
777 |
+ echo /usr/bin/cargo-miri >> "${T}/provider-${P}" |
778 |
+ fi |
779 |
+ if use rls; then |
780 |
+ echo /usr/bin/rls >> "${T}/provider-${P}" |
781 |
+ fi |
782 |
+ if use rustfmt; then |
783 |
+ echo /usr/bin/rustfmt >> "${T}/provider-${P}" |
784 |
+ echo /usr/bin/cargo-fmt >> "${T}/provider-${P}" |
785 |
+ fi |
786 |
+ |
787 |
+ insinto /etc/env.d/rust |
788 |
+ doins "${T}/provider-${P}" |
789 |
+} |
790 |
+ |
791 |
+pkg_postinst() { |
792 |
+ eselect rust update |
793 |
+ |
794 |
+ if has_version sys-devel/gdb || has_version dev-util/lldb; then |
795 |
+ elog "Rust installs a helper script for calling GDB and LLDB," |
796 |
+ elog "for your convenience it is installed under /usr/bin/rust-{gdb,lldb}-${PV}." |
797 |
+ fi |
798 |
+ |
799 |
+ if has_version app-editors/emacs; then |
800 |
+ elog "install app-emacs/rust-mode to get emacs support for rust." |
801 |
+ fi |
802 |
+ |
803 |
+ if has_version app-editors/gvim || has_version app-editors/vim; then |
804 |
+ elog "install app-vim/rust-vim to get vim support for rust." |
805 |
+ fi |
806 |
+} |
807 |
+ |
808 |
+pkg_postrm() { |
809 |
+ eselect rust cleanup |
810 |
+} |