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