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, 26 Apr 2019 04:48:05
Message-Id: 1556254066.76c2a13d9f6345d14c11689794e5234bfd52851e.gyakovlev@gentoo
1 commit: 76c2a13d9f6345d14c11689794e5234bfd52851e
2 Author: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
3 AuthorDate: Fri Apr 26 04:11:56 2019 +0000
4 Commit: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
5 CommitDate: Fri Apr 26 04:47:46 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=76c2a13d
7
8 dev-lang/rust: bump to 1.34.1
9
10 Package-Manager: Portage-2.3.64, Repoman-2.3.12
11 Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org>
12
13 dev-lang/rust/Manifest | 1 +
14 dev-lang/rust/rust-1.34.1.ebuild | 330 +++++++++++++++++++++++++++++++++++++++
15 2 files changed, 331 insertions(+)
16
17 diff --git a/dev-lang/rust/Manifest b/dev-lang/rust/Manifest
18 index c396c1c5962..49979028f4e 100644
19 --- a/dev-lang/rust/Manifest
20 +++ b/dev-lang/rust/Manifest
21 @@ -83,3 +83,4 @@ DIST rustc-1.31.1-src.tar.xz 96915864 BLAKE2B bedfe1d56e2f99bb43b4b652d540aedf0a
22 DIST rustc-1.32.0-src.tar.xz 99602696 BLAKE2B ab26247e3ecb75dbe373254c1c49f46c00a5a4db2b9cedffccb30122ea3b7de2761d6995b5423d0105caf85cc9542b4c21d487385faa34c835398c3320ccbd3b SHA512 487c405fed6430f62d2d0c38b65f6223b1c5074c7a0d3734dc8b3bb72fca255f5727e49541749569713a0c3e9a67eff574ba5698e8dceca6f0ef20b50f99aa42
23 DIST rustc-1.33.0-src.tar.xz 100635400 BLAKE2B 1fe8ffcfab8324a93a07b9b9ac9cd050fd9d660fb24884761e8ce5e5a67ce5b6df8513e1440090b39c3ced9cb5ced43f07cc9b0337d39625d2cf4aa9e083cfef SHA512 3291e4e19f75f44c81e6fcf4c01edc7c9d326eca43722381231abcf2e99f4314059ba59a29b79f5511ad9421c358c45e8fe18584d6954d17fe2aabad0f9d9147
24 DIST rustc-1.34.0-src.tar.xz 95055768 BLAKE2B 5df848369e8087ac10c57d9818e644e51be1d4a89e68341a2a49a09f0902c153ba5fab2d82e4178742b3ac4205249347950d0685259f6b1fe0761ec4daf87518 SHA512 cf9952cafe42987f84a6fe9e351a401f2db35c33ddc87d2efb762c4c33a643ffe516f00d848a1ae759f48cea1504243b6169c29ab28ba2e6b00a51422c745861
25 +DIST rustc-1.34.1-src.tar.xz 95048260 BLAKE2B 41e034aa0e5ea71aa21d6b5700134fc2e1391915309aa14e11426b1c0a3ad213c5b11f67df3f1beebd885d9d3bb358b12a10dd2095cbcb6b2a18870e977568f8 SHA512 c9ee59a98e0300c16a9044424fbaad0e1d5f026279b9cb238ab5bfe02c6b111780ec5f9884c4cac67d5ee91833e301bc23bd457026982587982b2fb80a528dca
26
27 diff --git a/dev-lang/rust/rust-1.34.1.ebuild b/dev-lang/rust/rust-1.34.1.ebuild
28 new file mode 100644
29 index 00000000000..3409dc5c4f4
30 --- /dev/null
31 +++ b/dev-lang/rust/rust-1.34.1.ebuild
32 @@ -0,0 +1,330 @@
33 +# Copyright 1999-2019 Gentoo Authors
34 +# Distributed under the terms of the GNU General Public License v2
35 +
36 +EAPI=6
37 +
38 +PYTHON_COMPAT=( python2_7 python3_{5,6,7} pypy )
39 +
40 +inherit check-reqs eapi7-ver 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 ~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="https://static.rust-lang.org/dist/${SRC} -> rustc-${PV}-src.tar.xz
62 + $(rust_all_arch_uris rust-${RUST_STAGE0_VERSION})"
63 +
64 +ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM BPF Hexagon Lanai Mips MSP430
65 + NVPTX PowerPC Sparc SystemZ WebAssembly X86 XCore )
66 +ALL_LLVM_TARGETS=( "${ALL_LLVM_TARGETS[@]/#/llvm_targets_}" )
67 +LLVM_TARGET_USEDEPS=${ALL_LLVM_TARGETS[@]/%/?}
68 +
69 +LICENSE="|| ( MIT Apache-2.0 ) BSD-1 BSD-2 BSD-4 UoI-NCSA"
70 +
71 +IUSE="clippy cpu_flags_x86_sse2 debug doc libressl rls rustfmt system-llvm wasm ${ALL_LLVM_TARGETS[*]}"
72 +
73 +# Please keep the LLVM dependency block separate. Since LLVM is slotted,
74 +# we need to *really* make sure we're not pulling one than more slot
75 +# simultaneously.
76 +
77 +# How to use it:
78 +# 1. List all the working slots (with min versions) in ||, newest first.
79 +# 2. Update the := to specify *max* version, e.g. < 9.
80 +# 3. Specify LLVM_MAX_SLOT, e.g. 8.
81 +LLVM_DEPEND="
82 + || (
83 + sys-devel/llvm:8[llvm_targets_WebAssembly?]
84 + )
85 + <sys-devel/llvm-9:=
86 +"
87 +LLVM_MAX_SLOT=8
88 +
89 +COMMON_DEPEND="
90 + sys-libs/zlib
91 + !libressl? ( dev-libs/openssl:0= )
92 + libressl? ( dev-libs/libressl:0= )
93 + net-libs/libssh2
94 + net-libs/http-parser:=
95 + net-misc/curl[ssl]
96 + system-llvm? (
97 + ${LLVM_DEPEND}
98 + )
99 +"
100 +
101 +DEPEND="${COMMON_DEPEND}
102 + ${PYTHON_DEPS}
103 + || (
104 + >=sys-devel/gcc-4.7
105 + >=sys-devel/clang-3.5
106 + )
107 + dev-util/cmake"
108 +RDEPEND="${COMMON_DEPEND}
109 + >=app-eselect/eselect-rust-20190311
110 + !dev-util/cargo
111 + rustfmt? ( !dev-util/rustfmt )"
112 +REQUIRED_USE="|| ( ${ALL_LLVM_TARGETS[*]} )
113 + wasm? ( llvm_targets_WebAssembly )
114 + x86? ( cpu_flags_x86_sse2 )
115 +"
116 +
117 +PATCHES=(
118 + "${FILESDIR}"/0001-llvm-cmake-Add-additional-headers-only-if-they-exist.patch
119 + "${FILESDIR}"/1.34.0-doc-build-fix.patch
120 + "${FILESDIR}"/1.34.0-libressl.patch # bug 684224
121 +)
122 +
123 +S="${WORKDIR}/${MY_P}-src"
124 +
125 +toml_usex() {
126 + usex "$1" true false
127 +}
128 +
129 +pre_build_checks() {
130 + CHECKREQS_DISK_BUILD="7G"
131 + CHECKREQS_MEMORY="4G"
132 + eshopts_push -s extglob
133 + if is-flagq '-g?(gdb)?([1-9])'; then
134 + CHECKREQS_DISK_BUILD="10G"
135 + CHECKREQS_MEMORY="16G"
136 + fi
137 + eshopts_pop
138 + check-reqs_pkg_setup
139 +}
140 +
141 +pkg_pretend() {
142 + pre_build_checks
143 +}
144 +
145 +pkg_setup() {
146 + pre_build_checks
147 + python-any-r1_pkg_setup
148 + use system-llvm && llvm_pkg_setup
149 +}
150 +
151 +src_prepare() {
152 + local rust_stage0_root="${WORKDIR}"/rust-stage0
153 +
154 + local rust_stage0="rust-${RUST_STAGE0_VERSION}-$(rust_abi)"
155 +
156 + "${WORKDIR}/${rust_stage0}"/install.sh --disable-ldconfig --destdir="${rust_stage0_root}" --prefix=/ || die
157 +
158 + # ugly hack for https://bugs.gentoo.org/679806
159 + if use ppc64; then
160 + sed -i 's/getentropy/gEtEnTrOpY/g' "${rust_stage0_root}"/bin/cargo || die
161 + export OPENSSL_ppccap=0
162 + fi
163 +
164 + default
165 +}
166 +
167 +src_configure() {
168 + local rust_target="" rust_targets="" arch_cflags
169 +
170 + # Collect rust target names to compile standard libs for all ABIs.
171 + for v in $(multilib_get_enabled_abi_pairs); do
172 + rust_targets="${rust_targets},\"$(rust_abi $(get_abi_CHOST ${v##*.}))\""
173 + done
174 + if use wasm; then
175 + rust_targets="${rust_targets},\"wasm32-unknown-unknown\""
176 + fi
177 + rust_targets="${rust_targets#,}"
178 +
179 + local extended="true" tools="\"cargo\","
180 + if use clippy; then
181 + tools="\"clippy\",$tools"
182 + fi
183 + if use rls; then
184 + tools="\"rls\",\"analysis\",\"src\",$tools"
185 + fi
186 + if use rustfmt; then
187 + tools="\"rustfmt\",$tools"
188 + fi
189 +
190 + local rust_stage0_root="${WORKDIR}"/rust-stage0
191 +
192 + rust_target="$(rust_abi)"
193 +
194 + cat <<- EOF > "${S}"/config.toml
195 + [llvm]
196 + optimize = $(toml_usex !debug)
197 + release-debuginfo = $(toml_usex debug)
198 + assertions = $(toml_usex debug)
199 + targets = "${LLVM_TARGETS// /;}"
200 + experimental-targets = ""
201 + link-shared = $(toml_usex system-llvm)
202 + [build]
203 + build = "${rust_target}"
204 + host = ["${rust_target}"]
205 + target = [${rust_targets}]
206 + cargo = "${rust_stage0_root}/bin/cargo"
207 + rustc = "${rust_stage0_root}/bin/rustc"
208 + docs = $(toml_usex doc)
209 + submodules = false
210 + python = "${EPYTHON}"
211 + locked-deps = true
212 + vendor = true
213 + extended = ${extended}
214 + tools = [${tools}]
215 + [install]
216 + prefix = "${EPREFIX}/usr"
217 + libdir = "$(get_libdir)/${P}"
218 + docdir = "share/doc/${P}"
219 + mandir = "share/${P}/man"
220 + [rust]
221 + optimize = $(toml_usex !debug)
222 + debuginfo = $(toml_usex debug)
223 + debug-assertions = $(toml_usex debug)
224 + default-linker = "$(tc-getCC)"
225 + channel = "stable"
226 + rpath = false
227 + lld = $(toml_usex wasm)
228 + EOF
229 +
230 + for v in $(multilib_get_enabled_abi_pairs); do
231 + rust_target=$(rust_abi $(get_abi_CHOST ${v##*.}))
232 + arch_cflags="$(get_abi_CFLAGS ${v##*.})"
233 +
234 + cat <<- EOF >> "${S}"/config.env
235 + CFLAGS_${rust_target}=${arch_cflags}
236 + EOF
237 +
238 + cat <<- EOF >> "${S}"/config.toml
239 + [target.${rust_target}]
240 + cc = "$(tc-getBUILD_CC)"
241 + cxx = "$(tc-getBUILD_CXX)"
242 + linker = "$(tc-getCC)"
243 + ar = "$(tc-getAR)"
244 + EOF
245 + if use system-llvm; then
246 + cat <<- EOF >> "${S}"/config.toml
247 + llvm-config = "$(get_llvm_prefix "${LLVM_MAX_SLOT}")/bin/llvm-config"
248 + EOF
249 + fi
250 + done
251 +
252 + if use wasm; then
253 + cat <<- EOF >> "${S}"/config.toml
254 + [target.wasm32-unknown-unknown]
255 + linker = "rust-lld"
256 + EOF
257 + fi
258 +}
259 +
260 +src_compile() {
261 + env $(cat "${S}"/config.env)\
262 + "${EPYTHON}" ./x.py build -v --config="${S}"/config.toml -j$(makeopts_jobs) \
263 + --exclude src/tools/miri || die # https://github.com/rust-lang/rust/issues/52305
264 +}
265 +
266 +src_install() {
267 + local rust_target abi_libdir
268 +
269 + env DESTDIR="${D}" "${EPYTHON}" ./x.py install -v || die
270 +
271 + mv "${ED}/usr/bin/rustc" "${ED}/usr/bin/rustc-${PV}" || die
272 + mv "${ED}/usr/bin/rustdoc" "${ED}/usr/bin/rustdoc-${PV}" || die
273 + mv "${ED}/usr/bin/rust-gdb" "${ED}/usr/bin/rust-gdb-${PV}" || die
274 + mv "${ED}/usr/bin/rust-gdbgui" "${ED}/usr/bin/rust-gdbgui-${PV}" || die
275 + mv "${ED}/usr/bin/rust-lldb" "${ED}/usr/bin/rust-lldb-${PV}" || die
276 + mv "${ED}/usr/bin/cargo" "${ED}/usr/bin/cargo-${PV}" || die
277 + if use clippy; then
278 + mv "${ED}/usr/bin/clippy-driver" "${ED}/usr/bin/clippy-driver-${PV}" || die
279 + mv "${ED}/usr/bin/cargo-clippy" "${ED}/usr/bin/cargo-clippy-${PV}" || die
280 + fi
281 + if use rls; then
282 + mv "${ED}/usr/bin/rls" "${ED}/usr/bin/rls-${PV}" || die
283 + fi
284 + if use rustfmt; then
285 + mv "${ED}/usr/bin/rustfmt" "${ED}/usr/bin/rustfmt-${PV}" || die
286 + mv "${ED}/usr/bin/cargo-fmt" "${ED}/usr/bin/cargo-fmt-${PV}" || die
287 + fi
288 +
289 + # Copy shared library versions of standard libraries for all targets
290 + # into the system's abi-dependent lib directories because the rust
291 + # installer only does so for the native ABI.
292 + for v in $(multilib_get_enabled_abi_pairs); do
293 + if [ ${v##*.} = ${DEFAULT_ABI} ]; then
294 + continue
295 + fi
296 + abi_libdir=$(get_abi_LIBDIR ${v##*.})
297 + rust_target=$(rust_abi $(get_abi_CHOST ${v##*.}))
298 + mkdir -p "${ED}/usr/${abi_libdir}"
299 + cp "${ED}/usr/$(get_libdir)/${P}/rustlib/${rust_target}/lib"/*.so \
300 + "${ED}/usr/${abi_libdir}" || die
301 + done
302 +
303 + dodoc COPYRIGHT
304 +
305 + # FIXME:
306 + # Really not sure if that env is needed, specailly LDPATH
307 + cat <<-EOF > "${T}"/50${P}
308 + LDPATH="${EPREFIX}/usr/$(get_libdir)/${P}"
309 + MANPATH="${EPREFIX}/usr/share/${P}/man"
310 + EOF
311 + doenvd "${T}"/50${P}
312 +
313 + # note: eselect-rust adds EROOT to all paths below
314 + cat <<-EOF > "${T}/provider-${P}"
315 + /usr/bin/rustdoc
316 + /usr/bin/rust-gdb
317 + /usr/bin/rust-gdbgui
318 + /usr/bin/rust-lldb
319 + EOF
320 + echo /usr/bin/cargo >> "${T}/provider-${P}"
321 + if use clippy; then
322 + echo /usr/bin/clippy-driver >> "${T}/provider-${P}"
323 + echo /usr/bin/cargo-clippy >> "${T}/provider-${P}"
324 + fi
325 + if use rls; then
326 + echo /usr/bin/rls >> "${T}/provider-${P}"
327 + fi
328 + if use rustfmt; then
329 + echo /usr/bin/rustfmt >> "${T}/provider-${P}"
330 + echo /usr/bin/cargo-fmt >> "${T}/provider-${P}"
331 + fi
332 + dodir /etc/env.d/rust
333 + insinto /etc/env.d/rust
334 + doins "${T}/provider-${P}"
335 +}
336 +
337 +pkg_postinst() {
338 + eselect rust update --if-unset
339 +
340 + elog "Rust installs a helper script for calling GDB and LLDB,"
341 + elog "for your convenience it is installed under /usr/bin/rust-{gdb,lldb}-${PV}."
342 +
343 + ewarn "cargo is now installed from dev-lang/rust{,-bin} instead of dev-util/cargo."
344 + ewarn "This might have resulted in a dangling symlink for /usr/bin/cargo on some"
345 + ewarn "systems. This can be resolved by calling 'sudo eselect rust set ${P}'."
346 +
347 + if has_version app-editors/emacs || has_version app-editors/emacs-vcs; then
348 + elog "install app-emacs/rust-mode to get emacs support for rust."
349 + fi
350 +
351 + if has_version app-editors/gvim || has_version app-editors/vim; then
352 + elog "install app-vim/rust-vim to get vim support for rust."
353 + fi
354 +
355 + if has_version 'app-shells/zsh'; then
356 + elog "install app-shells/rust-zshcomp to get zsh completion for rust."
357 + fi
358 +}
359 +
360 +pkg_postrm() {
361 + eselect rust unset --if-invalid
362 +}