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: Fri, 08 May 2020 07:01:42
Message-Id: 1588921284.172eb3fa0158a7ba77005de23eb305d7fe6a395d.gyakovlev@gentoo
1 commit: 172eb3fa0158a7ba77005de23eb305d7fe6a395d
2 Author: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
3 AuthorDate: Fri May 8 06:37:39 2020 +0000
4 Commit: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
5 CommitDate: Fri May 8 07:01:24 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=172eb3fa
7
8 dev-lang/rust: bump to 1.43.1
9
10 Package-Manager: Portage-2.3.99, Repoman-2.3.22
11 Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org>
12
13 dev-lang/rust/Manifest | 1 +
14 dev-lang/rust/rust-1.43.1.ebuild | 419 +++++++++++++++++++++++++++++++++++++++
15 2 files changed, 420 insertions(+)
16
17 diff --git a/dev-lang/rust/Manifest b/dev-lang/rust/Manifest
18 index 5f746fe3066..608a7f285cc 100644
19 --- a/dev-lang/rust/Manifest
20 +++ b/dev-lang/rust/Manifest
21 @@ -43,3 +43,4 @@ DIST rust-1.42.0-x86_64-unknown-linux-musl.tar.xz 97471188 BLAKE2B 29e7089a33a20
22 DIST rustc-1.41.1-src.tar.xz 93754192 BLAKE2B 235ece650d0c75e1c8700ce73d3811997cd0d827b850a6dd435a269f3f86d85849d54755ea346c5ddcbe0d1224836fd78213f6abeab4a9a8c4c3e2d8a05ff7b4 SHA512 ef33565c9cf4e27ca279072bfed3301e0276c09407d49727640746ba78d289de285278d64b1cce8708461fd6c97c7ab2ea8d56e7a4c4a23b2e66e2d164c35fc9
23 DIST rustc-1.42.0-src.tar.xz 94186592 BLAKE2B 82298ef3da44188546bb945bcbfc1af630e6a4466b643667da08a04a33c6417afd68fc86302bdd22ab36c208fdb13cbc479e762d1217c05507bbfeb13bfbef7e SHA512 589bfdc92deedd33b8ea0df7f7c64c2a9a085fbea64936eff92f81e812309c060ed7a7adc96f6010d7adf62a68434a230da0f6c5b3540df4e0a5c6de05a31b16
24 DIST rustc-1.43.0-src.tar.xz 94354332 BLAKE2B 845b52b6e447b3c9bf3256256f0215056989334d99dc17d196fd088b4c515928602632ce8882316dff6dee462c22aebf5bc7f21da0b4b206ec88bc178ff69163 SHA512 dbff18567f2971da4eb13c670c30b136757692df1bc5024cdc0406f3c30574d3485fd616724987bcc765bc5f64c8ed5026f0e96f11eacb035e00256ed190b4f3
25 +DIST rustc-1.43.1-src.tar.xz 94405276 BLAKE2B 8679fe937abc4f758f3e35c2542d57cc1ad0bb72111597881873b30779b6e7b6711baa52493cb5ff954bf9cd31367b36db4e4fc8676635026059197a33659048 SHA512 24bb01237b1f3f5412109290bb4406b9742cf8956162f4090a98ed3a59a6e2e8dda399452bec1c93c8afdcf5effd98e4825e7f218238e0e88735c1ff4a5b385f
26
27 diff --git a/dev-lang/rust/rust-1.43.1.ebuild b/dev-lang/rust/rust-1.43.1.ebuild
28 new file mode 100644
29 index 00000000000..bac30af017a
30 --- /dev/null
31 +++ b/dev-lang/rust/rust-1.43.1.ebuild
32 @@ -0,0 +1,419 @@
33 +# Copyright 1999-2020 Gentoo Authors
34 +# Distributed under the terms of the GNU General Public License v2
35 +
36 +EAPI=7
37 +
38 +PYTHON_COMPAT=( python3_{6,7,8} )
39 +
40 +inherit bash-completion-r1 check-reqs estack flag-o-matic llvm multiprocessing multilib-build python-any-r1 rust-toolchain toolchain-funcs
41 +
42 +if [[ ${PV} = *beta* ]]; then
43 + betaver=${PV//*beta}
44 + BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
45 + MY_P="rustc-beta"
46 + SLOT="beta/${PV}"
47 + SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.xz"
48 +else
49 + ABI_VER="$(ver_cut 1-2)"
50 + SLOT="stable/${ABI_VER}"
51 + MY_P="rustc-${PV}"
52 + SRC="${MY_P}-src.tar.xz"
53 + KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86"
54 +fi
55 +
56 +RUST_STAGE0_VERSION="1.$(($(ver_cut 2) - 1)).0"
57 +
58 +DESCRIPTION="Systems programming language from Mozilla"
59 +HOMEPAGE="https://www.rust-lang.org/"
60 +
61 +SRC_URI="
62 + https://static.rust-lang.org/dist/${SRC} -> rustc-${PV}-src.tar.xz
63 + !system-bootstrap? ( $(rust_all_arch_uris rust-${RUST_STAGE0_VERSION}) )
64 +"
65 +
66 +ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM BPF Hexagon Lanai Mips MSP430
67 + NVPTX PowerPC RISCV Sparc SystemZ WebAssembly X86 XCore )
68 +ALL_LLVM_TARGETS=( "${ALL_LLVM_TARGETS[@]/#/llvm_targets_}" )
69 +LLVM_TARGET_USEDEPS=${ALL_LLVM_TARGETS[@]/%/?}
70 +
71 +LICENSE="|| ( MIT Apache-2.0 ) BSD-1 BSD-2 BSD-4 UoI-NCSA"
72 +
73 +IUSE="clippy cpu_flags_x86_sse2 debug doc libressl miri nightly parallel-compiler rls rustfmt system-bootstrap system-llvm wasm ${ALL_LLVM_TARGETS[*]}"
74 +
75 +# Please keep the LLVM dependency block separate. Since LLVM is slotted,
76 +# we need to *really* make sure we're not pulling more than one slot
77 +# simultaneously.
78 +
79 +# How to use it:
80 +# 1. List all the working slots (with min versions) in ||, newest first.
81 +# 2. Update the := to specify *max* version, e.g. < 11.
82 +# 3. Specify LLVM_MAX_SLOT, e.g. 10.
83 +LLVM_DEPEND="
84 + || (
85 + sys-devel/llvm:10[${LLVM_TARGET_USEDEPS// /,}]
86 + sys-devel/llvm:9[${LLVM_TARGET_USEDEPS// /,}]
87 + )
88 + <sys-devel/llvm-11:=
89 + wasm? ( sys-devel/lld )
90 +"
91 +LLVM_MAX_SLOT=10
92 +
93 +BOOTSTRAP_DEPEND="|| ( >=dev-lang/rust-1.$(($(ver_cut 2) - 1)) >=dev-lang/rust-bin-1.$(($(ver_cut 2) - 1)) )"
94 +
95 +# libgit2 should be at least same as bungled into libgit-sys #707746
96 +COMMON_DEPEND="
97 + >=dev-libs/libgit2-0.99:=
98 + net-libs/libssh2:=
99 + net-libs/http-parser:=
100 + net-misc/curl:=[ssl]
101 + sys-libs/zlib:=
102 + !libressl? ( dev-libs/openssl:0= )
103 + libressl? ( dev-libs/libressl:0= )
104 + elibc_musl? ( sys-libs/libunwind )
105 + system-llvm? (
106 + ${LLVM_DEPEND}
107 + )
108 +"
109 +
110 +DEPEND="${COMMON_DEPEND}
111 + ${PYTHON_DEPS}
112 + || (
113 + >=sys-devel/gcc-4.7
114 + >=sys-devel/clang-3.5
115 + )
116 + system-bootstrap? ( ${BOOTSTRAP_DEPEND} )
117 + !system-llvm? (
118 + dev-util/cmake
119 + dev-util/ninja
120 + )
121 +"
122 +
123 +RDEPEND="${COMMON_DEPEND}
124 + >=app-eselect/eselect-rust-20190311
125 +"
126 +
127 +REQUIRED_USE="|| ( ${ALL_LLVM_TARGETS[*]} )
128 + miri? ( nightly )
129 + parallel-compiler? ( nightly )
130 + wasm? ( llvm_targets_WebAssembly )
131 + x86? ( cpu_flags_x86_sse2 )
132 +"
133 +
134 +QA_FLAGS_IGNORED="
135 + usr/bin/.*-${PV}
136 + usr/lib.*/lib.*.so
137 + usr/lib/rustlib/.*/codegen-backends/librustc_codegen_llvm-llvm.so
138 + usr/lib/rustlib/.*/lib/lib.*.so
139 +"
140 +
141 +# tests need a bit more work, currently they are causing multiple
142 +# re-compilations and somewhat fragile.
143 +RESTRICT="test"
144 +
145 +QA_SONAME="usr/lib.*/librustc_macros.*.so"
146 +
147 +PATCHES=(
148 + "${FILESDIR}"/1.40.0-add-soname.patch
149 + "${FILESDIR}"/0012-Ignore-broken-and-non-applicable-tests.patch
150 + "${FILESDIR}"/1.43.0-llvm10.patch
151 + "${FILESDIR}"/1.42.0-libressl.patch
152 +)
153 +
154 +S="${WORKDIR}/${MY_P}-src"
155 +
156 +toml_usex() {
157 + usex "$1" true false
158 +}
159 +
160 +pre_build_checks() {
161 + CHECKREQS_DISK_BUILD="9G"
162 + eshopts_push -s extglob
163 + if is-flagq '-g?(gdb)?([1-9])'; then
164 + CHECKREQS_DISK_BUILD="15G"
165 + fi
166 + eshopts_pop
167 + check-reqs_pkg_setup
168 +}
169 +
170 +pkg_pretend() {
171 + pre_build_checks
172 +}
173 +
174 +pkg_setup() {
175 + pre_build_checks
176 + python-any-r1_pkg_setup
177 +
178 + # required to link agains system libs, otherwise
179 + # crates use bundled sources and compile own static version
180 + export LIBGIT2_SYS_USE_PKG_CONFIG=1
181 + export LIBSSH2_SYS_USE_PKG_CONFIG=1
182 + export PKG_CONFIG_ALLOW_CROSS=1
183 +
184 + if use system-llvm; then
185 + llvm_pkg_setup
186 +
187 + local llvm_config="$(get_llvm_prefix "$LLVM_MAX_SLOT")/bin/llvm-config"
188 +
189 + export LLVM_LINK_SHARED=1
190 + export RUSTFLAGS="${RUSTFLAGS} -Lnative=$("${llvm_config}" --libdir)"
191 + fi
192 +}
193 +
194 +src_prepare() {
195 + if ! use system-bootstrap; then
196 + local rust_stage0_root="${WORKDIR}"/rust-stage0
197 + local rust_stage0="rust-${RUST_STAGE0_VERSION}-$(rust_abi)"
198 +
199 + "${WORKDIR}/${rust_stage0}"/install.sh --disable-ldconfig \
200 + --destdir="${rust_stage0_root}" --prefix=/ || die
201 + fi
202 +
203 + default
204 +}
205 +
206 +src_configure() {
207 + local rust_target="" rust_targets="" arch_cflags
208 +
209 + # Collect rust target names to compile standard libs for all ABIs.
210 + for v in $(multilib_get_enabled_abi_pairs); do
211 + rust_targets="${rust_targets},\"$(rust_abi $(get_abi_CHOST ${v##*.}))\""
212 + done
213 + if use wasm; then
214 + rust_targets="${rust_targets},\"wasm32-unknown-unknown\""
215 + fi
216 + rust_targets="${rust_targets#,}"
217 +
218 + local tools="\"cargo\","
219 + if use clippy; then
220 + tools="\"clippy\",$tools"
221 + fi
222 + if use miri; then
223 + tools="\"miri\",$tools"
224 + fi
225 + if use rls; then
226 + tools="\"rls\",\"analysis\",\"src\",$tools"
227 + fi
228 + if use rustfmt; then
229 + tools="\"rustfmt\",$tools"
230 + fi
231 +
232 + local rust_stage0_root
233 + if use system-bootstrap; then
234 + rust_stage0_root="$(rustc --print sysroot)"
235 + else
236 + rust_stage0_root="${WORKDIR}"/rust-stage0
237 + fi
238 +
239 + rust_target="$(rust_abi)"
240 +
241 + cat <<- EOF > "${S}"/config.toml
242 + [llvm]
243 + optimize = $(toml_usex !debug)
244 + release-debuginfo = $(toml_usex debug)
245 + assertions = $(toml_usex debug)
246 + ninja = true
247 + targets = "${LLVM_TARGETS// /;}"
248 + experimental-targets = ""
249 + link-shared = $(toml_usex system-llvm)
250 + [build]
251 + build = "${rust_target}"
252 + host = ["${rust_target}"]
253 + target = [${rust_targets}]
254 + cargo = "${rust_stage0_root}/bin/cargo"
255 + rustc = "${rust_stage0_root}/bin/rustc"
256 + docs = $(toml_usex doc)
257 + compiler-docs = $(toml_usex doc)
258 + submodules = false
259 + python = "${EPYTHON}"
260 + locked-deps = true
261 + vendor = true
262 + extended = true
263 + tools = [${tools}]
264 + verbose = 2
265 + sanitizers = false
266 + profiler = false
267 + cargo-native-static = false
268 + [install]
269 + prefix = "${EPREFIX}/usr"
270 + libdir = "lib"
271 + docdir = "share/doc/${PF}"
272 + mandir = "share/man"
273 + [rust]
274 + optimize = true
275 + debug = $(toml_usex debug)
276 + debug-assertions = $(toml_usex debug)
277 + debuginfo-level-rustc = 0
278 + backtrace = true
279 + incremental = false
280 + default-linker = "$(tc-getCC)"
281 + parallel-compiler = $(toml_usex parallel-compiler)
282 + channel = "$(usex nightly nightly stable)"
283 + rpath = false
284 + verbose-tests = true
285 + optimize-tests = $(toml_usex !debug)
286 + codegen-tests = true
287 + dist-src = false
288 + lld = $(usex system-llvm false $(toml_usex wasm))
289 + backtrace-on-ice = true
290 + jemalloc = false
291 + [dist]
292 + src-tarball = false
293 + EOF
294 +
295 + for v in $(multilib_get_enabled_abi_pairs); do
296 + rust_target=$(rust_abi $(get_abi_CHOST ${v##*.}))
297 + arch_cflags="$(get_abi_CFLAGS ${v##*.})"
298 +
299 + cat <<- EOF >> "${S}"/config.env
300 + CFLAGS_${rust_target}=${arch_cflags}
301 + EOF
302 +
303 + cat <<- EOF >> "${S}"/config.toml
304 + [target.${rust_target}]
305 + cc = "$(tc-getBUILD_CC)"
306 + cxx = "$(tc-getBUILD_CXX)"
307 + linker = "$(tc-getCC)"
308 + ar = "$(tc-getAR)"
309 + EOF
310 + # librustc_target/spec/linux_musl_base.rs sets base.crt_static_default = true;
311 + if use elibc_musl; then
312 + cat <<- EOF >> "${S}"/config.toml
313 + crt-static = false
314 + EOF
315 + fi
316 + if use system-llvm; then
317 + cat <<- EOF >> "${S}"/config.toml
318 + llvm-config = "$(get_llvm_prefix "${LLVM_MAX_SLOT}")/bin/llvm-config"
319 + EOF
320 + fi
321 + done
322 + if use wasm; then
323 + cat <<- EOF >> "${S}"/config.toml
324 + [target.wasm32-unknown-unknown]
325 + linker = "$(usex system-llvm lld rust-lld)"
326 + EOF
327 + fi
328 +
329 + einfo "Rust configured with the following settings:"
330 + cat "${S}"/config.toml || die
331 +}
332 +
333 +src_compile() {
334 + env $(cat "${S}"/config.env) RUST_BACKTRACE=1\
335 + "${EPYTHON}" ./x.py build -vv --config="${S}"/config.toml -j$(makeopts_jobs) || die
336 +}
337 +
338 +src_test() {
339 + env $(cat "${S}"/config.env) RUST_BACKTRACE=1\
340 + "${EPYTHON}" ./x.py test -vv --config="${S}"/config.toml -j$(makeopts_jobs) --no-doc --no-fail-fast \
341 + src/test/codegen \
342 + src/test/codegen-units \
343 + src/test/compile-fail \
344 + src/test/incremental \
345 + src/test/mir-opt \
346 + src/test/pretty \
347 + src/test/run-fail \
348 + src/test/run-make \
349 + src/test/run-make-fulldeps \
350 + src/test/ui \
351 + src/test/ui-fulldeps || die
352 +}
353 +
354 +src_install() {
355 + env $(cat "${S}"/config.env) DESTDIR="${D}" \
356 + "${EPYTHON}" ./x.py install -vv --config="${S}"/config.toml || die
357 +
358 + # bug #689562, #689160
359 + rm "${D}/etc/bash_completion.d/cargo" || die
360 + rmdir "${D}"/etc{/bash_completion.d,} || die
361 + dobashcomp build/tmp/dist/cargo-image/etc/bash_completion.d/cargo
362 +
363 + mv "${ED}/usr/bin/rustc" "${ED}/usr/bin/rustc-${PV}" || die
364 + mv "${ED}/usr/bin/rustdoc" "${ED}/usr/bin/rustdoc-${PV}" || die
365 + mv "${ED}/usr/bin/rust-gdb" "${ED}/usr/bin/rust-gdb-${PV}" || die
366 + mv "${ED}/usr/bin/rust-gdbgui" "${ED}/usr/bin/rust-gdbgui-${PV}" || die
367 + mv "${ED}/usr/bin/rust-lldb" "${ED}/usr/bin/rust-lldb-${PV}" || die
368 + mv "${ED}/usr/bin/cargo" "${ED}/usr/bin/cargo-${PV}" || die
369 + if use clippy; then
370 + mv "${ED}/usr/bin/clippy-driver" "${ED}/usr/bin/clippy-driver-${PV}" || die
371 + mv "${ED}/usr/bin/cargo-clippy" "${ED}/usr/bin/cargo-clippy-${PV}" || die
372 + fi
373 + if use miri; then
374 + mv "${ED}/usr/bin/miri" "${ED}/usr/bin/miri-${PV}" || die
375 + mv "${ED}/usr/bin/cargo-miri" "${ED}/usr/bin/cargo-miri-${PV}" || die
376 + fi
377 + if use rls; then
378 + mv "${ED}/usr/bin/rls" "${ED}/usr/bin/rls-${PV}" || die
379 + fi
380 + if use rustfmt; then
381 + mv "${ED}/usr/bin/rustfmt" "${ED}/usr/bin/rustfmt-${PV}" || die
382 + mv "${ED}/usr/bin/cargo-fmt" "${ED}/usr/bin/cargo-fmt-${PV}" || die
383 + fi
384 +
385 + # Move public shared libs to abi specific libdir
386 + # Private and target specific libs MUST stay in /usr/lib/rustlib/${rust_target}/lib
387 + if [[ $(get_libdir) != lib ]]; then
388 + dodir /usr/$(get_libdir)
389 + mv "${ED}/usr/lib"/*.so "${ED}/usr/$(get_libdir)/" || die
390 + fi
391 +
392 + dodoc COPYRIGHT
393 + rm "${ED}/usr/share/doc/${P}"/*.old || die
394 + rm "${ED}/usr/share/doc/${P}/LICENSE-APACHE" || die
395 + rm "${ED}/usr/share/doc/${P}/LICENSE-MIT" || die
396 +
397 + # note: eselect-rust adds EROOT to all paths below
398 + cat <<-EOF > "${T}/provider-${P}"
399 + /usr/bin/cargo
400 + /usr/bin/rustdoc
401 + /usr/bin/rust-gdb
402 + /usr/bin/rust-gdbgui
403 + /usr/bin/rust-lldb
404 + EOF
405 + if use clippy; then
406 + echo /usr/bin/clippy-driver >> "${T}/provider-${P}"
407 + echo /usr/bin/cargo-clippy >> "${T}/provider-${P}"
408 + fi
409 + if use miri; then
410 + echo /usr/bin/miri >> "${T}/provider-${P}"
411 + echo /usr/bin/cargo-miri >> "${T}/provider-${P}"
412 + fi
413 + if use rls; then
414 + echo /usr/bin/rls >> "${T}/provider-${P}"
415 + fi
416 + if use rustfmt; then
417 + echo /usr/bin/rustfmt >> "${T}/provider-${P}"
418 + echo /usr/bin/cargo-fmt >> "${T}/provider-${P}"
419 + fi
420 +
421 + insinto /etc/env.d/rust
422 + doins "${T}/provider-${P}"
423 +}
424 +
425 +pkg_postinst() {
426 + eselect rust update --if-unset
427 +
428 + elog "Rust installs a helper script for calling GDB and LLDB,"
429 + elog "for your convenience it is installed under /usr/bin/rust-{gdb,lldb}-${PV}."
430 +
431 + if has_version app-editors/emacs; then
432 + elog "install app-emacs/rust-mode to get emacs support for rust."
433 + fi
434 +
435 + if has_version app-editors/gvim || has_version app-editors/vim; then
436 + elog "install app-vim/rust-vim to get vim support for rust."
437 + fi
438 +
439 + if use elibc_musl; then
440 + ewarn "${PN} on *-musl targets is configured with crt-static"
441 + ewarn ""
442 + ewarn "you will need to set RUSTFLAGS=\"-C target-feature=-crt-static\" in make.conf"
443 + ewarn "to use it with portage, otherwise you may see failures like"
444 + ewarn "error: cannot produce proc-macro for serde_derive v1.0.98 as the target "
445 + ewarn "x86_64-unknown-linux-musl does not support these crate types"
446 + fi
447 +}
448 +
449 +pkg_postrm() {
450 + eselect rust cleanup
451 +}