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