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, 24 May 2019 09:07:01
Message-Id: 1558688550.a3a47e76ef90990dfeb3fd6fdac82111b2299e62.gyakovlev@gentoo
1 commit: a3a47e76ef90990dfeb3fd6fdac82111b2299e62
2 Author: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
3 AuthorDate: Fri May 24 05:29:54 2019 +0000
4 Commit: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
5 CommitDate: Fri May 24 09:02:30 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a3a47e76
7
8 dev-lang/rust: bump to 1.35.0
9
10 commit summary:
11 EAPI=7
12 don't compile lld with system-llvm and wasm
13 depend on lld if wasm enabled
14 pass config file at install phase, otherwise bad things happen
15 drop unneeded patches
16 make build verbose, so if users report bugs we can actually see failures
17 instead of cargo's green text
18
19 Package-Manager: Portage-2.3.66, Repoman-2.3.12
20 Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org>
21
22 dev-lang/rust/Manifest | 14 ++
23 dev-lang/rust/metadata.xml | 26 +--
24 dev-lang/rust/rust-1.35.0.ebuild | 334 +++++++++++++++++++++++++++++++++++++++
25 3 files changed, 361 insertions(+), 13 deletions(-)
26
27 diff --git a/dev-lang/rust/Manifest b/dev-lang/rust/Manifest
28 index 0d5f56dc073..fd33db50eff 100644
29 --- a/dev-lang/rust/Manifest
30 +++ b/dev-lang/rust/Manifest
31 @@ -76,6 +76,19 @@ DIST rust-1.33.0-powerpc64-unknown-linux-gnu.tar.xz 126030216 BLAKE2B b1d1b996b8
32 DIST rust-1.33.0-powerpc64le-unknown-linux-gnu.tar.xz 130922680 BLAKE2B db63d859631703e845efac57074e0f33f80a3b52b2e9dc8707b81892eee8fc922fa5a7d4b7b1f45fb5f19ea4d7f6fde9212f1c6e99e7e4c30dbc02aa87b0df7e SHA512 393c808e93792cf2b126d6111834932a55cbf18339942ac0d20fc4a3692b0ac08c21a3c8fd393795f7aafecac5a2c5d7c9415c18017a7453f759f746045f5144
33 DIST rust-1.33.0-s390x-unknown-linux-gnu.tar.xz 134441220 BLAKE2B e6f0a6e54e4e1fde10f54f66615d44442b7cb5eb5bda43d55ee791328c7ecd61505b3d84719df82b7c5c7ae473b7041512f2cf346281518d7d78d0e22112fa05 SHA512 755a0203e2c143386cb3729faada4d2c38b254dfa7e6eeb722ec9847d6319a1d3d289c7b77a2bc478d79dbbabfcd826d8b015acd29fbdf5acb591feae1876205
34 DIST rust-1.33.0-x86_64-unknown-linux-gnu.tar.xz 155298128 BLAKE2B af5bc628bc054bd354d5af78e53cd2ffbfbdf2c2d3a3e58eeb593f148c54024fa5905aa53a69c514d6d41e48688697e1ce8adb866817c77cdf541399f6e7956f SHA512 b7f3087f34e99517cd729f5ff1f8cce3f3254cb36c734d5b90d878293e4406934c2f597bf7e2941e9257046f62c9274eb4769a64dabfbc5f0bbf2a1703f7fef8
35 +DIST rust-1.34.2-aarch64-unknown-linux-gnu.tar.xz 120868188 BLAKE2B d843cce81338b2b3765c973f06dca83161fefed129efefe94efad663b5ddef54aa092bf5977ba7bca74519b008796e60486cf8b193ec2a2dead3add66295d41f SHA512 7103362b8840d094661a16053d8f07eba413c369bf3a2b686313875aa97c30b35697fceefbfc90dffd5cfd4de946e7f848f2b791736443639b30bb75709b7122
36 +DIST rust-1.34.2-arm-unknown-linux-gnueabi.tar.xz 122563056 BLAKE2B 05e73de7d58723affef3f272e646245a97b17373cc960d5e1be0365919ad3879e08bd9012126e41235b97a758bb57fa4e67fcd11e2f29322af9ab039fc3e2dfd SHA512 d6c055e8ba0fd494797a55d2a6df1eec2a6361c0b081e4b7cb06e42a03a644e4de49c7b17dc8cb6484f3271517f2bd50935bc72ead486531b5b370a1c576b12a
37 +DIST rust-1.34.2-arm-unknown-linux-gnueabihf.tar.xz 122858592 BLAKE2B aebe65fb64044c342f525749eb5d67217f459712aa72d49497062af461901a6e92d21b00e05439bd0753228b876f521198a8b005b116b5121ec3dd812df4bec8 SHA512 5cc2612988182b68d9b220d6d7620fc0b064a9d347825d4677959b7e43820647ff25651427db3a5c72401ab8d0c14e2976921d71ddbe0a5b540cf045241cd727
38 +DIST rust-1.34.2-armv7-unknown-linux-gnueabihf.tar.xz 124601212 BLAKE2B 7ab258783070d3ba1e27431faf36a8c75d0afae935bc4ba08bf1e6b7f080d56cb3a9ac3de8b91ff9885e2df2ccebdf29de80b99548c610ea30c157103b920434 SHA512 fe5be9a345d10ee2b3a47986977be91cd2dd94f2076571f810ac21cea36f79f073eb16915c090861cf46c6835f86db64c2ed1ef036f911b3be829d7927ecb747
39 +DIST rust-1.34.2-i686-unknown-linux-gnu.tar.xz 169581332 BLAKE2B 75f1fc4c52e81cb9c7f95d18d9aff2439bfc698444321d92f09d5a47e493d693f2cae3d8ee56ccff59ca967a0a2a53828559eefce1398a2450fe39c95397e3e2 SHA512 056243d226cd9a36dfcd266f2aba88adde58dbcfa87f20613183c5dcc514bb413e25f6d6963494dc141f4e91649b17b1db91e6a9d313af7ef7b1893b64337c33
40 +DIST rust-1.34.2-mips-unknown-linux-gnu.tar.xz 113493608 BLAKE2B 10df3e2eb9fd9200bab1ca94eafd80f680c94bd21589f72fd660e9d819a6615cc83e47ac70df87712e252946f58df30824be992f16ca707b72451898e1884e99 SHA512 ec100071fbd8373baf41f0f517497b9923a77ebea8257d2fdcc9a4488d7ec6d59c0b517f4d922a0f7f699d701510d32d49c1e699c69a94f571f73ba46fe795f3
41 +DIST rust-1.34.2-mips64-unknown-linux-gnuabi64.tar.xz 119118112 BLAKE2B 8ba04a90e82bf7d830c750350570dde8cfa0646f1ea10c583927cc6c7ceeb935fb4035248d8a3ac4a477a858a32d3753811e2893220b8b3919e882213dd63373 SHA512 bb3c5e8ce24895a07984059fca53f4737777a78d350312292877b8e1c21a7a84320f1fee4d64c9d684d14be5fe500494d38ef3f5ab4e4f0e84cbd3f3d30a8586
42 +DIST rust-1.34.2-mipsel-unknown-linux-gnu.tar.xz 115776696 BLAKE2B dfe09e60be47c6cbe183e4f4bb358cd6d1fe0872114d6a663ee95cd063155f99688bdf23b5c7230b626351654da8f38c7b763099b8d6c2707e185449267c137c SHA512 91348409dfdb63b82e6b6a3097d181485f05f0dfb6cd3bd80785da2eea23f493a90a4e07e660dbc14e9c887ff7e27bc0d13203c78feece5aca219e439a9c18cf
43 +DIST rust-1.34.2-powerpc-unknown-linux-gnu.tar.xz 116817940 BLAKE2B bd7fcc7e0e8844d23e73bb8bc07f7454d234d4fc96d6549399c399845af147debbfbcdea2c53d1ad5a28126d6c9cc20178634290fb837f0537947f64d688df75 SHA512 b8009e9ab2e9167cce8e1911ec0bebc9959a89bafcb645637f2a55af15a2f4f5d4fa20d6b38b7ae572480f3d3817392b8c6386b6ed589b34dd0a02529da2a459
44 +DIST rust-1.34.2-powerpc64-unknown-linux-gnu.tar.xz 125735384 BLAKE2B c25d43fa630e9b95692bcb493064f592a12ecee700538671192f04cfdf443a5d046493662c88d91f62cc1eba94e80ec9b6bed9949af9a8bc83788521832336d4 SHA512 d1ab37d68c0b52e3780ea133f8ba4d5b823c7f874bbf15f97f304c21405b1fdbde3d28e83381f08095fca8e2ea615f46accad725ee854ad9db168ab4629e30a3
45 +DIST rust-1.34.2-powerpc64le-unknown-linux-gnu.tar.xz 129619832 BLAKE2B df76b7c08941ae2cb512ba656b09a7b87e1e656badbadf58d64ab5f9133e7248a63873675ac44f16207107a0f68da6089706b46af94154c0bd51aed655f8b578 SHA512 3c881e7bcf622237f279855ebaeb544f4df9bfe5bc1f74578093d67befed8f027692ea56dc773c653bef8a124e9ebac2544d0c197a0e3a1ec8da63ef9d434412
46 +DIST rust-1.34.2-s390x-unknown-linux-gnu.tar.xz 134376720 BLAKE2B 3eb1452bc0f5d6cbe5547f18ad039c54d4fee44e8c24e35f3399272755cd293df008db2c7dded32c7853944e43de7a4d337b7408835445a4916dbf55d14a7b3e SHA512 181f58b00cdccb205be853f5d00fc0a0c939b7e4dc801717b21ece0f714a8f3b501f1196eb2e3f3081932a0417a6218763c3d095cdd036e9f202cc41291876a1
47 +DIST rust-1.34.2-x86_64-unknown-linux-gnu.tar.xz 157279864 BLAKE2B c25fcb6168e16a4deb19a8ca9b3d91966194f4c8d2e60933226fab015b64a819f6e56a6b51b6e9457ce80efaf5bf71f2eed2f3e6e39bef5856524e33d0a5637b SHA512 64d6b7da08ffd877c10d819605a37b0bc178c4ab80e2f7449f3d5ac9254a438e148da3729408b4c9429ed499d7f142c9d2926f5c916e0a32bebaaefe4b0a09a6
48 DIST rustc-1.29.1-src.tar.xz 61937676 BLAKE2B 6a60249538e1ec62471f4d0e3fc31c0a648433aa6f85ca7341657ea07772e338eb92a629941685808f4b80e84cb025d78aee9d0d6fa71c6635a1647c61bca9bc SHA512 1ded651b4c460e11e5e44c26de88a80fb13c2000097de2ee1e5af89638e12a7e8f43dd756689d4cc4fad45c52d4d43a3c70dd6a3ae550735b9dad5f8defea6a7
49 DIST rustc-1.29.2-src.tar.xz 61888912 BLAKE2B f59b0bf45caa6f6136f92ffbaa612bbc6a340c8694ec69d75aadace9180c36753f985641915524388b52cc108f8f5b71840ee3a6c0b1fcff6decb61d2d8a161e SHA512 d8fa9501764348ace8f60f2069bcd016925abe56c8bbc2b87fb52ff796e4bc7284c1fccbb1671416437bb82fde7d9240eeae875d6099914e27e75cfe050e2d38
50 DIST rustc-1.30.1-src.tar.xz 96086232 BLAKE2B 170767b64efe670086e7c4e73838b489a155a72c703148f83cad29d401a825a94a1def3aa462ba527e1bd08181c7a9be0e404c25f012906541c3d739eb57e9e5 SHA512 e466db81b9a82239670c48b876dc7390fcdda28c6390308691ddf2e0c12a39b57bd5ddb18322d1b4cd58165f69a666c7d83bee6573049da3b94e401657459bf5
51 @@ -83,3 +96,4 @@ DIST rustc-1.31.1-src.tar.xz 96915864 BLAKE2B bedfe1d56e2f99bb43b4b652d540aedf0a
52 DIST rustc-1.32.0-src.tar.xz 99602696 BLAKE2B ab26247e3ecb75dbe373254c1c49f46c00a5a4db2b9cedffccb30122ea3b7de2761d6995b5423d0105caf85cc9542b4c21d487385faa34c835398c3320ccbd3b SHA512 487c405fed6430f62d2d0c38b65f6223b1c5074c7a0d3734dc8b3bb72fca255f5727e49541749569713a0c3e9a67eff574ba5698e8dceca6f0ef20b50f99aa42
53 DIST rustc-1.33.0-src.tar.xz 100635400 BLAKE2B 1fe8ffcfab8324a93a07b9b9ac9cd050fd9d660fb24884761e8ce5e5a67ce5b6df8513e1440090b39c3ced9cb5ced43f07cc9b0337d39625d2cf4aa9e083cfef SHA512 3291e4e19f75f44c81e6fcf4c01edc7c9d326eca43722381231abcf2e99f4314059ba59a29b79f5511ad9421c358c45e8fe18584d6954d17fe2aabad0f9d9147
54 DIST rustc-1.34.2-src.tar.xz 95048792 BLAKE2B e81e4bfda87ddfb09ab8a74792346970aa440c678d2bb1279c329db4929282f761ada6fea9d81ceeecfd513613025c8e636487626fc36bd0b33559e045bb1b15 SHA512 f1bd2b226d90aae8a4657e6117b9a8451d4ce8129f79cc0fce0da7613a3b7800e690bc0ede8fec20a2f5f32c13fa8e22ac97d3838e0d36936793535a75d9c381
55 +DIST rustc-1.35.0-src.tar.xz 96543548 BLAKE2B 0291152f2b7aa8b50b22d74afbd9c7654bab8ae7dcb76224dbff43bc39a3b918ff86bfd20f408a9a16da8b20b08d9f0289bb63620f093d25d9fa008de57f52c3 SHA512 477c10b780bd54776be7ecbda0ab970416253e4a87c3e701825a7d07bcbcd91601b8e61129c5d04d4259e89c2e81e87cdbdee853375a8de5c9cf8372be2c9129
56
57 diff --git a/dev-lang/rust/metadata.xml b/dev-lang/rust/metadata.xml
58 index cd1133751de..210155e50b1 100644
59 --- a/dev-lang/rust/metadata.xml
60 +++ b/dev-lang/rust/metadata.xml
61 @@ -1,17 +1,17 @@
62 <?xml version="1.0" encoding="UTF-8"?>
63 <!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
64 <pkgmetadata>
65 - <maintainer type="project">
66 - <email>rust@g.o</email>
67 - <name>Rust Project</name>
68 - </maintainer>
69 - <use>
70 - <flag name="cargo">Install cargo component</flag>
71 - <flag name="clippy">Install clippy component</flag>
72 - <flag name="system-llvm">Use the system LLVM install</flag>
73 - <flag name="rls">Install rls component</flag>
74 - <flag name="rustfmt">Install rustfmt component</flag>
75 - <flag name="wasm">Build support for the wasm32-unknown-unknown
76 - target</flag>
77 - </use>
78 + <maintainer type="project">
79 + <email>rust@g.o</email>
80 + <name>Rust Project</name>
81 + </maintainer>
82 + <use>
83 + <flag name="cargo">Install cargo component</flag>
84 + <flag name="clippy">Install clippy component</flag>
85 + <flag name="system-llvm">Use the system LLVM install</flag>
86 + <flag name="rls">Install rls component</flag>
87 + <flag name="rustfmt">Install rustfmt component</flag>
88 + <flag name="wasm">Build support for the wasm32-unknown-unknown
89 + target</flag>
90 + </use>
91 </pkgmetadata>
92
93 diff --git a/dev-lang/rust/rust-1.35.0.ebuild b/dev-lang/rust/rust-1.35.0.ebuild
94 new file mode 100644
95 index 00000000000..801838bb704
96 --- /dev/null
97 +++ b/dev-lang/rust/rust-1.35.0.ebuild
98 @@ -0,0 +1,334 @@
99 +# Copyright 1999-2019 Gentoo Authors
100 +# Distributed under the terms of the GNU General Public License v2
101 +
102 +EAPI=7
103 +
104 +PYTHON_COMPAT=( python2_7 python3_{5,6,7} pypy )
105 +
106 +inherit check-reqs estack flag-o-matic llvm multiprocessing multilib-build python-any-r1 rust-toolchain toolchain-funcs
107 +
108 +if [[ ${PV} = *beta* ]]; then
109 + betaver=${PV//*beta}
110 + BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
111 + MY_P="rustc-beta"
112 + SLOT="beta/${PV}"
113 + SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.xz"
114 +else
115 + ABI_VER="$(ver_cut 1-2)"
116 + SLOT="stable/${ABI_VER}"
117 + MY_P="rustc-${PV}"
118 + SRC="${MY_P}-src.tar.xz"
119 + KEYWORDS="~amd64 ~arm64 ~ppc64 ~x86"
120 +fi
121 +
122 +RUST_STAGE0_VERSION="1.$(($(ver_cut 2) - 1)).2"
123 +
124 +DESCRIPTION="Systems programming language from Mozilla"
125 +HOMEPAGE="https://www.rust-lang.org/"
126 +
127 +SRC_URI="https://static.rust-lang.org/dist/${SRC} -> rustc-${PV}-src.tar.xz
128 + $(rust_all_arch_uris rust-${RUST_STAGE0_VERSION})"
129 +
130 +ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM BPF Hexagon Lanai Mips MSP430
131 + NVPTX PowerPC Sparc SystemZ WebAssembly X86 XCore )
132 +ALL_LLVM_TARGETS=( "${ALL_LLVM_TARGETS[@]/#/llvm_targets_}" )
133 +LLVM_TARGET_USEDEPS=${ALL_LLVM_TARGETS[@]/%/?}
134 +
135 +LICENSE="|| ( MIT Apache-2.0 ) BSD-1 BSD-2 BSD-4 UoI-NCSA"
136 +
137 +IUSE="clippy cpu_flags_x86_sse2 debug doc libressl rls rustfmt system-llvm wasm ${ALL_LLVM_TARGETS[*]}"
138 +
139 +# Please keep the LLVM dependency block separate. Since LLVM is slotted,
140 +# we need to *really* make sure we're not pulling one than more slot
141 +# simultaneously.
142 +
143 +# How to use it:
144 +# 1. List all the working slots (with min versions) in ||, newest first.
145 +# 2. Update the := to specify *max* version, e.g. < 9.
146 +# 3. Specify LLVM_MAX_SLOT, e.g. 8.
147 +LLVM_DEPEND="
148 + || (
149 + sys-devel/llvm:8[llvm_targets_WebAssembly?]
150 + wasm? ( =sys-devel/lld-8* )
151 + )
152 + <sys-devel/llvm-9:=
153 +"
154 +LLVM_MAX_SLOT=8
155 +
156 +COMMON_DEPEND="
157 + sys-libs/zlib
158 + !libressl? ( dev-libs/openssl:0= )
159 + libressl? ( dev-libs/libressl:0= )
160 + net-libs/libssh2
161 + net-libs/http-parser:=
162 + net-misc/curl[ssl]
163 + system-llvm? (
164 + ${LLVM_DEPEND}
165 + )
166 +"
167 +
168 +DEPEND="${COMMON_DEPEND}
169 + ${PYTHON_DEPS}
170 + || (
171 + >=sys-devel/gcc-4.7
172 + >=sys-devel/clang-3.5
173 + )
174 + dev-util/cmake
175 +"
176 +
177 +RDEPEND="${COMMON_DEPEND}
178 + >=app-eselect/eselect-rust-20190311
179 + !dev-util/cargo
180 + rustfmt? ( !dev-util/rustfmt )
181 +"
182 +
183 +REQUIRED_USE="|| ( ${ALL_LLVM_TARGETS[*]} )
184 + wasm? ( llvm_targets_WebAssembly )
185 + x86? ( cpu_flags_x86_sse2 )
186 +"
187 +
188 +PATCHES=(
189 + "${FILESDIR}"/0001-llvm-cmake-Add-additional-headers-only-if-they-exist.patch
190 +)
191 +
192 +S="${WORKDIR}/${MY_P}-src"
193 +
194 +toml_usex() {
195 + usex "$1" true false
196 +}
197 +
198 +pre_build_checks() {
199 + CHECKREQS_DISK_BUILD="7G"
200 + eshopts_push -s extglob
201 + if is-flagq '-g?(gdb)?([1-9])'; then
202 + CHECKREQS_DISK_BUILD="10G"
203 + fi
204 + eshopts_pop
205 + check-reqs_pkg_setup
206 +}
207 +
208 +pkg_pretend() {
209 + pre_build_checks
210 +}
211 +
212 +pkg_setup() {
213 + pre_build_checks
214 + python-any-r1_pkg_setup
215 + use system-llvm && llvm_pkg_setup
216 +}
217 +
218 +src_prepare() {
219 + local rust_stage0_root="${WORKDIR}"/rust-stage0
220 +
221 + local rust_stage0="rust-${RUST_STAGE0_VERSION}-$(rust_abi)"
222 +
223 + "${WORKDIR}/${rust_stage0}"/install.sh --disable-ldconfig --destdir="${rust_stage0_root}" --prefix=/ || die
224 +
225 + # ugly hack for https://bugs.gentoo.org/679806
226 + # we have to keep it until we switch to 1.35.x bootstrap tarball.
227 + if use ppc64; then
228 + sed -i 's/getentropy/gEtEnTrOpY/g' "${rust_stage0_root}"/bin/cargo || die
229 + export OPENSSL_ppccap=0
230 + fi
231 +
232 + default
233 +}
234 +
235 +src_configure() {
236 + local rust_target="" rust_targets="" arch_cflags
237 +
238 + # Collect rust target names to compile standard libs for all ABIs.
239 + for v in $(multilib_get_enabled_abi_pairs); do
240 + rust_targets="${rust_targets},\"$(rust_abi $(get_abi_CHOST ${v##*.}))\""
241 + done
242 + if use wasm; then
243 + rust_targets="${rust_targets},\"wasm32-unknown-unknown\""
244 + fi
245 + rust_targets="${rust_targets#,}"
246 +
247 + local extended="true" tools="\"cargo\","
248 + if use clippy; then
249 + tools="\"clippy\",$tools"
250 + fi
251 + if use rls; then
252 + tools="\"rls\",\"analysis\",\"src\",$tools"
253 + fi
254 + if use rustfmt; then
255 + tools="\"rustfmt\",$tools"
256 + fi
257 +
258 + local rust_stage0_root="${WORKDIR}"/rust-stage0
259 +
260 + rust_target="$(rust_abi)"
261 +
262 + cat <<- EOF > "${S}"/config.toml
263 + [llvm]
264 + optimize = $(toml_usex !debug)
265 + release-debuginfo = $(toml_usex debug)
266 + assertions = $(toml_usex debug)
267 + targets = "${LLVM_TARGETS// /;}"
268 + experimental-targets = ""
269 + link-shared = $(toml_usex system-llvm)
270 + [build]
271 + build = "${rust_target}"
272 + host = ["${rust_target}"]
273 + target = [${rust_targets}]
274 + cargo = "${rust_stage0_root}/bin/cargo"
275 + rustc = "${rust_stage0_root}/bin/rustc"
276 + docs = $(toml_usex doc)
277 + submodules = false
278 + python = "${EPYTHON}"
279 + locked-deps = true
280 + vendor = true
281 + extended = ${extended}
282 + tools = [${tools}]
283 + verbose = 2
284 + [install]
285 + prefix = "${EPREFIX}/usr"
286 + libdir = "$(get_libdir)/${P}"
287 + docdir = "share/doc/${P}"
288 + mandir = "share/${P}/man"
289 + [rust]
290 + optimize = $(toml_usex !debug)
291 + debuginfo = $(toml_usex debug)
292 + debug-assertions = $(toml_usex debug)
293 + default-linker = "$(tc-getCC)"
294 + channel = "stable"
295 + rpath = false
296 + lld = $(usex system-llvm false $(toml_usex wasm))
297 + EOF
298 +
299 + for v in $(multilib_get_enabled_abi_pairs); do
300 + rust_target=$(rust_abi $(get_abi_CHOST ${v##*.}))
301 + arch_cflags="$(get_abi_CFLAGS ${v##*.})"
302 +
303 + cat <<- EOF >> "${S}"/config.env
304 + CFLAGS_${rust_target}=${arch_cflags}
305 + EOF
306 +
307 + cat <<- EOF >> "${S}"/config.toml
308 + [target.${rust_target}]
309 + cc = "$(tc-getBUILD_CC)"
310 + cxx = "$(tc-getBUILD_CXX)"
311 + linker = "$(tc-getCC)"
312 + ar = "$(tc-getAR)"
313 + EOF
314 + if use system-llvm; then
315 + cat <<- EOF >> "${S}"/config.toml
316 + llvm-config = "$(get_llvm_prefix "${LLVM_MAX_SLOT}")/bin/llvm-config"
317 + EOF
318 + fi
319 + done
320 +
321 + if use wasm; then
322 + cat <<- EOF >> "${S}"/config.toml
323 + [target.wasm32-unknown-unknown]
324 + linker = "$(usex system-llvm lld rust-lld)"
325 + EOF
326 + fi
327 +}
328 +
329 +src_compile() {
330 + env $(cat "${S}"/config.env)\
331 + "${EPYTHON}" ./x.py build -vv --config="${S}"/config.toml -j$(makeopts_jobs) \
332 + --exclude src/tools/miri || die # https://github.com/rust-lang/rust/issues/52305
333 +}
334 +
335 +src_install() {
336 + local rust_target abi_libdir
337 +
338 + env DESTDIR="${D}" "${EPYTHON}" ./x.py install -vv --config="${S}"/config.toml \
339 + --exclude src/tools/miri || die
340 +
341 + mv "${ED}/usr/bin/rustc" "${ED}/usr/bin/rustc-${PV}" || die
342 + mv "${ED}/usr/bin/rustdoc" "${ED}/usr/bin/rustdoc-${PV}" || die
343 + mv "${ED}/usr/bin/rust-gdb" "${ED}/usr/bin/rust-gdb-${PV}" || die
344 + mv "${ED}/usr/bin/rust-gdbgui" "${ED}/usr/bin/rust-gdbgui-${PV}" || die
345 + mv "${ED}/usr/bin/rust-lldb" "${ED}/usr/bin/rust-lldb-${PV}" || die
346 + mv "${ED}/usr/bin/cargo" "${ED}/usr/bin/cargo-${PV}" || die
347 + if use clippy; then
348 + mv "${ED}/usr/bin/clippy-driver" "${ED}/usr/bin/clippy-driver-${PV}" || die
349 + mv "${ED}/usr/bin/cargo-clippy" "${ED}/usr/bin/cargo-clippy-${PV}" || die
350 + fi
351 + if use rls; then
352 + mv "${ED}/usr/bin/rls" "${ED}/usr/bin/rls-${PV}" || die
353 + fi
354 + if use rustfmt; then
355 + mv "${ED}/usr/bin/rustfmt" "${ED}/usr/bin/rustfmt-${PV}" || die
356 + mv "${ED}/usr/bin/cargo-fmt" "${ED}/usr/bin/cargo-fmt-${PV}" || die
357 + fi
358 +
359 + # Copy shared library versions of standard libraries for all targets
360 + # into the system's abi-dependent lib directories because the rust
361 + # installer only does so for the native ABI.
362 + for v in $(multilib_get_enabled_abi_pairs); do
363 + if [ ${v##*.} = ${DEFAULT_ABI} ]; then
364 + continue
365 + fi
366 + abi_libdir=$(get_abi_LIBDIR ${v##*.})
367 + rust_target=$(rust_abi $(get_abi_CHOST ${v##*.}))
368 + mkdir -p "${ED}/usr/${abi_libdir}"
369 + cp "${ED}/usr/$(get_libdir)/${P}/rustlib/${rust_target}/lib"/*.so \
370 + "${ED}/usr/${abi_libdir}" || die
371 + done
372 +
373 + dodoc COPYRIGHT
374 +
375 + # FIXME:
376 + # Really not sure if that env is needed, specailly LDPATH
377 + cat <<-EOF > "${T}"/50${P}
378 + LDPATH="${EPREFIX}/usr/$(get_libdir)/${P}"
379 + MANPATH="${EPREFIX}/usr/share/${P}/man"
380 + EOF
381 + doenvd "${T}"/50${P}
382 +
383 + # note: eselect-rust adds EROOT to all paths below
384 + cat <<-EOF > "${T}/provider-${P}"
385 + /usr/bin/rustdoc
386 + /usr/bin/rust-gdb
387 + /usr/bin/rust-gdbgui
388 + /usr/bin/rust-lldb
389 + EOF
390 + echo /usr/bin/cargo >> "${T}/provider-${P}"
391 + if use clippy; then
392 + echo /usr/bin/clippy-driver >> "${T}/provider-${P}"
393 + echo /usr/bin/cargo-clippy >> "${T}/provider-${P}"
394 + fi
395 + if use rls; then
396 + echo /usr/bin/rls >> "${T}/provider-${P}"
397 + fi
398 + if use rustfmt; then
399 + echo /usr/bin/rustfmt >> "${T}/provider-${P}"
400 + echo /usr/bin/cargo-fmt >> "${T}/provider-${P}"
401 + fi
402 + dodir /etc/env.d/rust
403 + insinto /etc/env.d/rust
404 + doins "${T}/provider-${P}"
405 +}
406 +
407 +pkg_postinst() {
408 + eselect rust update --if-unset
409 +
410 + elog "Rust installs a helper script for calling GDB and LLDB,"
411 + elog "for your convenience it is installed under /usr/bin/rust-{gdb,lldb}-${PV}."
412 +
413 + ewarn "cargo is now installed from dev-lang/rust{,-bin} instead of dev-util/cargo."
414 + ewarn "This might have resulted in a dangling symlink for /usr/bin/cargo on some"
415 + ewarn "systems. This can be resolved by calling 'sudo eselect rust set ${P}'."
416 +
417 + if has_version app-editors/emacs || has_version app-editors/emacs-vcs; then
418 + elog "install app-emacs/rust-mode to get emacs support for rust."
419 + fi
420 +
421 + if has_version app-editors/gvim || has_version app-editors/vim; then
422 + elog "install app-vim/rust-vim to get vim support for rust."
423 + fi
424 +
425 + if has_version 'app-shells/zsh'; then
426 + elog "install app-shells/rust-zshcomp to get zsh completion for rust."
427 + fi
428 +}
429 +
430 +pkg_postrm() {
431 + eselect rust unset --if-invalid
432 +}