1 |
commit: 0c6ec743ace5257046552f4d1745bbf46f2ed73c |
2 |
Author: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Jul 31 08:01:57 2020 +0000 |
4 |
Commit: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Jul 31 09:20:33 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0c6ec743 |
7 |
|
8 |
dev-lang/rust: bump to 1.45.1 |
9 |
|
10 |
Bug: https://bugs.gentoo.org/734018 |
11 |
Package-Manager: Portage-3.0.1, Repoman-2.3.23 |
12 |
Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org> |
13 |
|
14 |
dev-lang/rust/Manifest | 1 + |
15 |
dev-lang/rust/rust-1.45.1.ebuild | 504 +++++++++++++++++++++++++++++++++++++++ |
16 |
2 files changed, 505 insertions(+) |
17 |
|
18 |
diff --git a/dev-lang/rust/Manifest b/dev-lang/rust/Manifest |
19 |
index cdb786770d7..a212b99c9c1 100644 |
20 |
--- a/dev-lang/rust/Manifest |
21 |
+++ b/dev-lang/rust/Manifest |
22 |
@@ -73,3 +73,4 @@ DIST rustc-1.42.0-src.tar.xz 94186592 BLAKE2B 82298ef3da44188546bb945bcbfc1af630 |
23 |
DIST rustc-1.43.1-src.tar.xz 94405276 BLAKE2B 8679fe937abc4f758f3e35c2542d57cc1ad0bb72111597881873b30779b6e7b6711baa52493cb5ff954bf9cd31367b36db4e4fc8676635026059197a33659048 SHA512 24bb01237b1f3f5412109290bb4406b9742cf8956162f4090a98ed3a59a6e2e8dda399452bec1c93c8afdcf5effd98e4825e7f218238e0e88735c1ff4a5b385f |
24 |
DIST rustc-1.44.1-src.tar.xz 94756856 BLAKE2B 60f536c3ba0fa1fec4b6333ee57809ee5226090ad5041c14a136b4356ff3b898062e06c3fe54effe873e27931ac8fcb902cd48a38615a8de7eebc6ecb3bdc2bd SHA512 1c17002edae844a710db9b144c17171416330dc565343c65af8a6e112fb61555e2025bb4cf33cac1229d7df689e6ff8858b91ae00552400ccacafaf1de11849b |
25 |
DIST rustc-1.45.0-src.tar.xz 98677856 BLAKE2B 2558ba9444a53268de4f1604f13e701077a27e9480c97732a30706d656682672c17f87d8c015da3b839ed3b38081ef8d132bbab3522911bf9b50f018367e6ec7 SHA512 ff049eb65b36e6c64531d56251ebd446336a782f26504eccf375df1c22fa94b5f18e84660cef423edb815c1b31a1a7c9e57aea4aa0779576f3b0d7e81e19427b |
26 |
+DIST rustc-1.45.1-src.tar.xz 98686408 BLAKE2B 49eec97cccc9932915877cf28cc6b27b8008d5fecc2c6255d8974d9ee52375b95933d0052fad23ed2e60f4f08fcc305e1ca47239e8f5adaa8a3acb62eb2c1e14 SHA512 ef71a1706c84fa8557f481d310033285a41ecd9b8d537bacb846d01ed9954b679b915272db57cd96d5ee097cc0134899e584d517c467a9d2949496312e5995df |
27 |
|
28 |
diff --git a/dev-lang/rust/rust-1.45.1.ebuild b/dev-lang/rust/rust-1.45.1.ebuild |
29 |
new file mode 100644 |
30 |
index 00000000000..e1a02923012 |
31 |
--- /dev/null |
32 |
+++ b/dev-lang/rust/rust-1.45.1.ebuild |
33 |
@@ -0,0 +1,504 @@ |
34 |
+# Copyright 1999-2020 Gentoo Authors |
35 |
+# Distributed under the terms of the GNU General Public License v2 |
36 |
+ |
37 |
+EAPI=7 |
38 |
+ |
39 |
+PYTHON_COMPAT=( python3_{6,7,8} ) |
40 |
+ |
41 |
+inherit bash-completion-r1 check-reqs estack flag-o-matic llvm multiprocessing multilib-build python-any-r1 rust-toolchain toolchain-funcs |
42 |
+ |
43 |
+if [[ ${PV} = *beta* ]]; then |
44 |
+ betaver=${PV//*beta} |
45 |
+ BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}" |
46 |
+ MY_P="rustc-beta" |
47 |
+ SLOT="beta/${PV}" |
48 |
+ SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.xz" |
49 |
+else |
50 |
+ ABI_VER="$(ver_cut 1-2)" |
51 |
+ SLOT="stable/${ABI_VER}" |
52 |
+ MY_P="rustc-${PV}" |
53 |
+ SRC="${MY_P}-src.tar.xz" |
54 |
+ KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86" |
55 |
+fi |
56 |
+ |
57 |
+RUST_STAGE0_VERSION="1.$(($(ver_cut 2) - 1)).1" |
58 |
+ |
59 |
+DESCRIPTION="Systems programming language from Mozilla" |
60 |
+HOMEPAGE="https://www.rust-lang.org/" |
61 |
+ |
62 |
+SRC_URI=" |
63 |
+ https://static.rust-lang.org/dist/${SRC} -> rustc-${PV}-src.tar.xz |
64 |
+ !system-bootstrap? ( $(rust_all_arch_uris rust-${RUST_STAGE0_VERSION}) ) |
65 |
+" |
66 |
+ |
67 |
+ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM BPF Hexagon Lanai Mips MSP430 |
68 |
+ NVPTX PowerPC RISCV Sparc SystemZ WebAssembly X86 XCore ) |
69 |
+ALL_LLVM_TARGETS=( "${ALL_LLVM_TARGETS[@]/#/llvm_targets_}" ) |
70 |
+LLVM_TARGET_USEDEPS=${ALL_LLVM_TARGETS[@]/%/?} |
71 |
+ |
72 |
+LICENSE="|| ( MIT Apache-2.0 ) BSD-1 BSD-2 BSD-4 UoI-NCSA" |
73 |
+ |
74 |
+IUSE="clippy cpu_flags_x86_sse2 debug doc libressl miri nightly parallel-compiler rls rustfmt system-bootstrap system-llvm wasm ${ALL_LLVM_TARGETS[*]}" |
75 |
+ |
76 |
+# Please keep the LLVM dependency block separate. Since LLVM is slotted, |
77 |
+# we need to *really* make sure we're not pulling more than one slot |
78 |
+# simultaneously. |
79 |
+ |
80 |
+# How to use it: |
81 |
+# 1. List all the working slots (with min versions) in ||, newest first. |
82 |
+# 2. Update the := to specify *max* version, e.g. < 11. |
83 |
+# 3. Specify LLVM_MAX_SLOT, e.g. 10. |
84 |
+LLVM_DEPEND=" |
85 |
+ || ( |
86 |
+ sys-devel/llvm:10[${LLVM_TARGET_USEDEPS// /,}] |
87 |
+ sys-devel/llvm:9[${LLVM_TARGET_USEDEPS// /,}] |
88 |
+ ) |
89 |
+ <sys-devel/llvm-11:= |
90 |
+ wasm? ( sys-devel/lld ) |
91 |
+" |
92 |
+LLVM_MAX_SLOT=10 |
93 |
+ |
94 |
+BOOTSTRAP_DEPEND="|| ( >=dev-lang/rust-1.$(($(ver_cut 2) - 1)) >=dev-lang/rust-bin-1.$(($(ver_cut 2) - 1)) )" |
95 |
+ |
96 |
+BDEPEND="${PYTHON_DEPS} |
97 |
+ app-eselect/eselect-rust |
98 |
+ || ( |
99 |
+ >=sys-devel/gcc-4.7 |
100 |
+ >=sys-devel/clang-3.5 |
101 |
+ ) |
102 |
+ system-bootstrap? ( ${BOOTSTRAP_DEPEND} ) |
103 |
+ !system-llvm? ( |
104 |
+ dev-util/cmake |
105 |
+ dev-util/ninja |
106 |
+ ) |
107 |
+" |
108 |
+ |
109 |
+# libgit2 should be at least same as bundled into libgit-sys #707746 |
110 |
+DEPEND=" |
111 |
+ >=dev-libs/libgit2-0.99:= |
112 |
+ net-libs/libssh2:= |
113 |
+ net-libs/http-parser:= |
114 |
+ net-misc/curl:=[http2,ssl] |
115 |
+ sys-libs/zlib:= |
116 |
+ !libressl? ( dev-libs/openssl:0= ) |
117 |
+ libressl? ( dev-libs/libressl:0= ) |
118 |
+ elibc_musl? ( sys-libs/libunwind ) |
119 |
+ system-llvm? ( |
120 |
+ ${LLVM_DEPEND} |
121 |
+ ) |
122 |
+" |
123 |
+ |
124 |
+RDEPEND="${DEPEND} |
125 |
+ app-eselect/eselect-rust |
126 |
+" |
127 |
+ |
128 |
+REQUIRED_USE="|| ( ${ALL_LLVM_TARGETS[*]} ) |
129 |
+ miri? ( nightly ) |
130 |
+ parallel-compiler? ( nightly ) |
131 |
+ wasm? ( llvm_targets_WebAssembly ) |
132 |
+ x86? ( cpu_flags_x86_sse2 ) |
133 |
+" |
134 |
+ |
135 |
+QA_FLAGS_IGNORED=" |
136 |
+ usr/bin/.*-${PV} |
137 |
+ usr/lib.*/lib.*.so |
138 |
+ usr/lib/rustlib/.*/bin/rust-lld |
139 |
+ usr/lib/rustlib/.*/codegen-backends/librustc_codegen_llvm-llvm.so |
140 |
+ usr/lib/rustlib/.*/lib/lib.*.so |
141 |
+" |
142 |
+ |
143 |
+QA_SONAME=" |
144 |
+ usr/lib.*/lib.*.so |
145 |
+ usr/lib.*/librustc_macros.*.s |
146 |
+" |
147 |
+ |
148 |
+# tests need a bit more work, currently they are causing multiple |
149 |
+# re-compilations and somewhat fragile. |
150 |
+RESTRICT="test" |
151 |
+ |
152 |
+PATCHES=( |
153 |
+ "${FILESDIR}"/0012-Ignore-broken-and-non-applicable-tests.patch |
154 |
+ "${FILESDIR}"/1.44.0-libressl.patch |
155 |
+) |
156 |
+ |
157 |
+S="${WORKDIR}/${MY_P}-src" |
158 |
+ |
159 |
+toml_usex() { |
160 |
+ usex "$1" true false |
161 |
+} |
162 |
+ |
163 |
+pre_build_checks() { |
164 |
+ CHECKREQS_DISK_BUILD="9G" |
165 |
+ eshopts_push -s extglob |
166 |
+ if is-flagq '-g?(gdb)?([1-9])'; then |
167 |
+ CHECKREQS_DISK_BUILD="15G" |
168 |
+ fi |
169 |
+ eshopts_pop |
170 |
+ check-reqs_pkg_setup |
171 |
+} |
172 |
+ |
173 |
+pkg_pretend() { |
174 |
+ pre_build_checks |
175 |
+} |
176 |
+ |
177 |
+pkg_setup() { |
178 |
+ pre_build_checks |
179 |
+ python-any-r1_pkg_setup |
180 |
+ |
181 |
+ # required to link agains system libs, otherwise |
182 |
+ # crates use bundled sources and compile own static version |
183 |
+ export LIBGIT2_SYS_USE_PKG_CONFIG=1 |
184 |
+ export LIBSSH2_SYS_USE_PKG_CONFIG=1 |
185 |
+ export PKG_CONFIG_ALLOW_CROSS=1 |
186 |
+ |
187 |
+ if use system-llvm; then |
188 |
+ llvm_pkg_setup |
189 |
+ |
190 |
+ local llvm_config="$(get_llvm_prefix "$LLVM_MAX_SLOT")/bin/llvm-config" |
191 |
+ |
192 |
+ export LLVM_LINK_SHARED=1 |
193 |
+ export RUSTFLAGS="${RUSTFLAGS} -Lnative=$("${llvm_config}" --libdir)" |
194 |
+ fi |
195 |
+} |
196 |
+ |
197 |
+src_prepare() { |
198 |
+ if ! use system-bootstrap; then |
199 |
+ local rust_stage0_root="${WORKDIR}"/rust-stage0 |
200 |
+ local rust_stage0="rust-${RUST_STAGE0_VERSION}-$(rust_abi)" |
201 |
+ |
202 |
+ "${WORKDIR}/${rust_stage0}"/install.sh --disable-ldconfig \ |
203 |
+ --destdir="${rust_stage0_root}" --prefix=/ || die |
204 |
+ fi |
205 |
+ |
206 |
+ default |
207 |
+} |
208 |
+ |
209 |
+src_configure() { |
210 |
+ local rust_target="" rust_targets="" arch_cflags |
211 |
+ |
212 |
+ # Collect rust target names to compile standard libs for all ABIs. |
213 |
+ for v in $(multilib_get_enabled_abi_pairs); do |
214 |
+ rust_targets="${rust_targets},\"$(rust_abi $(get_abi_CHOST ${v##*.}))\"" |
215 |
+ done |
216 |
+ if use wasm; then |
217 |
+ rust_targets="${rust_targets},\"wasm32-unknown-unknown\"" |
218 |
+ if use system-llvm; then |
219 |
+ # un-hardcode rust-lld linker for this target |
220 |
+ # https://bugs.gentoo.org/715348 |
221 |
+ sed -i '/linker:/ s/rust-lld/wasm-ld/' src/librustc_target/spec/wasm32_base.rs || die |
222 |
+ fi |
223 |
+ fi |
224 |
+ rust_targets="${rust_targets#,}" |
225 |
+ |
226 |
+ local tools="\"cargo\"," |
227 |
+ if use clippy; then |
228 |
+ tools="\"clippy\",$tools" |
229 |
+ fi |
230 |
+ if use miri; then |
231 |
+ tools="\"miri\",$tools" |
232 |
+ fi |
233 |
+ if use rls; then |
234 |
+ tools="\"rls\",\"analysis\",\"src\",$tools" |
235 |
+ fi |
236 |
+ if use rustfmt; then |
237 |
+ tools="\"rustfmt\",$tools" |
238 |
+ fi |
239 |
+ |
240 |
+ local rust_stage0_root |
241 |
+ if use system-bootstrap; then |
242 |
+ rust_stage0_root="$(rustc --print sysroot)" |
243 |
+ else |
244 |
+ rust_stage0_root="${WORKDIR}"/rust-stage0 |
245 |
+ fi |
246 |
+ |
247 |
+ rust_target="$(rust_abi)" |
248 |
+ |
249 |
+ cat <<- EOF > "${S}"/config.toml |
250 |
+ [llvm] |
251 |
+ optimize = $(toml_usex !debug) |
252 |
+ release-debuginfo = $(toml_usex debug) |
253 |
+ assertions = $(toml_usex debug) |
254 |
+ ninja = true |
255 |
+ targets = "${LLVM_TARGETS// /;}" |
256 |
+ experimental-targets = "" |
257 |
+ link-shared = $(toml_usex system-llvm) |
258 |
+ [build] |
259 |
+ build = "${rust_target}" |
260 |
+ host = ["${rust_target}"] |
261 |
+ target = [${rust_targets}] |
262 |
+ cargo = "${rust_stage0_root}/bin/cargo" |
263 |
+ rustc = "${rust_stage0_root}/bin/rustc" |
264 |
+ docs = $(toml_usex doc) |
265 |
+ compiler-docs = $(toml_usex doc) |
266 |
+ submodules = false |
267 |
+ python = "${EPYTHON}" |
268 |
+ locked-deps = true |
269 |
+ vendor = true |
270 |
+ extended = true |
271 |
+ tools = [${tools}] |
272 |
+ verbose = 2 |
273 |
+ sanitizers = false |
274 |
+ profiler = false |
275 |
+ cargo-native-static = false |
276 |
+ [install] |
277 |
+ prefix = "${EPREFIX}/usr" |
278 |
+ libdir = "lib" |
279 |
+ docdir = "share/doc/${PF}" |
280 |
+ mandir = "share/man" |
281 |
+ [rust] |
282 |
+ optimize = true |
283 |
+ debug = $(toml_usex debug) |
284 |
+ debug-assertions = $(toml_usex debug) |
285 |
+ debuginfo-level-rustc = 0 |
286 |
+ backtrace = true |
287 |
+ incremental = false |
288 |
+ default-linker = "$(tc-getCC)" |
289 |
+ parallel-compiler = $(toml_usex parallel-compiler) |
290 |
+ channel = "$(usex nightly nightly stable)" |
291 |
+ rpath = false |
292 |
+ verbose-tests = true |
293 |
+ optimize-tests = $(toml_usex !debug) |
294 |
+ codegen-tests = true |
295 |
+ dist-src = false |
296 |
+ remap-debuginfo = true |
297 |
+ lld = $(usex system-llvm false $(toml_usex wasm)) |
298 |
+ backtrace-on-ice = true |
299 |
+ jemalloc = false |
300 |
+ [dist] |
301 |
+ src-tarball = false |
302 |
+ EOF |
303 |
+ |
304 |
+ for v in $(multilib_get_enabled_abi_pairs); do |
305 |
+ rust_target=$(rust_abi $(get_abi_CHOST ${v##*.})) |
306 |
+ arch_cflags="$(get_abi_CFLAGS ${v##*.})" |
307 |
+ |
308 |
+ cat <<- EOF >> "${S}"/config.env |
309 |
+ CFLAGS_${rust_target}=${arch_cflags} |
310 |
+ EOF |
311 |
+ |
312 |
+ cat <<- EOF >> "${S}"/config.toml |
313 |
+ [target.${rust_target}] |
314 |
+ cc = "$(tc-getBUILD_CC)" |
315 |
+ cxx = "$(tc-getBUILD_CXX)" |
316 |
+ linker = "$(tc-getCC)" |
317 |
+ ar = "$(tc-getAR)" |
318 |
+ EOF |
319 |
+ # librustc_target/spec/linux_musl_base.rs sets base.crt_static_default = true; |
320 |
+ if use elibc_musl; then |
321 |
+ cat <<- EOF >> "${S}"/config.toml |
322 |
+ crt-static = false |
323 |
+ EOF |
324 |
+ fi |
325 |
+ if use system-llvm; then |
326 |
+ cat <<- EOF >> "${S}"/config.toml |
327 |
+ llvm-config = "$(get_llvm_prefix "${LLVM_MAX_SLOT}")/bin/llvm-config" |
328 |
+ EOF |
329 |
+ fi |
330 |
+ done |
331 |
+ if use wasm; then |
332 |
+ cat <<- EOF >> "${S}"/config.toml |
333 |
+ [target.wasm32-unknown-unknown] |
334 |
+ linker = "$(usex system-llvm lld rust-lld)" |
335 |
+ EOF |
336 |
+ fi |
337 |
+ |
338 |
+ if [[ -n ${I_KNOW_WHAT_I_AM_DOING_CROSS} ]]; then #whitespace intentionally shifted below |
339 |
+ # experimental cross support |
340 |
+ # discussion: https://bugs.gentoo.org/679878 |
341 |
+ # TODO: c*flags, clang, system-llvm, cargo.eclass target support |
342 |
+ # it would be much better if we could split out stdlib |
343 |
+ # complilation to separate ebuild and abuse CATEGORY to |
344 |
+ # just install to /usr/lib/rustlib/<target> |
345 |
+ |
346 |
+ # extra targets defined as a bash array |
347 |
+ # spec format: <LLVM target>:<rust-target>:<CTARGET> |
348 |
+ # best place would be /etc/portage/env/dev-lang/rust |
349 |
+ # Example: |
350 |
+ # RUST_CROSS_TARGETS=( |
351 |
+ # "AArch64:aarch64-unknown-linux-gnu:aarch64-unknown-linux-gnu" |
352 |
+ # ) |
353 |
+ # no extra hand holding is done, no target transformations, all |
354 |
+ # values are passed as-is with just basic checks, so it's up to user to supply correct values |
355 |
+ # valid rust targets can be obtained with |
356 |
+ # rustc --print target-list |
357 |
+ # matching cross toolchain has to be installed |
358 |
+ # matching LLVM_TARGET has to be enabled for both rust and llvm (if using system one) |
359 |
+ # only gcc toolchains installed with crossdev are checked for now. |
360 |
+ |
361 |
+ # BUG: we can't pass host flags to cross compiler, so just filter for now |
362 |
+ # BUG: this should be more fine-grained. |
363 |
+ filter-flags '-mcpu=*' '-march=*' '-mtune=*' |
364 |
+ |
365 |
+ local cross_target_spec |
366 |
+ for cross_target_spec in "${RUST_CROSS_TARGETS[@]}";do |
367 |
+ # extracts first element form <LLVM target>:<rust-target>:<CTARGET> |
368 |
+ local cross_llvm_target="${cross_target_spec%%:*}" |
369 |
+ # extracts toolchain triples, <rust-target>:<CTARGET> |
370 |
+ local cross_triples="${cross_target_spec#*:}" |
371 |
+ # extracts first element after before : separator |
372 |
+ local cross_rust_target="${cross_triples%%:*}" |
373 |
+ # extracts last element after : separator |
374 |
+ local cross_toolchain="${cross_triples##*:}" |
375 |
+ use llvm_targets_${cross_llvm_target} || die "need llvm_targets_${cross_llvm_target} target enabled" |
376 |
+ command -v ${cross_toolchain}-gcc > /dev/null 2>&1 || die "need ${cross_toolchain} cross toolchain" |
377 |
+ |
378 |
+ cat <<- EOF >> "${S}"/config.toml |
379 |
+ [target.${cross_rust_target}] |
380 |
+ cc = "${cross_toolchain}-gcc" |
381 |
+ cxx = "${cross_toolchain}-g++" |
382 |
+ linker = "${cross_toolchain}-gcc" |
383 |
+ ar = "${cross_toolchain}-ar" |
384 |
+ EOF |
385 |
+ if use system-llvm; then |
386 |
+ cat <<- EOF >> "${S}"/config.toml |
387 |
+ llvm-config = "$(get_llvm_prefix "${LLVM_MAX_SLOT}")/bin/llvm-config" |
388 |
+ EOF |
389 |
+ fi |
390 |
+ |
391 |
+ # append cross target to "normal" target list |
392 |
+ # example 'target = ["powerpc64le-unknown-linux-gnu"]' |
393 |
+ # becomes 'target = ["powerpc64le-unknown-linux-gnu","aarch64-unknown-linux-gnu"]' |
394 |
+ |
395 |
+ rust_targets="${rust_targets},\"${cross_rust_target}\"" |
396 |
+ sed -i "/^target = \[/ s#\[.*\]#\[${rust_targets}\]#" config.toml || die |
397 |
+ |
398 |
+ ewarn |
399 |
+ ewarn "Enabled ${cross_rust_target} rust target" |
400 |
+ ewarn "Using ${cross_toolchain} cross toolchain" |
401 |
+ ewarn |
402 |
+ if ! has_version -b 'sys-devel/binutils[multitarget]' ; then |
403 |
+ ewarn "'sys-devel/binutils[multitarget]' is not installed" |
404 |
+ ewarn "'strip' will be unable to strip cross libraries" |
405 |
+ ewarn "cross targets will be installed with full debug information" |
406 |
+ ewarn "enable 'multitarget' USE flag for binutils to be able to strip object files" |
407 |
+ ewarn |
408 |
+ ewarn "Alternatively llvm-strip can be used, it supports stripping any target" |
409 |
+ ewarn "define STRIP=\"llvm-strip\" to use it (experimental)" |
410 |
+ ewarn |
411 |
+ fi |
412 |
+ done |
413 |
+ fi # I_KNOW_WHAT_I_AM_DOING_CROSS |
414 |
+ |
415 |
+ einfo "Rust configured with the following settings:" |
416 |
+ cat "${S}"/config.toml || die |
417 |
+} |
418 |
+ |
419 |
+src_compile() { |
420 |
+ env $(cat "${S}"/config.env) RUST_BACKTRACE=1\ |
421 |
+ "${EPYTHON}" ./x.py build -vv --config="${S}"/config.toml -j$(makeopts_jobs) || die |
422 |
+} |
423 |
+ |
424 |
+src_test() { |
425 |
+ env $(cat "${S}"/config.env) RUST_BACKTRACE=1\ |
426 |
+ "${EPYTHON}" ./x.py test -vv --config="${S}"/config.toml -j$(makeopts_jobs) --no-doc --no-fail-fast \ |
427 |
+ src/test/codegen \ |
428 |
+ src/test/codegen-units \ |
429 |
+ src/test/compile-fail \ |
430 |
+ src/test/incremental \ |
431 |
+ src/test/mir-opt \ |
432 |
+ src/test/pretty \ |
433 |
+ src/test/run-fail \ |
434 |
+ src/test/run-make \ |
435 |
+ src/test/run-make-fulldeps \ |
436 |
+ src/test/ui \ |
437 |
+ src/test/ui-fulldeps || die |
438 |
+} |
439 |
+ |
440 |
+src_install() { |
441 |
+ env $(cat "${S}"/config.env) DESTDIR="${D}" \ |
442 |
+ "${EPYTHON}" ./x.py install -vv --config="${S}"/config.toml || die |
443 |
+ |
444 |
+ # bug #689562, #689160 |
445 |
+ rm "${D}/etc/bash_completion.d/cargo" || die |
446 |
+ rmdir "${D}"/etc{/bash_completion.d,} || die |
447 |
+ dobashcomp build/tmp/dist/cargo-image/etc/bash_completion.d/cargo |
448 |
+ |
449 |
+ mv "${ED}/usr/bin/rustc" "${ED}/usr/bin/rustc-${PV}" || die |
450 |
+ mv "${ED}/usr/bin/rustdoc" "${ED}/usr/bin/rustdoc-${PV}" || die |
451 |
+ mv "${ED}/usr/bin/rust-gdb" "${ED}/usr/bin/rust-gdb-${PV}" || die |
452 |
+ mv "${ED}/usr/bin/rust-gdbgui" "${ED}/usr/bin/rust-gdbgui-${PV}" || die |
453 |
+ mv "${ED}/usr/bin/rust-lldb" "${ED}/usr/bin/rust-lldb-${PV}" || die |
454 |
+ mv "${ED}/usr/bin/cargo" "${ED}/usr/bin/cargo-${PV}" || die |
455 |
+ if use clippy; then |
456 |
+ mv "${ED}/usr/bin/clippy-driver" "${ED}/usr/bin/clippy-driver-${PV}" || die |
457 |
+ mv "${ED}/usr/bin/cargo-clippy" "${ED}/usr/bin/cargo-clippy-${PV}" || die |
458 |
+ fi |
459 |
+ if use miri; then |
460 |
+ mv "${ED}/usr/bin/miri" "${ED}/usr/bin/miri-${PV}" || die |
461 |
+ mv "${ED}/usr/bin/cargo-miri" "${ED}/usr/bin/cargo-miri-${PV}" || die |
462 |
+ fi |
463 |
+ if use rls; then |
464 |
+ mv "${ED}/usr/bin/rls" "${ED}/usr/bin/rls-${PV}" || die |
465 |
+ fi |
466 |
+ if use rustfmt; then |
467 |
+ mv "${ED}/usr/bin/rustfmt" "${ED}/usr/bin/rustfmt-${PV}" || die |
468 |
+ mv "${ED}/usr/bin/cargo-fmt" "${ED}/usr/bin/cargo-fmt-${PV}" || die |
469 |
+ fi |
470 |
+ |
471 |
+ # Move public shared libs to abi specific libdir |
472 |
+ # Private and target specific libs MUST stay in /usr/lib/rustlib/${rust_target}/lib |
473 |
+ if [[ $(get_libdir) != lib ]]; then |
474 |
+ dodir /usr/$(get_libdir) |
475 |
+ mv "${ED}/usr/lib"/*.so "${ED}/usr/$(get_libdir)/" || die |
476 |
+ fi |
477 |
+ |
478 |
+ dodoc COPYRIGHT |
479 |
+ rm "${ED}/usr/share/doc/${P}"/*.old || die |
480 |
+ rm "${ED}/usr/share/doc/${P}/LICENSE-APACHE" || die |
481 |
+ rm "${ED}/usr/share/doc/${P}/LICENSE-MIT" || die |
482 |
+ |
483 |
+ # note: eselect-rust adds EROOT to all paths below |
484 |
+ cat <<-EOF > "${T}/provider-${P}" |
485 |
+ /usr/bin/cargo |
486 |
+ /usr/bin/rustdoc |
487 |
+ /usr/bin/rust-gdb |
488 |
+ /usr/bin/rust-gdbgui |
489 |
+ /usr/bin/rust-lldb |
490 |
+ EOF |
491 |
+ if use clippy; then |
492 |
+ echo /usr/bin/clippy-driver >> "${T}/provider-${P}" |
493 |
+ echo /usr/bin/cargo-clippy >> "${T}/provider-${P}" |
494 |
+ fi |
495 |
+ if use miri; then |
496 |
+ echo /usr/bin/miri >> "${T}/provider-${P}" |
497 |
+ echo /usr/bin/cargo-miri >> "${T}/provider-${P}" |
498 |
+ fi |
499 |
+ if use rls; then |
500 |
+ echo /usr/bin/rls >> "${T}/provider-${P}" |
501 |
+ fi |
502 |
+ if use rustfmt; then |
503 |
+ echo /usr/bin/rustfmt >> "${T}/provider-${P}" |
504 |
+ echo /usr/bin/cargo-fmt >> "${T}/provider-${P}" |
505 |
+ fi |
506 |
+ |
507 |
+ insinto /etc/env.d/rust |
508 |
+ doins "${T}/provider-${P}" |
509 |
+} |
510 |
+ |
511 |
+pkg_postinst() { |
512 |
+ eselect rust update --if-unset |
513 |
+ |
514 |
+ elog "Rust installs a helper script for calling GDB and LLDB," |
515 |
+ elog "for your convenience it is installed under /usr/bin/rust-{gdb,lldb}-${PV}." |
516 |
+ |
517 |
+ if has_version app-editors/emacs; then |
518 |
+ elog "install app-emacs/rust-mode to get emacs support for rust." |
519 |
+ fi |
520 |
+ |
521 |
+ if has_version app-editors/gvim || has_version app-editors/vim; then |
522 |
+ elog "install app-vim/rust-vim to get vim support for rust." |
523 |
+ fi |
524 |
+ |
525 |
+ if use elibc_musl; then |
526 |
+ ewarn "${PN} on *-musl targets is configured with crt-static" |
527 |
+ ewarn "" |
528 |
+ ewarn "you will need to set RUSTFLAGS=\"-C target-feature=-crt-static\" in make.conf" |
529 |
+ ewarn "to use it with portage, otherwise you may see failures like" |
530 |
+ ewarn "error: cannot produce proc-macro for serde_derive v1.0.98 as the target " |
531 |
+ ewarn "x86_64-unknown-linux-musl does not support these crate types" |
532 |
+ fi |
533 |
+} |
534 |
+ |
535 |
+pkg_postrm() { |
536 |
+ eselect rust cleanup |
537 |
+} |