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: Thu, 27 Aug 2020 18:28:39
Message-Id: 1598552895.d33fc58289d1cf491ec5b834130625b417ac3c92.gyakovlev@gentoo
1 commit: d33fc58289d1cf491ec5b834130625b417ac3c92
2 Author: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
3 AuthorDate: Thu Aug 27 17:29:47 2020 +0000
4 Commit: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
5 CommitDate: Thu Aug 27 18:28:15 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d33fc582
7
8 dev-lang/rust: bump to 1.46.0
9
10 Package-Manager: Portage-3.0.4, Repoman-3.0.1
11 Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org>
12
13 dev-lang/rust/Manifest | 15 ++
14 dev-lang/rust/rust-1.46.0.ebuild | 550 +++++++++++++++++++++++++++++++++++++++
15 2 files changed, 565 insertions(+)
16
17 diff --git a/dev-lang/rust/Manifest b/dev-lang/rust/Manifest
18 index e60f43af04f..9c9eea3dce4 100644
19 --- a/dev-lang/rust/Manifest
20 +++ b/dev-lang/rust/Manifest
21 @@ -26,5 +26,20 @@ DIST rust-1.44.1-powerpc64le-unknown-linux-gnu.tar.xz 112429740 BLAKE2B 10252623
22 DIST rust-1.44.1-s390x-unknown-linux-gnu.tar.xz 119312728 BLAKE2B f5e3209990d3cc0181a200448e4bcbf1f6754847cfc36d7355e191fd49e239d3e0c002310743fd063241c5dec47da3a0776c361241facbcc4a1f1e9254eb805d SHA512 84c6ed736bb7d0c10aaceeb2c2c3c97f6188fd7d7f4466c8ef35ffc591d6bde3b273a0d62d50e60f184ccd81c96a31ed2e610e82fb9ed9efd574e4c5a5f25d26
23 DIST rust-1.44.1-x86_64-unknown-linux-gnu.tar.xz 112133992 BLAKE2B c0af6bf1417bbb69be9f552f60805eb0a5f530b667ca2bbd04db9d567f1eb467a9e72912062a3c22d3922c29809258637dd7568c29e461dbeb5d17aa0699dd45 SHA512 540761fd5246f4a48a7606ac0220f0d61963473b57ef703696871dc23fda8154d45351b8e81018d15899c386b44e43b05028cc797d495e9dc46f127fbea7f093
24 DIST rust-1.44.1-x86_64-unknown-linux-musl.tar.xz 117456616 BLAKE2B fd2752cf867e1ff701e624caf602fe7a29b47c64e633508e91da1a1b2321f5531441b84cc9f0ad159ef399d38628d60e59f8b7a99e5427df928abceb24f937f2 SHA512 05ca3e07001746511c5fcb5122f487205ffaee771805b0219db018b350d67945f5ab4b0b2cf98b7e7832b53365e3932fef37506a65ecaaf624d0bb8d43cf8427
25 +DIST rust-1.45.1-aarch64-unknown-linux-gnu.tar.xz 110598096 BLAKE2B a3defd33d2c223012c9eb7b094c77f338ae9beb8661412966a62b4bc868175cf91489f4328a8dc7d0b84b892dad713d2c4f4d180c55dbcd2ffd58c3920585e84 SHA512 fd64aaa3d8137d62c838f0ef554ff159c84263a4734556c0e4ef911d3f87921f846d70d76983fe8ebe9679477915255ceea69c8a9769797893827d5d67e97b0b
26 +DIST rust-1.45.1-arm-unknown-linux-gnueabi.tar.xz 115140648 BLAKE2B 537fe3874c0b09b8cad304c09ca36824cd77916508e7527b9b53a3a8a37ddeab3e760bb1f40c185a91a1eeba7953d7d9d2687e1d341b0833e2a129994e4a9014 SHA512 a3c36dee2f7cda77dd307ad61065c7ce20a433689a3396d8c286b07f0f2aea666881dd4089e2332a0793a51a72189928919a477e72e7f44a64b41101c65cf9ed
27 +DIST rust-1.45.1-arm-unknown-linux-gnueabihf.tar.xz 113215036 BLAKE2B 36cabfcf77dd533b7f5f89dd5b94244d148cc4c6e19c76a9d677c01a4daffd8075f6842b98314f5ab37c66b223901cfe8a16e7637f3f805f5e75c705979fe8e4 SHA512 770fa7b73fc08979da63f83155cd424b0b7a543a5e6c47a2cb20aeb4f3470360622b70adc9d527a9316bc6b388a696d60c9de9119fe9be448d26cd48871b533d
28 +DIST rust-1.45.1-armv7-unknown-linux-gnueabihf.tar.xz 116371752 BLAKE2B 3feecd7c1917294bd2384c36a9bfc371df1fa551f04c509e13d21ad3f95bdc06d2f0aac97edef10a87eef65b41b95bc34acae3741fd9648996f4ed43d4a54db7 SHA512 6dec92d112c0bbbe0434162d10df630505ba179b99fb51800140204fb2e52215d387162d97dadd3aff2324c81a4bbc944e45f4d39e55bf85e244d741e556a391
29 +DIST rust-1.45.1-i686-unknown-linux-gnu.tar.xz 131991636 BLAKE2B 2c012695d39e3665fc35fe5f66d4f0dcbbbd5525d1c8a8e26de2edc2edeee3985df1e5aa39e3122ac723f4dad1d9792be215748d80157d6f717584cbed656a98 SHA512 80f3bb328666766e177587c11cac4fb0db515ea16fc0462a29816a8474669f49c69461d2939919833337f3a95fbd1da09a55307f3f1936220bc2065f760a2345
30 +DIST rust-1.45.1-mips-unknown-linux-gnu.tar.xz 101183232 BLAKE2B f04ff7601935aad83e00ee062823b289d7bad8b591cd7d2ddb7c0d77be1b987621484ae829e56fd24971ac92c4dcce93d35d7313476d937b67da88cd4353aa2f SHA512 e70efa6c04f9ac4e4ef23d80457abee2219f04e81a743e67aa5305022265f0fac7db4998cae3d5587c38c17ae8f6d8e8d7052897a08c6939bce882bb6186bb2c
31 +DIST rust-1.45.1-mips64-unknown-linux-gnuabi64.tar.xz 107235492 BLAKE2B 425dca5246a6c4648fa061c73a09b38650a838e86760d55ab51cb655385f3066c29bb520d5c12271b4d04e4b961d948782b9a27078a849fafc867882720d0505 SHA512 f1ccc296c8f5e806795630aa8939ca3025cde76bf7fb0285e656b1bbf0d0e29b70f3ef7e6598a8146250d0d743d41b372018777aecde8bbde015e276d365db6c
32 +DIST rust-1.45.1-mipsel-unknown-linux-gnu.tar.xz 104260264 BLAKE2B b39b3305a1624daf0023ff5564dea21933999c2e488e6ca0da32a52be9891e4e9e3836e7509e8b7de8d3f2fab58b1360f21c2519da7bd1be8ed539f901973997 SHA512 de4e294e45d07e1544bb20e1fde78dcdf183e291f643f119959f61d075b691bff1290b3060c365a469dec7ae9bbf516e0b613b7b2b707b4fe23c37f972f40861
33 +DIST rust-1.45.1-powerpc-unknown-linux-gnu.tar.xz 106026300 BLAKE2B 73456028e79893ddb252a010ec0fa03443be874f5fd3b82f64ce221bd5685aea94acf29551ea3493155dc7caa7087b6db6df760b59dafc344f3040dd5e145ea6 SHA512 bbd6fdd879a8a7125f818946851e59f869c17997e58c90119370f4066c20db9d83f1250d59dccfc560d8b23cab45ce5c2d7edaef131f89ef7e2ce1ad903f2768
34 +DIST rust-1.45.1-powerpc64-unknown-linux-gnu.tar.xz 116528188 BLAKE2B 56a9d1a8d967b67b160aba248b50731744d21df4bb80f509a3008dbb6f2ed1c0271c9bcb621786354ece55c2f0aba63e9baad8ffdf30627b7e3167de645f9165 SHA512 12413ebf48a369ab869c4c7d40f6dcbe9cf53e094983eefbf142149759ce74a3f961dc8b68dfe4607b17c2ca34e5a97a38e0ccb2c14dea157fe93eccfd511bd5
35 +DIST rust-1.45.1-powerpc64le-unknown-linux-gnu.tar.xz 119234164 BLAKE2B 4148957ff2f95a8c440609e66956bfaed983e689dbcb5ae041e8ca092ef5da366324806d4c6075d0a73af6110c1f16d2bde09b369166b6fe47e42c104a5f2df5 SHA512 5222d1baa2836138ea65646a8ced3f186486bf7cf3b988f93280e2153371aa593c0ba660be9830ff4dd6cfdbe6cda32ead27a824a2e71c51d23749ea4a20c39d
36 +DIST rust-1.45.1-s390x-unknown-linux-gnu.tar.xz 124758156 BLAKE2B ff62e14d5ae9f7213ebc24d694317ff292cb0d7d2a67f0ca284cddd2b9f594547b01a6c647780d47989d4405072f377d37fc03933431a3df804e37bc1248e803 SHA512 278411c6308eaa4d732ff4c0f448d808a5ee74dae5f3eaf04773ccf65c9bc5963153f62346d30de0f577dd6da89c55bed280c2fb0e50d2075e3c30a3649fc4e8
37 +DIST rust-1.45.1-x86_64-unknown-linux-gnu.tar.xz 117764080 BLAKE2B cafe6e4f7c28112879089d75703a1b1ce7c0cf9b5ab5beeb4ddf343f7bc93e8704bc105ba0bd95f1df6d62439f206d8f4ae9090330af857ec0a249540eb63122 SHA512 13ee5ff7cae29440e32fb140404ff01414d66f0ea8d79777fb1586541de1ee6ef8e12f9249c35374501460a2352f7d0f6035b5bdc2f0daa91d772a157657ec0b
38 +DIST rust-1.45.1-x86_64-unknown-linux-musl.tar.xz 123820216 BLAKE2B 1afe48589e5eec15d8fdb31d52b2ada49688e78a311298d421a8b2d4c0cc6a708223e5976518d66506584dc2adc63651b62b8c1fc3c3ccfaff80e2ef7ade5078 SHA512 39875878acfeb05d7b72bab2dea51063a523fa7ad136d582ba28603df7f8b1c3360e5838e5f9b08f396969e52bb1fc672fa4c08cf5f8ffc39128af129b6b17a6
39 DIST rustc-1.44.1-src.tar.xz 94756856 BLAKE2B 60f536c3ba0fa1fec4b6333ee57809ee5226090ad5041c14a136b4356ff3b898062e06c3fe54effe873e27931ac8fcb902cd48a38615a8de7eebc6ecb3bdc2bd SHA512 1c17002edae844a710db9b144c17171416330dc565343c65af8a6e112fb61555e2025bb4cf33cac1229d7df689e6ff8858b91ae00552400ccacafaf1de11849b
40 DIST rustc-1.45.2-src.tar.xz 98683036 BLAKE2B a4102a5d4744b7ccc9b076aba00c39d69532f777e7d39e0e4ce2033b663b43e27b55034fdb3a1e13379fae9a16bff9e7748865a84507f7388ef0ebf9d421eac7 SHA512 cc6250c0bc844e77ca6dd7ae013e434ed3009b001914114866ed31f28edf3960221454d131e298b15050e3b8153fb8298d509559c2f7307c64611aa8e36b4d25
41 +DIST rustc-1.46.0-src.tar.xz 101868452 BLAKE2B da9798596b124a10d79c236a871228f05e5f571d22c2259328e7026c91e088c85f5de9c0536a16531e0cb10477bfcd16d3ac11467979f5561cb6199442b877ef SHA512 099857f1d295043587a4e2a65ef3e6a90e12c8b6958e98535a1656c113c553f9a9b621aba8a19cf21bd8d2c79d27cbfa4b8e6fabbcb3cbfee23b545be7b450b4
42
43 diff --git a/dev-lang/rust/rust-1.46.0.ebuild b/dev-lang/rust/rust-1.46.0.ebuild
44 new file mode 100644
45 index 00000000000..68cc5bb4cb2
46 --- /dev/null
47 +++ b/dev-lang/rust/rust-1.46.0.ebuild
48 @@ -0,0 +1,550 @@
49 +# Copyright 1999-2020 Gentoo Authors
50 +# Distributed under the terms of the GNU General Public License v2
51 +
52 +EAPI=7
53 +
54 +PYTHON_COMPAT=( python3_{6,7,8} )
55 +
56 +inherit bash-completion-r1 check-reqs estack flag-o-matic llvm multiprocessing multilib-build python-any-r1 rust-toolchain toolchain-funcs
57 +
58 +if [[ ${PV} = *beta* ]]; then
59 + betaver=${PV//*beta}
60 + BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
61 + MY_P="rustc-beta"
62 + SLOT="beta/${PV}"
63 + SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.xz"
64 +else
65 + ABI_VER="$(ver_cut 1-2)"
66 + SLOT="stable/${ABI_VER}"
67 + MY_P="rustc-${PV}"
68 + SRC="${MY_P}-src.tar.xz"
69 + KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86"
70 +fi
71 +
72 +RUST_STAGE0_VERSION="1.$(($(ver_cut 2) - 1)).1"
73 +
74 +DESCRIPTION="Systems programming language from Mozilla"
75 +HOMEPAGE="https://www.rust-lang.org/"
76 +
77 +SRC_URI="
78 + https://static.rust-lang.org/dist/${SRC} -> rustc-${PV}-src.tar.xz
79 + !system-bootstrap? ( $(rust_all_arch_uris rust-${RUST_STAGE0_VERSION}) )
80 +"
81 +
82 +ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM BPF Hexagon Lanai Mips MSP430
83 + NVPTX PowerPC RISCV Sparc SystemZ WebAssembly X86 XCore )
84 +ALL_LLVM_TARGETS=( "${ALL_LLVM_TARGETS[@]/#/llvm_targets_}" )
85 +LLVM_TARGET_USEDEPS=${ALL_LLVM_TARGETS[@]/%/?}
86 +
87 +LICENSE="|| ( MIT Apache-2.0 ) BSD-1 BSD-2 BSD-4 UoI-NCSA"
88 +
89 +IUSE="clippy cpu_flags_x86_sse2 debug doc libressl miri nightly parallel-compiler rls rustfmt system-bootstrap system-llvm wasm ${ALL_LLVM_TARGETS[*]}"
90 +
91 +# Please keep the LLVM dependency block separate. Since LLVM is slotted,
92 +# we need to *really* make sure we're not pulling more than one slot
93 +# simultaneously.
94 +
95 +# How to use it:
96 +# 1. List all the working slots (with min versions) in ||, newest first.
97 +# 2. Update the := to specify *max* version, e.g. < 11.
98 +# 3. Specify LLVM_MAX_SLOT, e.g. 10.
99 +LLVM_DEPEND="
100 + || (
101 + sys-devel/llvm:10[${LLVM_TARGET_USEDEPS// /,}]
102 + sys-devel/llvm:9[${LLVM_TARGET_USEDEPS// /,}]
103 + )
104 + <sys-devel/llvm-11:=
105 + wasm? ( sys-devel/lld )
106 +"
107 +LLVM_MAX_SLOT=10
108 +
109 +BOOTSTRAP_DEPEND="|| ( >=dev-lang/rust-1.$(($(ver_cut 2) - 1)) >=dev-lang/rust-bin-1.$(($(ver_cut 2) - 1)) )"
110 +
111 +BDEPEND="${PYTHON_DEPS}
112 + app-eselect/eselect-rust
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 +# libgit2 should be at least same as bundled into libgit-sys #707746
125 +DEPEND="
126 + >=dev-libs/libgit2-0.99:=
127 + net-libs/libssh2:=
128 + net-libs/http-parser:=
129 + net-misc/curl:=[http2,ssl]
130 + sys-libs/zlib:=
131 + !libressl? ( dev-libs/openssl:0= )
132 + libressl? ( dev-libs/libressl:0= )
133 + elibc_musl? ( sys-libs/libunwind )
134 + system-llvm? (
135 + ${LLVM_DEPEND}
136 + )
137 +"
138 +
139 +RDEPEND="${DEPEND}
140 + app-eselect/eselect-rust
141 +"
142 +
143 +REQUIRED_USE="|| ( ${ALL_LLVM_TARGETS[*]} )
144 + miri? ( nightly )
145 + parallel-compiler? ( nightly )
146 + wasm? ( llvm_targets_WebAssembly )
147 + x86? ( cpu_flags_x86_sse2 )
148 +"
149 +
150 +# we don't use cmake.eclass, but can get a warnin -l
151 +CMAKE_WARN_UNUSED_CLI=no
152 +
153 +QA_FLAGS_IGNORED="
154 + usr/bin/.*-${PV}
155 + usr/lib.*/${P}/lib.*.so.*
156 + usr/lib.*/${P}/rustlib/.*/bin/.*
157 + usr/lib.*/${P}/rustlib/.*/lib/lib.*.so.*
158 +"
159 +
160 +QA_SONAME="
161 + usr/lib.*/${P}/lib.*.so.*
162 + usr/lib.*/${P}/rustlib/.*/lib/lib.*.so.*
163 +"
164 +
165 +# tests need a bit more work, currently they are causing multiple
166 +# re-compilations and somewhat fragile.
167 +RESTRICT="test"
168 +
169 +PATCHES=(
170 + "${FILESDIR}"/0012-Ignore-broken-and-non-applicable-tests.patch
171 + "${FILESDIR}"/1.44.0-libressl.patch
172 +)
173 +
174 +S="${WORKDIR}/${MY_P}-src"
175 +
176 +toml_usex() {
177 + usex "$1" true false
178 +}
179 +
180 +boostrap_rust_version_check() {
181 + # never call from pkg_pretend. eselect-rust may be not installed yet.
182 + local rustc_wanted="$(ver_cut 1).$(($(ver_cut 2) - 1))"
183 + local rustc_version=( $(eselect --brief rust show 2>/dev/null) )
184 + rustc_version=${rustc_version[0]#rust-bin-}
185 + rustc_version=${rustc_version#rust-}
186 +
187 + [[ -z "${rustc_version}" ]] && die "Failed to determine rustc version!"
188 +
189 + if ver_test "${rustc_version}" -lt "${rustc_wanted}" ; then
190 + eerror "Rust >=${rustc_wanted} is required"
191 + eerror "please run \'eselect rust\' and set correct rust version"
192 + die
193 + else
194 + einfo "Using rust ${rustc_version} to build"
195 + fi
196 +}
197 +
198 +pre_build_checks() {
199 + local M=6144
200 + M=$(( $(usex clippy 128 0) + ${M} ))
201 + M=$(( $(usex miri 128 0) + ${M} ))
202 + M=$(( $(usex rls 512 0) + ${M} ))
203 + M=$(( $(usex rustfmt 256 0) + ${M} ))
204 + M=$(( $(usex system-llvm 0 2048) + ${M} ))
205 + M=$(( $(usex wasm 256 0) + ${M} ))
206 + M=$(( $(usex debug 15 10) * ${M} / 10 ))
207 + eshopts_push -s extglob
208 + if is-flagq '-g?(gdb)?([1-9])'; then
209 + M=$(( 15 * ${M} / 10 ))
210 + fi
211 + eshopts_pop
212 + M=$(( $(usex system-bootstrap 0 1024) + ${M} ))
213 + M=$(( $(usex doc 256 0) + ${M} ))
214 + CHECKREQS_DISK_BUILD=${M}M check-reqs_pkg_${EBUILD_PHASE}
215 +}
216 +
217 +pkg_pretend() {
218 + pre_build_checks
219 +}
220 +
221 +pkg_setup() {
222 + pre_build_checks
223 + python-any-r1_pkg_setup
224 + use system-bootstrap && boostrap_rust_version_check
225 +
226 + # required to link agains system libs, otherwise
227 + # crates use bundled sources and compile own static version
228 + export LIBGIT2_SYS_USE_PKG_CONFIG=1
229 + export LIBSSH2_SYS_USE_PKG_CONFIG=1
230 + export PKG_CONFIG_ALLOW_CROSS=1
231 +
232 + if use system-llvm; then
233 + llvm_pkg_setup
234 +
235 + local llvm_config="$(get_llvm_prefix "$LLVM_MAX_SLOT")/bin/llvm-config"
236 +
237 + export LLVM_LINK_SHARED=1
238 + export RUSTFLAGS="${RUSTFLAGS} -Lnative=$("${llvm_config}" --libdir)"
239 + fi
240 +}
241 +
242 +src_prepare() {
243 + if ! use system-bootstrap; then
244 + local rust_stage0_root="${WORKDIR}"/rust-stage0
245 + local rust_stage0="rust-${RUST_STAGE0_VERSION}-$(rust_abi)"
246 +
247 + "${WORKDIR}/${rust_stage0}"/install.sh --disable-ldconfig \
248 + --destdir="${rust_stage0_root}" --prefix=/ || die
249 + fi
250 +
251 + default
252 +}
253 +
254 +src_configure() {
255 + local rust_target="" rust_targets="" arch_cflags
256 +
257 + # Collect rust target names to compile standard libs for all ABIs.
258 + for v in $(multilib_get_enabled_abi_pairs); do
259 + rust_targets="${rust_targets},\"$(rust_abi $(get_abi_CHOST ${v##*.}))\""
260 + done
261 + if use wasm; then
262 + rust_targets="${rust_targets},\"wasm32-unknown-unknown\""
263 + if use system-llvm; then
264 + # un-hardcode rust-lld linker for this target
265 + # https://bugs.gentoo.org/715348
266 + sed -i '/linker:/ s/rust-lld/wasm-ld/' src/librustc_target/spec/wasm32_base.rs || die
267 + fi
268 + fi
269 + rust_targets="${rust_targets#,}"
270 +
271 + local tools="\"cargo\","
272 + if use clippy; then
273 + tools="\"clippy\",$tools"
274 + fi
275 + if use miri; then
276 + tools="\"miri\",$tools"
277 + fi
278 + if use rls; then
279 + tools="\"rls\",\"analysis\",\"src\",$tools"
280 + fi
281 + if use rustfmt; then
282 + tools="\"rustfmt\",$tools"
283 + fi
284 +
285 + local rust_stage0_root
286 + if use system-bootstrap; then
287 + rust_stage0_root="$(rustc --print sysroot)"
288 + else
289 + rust_stage0_root="${WORKDIR}"/rust-stage0
290 + fi
291 +
292 + rust_target="$(rust_abi)"
293 +
294 + cat <<- EOF > "${S}"/config.toml
295 + [llvm]
296 + optimize = $(toml_usex !debug)
297 + release-debuginfo = $(toml_usex debug)
298 + assertions = $(toml_usex debug)
299 + ninja = true
300 + targets = "${LLVM_TARGETS// /;}"
301 + experimental-targets = ""
302 + link-shared = $(toml_usex system-llvm)
303 + [build]
304 + build = "${rust_target}"
305 + host = ["${rust_target}"]
306 + target = [${rust_targets}]
307 + cargo = "${rust_stage0_root}/bin/cargo"
308 + rustc = "${rust_stage0_root}/bin/rustc"
309 + docs = $(toml_usex doc)
310 + compiler-docs = $(toml_usex doc)
311 + submodules = false
312 + python = "${EPYTHON}"
313 + locked-deps = true
314 + vendor = true
315 + extended = true
316 + tools = [${tools}]
317 + verbose = 2
318 + sanitizers = false
319 + profiler = false
320 + cargo-native-static = false
321 + [install]
322 + prefix = "${EPREFIX}/usr"
323 + libdir = "$(get_libdir)/${P}"
324 + docdir = "share/doc/${PF}"
325 + mandir = "share/${P}/man"
326 + [rust]
327 + optimize = true
328 + debug = $(toml_usex debug)
329 + debug-assertions = $(toml_usex debug)
330 + debuginfo-level-rustc = 0
331 + backtrace = true
332 + incremental = false
333 + default-linker = "$(tc-getCC)"
334 + parallel-compiler = $(toml_usex parallel-compiler)
335 + channel = "$(usex nightly nightly stable)"
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 + env $(cat "${S}"/config.env) RUST_BACKTRACE=1\
466 + "${EPYTHON}" ./x.py build -vv --config="${S}"/config.toml -j$(makeopts_jobs) || die
467 +}
468 +
469 +src_test() {
470 + env $(cat "${S}"/config.env) RUST_BACKTRACE=1\
471 + "${EPYTHON}" ./x.py test -vv --config="${S}"/config.toml -j$(makeopts_jobs) --no-doc --no-fail-fast \
472 + src/test/codegen \
473 + src/test/codegen-units \
474 + src/test/compile-fail \
475 + src/test/incremental \
476 + src/test/mir-opt \
477 + src/test/pretty \
478 + src/test/run-fail \
479 + src/test/run-make \
480 + src/test/run-make-fulldeps \
481 + src/test/ui \
482 + src/test/ui-fulldeps || die
483 +}
484 +
485 +src_install() {
486 + env $(cat "${S}"/config.env) DESTDIR="${D}" \
487 + "${EPYTHON}" ./x.py install -vv --config="${S}"/config.toml || die
488 +
489 + # bug #689562, #689160
490 + rm "${D}/etc/bash_completion.d/cargo" || die
491 + rmdir "${D}"/etc{/bash_completion.d,} || die
492 + dobashcomp build/tmp/dist/cargo-image/etc/bash_completion.d/cargo
493 +
494 + mv "${ED}/usr/bin/rustc" "${ED}/usr/bin/rustc-${PV}" || die
495 + mv "${ED}/usr/bin/rustdoc" "${ED}/usr/bin/rustdoc-${PV}" || die
496 + mv "${ED}/usr/bin/rust-gdb" "${ED}/usr/bin/rust-gdb-${PV}" || die
497 + mv "${ED}/usr/bin/rust-gdbgui" "${ED}/usr/bin/rust-gdbgui-${PV}" || die
498 + mv "${ED}/usr/bin/rust-lldb" "${ED}/usr/bin/rust-lldb-${PV}" || die
499 + mv "${ED}/usr/bin/cargo" "${ED}/usr/bin/cargo-${PV}" || die
500 + if use clippy; then
501 + mv "${ED}/usr/bin/clippy-driver" "${ED}/usr/bin/clippy-driver-${PV}" || die
502 + mv "${ED}/usr/bin/cargo-clippy" "${ED}/usr/bin/cargo-clippy-${PV}" || die
503 + fi
504 + if use miri; then
505 + mv "${ED}/usr/bin/miri" "${ED}/usr/bin/miri-${PV}" || die
506 + mv "${ED}/usr/bin/cargo-miri" "${ED}/usr/bin/cargo-miri-${PV}" || die
507 + fi
508 + if use rls; then
509 + mv "${ED}/usr/bin/rls" "${ED}/usr/bin/rls-${PV}" || die
510 + fi
511 + if use rustfmt; then
512 + mv "${ED}/usr/bin/rustfmt" "${ED}/usr/bin/rustfmt-${PV}" || die
513 + mv "${ED}/usr/bin/cargo-fmt" "${ED}/usr/bin/cargo-fmt-${PV}" || die
514 + fi
515 +
516 + # Copy shared library versions of standard libraries for all targets
517 + # into the system's abi-dependent lib directories because the rust
518 + # installer only does so for the native ABI.
519 +
520 + local abi_libdir rust_target
521 + for v in $(multilib_get_enabled_abi_pairs); do
522 + if [ ${v##*.} = ${DEFAULT_ABI} ]; then
523 + continue
524 + fi
525 + abi_libdir=$(get_abi_LIBDIR ${v##*.})
526 + rust_target=$(rust_abi $(get_abi_CHOST ${v##*.}))
527 + mkdir -p "${ED}/usr/${abi_libdir}/${P}"
528 + cp "${ED}/usr/$(get_libdir)/${P}/rustlib/${rust_target}/lib"/*.so \
529 + "${ED}/usr/${abi_libdir}/${P}" || die
530 + done
531 +
532 + # versioned libdir/mandir support
533 + newenvd - "50${P}" <<-_EOF_
534 + LDPATH="${EPREFIX}/usr/$(get_libdir)/${P}"
535 + MANPATH="${EPREFIX}/usr/share/${P}/man"
536 + _EOF_
537 +
538 + dodoc COPYRIGHT
539 + rm -rf "${ED}/usr/$(get_libdir)/${P}"/*.old || die
540 + rm "${ED}/usr/share/doc/${P}"/*.old || die
541 + rm "${ED}/usr/share/doc/${P}/LICENSE-APACHE" || die
542 + rm "${ED}/usr/share/doc/${P}/LICENSE-MIT" || die
543 +
544 + # note: eselect-rust adds EROOT to all paths below
545 + cat <<-EOF > "${T}/provider-${P}"
546 + /usr/bin/cargo
547 + /usr/bin/rustdoc
548 + /usr/bin/rust-gdb
549 + /usr/bin/rust-gdbgui
550 + /usr/bin/rust-lldb
551 + EOF
552 + if use clippy; then
553 + echo /usr/bin/clippy-driver >> "${T}/provider-${P}"
554 + echo /usr/bin/cargo-clippy >> "${T}/provider-${P}"
555 + fi
556 + if use miri; then
557 + echo /usr/bin/miri >> "${T}/provider-${P}"
558 + echo /usr/bin/cargo-miri >> "${T}/provider-${P}"
559 + fi
560 + if use rls; then
561 + echo /usr/bin/rls >> "${T}/provider-${P}"
562 + fi
563 + if use rustfmt; then
564 + echo /usr/bin/rustfmt >> "${T}/provider-${P}"
565 + echo /usr/bin/cargo-fmt >> "${T}/provider-${P}"
566 + fi
567 +
568 + insinto /etc/env.d/rust
569 + doins "${T}/provider-${P}"
570 +}
571 +
572 +pkg_postinst() {
573 + eselect rust update --if-unset
574 +
575 + elog "Rust installs a helper script for calling GDB and LLDB,"
576 + elog "for your convenience it is installed under /usr/bin/rust-{gdb,lldb}-${PV}."
577 +
578 + if has_version app-editors/emacs; then
579 + elog "install app-emacs/rust-mode to get emacs support for rust."
580 + fi
581 +
582 + if has_version app-editors/gvim || has_version app-editors/vim; then
583 + elog "install app-vim/rust-vim to get vim support for rust."
584 + fi
585 +
586 + if use elibc_musl; then
587 + ewarn "${PN} on *-musl targets is configured with crt-static"
588 + ewarn ""
589 + ewarn "you will need to set RUSTFLAGS=\"-C target-feature=-crt-static\" in make.conf"
590 + ewarn "to use it with portage, otherwise you may see failures like"
591 + ewarn "error: cannot produce proc-macro for serde_derive v1.0.98 as the target "
592 + ewarn "x86_64-unknown-linux-musl does not support these crate types"
593 + fi
594 +}
595 +
596 +pkg_postrm() {
597 + eselect rust cleanup
598 +}