Gentoo Archives: gentoo-commits

From: Georgy Yakovlev <gyakovlev@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-lang/rust/
Date: Sun, 18 Apr 2021 11:27:05
Message-Id: 1618745185.78b40d2e6a9eb40ce44a8b1177bb759aa41d4f45.gyakovlev@gentoo
1 commit: 78b40d2e6a9eb40ce44a8b1177bb759aa41d4f45
2 Author: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
3 AuthorDate: Sun Apr 18 11:24:31 2021 +0000
4 Commit: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
5 CommitDate: Sun Apr 18 11:26:25 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=78b40d2e
7
8 dev-lang/rust: drop rust-1.51.0
9
10 Bug: https://bugs.gentoo.org/782367
11 Bug: https://bugs.gentoo.org/782799
12 Closes: https://bugs.gentoo.org/783468
13
14 Package-Manager: Portage-3.0.18, Repoman-3.0.3
15 Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org>
16
17 dev-lang/rust/rust-1.51.0.ebuild | 617 ---------------------------------------
18 1 file changed, 617 deletions(-)
19
20 diff --git a/dev-lang/rust/rust-1.51.0.ebuild b/dev-lang/rust/rust-1.51.0.ebuild
21 deleted file mode 100644
22 index 45c23455773..00000000000
23 --- a/dev-lang/rust/rust-1.51.0.ebuild
24 +++ /dev/null
25 @@ -1,617 +0,0 @@
26 -# Copyright 1999-2021 Gentoo Authors
27 -# Distributed under the terms of the GNU General Public License v2
28 -
29 -EAPI=7
30 -
31 -PYTHON_COMPAT=( python3_{7..9} )
32 -
33 -inherit bash-completion-r1 check-reqs estack flag-o-matic llvm multiprocessing multilib-build python-any-r1 rust-toolchain toolchain-funcs
34 -
35 -if [[ ${PV} = *beta* ]]; then
36 - betaver=${PV//*beta}
37 - BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
38 - MY_P="rustc-beta"
39 - SLOT="beta/${PV}"
40 - SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.xz -> rustc-${PV}-src.tar.xz"
41 -else
42 - ABI_VER="$(ver_cut 1-2)"
43 - SLOT="stable/${ABI_VER}"
44 - MY_P="rustc-${PV}"
45 - SRC="${MY_P}-src.tar.xz"
46 - KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86"
47 -fi
48 -
49 -RUST_STAGE0_VERSION="1.$(($(ver_cut 2) - 1)).0"
50 -
51 -DESCRIPTION="Systems programming language from Mozilla"
52 -HOMEPAGE="https://www.rust-lang.org/"
53 -
54 -SRC_URI="
55 - https://static.rust-lang.org/dist/${SRC}
56 - !system-bootstrap? ( $(rust_all_arch_uris rust-${RUST_STAGE0_VERSION}) )
57 -"
58 -
59 -# keep in sync with llvm ebuild of the same version as bundled one.
60 -ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM AVR BPF Hexagon Lanai Mips MSP430
61 - NVPTX PowerPC RISCV Sparc SystemZ WebAssembly X86 XCore )
62 -ALL_LLVM_TARGETS=( "${ALL_LLVM_TARGETS[@]/#/llvm_targets_}" )
63 -LLVM_TARGET_USEDEPS=${ALL_LLVM_TARGETS[@]/%/?}
64 -
65 -LICENSE="|| ( MIT Apache-2.0 ) BSD-1 BSD-2 BSD-4 UoI-NCSA"
66 -
67 -IUSE="clippy cpu_flags_x86_sse2 debug doc libressl miri nightly parallel-compiler rls rustfmt system-bootstrap system-llvm test wasm ${ALL_LLVM_TARGETS[*]}"
68 -
69 -# Please keep the LLVM dependency block separate. Since LLVM is slotted,
70 -# we need to *really* make sure we're not pulling more than one slot
71 -# simultaneously.
72 -
73 -# How to use it:
74 -# 1. List all the working slots (with min versions) in ||, newest first.
75 -# 2. Update the := to specify *max* version, e.g. < 12.
76 -# 3. Specify LLVM_MAX_SLOT, e.g. 11.
77 -LLVM_DEPEND="
78 - || (
79 - sys-devel/llvm:11[${LLVM_TARGET_USEDEPS// /,}]
80 - )
81 - <sys-devel/llvm-12:=
82 - wasm? ( sys-devel/lld )
83 -"
84 -LLVM_MAX_SLOT=11
85 -
86 -# to bootstrap we need at least exactly previous version, or same.
87 -# most of the time previous versions fail to bootstrap with newer
88 -# for example 1.47.x, requires at least 1.46.x, 1.47.x is ok,
89 -# but it fails to bootstrap with 1.48.x
90 -# https://github.com/rust-lang/rust/blob/${PV}/src/stage0.txt
91 -BOOTSTRAP_DEPEND="||
92 - (
93 - =dev-lang/rust-$(ver_cut 1).$(($(ver_cut 2) - 1))*
94 - =dev-lang/rust-bin-$(ver_cut 1).$(($(ver_cut 2) - 1))*
95 - =dev-lang/rust-$(ver_cut 1).$(ver_cut 2)*
96 - =dev-lang/rust-bin-$(ver_cut 1).$(ver_cut 2)*
97 - )
98 -"
99 -
100 -BDEPEND="${PYTHON_DEPS}
101 - app-eselect/eselect-rust
102 - || (
103 - >=sys-devel/gcc-4.7
104 - >=sys-devel/clang-3.5
105 - )
106 - system-bootstrap? ( ${BOOTSTRAP_DEPEND} )
107 - !system-llvm? (
108 - dev-util/cmake
109 - dev-util/ninja
110 - )
111 -"
112 -
113 -DEPEND="
114 - >=app-arch/xz-utils-5.2
115 - net-misc/curl:=[http2,ssl]
116 - sys-libs/zlib:=
117 - !libressl? ( dev-libs/openssl:0= )
118 - libressl? ( dev-libs/libressl:0= )
119 - elibc_musl? ( sys-libs/libunwind:= )
120 - system-llvm? (
121 - ${LLVM_DEPEND}
122 - )
123 -"
124 -
125 -# we need to block older versions due to layout changes.
126 -RDEPEND="${DEPEND}
127 - app-eselect/eselect-rust
128 - !<dev-lang/rust-1.47.0-r1
129 - !<dev-lang/rust-bin-1.47.0-r1
130 -"
131 -
132 -REQUIRED_USE="|| ( ${ALL_LLVM_TARGETS[*]} )
133 - miri? ( nightly )
134 - parallel-compiler? ( nightly )
135 - test? ( ${ALL_LLVM_TARGETS[*]} )
136 - wasm? ( llvm_targets_WebAssembly )
137 - x86? ( cpu_flags_x86_sse2 )
138 -"
139 -
140 -# we don't use cmake.eclass, but can get a warnings
141 -CMAKE_WARN_UNUSED_CLI=no
142 -
143 -QA_FLAGS_IGNORED="
144 - usr/lib/${PN}/${PV}/bin/.*
145 - usr/lib/${PN}/${PV}/libexec/.*
146 - usr/lib/${PN}/${PV}/lib/lib.*.so
147 - usr/lib/${PN}/${PV}/lib/rustlib/.*/bin/.*
148 - usr/lib/${PN}/${PV}/lib/rustlib/.*/lib/lib.*.so
149 -"
150 -
151 -QA_SONAME="
152 - usr/lib/${PN}/${PV}/lib/lib.*.so.*
153 - usr/lib/${PN}/${PV}/lib/rustlib/.*/lib/lib.*.so
154 -"
155 -
156 -# causes double bootstrap
157 -RESTRICT="test"
158 -
159 -PATCHES=(
160 - "${FILESDIR}"/1.47.0-libressl.patch
161 - "${FILESDIR}"/1.47.0-ignore-broken-and-non-applicable-tests.patch
162 - "${FILESDIR}"/1.49.0-gentoo-musl-target-specs.patch
163 - "${FILESDIR}"/1.51.0-bootstrap-panic.patch
164 -)
165 -
166 -S="${WORKDIR}/${MY_P}-src"
167 -
168 -toml_usex() {
169 - usex "${1}" true false
170 -}
171 -
172 -boostrap_rust_version_check() {
173 - # never call from pkg_pretend. eselect-rust may be not installed yet.
174 - [[ ${MERGE_TYPE} == binary ]] && return
175 - local rustc_wanted="$(ver_cut 1).$(($(ver_cut 2) - 1))"
176 - local rustc_toonew="$(ver_cut 1).$(($(ver_cut 2) + 1))"
177 - local rustc_version=( $(eselect --brief rust show 2>/dev/null) )
178 - rustc_version=${rustc_version[0]#rust-bin-}
179 - rustc_version=${rustc_version#rust-}
180 -
181 - [[ -z "${rustc_version}" ]] && die "Failed to determine rust version, check 'eselect rust' output"
182 -
183 - if ver_test "${rustc_version}" -lt "${rustc_wanted}" ; then
184 - eerror "Rust >=${rustc_wanted} is required"
185 - eerror "please run 'eselect rust' and set correct rust version"
186 - die "selected rust version is too old"
187 - elif ver_test "${rustc_version}" -ge "${rustc_toonew}" ; then
188 - eerror "Rust <${rustc_toonew} is required"
189 - eerror "please run 'eselect rust' and set correct rust version"
190 - die "selected rust version is too new"
191 - else
192 - einfo "Using rust ${rustc_version} to build"
193 - fi
194 -}
195 -
196 -pre_build_checks() {
197 - local M=6144
198 - M=$(( $(usex clippy 128 0) + ${M} ))
199 - M=$(( $(usex miri 128 0) + ${M} ))
200 - M=$(( $(usex rls 512 0) + ${M} ))
201 - M=$(( $(usex rustfmt 256 0) + ${M} ))
202 - M=$(( $(usex system-llvm 0 2048) + ${M} ))
203 - M=$(( $(usex wasm 256 0) + ${M} ))
204 - M=$(( $(usex debug 15 10) * ${M} / 10 ))
205 - eshopts_push -s extglob
206 - if is-flagq '-g?(gdb)?([1-9])'; then
207 - M=$(( 15 * ${M} / 10 ))
208 - fi
209 - eshopts_pop
210 - M=$(( $(usex system-bootstrap 0 1024) + ${M} ))
211 - M=$(( $(usex doc 256 0) + ${M} ))
212 - CHECKREQS_DISK_BUILD=${M}M check-reqs_pkg_${EBUILD_PHASE}
213 -}
214 -
215 -pkg_pretend() {
216 - pre_build_checks
217 -}
218 -
219 -pkg_setup() {
220 - pre_build_checks
221 - python-any-r1_pkg_setup
222 -
223 - export LIBGIT2_NO_PKG_CONFIG=1 #749381
224 -
225 - use system-bootstrap && boostrap_rust_version_check
226 -
227 - if use system-llvm; then
228 - llvm_pkg_setup
229 -
230 - local llvm_config="$(get_llvm_prefix "$LLVM_MAX_SLOT")/bin/llvm-config"
231 - export LLVM_LINK_SHARED=1
232 - export RUSTFLAGS="${RUSTFLAGS} -Lnative=$("${llvm_config}" --libdir)"
233 - fi
234 -}
235 -
236 -src_prepare() {
237 - if ! use system-bootstrap; then
238 - local rust_stage0_root="${WORKDIR}"/rust-stage0
239 - local rust_stage0="rust-${RUST_STAGE0_VERSION}-$(rust_abi)"
240 -
241 - "${WORKDIR}/${rust_stage0}"/install.sh --disable-ldconfig \
242 - --destdir="${rust_stage0_root}" --prefix=/ || die
243 - fi
244 -
245 - default
246 -}
247 -
248 -src_configure() {
249 - local rust_target="" rust_targets="" arch_cflags
250 -
251 - # Collect rust target names to compile standard libs for all ABIs.
252 - for v in $(multilib_get_enabled_abi_pairs); do
253 - rust_targets="${rust_targets},\"$(rust_abi $(get_abi_CHOST ${v##*.}))\""
254 - done
255 - if use wasm; then
256 - rust_targets="${rust_targets},\"wasm32-unknown-unknown\""
257 - if use system-llvm; then
258 - # un-hardcode rust-lld linker for this target
259 - # https://bugs.gentoo.org/715348
260 - sed -i '/linker:/ s/rust-lld/wasm-ld/' compiler/rustc_target/src/spec/wasm32_base.rs || die
261 - fi
262 - fi
263 - rust_targets="${rust_targets#,}"
264 -
265 - local tools="\"cargo\","
266 - if use clippy; then
267 - tools="\"clippy\",$tools"
268 - fi
269 - if use miri; then
270 - tools="\"miri\",$tools"
271 - fi
272 - if use rls; then
273 - tools="\"rls\",\"analysis\",\"src\",$tools"
274 - fi
275 - if use rustfmt; then
276 - tools="\"rustfmt\",$tools"
277 - fi
278 -
279 - local rust_stage0_root
280 - if use system-bootstrap; then
281 - rust_stage0_root="$(rustc --print sysroot)"
282 - else
283 - rust_stage0_root="${WORKDIR}"/rust-stage0
284 - fi
285 -
286 - rust_target="$(rust_abi)"
287 -
288 - cat <<- _EOF_ > "${S}"/config.toml
289 - [llvm]
290 - download-ci-llvm = false
291 - optimize = $(toml_usex !debug)
292 - release-debuginfo = $(toml_usex debug)
293 - assertions = $(toml_usex debug)
294 - ninja = true
295 - targets = "${LLVM_TARGETS// /;}"
296 - experimental-targets = ""
297 - link-shared = $(toml_usex system-llvm)
298 - [build]
299 - build = "${rust_target}"
300 - host = ["${rust_target}"]
301 - target = [${rust_targets}]
302 - cargo = "${rust_stage0_root}/bin/cargo"
303 - rustc = "${rust_stage0_root}/bin/rustc"
304 - docs = $(toml_usex doc)
305 - compiler-docs = $(toml_usex doc)
306 - submodules = false
307 - python = "${EPYTHON}"
308 - locked-deps = true
309 - vendor = true
310 - extended = true
311 - tools = [${tools}]
312 - verbose = 2
313 - sanitizers = false
314 - profiler = false
315 - cargo-native-static = false
316 - [install]
317 - prefix = "${EPREFIX}/usr/lib/${PN}/${PV}"
318 - sysconfdir = "etc"
319 - docdir = "share/doc/rust"
320 - bindir = "bin"
321 - libdir = "lib"
322 - mandir = "share/man"
323 - [rust]
324 - # https://github.com/rust-lang/rust/issues/54872
325 - codegen-units-std = 1
326 - optimize = true
327 - debug = $(toml_usex debug)
328 - debug-assertions = $(toml_usex debug)
329 - debuginfo-level-rustc = 0
330 - backtrace = true
331 - incremental = false
332 - default-linker = "$(tc-getCC)"
333 - parallel-compiler = $(toml_usex parallel-compiler)
334 - channel = "$(usex nightly nightly stable)"
335 - description = "gentoo"
336 - rpath = false
337 - verbose-tests = true
338 - optimize-tests = $(toml_usex !debug)
339 - codegen-tests = true
340 - dist-src = false
341 - remap-debuginfo = true
342 - lld = $(usex system-llvm false $(toml_usex wasm))
343 - backtrace-on-ice = true
344 - jemalloc = false
345 - [dist]
346 - src-tarball = false
347 - _EOF_
348 -
349 - for v in $(multilib_get_enabled_abi_pairs); do
350 - rust_target=$(rust_abi $(get_abi_CHOST ${v##*.}))
351 - arch_cflags="$(get_abi_CFLAGS ${v##*.})"
352 -
353 - cat <<- _EOF_ >> "${S}"/config.env
354 - CFLAGS_${rust_target}=${arch_cflags}
355 - _EOF_
356 -
357 - cat <<- _EOF_ >> "${S}"/config.toml
358 - [target.${rust_target}]
359 - cc = "$(tc-getBUILD_CC)"
360 - cxx = "$(tc-getBUILD_CXX)"
361 - linker = "$(tc-getCC)"
362 - ar = "$(tc-getAR)"
363 - _EOF_
364 - # librustc_target/spec/linux_musl_base.rs sets base.crt_static_default = true;
365 - if use elibc_musl; then
366 - cat <<- _EOF_ >> "${S}"/config.toml
367 - crt-static = false
368 - _EOF_
369 - fi
370 - if use system-llvm; then
371 - cat <<- _EOF_ >> "${S}"/config.toml
372 - llvm-config = "$(get_llvm_prefix "${LLVM_MAX_SLOT}")/bin/llvm-config"
373 - _EOF_
374 - fi
375 - done
376 - if use wasm; then
377 - cat <<- _EOF_ >> "${S}"/config.toml
378 - [target.wasm32-unknown-unknown]
379 - linker = "$(usex system-llvm lld rust-lld)"
380 - _EOF_
381 - fi
382 -
383 - if [[ -n ${I_KNOW_WHAT_I_AM_DOING_CROSS} ]]; then # whitespace intentionally shifted below
384 - # experimental cross support
385 - # discussion: https://bugs.gentoo.org/679878
386 - # TODO: c*flags, clang, system-llvm, cargo.eclass target support
387 - # it would be much better if we could split out stdlib
388 - # complilation to separate ebuild and abuse CATEGORY to
389 - # just install to /usr/lib/rustlib/<target>
390 -
391 - # extra targets defined as a bash array
392 - # spec format: <LLVM target>:<rust-target>:<CTARGET>
393 - # best place would be /etc/portage/env/dev-lang/rust
394 - # Example:
395 - # RUST_CROSS_TARGETS=(
396 - # "AArch64:aarch64-unknown-linux-gnu:aarch64-unknown-linux-gnu"
397 - # )
398 - # no extra hand holding is done, no target transformations, all
399 - # values are passed as-is with just basic checks, so it's up to user to supply correct values
400 - # valid rust targets can be obtained with
401 - # rustc --print target-list
402 - # matching cross toolchain has to be installed
403 - # matching LLVM_TARGET has to be enabled for both rust and llvm (if using system one)
404 - # only gcc toolchains installed with crossdev are checked for now.
405 -
406 - # BUG: we can't pass host flags to cross compiler, so just filter for now
407 - # BUG: this should be more fine-grained.
408 - filter-flags '-mcpu=*' '-march=*' '-mtune=*'
409 -
410 - local cross_target_spec
411 - for cross_target_spec in "${RUST_CROSS_TARGETS[@]}";do
412 - # extracts first element form <LLVM target>:<rust-target>:<CTARGET>
413 - local cross_llvm_target="${cross_target_spec%%:*}"
414 - # extracts toolchain triples, <rust-target>:<CTARGET>
415 - local cross_triples="${cross_target_spec#*:}"
416 - # extracts first element after before : separator
417 - local cross_rust_target="${cross_triples%%:*}"
418 - # extracts last element after : separator
419 - local cross_toolchain="${cross_triples##*:}"
420 - use llvm_targets_${cross_llvm_target} || die "need llvm_targets_${cross_llvm_target} target enabled"
421 - command -v ${cross_toolchain}-gcc > /dev/null 2>&1 || die "need ${cross_toolchain} cross toolchain"
422 -
423 - cat <<- _EOF_ >> "${S}"/config.toml
424 - [target.${cross_rust_target}]
425 - cc = "${cross_toolchain}-gcc"
426 - cxx = "${cross_toolchain}-g++"
427 - linker = "${cross_toolchain}-gcc"
428 - ar = "${cross_toolchain}-ar"
429 - _EOF_
430 - if use system-llvm; then
431 - cat <<- _EOF_ >> "${S}"/config.toml
432 - llvm-config = "$(get_llvm_prefix "${LLVM_MAX_SLOT}")/bin/llvm-config"
433 - _EOF_
434 - fi
435 -
436 - # append cross target to "normal" target list
437 - # example 'target = ["powerpc64le-unknown-linux-gnu"]'
438 - # becomes 'target = ["powerpc64le-unknown-linux-gnu","aarch64-unknown-linux-gnu"]'
439 -
440 - rust_targets="${rust_targets},\"${cross_rust_target}\""
441 - sed -i "/^target = \[/ s#\[.*\]#\[${rust_targets}\]#" config.toml || die
442 -
443 - ewarn
444 - ewarn "Enabled ${cross_rust_target} rust target"
445 - ewarn "Using ${cross_toolchain} cross toolchain"
446 - ewarn
447 - if ! has_version -b 'sys-devel/binutils[multitarget]' ; then
448 - ewarn "'sys-devel/binutils[multitarget]' is not installed"
449 - ewarn "'strip' will be unable to strip cross libraries"
450 - ewarn "cross targets will be installed with full debug information"
451 - ewarn "enable 'multitarget' USE flag for binutils to be able to strip object files"
452 - ewarn
453 - ewarn "Alternatively llvm-strip can be used, it supports stripping any target"
454 - ewarn "define STRIP=\"llvm-strip\" to use it (experimental)"
455 - ewarn
456 - fi
457 - done
458 - fi # I_KNOW_WHAT_I_AM_DOING_CROSS
459 -
460 - einfo "Rust configured with the following settings:"
461 - cat "${S}"/config.toml || die
462 -}
463 -
464 -src_compile() {
465 - # we need \n IFS to have config.env with spaces loaded properly. #734018
466 - (
467 - IFS=$'\n'
468 - env $(cat "${S}"/config.env) RUST_BACKTRACE=1\
469 - "${EPYTHON}" ./x.py dist -vv --config="${S}"/config.toml -j$(makeopts_jobs) || die
470 - )
471 -}
472 -
473 -src_test() {
474 - # https://rustc-dev-guide.rust-lang.org/tests/intro.html
475 -
476 - # those are basic and codegen tests.
477 - local tests=(
478 - codegen
479 - codegen-units
480 - compile-fail
481 - incremental
482 - mir-opt
483 - pretty
484 - run-make
485 - )
486 -
487 - # fails if llvm is not built with ALL targets.
488 - # and known to fail with system llvm sometimes.
489 - use system-llvm || tests+=( assembly )
490 -
491 - # fragile/expensive/less important tests
492 - # or tests that require extra builds
493 - # TODO: instead of skipping, just make some nonfatal.
494 - if [[ ${ERUST_RUN_EXTRA_TESTS:-no} != no ]]; then
495 - tests+=(
496 - rustdoc
497 - rustdoc-js
498 - rustdoc-js-std
499 - rustdoc-ui
500 - run-make-fulldeps
501 - ui
502 - ui-fulldeps
503 - )
504 - fi
505 -
506 - local i failed=()
507 - einfo "rust_src_test: enabled tests ${tests[@]/#/src/test/}"
508 - for i in "${tests[@]}"; do
509 - local t="src/test/${i}"
510 - einfo "rust_src_test: running ${t}"
511 - if ! (
512 - IFS=$'\n'
513 - env $(cat "${S}"/config.env) RUST_BACKTRACE=1 \
514 - "${EPYTHON}" ./x.py test -vv --config="${S}"/config.toml \
515 - -j$(makeopts_jobs) --no-doc --no-fail-fast "${t}"
516 - )
517 - then
518 - failed+=( "${t}" )
519 - eerror "rust_src_test: ${t} failed"
520 - fi
521 - done
522 -
523 - if [[ ${#failed[@]} -ne 0 ]]; then
524 - eerror "rust_src_test: failure summary: ${failed[@]}"
525 - die "aborting due to test failures"
526 - fi
527 -}
528 -
529 -src_install() {
530 - (
531 - IFS=$'\n'
532 - env $(cat "${S}"/config.env) DESTDIR="${D}" \
533 - "${EPYTHON}" ./x.py install -vv --config="${S}"/config.toml || die
534 - )
535 -
536 - # bug #689562, #689160
537 - rm -v "${ED}/usr/lib/${PN}/${PV}/etc/bash_completion.d/cargo" || die
538 - rmdir -v "${ED}/usr/lib/${PN}/${PV}"/etc{/bash_completion.d,} || die
539 - newbashcomp src/tools/cargo/src/etc/cargo.bashcomp.sh cargo
540 -
541 - local symlinks=(
542 - cargo
543 - rustc
544 - rustdoc
545 - rust-gdb
546 - rust-gdbgui
547 - rust-lldb
548 - )
549 -
550 - use clippy && symlinks+=( clippy-driver cargo-clippy )
551 - use miri && symlinks+=( miri cargo-miri )
552 - use rls && symlinks+=( rls )
553 - use rustfmt && symlinks+=( rustfmt cargo-fmt )
554 -
555 - einfo "installing eselect-rust symlinks and paths: ${symlinks[@]}"
556 - local i
557 - for i in "${symlinks[@]}"; do
558 - # we need realpath on /usr/bin/* symlink return version-appended binary path.
559 - # so /usr/bin/rustc should point to /usr/lib/rust/<ver>/bin/rustc-<ver>
560 - # need to fix eselect-rust to remove this hack.
561 - local ver_i="${i}-${PV}"
562 - if [[ -f "${ED}/usr/lib/${PN}/${PV}/bin/${i}" ]]; then
563 - einfo "Installing ${i} symlink"
564 - ln -v "${ED}/usr/lib/${PN}/${PV}/bin/${i}" "${ED}/usr/lib/${PN}/${PV}/bin/${ver_i}" || die
565 - else
566 - ewarn "${i} symlink requested, but source file not found"
567 - ewarn "please report this"
568 - fi
569 - dosym "../lib/${PN}/${PV}/bin/${ver_i}" "/usr/bin/${ver_i}"
570 - done
571 -
572 - # symlinks to switch components to active rust in eselect
573 - dosym "${PV}/lib" "/usr/lib/${PN}/lib-${PV}"
574 - dosym "${PV}/libexec" "/usr/lib/${PN}/libexec-${PV}"
575 - dosym "${PV}/share/man" "/usr/lib/${PN}/man-${PV}"
576 - dosym "rust/${PV}/lib/rustlib" "/usr/lib/rustlib-${PV}"
577 - dosym "../../lib/${PN}/${PV}/share/doc/rust" "/usr/share/doc/${P}"
578 -
579 - newenvd - "50${P}" <<-_EOF_
580 - LDPATH="${EPREFIX}/usr/lib/rust/lib"
581 - MANPATH="${EPREFIX}/usr/lib/rust/man"
582 - $(use amd64 && usex elibc_musl 'CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_RUSTFLAGS="-C target-feature=-crt-static"' '')
583 - $(use arm64 && usex elibc_musl 'CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_RUSTFLAGS="-C target-feature=-crt-static"' '')
584 - _EOF_
585 -
586 - rm -rf "${ED}/usr/lib/${PN}/${PV}"/*.old || die
587 - rm -rf "${ED}/usr/lib/${PN}/${PV}/doc"/*.old || die
588 -
589 - # note: eselect-rust adds EROOT to all paths below
590 - cat <<-_EOF_ > "${T}/provider-${P}"
591 - /usr/bin/cargo
592 - /usr/bin/rustdoc
593 - /usr/bin/rust-gdb
594 - /usr/bin/rust-gdbgui
595 - /usr/bin/rust-lldb
596 - /usr/lib/rustlib
597 - /usr/lib/rust/lib
598 - /usr/lib/rust/libexec
599 - /usr/lib/rust/man
600 - /usr/share/doc/rust
601 - _EOF_
602 -
603 - if use clippy; then
604 - echo /usr/bin/clippy-driver >> "${T}/provider-${P}"
605 - echo /usr/bin/cargo-clippy >> "${T}/provider-${P}"
606 - fi
607 - if use miri; then
608 - echo /usr/bin/miri >> "${T}/provider-${P}"
609 - echo /usr/bin/cargo-miri >> "${T}/provider-${P}"
610 - fi
611 - if use rls; then
612 - echo /usr/bin/rls >> "${T}/provider-${P}"
613 - fi
614 - if use rustfmt; then
615 - echo /usr/bin/rustfmt >> "${T}/provider-${P}"
616 - echo /usr/bin/cargo-fmt >> "${T}/provider-${P}"
617 - fi
618 -
619 - insinto /etc/env.d/rust
620 - doins "${T}/provider-${P}"
621 -}
622 -
623 -pkg_postinst() {
624 - eselect rust update
625 -
626 - if has_version sys-devel/gdb || has_version dev-util/lldb; then
627 - elog "Rust installs a helper script for calling GDB and LLDB,"
628 - elog "for your convenience it is installed under /usr/bin/rust-{gdb,lldb}-${PV}."
629 - fi
630 -
631 - if has_version app-editors/emacs; then
632 - elog "install app-emacs/rust-mode to get emacs support for rust."
633 - fi
634 -
635 - if has_version app-editors/gvim || has_version app-editors/vim; then
636 - elog "install app-vim/rust-vim to get vim support for rust."
637 - fi
638 -}
639 -
640 -pkg_postrm() {
641 - eselect rust cleanup
642 -}