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: Sat, 29 Feb 2020 07:46:30
Message-Id: 1582962338.f3b2e674ecc5a2c24935170a85f0e6a72a567bc5.gyakovlev@gentoo
1 commit: f3b2e674ecc5a2c24935170a85f0e6a72a567bc5
2 Author: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
3 AuthorDate: Sat Feb 29 04:17:03 2020 +0000
4 Commit: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
5 CommitDate: Sat Feb 29 07:45:38 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f3b2e674
7
8 dev-lang/rust: bump to 1.41.1
9
10 generate backtrace on ice during bootstrap
11 change how debug flag works. we were setting optimize = false if debug
12 is enabled, but this is wrong, see config.toml.example upstream.
13
14 Package-Manager: Portage-2.3.89, Repoman-2.3.20
15 Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org>
16
17 dev-lang/rust/Manifest | 1 +
18 dev-lang/rust/rust-1.41.1.ebuild | 370 +++++++++++++++++++++++++++++++++++++++
19 2 files changed, 371 insertions(+)
20
21 diff --git a/dev-lang/rust/Manifest b/dev-lang/rust/Manifest
22 index 774662a8ad8..a38ac2d2b29 100644
23 --- a/dev-lang/rust/Manifest
24 +++ b/dev-lang/rust/Manifest
25 @@ -73,3 +73,4 @@ DIST rustc-1.38.0-src.tar.xz 96163304 BLAKE2B 1e900b44db64727477ccf8e58e0ebb9ec2
26 DIST rustc-1.39.0-src.tar.xz 96495140 BLAKE2B 6df6bf0c3b38c28753713acdc477ea6929740c32893171dd9b8620992439e45730ef6f9489a6fc411ff5884c661ac4c07b7b93f5a4174207ed53351d2dea09bf SHA512 8610b2ec77722087c572bd84ac562a5b7c5f1a644aea58c5d5daa07a9aed242703b7816e73e2eaa049f773d5907859e259744a0de700622df005584fd798dab0
27 DIST rustc-1.40.0-src.tar.xz 92306352 BLAKE2B 762b9592414e5c816540f6fd37d07b3b0ffe97a151968cc8ae77be2fda03a6d66905192985edc65055cc7811dbd90faa2b2c056481f72161c6f7ccbcce13671a SHA512 b5ac3079acefb62d3c985b77f624d7fb68de23a59396fed9ccb292db61641c064f3146ee54d3cf59067b17ebfaadd14a6b2b466def60316bb5b13ba3aef01e1f
28 DIST rustc-1.41.0-src.tar.xz 93763052 BLAKE2B a68524fb6e3abb43d52ae6676a1e9de1c5d33606eaea6e93bb518f10b196d620f2f370c631c32e39a624af71a3bf6911662a9df7eecb8dde78a20c8054a349fc SHA512 0e30fe53b77860085bea0f1f60315eb835b00dd796c5d1b98ed44fe6fc27336dfb064908c86e1669a9cbe81c9ca1495e1c259a8a268bef23b23805a719cef0dd
29 +DIST rustc-1.41.1-src.tar.xz 93754192 BLAKE2B 235ece650d0c75e1c8700ce73d3811997cd0d827b850a6dd435a269f3f86d85849d54755ea346c5ddcbe0d1224836fd78213f6abeab4a9a8c4c3e2d8a05ff7b4 SHA512 ef33565c9cf4e27ca279072bfed3301e0276c09407d49727640746ba78d289de285278d64b1cce8708461fd6c97c7ab2ea8d56e7a4c4a23b2e66e2d164c35fc9
30
31 diff --git a/dev-lang/rust/rust-1.41.1.ebuild b/dev-lang/rust/rust-1.41.1.ebuild
32 new file mode 100644
33 index 00000000000..94d6e304cbb
34 --- /dev/null
35 +++ b/dev-lang/rust/rust-1.41.1.ebuild
36 @@ -0,0 +1,370 @@
37 +# Copyright 1999-2020 Gentoo Authors
38 +# Distributed under the terms of the GNU General Public License v2
39 +
40 +EAPI=7
41 +
42 +PYTHON_COMPAT=( python3_{6,7} )
43 +
44 +inherit bash-completion-r1 check-reqs estack flag-o-matic llvm multiprocessing multilib-build python-any-r1 rust-toolchain toolchain-funcs
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"
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 ~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} -> rustc-${PV}-src.tar.xz
67 + !system-bootstrap? ( $(rust_all_arch_uris rust-${RUST_STAGE0_VERSION}) )
68 +"
69 +
70 +ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM BPF Hexagon Lanai Mips MSP430
71 + NVPTX PowerPC RISCV Sparc SystemZ WebAssembly X86 XCore )
72 +ALL_LLVM_TARGETS=( "${ALL_LLVM_TARGETS[@]/#/llvm_targets_}" )
73 +LLVM_TARGET_USEDEPS=${ALL_LLVM_TARGETS[@]/%/?}
74 +
75 +LICENSE="|| ( MIT Apache-2.0 ) BSD-1 BSD-2 BSD-4 UoI-NCSA"
76 +
77 +IUSE="clippy cpu_flags_x86_sse2 debug doc libressl nightly parallel-compiler rls rustfmt system-bootstrap system-llvm wasm ${ALL_LLVM_TARGETS[*]}"
78 +
79 +# Please keep the LLVM dependency block separate. Since LLVM is slotted,
80 +# we need to *really* make sure we're not pulling more than one slot
81 +# simultaneously.
82 +
83 +# How to use it:
84 +# 1. List all the working slots (with min versions) in ||, newest first.
85 +# 2. Update the := to specify *max* version, e.g. < 10.
86 +# 3. Specify LLVM_MAX_SLOT, e.g. 9.
87 +LLVM_DEPEND="
88 + || (
89 + sys-devel/llvm:9[llvm_targets_WebAssembly?]
90 + wasm? ( =sys-devel/lld-9* )
91 + )
92 + <sys-devel/llvm-10:=
93 +"
94 +LLVM_MAX_SLOT=9
95 +
96 +BOOTSTRAP_DEPEND="|| ( >=dev-lang/rust-1.$(($(ver_cut 2) - 1)).0-r1 >=dev-lang/rust-bin-1.$(($(ver_cut 2) - 1)) )"
97 +
98 +COMMON_DEPEND="
99 + net-libs/libssh2:=
100 + net-libs/http-parser:=
101 + net-misc/curl:=[ssl]
102 + sys-libs/zlib:=
103 + !libressl? ( dev-libs/openssl:0= )
104 + libressl? ( dev-libs/libressl:0= )
105 + elibc_musl? ( sys-libs/libunwind )
106 + system-llvm? (
107 + ${LLVM_DEPEND}
108 + )
109 +"
110 +
111 +DEPEND="${COMMON_DEPEND}
112 + ${PYTHON_DEPS}
113 + || (
114 + >=sys-devel/gcc-4.7
115 + >=sys-devel/clang-3.5
116 + )
117 + system-bootstrap? ( ${BOOTSTRAP_DEPEND} )
118 + system-llvm? (
119 + dev-util/cmake
120 + dev-util/ninja
121 + )
122 +"
123 +
124 +RDEPEND="${COMMON_DEPEND}
125 + >=app-eselect/eselect-rust-20190311
126 +"
127 +
128 +REQUIRED_USE="|| ( ${ALL_LLVM_TARGETS[*]} )
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 +QA_SONAME="usr/lib.*/librustc_macros.*.so"
142 +
143 +PATCHES=(
144 + "${FILESDIR}"/1.40.0-add-soname.patch
145 + "${FILESDIR}"/llvm-gcc10.patch
146 +)
147 +
148 +S="${WORKDIR}/${MY_P}-src"
149 +
150 +toml_usex() {
151 + usex "$1" true false
152 +}
153 +
154 +pre_build_checks() {
155 + CHECKREQS_DISK_BUILD="9G"
156 + eshopts_push -s extglob
157 + if is-flagq '-g?(gdb)?([1-9])'; then
158 + CHECKREQS_DISK_BUILD="15G"
159 + fi
160 + eshopts_pop
161 + check-reqs_pkg_setup
162 +}
163 +
164 +pkg_pretend() {
165 + pre_build_checks
166 +}
167 +
168 +pkg_setup() {
169 + pre_build_checks
170 + python-any-r1_pkg_setup
171 +
172 + # use bundled for now, #707746
173 + # will need dev-libs/libgit2 slotted dep if re-enabled
174 + #export LIBGIT2_SYS_USE_PKG_CONFIG=1
175 + export LIBSSH2_SYS_USE_PKG_CONFIG=1
176 + export PKG_CONFIG_ALLOW_CROSS=1
177 +
178 + if use system-llvm; then
179 + llvm_pkg_setup
180 +
181 + local llvm_config="$(get_llvm_prefix "$LLVM_MAX_SLOT")/bin/llvm-config"
182 +
183 + export LLVM_LINK_SHARED=1
184 + export RUSTFLAGS="${RUSTFLAGS} -Lnative=$("${llvm_config}" --libdir)"
185 + fi
186 +}
187 +
188 +src_prepare() {
189 + if ! use system-bootstrap; then
190 + local rust_stage0_root="${WORKDIR}"/rust-stage0
191 + local rust_stage0="rust-${RUST_STAGE0_VERSION}-$(rust_abi)"
192 +
193 + "${WORKDIR}/${rust_stage0}"/install.sh --disable-ldconfig \
194 + --destdir="${rust_stage0_root}" --prefix=/ || die
195 + fi
196 +
197 + default
198 +}
199 +
200 +src_configure() {
201 + local rust_target="" rust_targets="" arch_cflags
202 +
203 + # Collect rust target names to compile standard libs for all ABIs.
204 + for v in $(multilib_get_enabled_abi_pairs); do
205 + rust_targets="${rust_targets},\"$(rust_abi $(get_abi_CHOST ${v##*.}))\""
206 + done
207 + if use wasm; then
208 + rust_targets="${rust_targets},\"wasm32-unknown-unknown\""
209 + fi
210 + rust_targets="${rust_targets#,}"
211 +
212 + local extended="true" tools="\"cargo\","
213 + if use clippy; then
214 + tools="\"clippy\",$tools"
215 + fi
216 + if use rls; then
217 + tools="\"rls\",\"analysis\",\"src\",$tools"
218 + fi
219 + if use rustfmt; then
220 + tools="\"rustfmt\",$tools"
221 + fi
222 +
223 + local rust_stage0_root
224 + if use system-bootstrap; then
225 + rust_stage0_root="$(rustc --print sysroot)"
226 + else
227 + rust_stage0_root="${WORKDIR}"/rust-stage0
228 + fi
229 +
230 + rust_target="$(rust_abi)"
231 +
232 + cat <<- EOF > "${S}"/config.toml
233 + [llvm]
234 + optimize = $(toml_usex !debug)
235 + release-debuginfo = $(toml_usex debug)
236 + assertions = $(toml_usex debug)
237 + targets = "${LLVM_TARGETS// /;}"
238 + experimental-targets = ""
239 + link-shared = $(toml_usex system-llvm)
240 + [build]
241 + build = "${rust_target}"
242 + host = ["${rust_target}"]
243 + target = [${rust_targets}]
244 + cargo = "${rust_stage0_root}/bin/cargo"
245 + rustc = "${rust_stage0_root}/bin/rustc"
246 + docs = $(toml_usex doc)
247 + compiler-docs = $(toml_usex doc)
248 + submodules = false
249 + python = "${EPYTHON}"
250 + locked-deps = true
251 + vendor = true
252 + extended = ${extended}
253 + tools = [${tools}]
254 + verbose = 2
255 + [install]
256 + prefix = "${EPREFIX}/usr"
257 + libdir = "lib"
258 + docdir = "share/doc/${PF}"
259 + mandir = "share/man"
260 + [rust]
261 + optimize = true
262 + debug = $(toml_usex debug)
263 + debug-assertions = $(toml_usex debug)
264 + default-linker = "$(tc-getCC)"
265 + parallel-compiler = $(toml_usex parallel-compiler)
266 + channel = "$(usex nightly nightly stable)"
267 + rpath = false
268 + lld = $(usex system-llvm false $(toml_usex wasm))
269 + backtrace-on-ice = true
270 + [dist]
271 + src-tarball = false
272 + EOF
273 +
274 + for v in $(multilib_get_enabled_abi_pairs); do
275 + rust_target=$(rust_abi $(get_abi_CHOST ${v##*.}))
276 + arch_cflags="$(get_abi_CFLAGS ${v##*.})"
277 +
278 + cat <<- EOF >> "${S}"/config.env
279 + CFLAGS_${rust_target}=${arch_cflags}
280 + EOF
281 +
282 + cat <<- EOF >> "${S}"/config.toml
283 + [target.${rust_target}]
284 + cc = "$(tc-getBUILD_CC)"
285 + cxx = "$(tc-getBUILD_CXX)"
286 + linker = "$(tc-getCC)"
287 + ar = "$(tc-getAR)"
288 + EOF
289 + # librustc_target/spec/linux_musl_base.rs sets base.crt_static_default = true;
290 + if use elibc_musl; then
291 + cat <<- EOF >> "${S}"/config.toml
292 + crt-static = false
293 + EOF
294 + fi
295 + if use system-llvm; then
296 + cat <<- EOF >> "${S}"/config.toml
297 + llvm-config = "$(get_llvm_prefix "${LLVM_MAX_SLOT}")/bin/llvm-config"
298 + EOF
299 + fi
300 + done
301 +
302 + if use wasm; then
303 + cat <<- EOF >> "${S}"/config.toml
304 + [target.wasm32-unknown-unknown]
305 + linker = "$(usex system-llvm lld rust-lld)"
306 + EOF
307 + fi
308 +}
309 +
310 +src_compile() {
311 + env $(cat "${S}"/config.env)\
312 + "${EPYTHON}" ./x.py build -vv --config="${S}"/config.toml -j$(makeopts_jobs) \
313 + --exclude src/tools/miri || die # https://github.com/rust-lang/rust/issues/52305
314 +}
315 +
316 +src_install() {
317 + env DESTDIR="${D}" "${EPYTHON}" ./x.py install -vv --config="${S}"/config.toml \
318 + --exclude src/tools/miri || die
319 +
320 + # bug #689562, #689160
321 + rm "${D}/etc/bash_completion.d/cargo" || die
322 + rmdir "${D}"/etc{/bash_completion.d,} || die
323 + dobashcomp build/tmp/dist/cargo-image/etc/bash_completion.d/cargo
324 +
325 + mv "${ED}/usr/bin/rustc" "${ED}/usr/bin/rustc-${PV}" || die
326 + mv "${ED}/usr/bin/rustdoc" "${ED}/usr/bin/rustdoc-${PV}" || die
327 + mv "${ED}/usr/bin/rust-gdb" "${ED}/usr/bin/rust-gdb-${PV}" || die
328 + mv "${ED}/usr/bin/rust-gdbgui" "${ED}/usr/bin/rust-gdbgui-${PV}" || die
329 + mv "${ED}/usr/bin/rust-lldb" "${ED}/usr/bin/rust-lldb-${PV}" || die
330 + mv "${ED}/usr/bin/cargo" "${ED}/usr/bin/cargo-${PV}" || die
331 + if use clippy; then
332 + mv "${ED}/usr/bin/clippy-driver" "${ED}/usr/bin/clippy-driver-${PV}" || die
333 + mv "${ED}/usr/bin/cargo-clippy" "${ED}/usr/bin/cargo-clippy-${PV}" || die
334 + fi
335 + if use rls; then
336 + mv "${ED}/usr/bin/rls" "${ED}/usr/bin/rls-${PV}" || die
337 + fi
338 + if use rustfmt; then
339 + mv "${ED}/usr/bin/rustfmt" "${ED}/usr/bin/rustfmt-${PV}" || die
340 + mv "${ED}/usr/bin/cargo-fmt" "${ED}/usr/bin/cargo-fmt-${PV}" || die
341 + fi
342 +
343 + # Move public shared libs to abi specific libdir
344 + # Private and target specific libs MUST stay in /usr/lib/rustlib/${rust_target}/lib
345 + if [[ $(get_libdir) != lib ]]; then
346 + dodir /usr/$(get_libdir)
347 + mv "${ED}/usr/lib"/*.so "${ED}/usr/$(get_libdir)/" || die
348 + fi
349 +
350 + dodoc COPYRIGHT
351 +
352 + # note: eselect-rust adds EROOT to all paths below
353 + cat <<-EOF > "${T}/provider-${P}"
354 + /usr/bin/rustdoc
355 + /usr/bin/rust-gdb
356 + /usr/bin/rust-gdbgui
357 + /usr/bin/rust-lldb
358 + EOF
359 + echo /usr/bin/cargo >> "${T}/provider-${P}"
360 + if use clippy; then
361 + echo /usr/bin/clippy-driver >> "${T}/provider-${P}"
362 + echo /usr/bin/cargo-clippy >> "${T}/provider-${P}"
363 + fi
364 + if use rls; then
365 + echo /usr/bin/rls >> "${T}/provider-${P}"
366 + fi
367 + if use rustfmt; then
368 + echo /usr/bin/rustfmt >> "${T}/provider-${P}"
369 + echo /usr/bin/cargo-fmt >> "${T}/provider-${P}"
370 + fi
371 +
372 + insinto /etc/env.d/rust
373 + doins "${T}/provider-${P}"
374 +}
375 +
376 +pkg_postinst() {
377 + eselect rust update --if-unset
378 +
379 + elog "Rust installs a helper script for calling GDB and LLDB,"
380 + elog "for your convenience it is installed under /usr/bin/rust-{gdb,lldb}-${PV}."
381 +
382 + ewarn "cargo is now installed from dev-lang/rust{,-bin} instead of dev-util/cargo."
383 + ewarn "This might have resulted in a dangling symlink for /usr/bin/cargo on some"
384 + ewarn "systems. This can be resolved by calling 'sudo eselect rust set ${P}'."
385 +
386 + if has_version app-editors/emacs; then
387 + elog "install app-emacs/rust-mode to get emacs support for rust."
388 + fi
389 +
390 + if has_version app-editors/gvim || has_version app-editors/vim; then
391 + elog "install app-vim/rust-vim to get vim support for rust."
392 + fi
393 +
394 + if use elibc_musl; then
395 + ewarn "${PN} on *-musl targets is configured with crt-static"
396 + ewarn ""
397 + ewarn "you will need to set RUSTFLAGS=\"-C target-feature=-crt-static\" in make.conf"
398 + ewarn "to use it with portage, otherwise you may see failures like"
399 + ewarn "error: cannot produce proc-macro for serde_derive v1.0.98 as the target "
400 + ewarn "x86_64-unknown-linux-musl does not support these crate types"
401 + fi
402 +}
403 +
404 +pkg_postrm() {
405 + eselect rust cleanup
406 +}