1 |
commit: d4e6ca7891bdea48a8214f8ca2a675ce00c65604 |
2 |
Author: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Aug 3 20:08:15 2020 +0000 |
4 |
Commit: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Aug 3 20:11:39 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d4e6ca78 |
7 |
|
8 |
dev-lang/rust: bump to 1.45.2 |
9 |
|
10 |
Install rustlib to versioned subdirectory in /usr/lib* again |
11 |
|
12 |
Bug: https://bugs.gentoo.org/703744 |
13 |
Bug: https://bugs.gentoo.org/683420 |
14 |
Package-Manager: Portage-3.0.1, Repoman-2.3.23 |
15 |
Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org> |
16 |
|
17 |
dev-lang/rust/Manifest | 1 + |
18 |
dev-lang/rust/rust-1.45.2.ebuild | 521 +++++++++++++++++++++++++++++++++++++++ |
19 |
2 files changed, 522 insertions(+) |
20 |
|
21 |
diff --git a/dev-lang/rust/Manifest b/dev-lang/rust/Manifest |
22 |
index 850e643071c..a043cedde16 100644 |
23 |
--- a/dev-lang/rust/Manifest |
24 |
+++ b/dev-lang/rust/Manifest |
25 |
@@ -29,3 +29,4 @@ DIST rust-1.44.1-x86_64-unknown-linux-musl.tar.xz 117456616 BLAKE2B fd2752cf867e |
26 |
DIST rustc-1.44.1-src.tar.xz 94756856 BLAKE2B 60f536c3ba0fa1fec4b6333ee57809ee5226090ad5041c14a136b4356ff3b898062e06c3fe54effe873e27931ac8fcb902cd48a38615a8de7eebc6ecb3bdc2bd SHA512 1c17002edae844a710db9b144c17171416330dc565343c65af8a6e112fb61555e2025bb4cf33cac1229d7df689e6ff8858b91ae00552400ccacafaf1de11849b |
27 |
DIST rustc-1.45.0-src.tar.xz 98677856 BLAKE2B 2558ba9444a53268de4f1604f13e701077a27e9480c97732a30706d656682672c17f87d8c015da3b839ed3b38081ef8d132bbab3522911bf9b50f018367e6ec7 SHA512 ff049eb65b36e6c64531d56251ebd446336a782f26504eccf375df1c22fa94b5f18e84660cef423edb815c1b31a1a7c9e57aea4aa0779576f3b0d7e81e19427b |
28 |
DIST rustc-1.45.1-src.tar.xz 98686408 BLAKE2B 49eec97cccc9932915877cf28cc6b27b8008d5fecc2c6255d8974d9ee52375b95933d0052fad23ed2e60f4f08fcc305e1ca47239e8f5adaa8a3acb62eb2c1e14 SHA512 ef71a1706c84fa8557f481d310033285a41ecd9b8d537bacb846d01ed9954b679b915272db57cd96d5ee097cc0134899e584d517c467a9d2949496312e5995df |
29 |
+DIST rustc-1.45.2-src.tar.xz 98683036 BLAKE2B a4102a5d4744b7ccc9b076aba00c39d69532f777e7d39e0e4ce2033b663b43e27b55034fdb3a1e13379fae9a16bff9e7748865a84507f7388ef0ebf9d421eac7 SHA512 cc6250c0bc844e77ca6dd7ae013e434ed3009b001914114866ed31f28edf3960221454d131e298b15050e3b8153fb8298d509559c2f7307c64611aa8e36b4d25 |
30 |
|
31 |
diff --git a/dev-lang/rust/rust-1.45.2.ebuild b/dev-lang/rust/rust-1.45.2.ebuild |
32 |
new file mode 100644 |
33 |
index 00000000000..45231ffd902 |
34 |
--- /dev/null |
35 |
+++ b/dev-lang/rust/rust-1.45.2.ebuild |
36 |
@@ -0,0 +1,521 @@ |
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,8} ) |
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)).1" |
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 miri 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. < 11. |
86 |
+# 3. Specify LLVM_MAX_SLOT, e.g. 10. |
87 |
+LLVM_DEPEND=" |
88 |
+ || ( |
89 |
+ sys-devel/llvm:10[${LLVM_TARGET_USEDEPS// /,}] |
90 |
+ sys-devel/llvm:9[${LLVM_TARGET_USEDEPS// /,}] |
91 |
+ ) |
92 |
+ <sys-devel/llvm-11:= |
93 |
+ wasm? ( sys-devel/lld ) |
94 |
+" |
95 |
+LLVM_MAX_SLOT=10 |
96 |
+ |
97 |
+BOOTSTRAP_DEPEND="|| ( >=dev-lang/rust-1.$(($(ver_cut 2) - 1)) >=dev-lang/rust-bin-1.$(($(ver_cut 2) - 1)) )" |
98 |
+ |
99 |
+BDEPEND="${PYTHON_DEPS} |
100 |
+ app-eselect/eselect-rust |
101 |
+ || ( |
102 |
+ >=sys-devel/gcc-4.7 |
103 |
+ >=sys-devel/clang-3.5 |
104 |
+ ) |
105 |
+ system-bootstrap? ( ${BOOTSTRAP_DEPEND} ) |
106 |
+ !system-llvm? ( |
107 |
+ dev-util/cmake |
108 |
+ dev-util/ninja |
109 |
+ ) |
110 |
+" |
111 |
+ |
112 |
+# libgit2 should be at least same as bundled into libgit-sys #707746 |
113 |
+DEPEND=" |
114 |
+ >=dev-libs/libgit2-0.99:= |
115 |
+ net-libs/libssh2:= |
116 |
+ net-libs/http-parser:= |
117 |
+ net-misc/curl:=[http2,ssl] |
118 |
+ sys-libs/zlib:= |
119 |
+ !libressl? ( dev-libs/openssl:0= ) |
120 |
+ libressl? ( dev-libs/libressl:0= ) |
121 |
+ elibc_musl? ( sys-libs/libunwind ) |
122 |
+ system-llvm? ( |
123 |
+ ${LLVM_DEPEND} |
124 |
+ ) |
125 |
+" |
126 |
+ |
127 |
+RDEPEND="${DEPEND} |
128 |
+ app-eselect/eselect-rust |
129 |
+" |
130 |
+ |
131 |
+REQUIRED_USE="|| ( ${ALL_LLVM_TARGETS[*]} ) |
132 |
+ miri? ( nightly ) |
133 |
+ parallel-compiler? ( nightly ) |
134 |
+ wasm? ( llvm_targets_WebAssembly ) |
135 |
+ x86? ( cpu_flags_x86_sse2 ) |
136 |
+" |
137 |
+ |
138 |
+# we don't use cmake.eclass, but can get a warnin -l |
139 |
+CMAKE_WARN_UNUSED_CLI=no |
140 |
+ |
141 |
+QA_FLAGS_IGNORED=" |
142 |
+ usr/bin/.*-${PV} |
143 |
+ usr/lib.*/${P}/lib.*.so.* |
144 |
+ usr/lib.*/${P}/rustlib/.*/bin/.* |
145 |
+ usr/lib.*/${P}/rustlib/.*/lib/lib.*.so.* |
146 |
+" |
147 |
+ |
148 |
+QA_SONAME=" |
149 |
+ usr/lib.*/${P}/lib.*.so.* |
150 |
+ usr/lib.*/${P}/rustlib/.*/lib/lib.*.so.* |
151 |
+" |
152 |
+ |
153 |
+# tests need a bit more work, currently they are causing multiple |
154 |
+# re-compilations and somewhat fragile. |
155 |
+RESTRICT="test" |
156 |
+ |
157 |
+PATCHES=( |
158 |
+ "${FILESDIR}"/0012-Ignore-broken-and-non-applicable-tests.patch |
159 |
+ "${FILESDIR}"/1.44.0-libressl.patch |
160 |
+) |
161 |
+ |
162 |
+S="${WORKDIR}/${MY_P}-src" |
163 |
+ |
164 |
+toml_usex() { |
165 |
+ usex "$1" true false |
166 |
+} |
167 |
+ |
168 |
+pre_build_checks() { |
169 |
+ CHECKREQS_DISK_BUILD="9G" |
170 |
+ eshopts_push -s extglob |
171 |
+ if is-flagq '-g?(gdb)?([1-9])'; then |
172 |
+ CHECKREQS_DISK_BUILD="15G" |
173 |
+ fi |
174 |
+ eshopts_pop |
175 |
+ check-reqs_pkg_setup |
176 |
+} |
177 |
+ |
178 |
+pkg_pretend() { |
179 |
+ pre_build_checks |
180 |
+} |
181 |
+ |
182 |
+pkg_setup() { |
183 |
+ pre_build_checks |
184 |
+ python-any-r1_pkg_setup |
185 |
+ |
186 |
+ # required to link agains system libs, otherwise |
187 |
+ # crates use bundled sources and compile own static version |
188 |
+ export LIBGIT2_SYS_USE_PKG_CONFIG=1 |
189 |
+ export LIBSSH2_SYS_USE_PKG_CONFIG=1 |
190 |
+ export PKG_CONFIG_ALLOW_CROSS=1 |
191 |
+ |
192 |
+ if use system-llvm; then |
193 |
+ llvm_pkg_setup |
194 |
+ |
195 |
+ local llvm_config="$(get_llvm_prefix "$LLVM_MAX_SLOT")/bin/llvm-config" |
196 |
+ |
197 |
+ export LLVM_LINK_SHARED=1 |
198 |
+ export RUSTFLAGS="${RUSTFLAGS} -Lnative=$("${llvm_config}" --libdir)" |
199 |
+ fi |
200 |
+} |
201 |
+ |
202 |
+src_prepare() { |
203 |
+ if ! use system-bootstrap; then |
204 |
+ local rust_stage0_root="${WORKDIR}"/rust-stage0 |
205 |
+ local rust_stage0="rust-${RUST_STAGE0_VERSION}-$(rust_abi)" |
206 |
+ |
207 |
+ "${WORKDIR}/${rust_stage0}"/install.sh --disable-ldconfig \ |
208 |
+ --destdir="${rust_stage0_root}" --prefix=/ || die |
209 |
+ fi |
210 |
+ |
211 |
+ default |
212 |
+} |
213 |
+ |
214 |
+src_configure() { |
215 |
+ local rust_target="" rust_targets="" arch_cflags |
216 |
+ |
217 |
+ # Collect rust target names to compile standard libs for all ABIs. |
218 |
+ for v in $(multilib_get_enabled_abi_pairs); do |
219 |
+ rust_targets="${rust_targets},\"$(rust_abi $(get_abi_CHOST ${v##*.}))\"" |
220 |
+ done |
221 |
+ if use wasm; then |
222 |
+ rust_targets="${rust_targets},\"wasm32-unknown-unknown\"" |
223 |
+ if use system-llvm; then |
224 |
+ # un-hardcode rust-lld linker for this target |
225 |
+ # https://bugs.gentoo.org/715348 |
226 |
+ sed -i '/linker:/ s/rust-lld/wasm-ld/' src/librustc_target/spec/wasm32_base.rs || die |
227 |
+ fi |
228 |
+ fi |
229 |
+ rust_targets="${rust_targets#,}" |
230 |
+ |
231 |
+ local tools="\"cargo\"," |
232 |
+ if use clippy; then |
233 |
+ tools="\"clippy\",$tools" |
234 |
+ fi |
235 |
+ if use miri; then |
236 |
+ tools="\"miri\",$tools" |
237 |
+ fi |
238 |
+ if use rls; then |
239 |
+ tools="\"rls\",\"analysis\",\"src\",$tools" |
240 |
+ fi |
241 |
+ if use rustfmt; then |
242 |
+ tools="\"rustfmt\",$tools" |
243 |
+ fi |
244 |
+ |
245 |
+ local rust_stage0_root |
246 |
+ if use system-bootstrap; then |
247 |
+ rust_stage0_root="$(rustc --print sysroot)" |
248 |
+ else |
249 |
+ rust_stage0_root="${WORKDIR}"/rust-stage0 |
250 |
+ fi |
251 |
+ |
252 |
+ rust_target="$(rust_abi)" |
253 |
+ |
254 |
+ cat <<- EOF > "${S}"/config.toml |
255 |
+ [llvm] |
256 |
+ optimize = $(toml_usex !debug) |
257 |
+ release-debuginfo = $(toml_usex debug) |
258 |
+ assertions = $(toml_usex debug) |
259 |
+ ninja = true |
260 |
+ targets = "${LLVM_TARGETS// /;}" |
261 |
+ experimental-targets = "" |
262 |
+ link-shared = $(toml_usex system-llvm) |
263 |
+ [build] |
264 |
+ build = "${rust_target}" |
265 |
+ host = ["${rust_target}"] |
266 |
+ target = [${rust_targets}] |
267 |
+ cargo = "${rust_stage0_root}/bin/cargo" |
268 |
+ rustc = "${rust_stage0_root}/bin/rustc" |
269 |
+ docs = $(toml_usex doc) |
270 |
+ compiler-docs = $(toml_usex doc) |
271 |
+ submodules = false |
272 |
+ python = "${EPYTHON}" |
273 |
+ locked-deps = true |
274 |
+ vendor = true |
275 |
+ extended = true |
276 |
+ tools = [${tools}] |
277 |
+ verbose = 2 |
278 |
+ sanitizers = false |
279 |
+ profiler = false |
280 |
+ cargo-native-static = false |
281 |
+ [install] |
282 |
+ prefix = "${EPREFIX}/usr" |
283 |
+ libdir = "$(get_libdir)/${P}" |
284 |
+ docdir = "share/doc/${PF}" |
285 |
+ mandir = "share/${P}/man" |
286 |
+ [rust] |
287 |
+ optimize = true |
288 |
+ debug = $(toml_usex debug) |
289 |
+ debug-assertions = $(toml_usex debug) |
290 |
+ debuginfo-level-rustc = 0 |
291 |
+ backtrace = true |
292 |
+ incremental = false |
293 |
+ default-linker = "$(tc-getCC)" |
294 |
+ parallel-compiler = $(toml_usex parallel-compiler) |
295 |
+ channel = "$(usex nightly nightly stable)" |
296 |
+ rpath = false |
297 |
+ verbose-tests = true |
298 |
+ optimize-tests = $(toml_usex !debug) |
299 |
+ codegen-tests = true |
300 |
+ dist-src = false |
301 |
+ remap-debuginfo = true |
302 |
+ lld = $(usex system-llvm false $(toml_usex wasm)) |
303 |
+ backtrace-on-ice = true |
304 |
+ jemalloc = false |
305 |
+ [dist] |
306 |
+ src-tarball = false |
307 |
+ EOF |
308 |
+ |
309 |
+ for v in $(multilib_get_enabled_abi_pairs); do |
310 |
+ rust_target=$(rust_abi $(get_abi_CHOST ${v##*.})) |
311 |
+ arch_cflags="$(get_abi_CFLAGS ${v##*.})" |
312 |
+ |
313 |
+ cat <<- EOF >> "${S}"/config.env |
314 |
+ CFLAGS_${rust_target}=${arch_cflags} |
315 |
+ EOF |
316 |
+ |
317 |
+ cat <<- EOF >> "${S}"/config.toml |
318 |
+ [target.${rust_target}] |
319 |
+ cc = "$(tc-getBUILD_CC)" |
320 |
+ cxx = "$(tc-getBUILD_CXX)" |
321 |
+ linker = "$(tc-getCC)" |
322 |
+ ar = "$(tc-getAR)" |
323 |
+ EOF |
324 |
+ # librustc_target/spec/linux_musl_base.rs sets base.crt_static_default = true; |
325 |
+ if use elibc_musl; then |
326 |
+ cat <<- EOF >> "${S}"/config.toml |
327 |
+ crt-static = false |
328 |
+ EOF |
329 |
+ fi |
330 |
+ if use system-llvm; then |
331 |
+ cat <<- EOF >> "${S}"/config.toml |
332 |
+ llvm-config = "$(get_llvm_prefix "${LLVM_MAX_SLOT}")/bin/llvm-config" |
333 |
+ EOF |
334 |
+ fi |
335 |
+ done |
336 |
+ if use wasm; then |
337 |
+ cat <<- EOF >> "${S}"/config.toml |
338 |
+ [target.wasm32-unknown-unknown] |
339 |
+ linker = "$(usex system-llvm lld rust-lld)" |
340 |
+ EOF |
341 |
+ fi |
342 |
+ |
343 |
+ if [[ -n ${I_KNOW_WHAT_I_AM_DOING_CROSS} ]]; then #whitespace intentionally shifted below |
344 |
+ # experimental cross support |
345 |
+ # discussion: https://bugs.gentoo.org/679878 |
346 |
+ # TODO: c*flags, clang, system-llvm, cargo.eclass target support |
347 |
+ # it would be much better if we could split out stdlib |
348 |
+ # complilation to separate ebuild and abuse CATEGORY to |
349 |
+ # just install to /usr/lib/rustlib/<target> |
350 |
+ |
351 |
+ # extra targets defined as a bash array |
352 |
+ # spec format: <LLVM target>:<rust-target>:<CTARGET> |
353 |
+ # best place would be /etc/portage/env/dev-lang/rust |
354 |
+ # Example: |
355 |
+ # RUST_CROSS_TARGETS=( |
356 |
+ # "AArch64:aarch64-unknown-linux-gnu:aarch64-unknown-linux-gnu" |
357 |
+ # ) |
358 |
+ # no extra hand holding is done, no target transformations, all |
359 |
+ # values are passed as-is with just basic checks, so it's up to user to supply correct values |
360 |
+ # valid rust targets can be obtained with |
361 |
+ # rustc --print target-list |
362 |
+ # matching cross toolchain has to be installed |
363 |
+ # matching LLVM_TARGET has to be enabled for both rust and llvm (if using system one) |
364 |
+ # only gcc toolchains installed with crossdev are checked for now. |
365 |
+ |
366 |
+ # BUG: we can't pass host flags to cross compiler, so just filter for now |
367 |
+ # BUG: this should be more fine-grained. |
368 |
+ filter-flags '-mcpu=*' '-march=*' '-mtune=*' |
369 |
+ |
370 |
+ local cross_target_spec |
371 |
+ for cross_target_spec in "${RUST_CROSS_TARGETS[@]}";do |
372 |
+ # extracts first element form <LLVM target>:<rust-target>:<CTARGET> |
373 |
+ local cross_llvm_target="${cross_target_spec%%:*}" |
374 |
+ # extracts toolchain triples, <rust-target>:<CTARGET> |
375 |
+ local cross_triples="${cross_target_spec#*:}" |
376 |
+ # extracts first element after before : separator |
377 |
+ local cross_rust_target="${cross_triples%%:*}" |
378 |
+ # extracts last element after : separator |
379 |
+ local cross_toolchain="${cross_triples##*:}" |
380 |
+ use llvm_targets_${cross_llvm_target} || die "need llvm_targets_${cross_llvm_target} target enabled" |
381 |
+ command -v ${cross_toolchain}-gcc > /dev/null 2>&1 || die "need ${cross_toolchain} cross toolchain" |
382 |
+ |
383 |
+ cat <<- EOF >> "${S}"/config.toml |
384 |
+ [target.${cross_rust_target}] |
385 |
+ cc = "${cross_toolchain}-gcc" |
386 |
+ cxx = "${cross_toolchain}-g++" |
387 |
+ linker = "${cross_toolchain}-gcc" |
388 |
+ ar = "${cross_toolchain}-ar" |
389 |
+ EOF |
390 |
+ if use system-llvm; then |
391 |
+ cat <<- EOF >> "${S}"/config.toml |
392 |
+ llvm-config = "$(get_llvm_prefix "${LLVM_MAX_SLOT}")/bin/llvm-config" |
393 |
+ EOF |
394 |
+ fi |
395 |
+ |
396 |
+ # append cross target to "normal" target list |
397 |
+ # example 'target = ["powerpc64le-unknown-linux-gnu"]' |
398 |
+ # becomes 'target = ["powerpc64le-unknown-linux-gnu","aarch64-unknown-linux-gnu"]' |
399 |
+ |
400 |
+ rust_targets="${rust_targets},\"${cross_rust_target}\"" |
401 |
+ sed -i "/^target = \[/ s#\[.*\]#\[${rust_targets}\]#" config.toml || die |
402 |
+ |
403 |
+ ewarn |
404 |
+ ewarn "Enabled ${cross_rust_target} rust target" |
405 |
+ ewarn "Using ${cross_toolchain} cross toolchain" |
406 |
+ ewarn |
407 |
+ if ! has_version -b 'sys-devel/binutils[multitarget]' ; then |
408 |
+ ewarn "'sys-devel/binutils[multitarget]' is not installed" |
409 |
+ ewarn "'strip' will be unable to strip cross libraries" |
410 |
+ ewarn "cross targets will be installed with full debug information" |
411 |
+ ewarn "enable 'multitarget' USE flag for binutils to be able to strip object files" |
412 |
+ ewarn |
413 |
+ ewarn "Alternatively llvm-strip can be used, it supports stripping any target" |
414 |
+ ewarn "define STRIP=\"llvm-strip\" to use it (experimental)" |
415 |
+ ewarn |
416 |
+ fi |
417 |
+ done |
418 |
+ fi # I_KNOW_WHAT_I_AM_DOING_CROSS |
419 |
+ |
420 |
+ einfo "Rust configured with the following settings:" |
421 |
+ cat "${S}"/config.toml || die |
422 |
+} |
423 |
+ |
424 |
+src_compile() { |
425 |
+ env $(cat "${S}"/config.env) RUST_BACKTRACE=1\ |
426 |
+ "${EPYTHON}" ./x.py build -vv --config="${S}"/config.toml -j$(makeopts_jobs) || die |
427 |
+} |
428 |
+ |
429 |
+src_test() { |
430 |
+ env $(cat "${S}"/config.env) RUST_BACKTRACE=1\ |
431 |
+ "${EPYTHON}" ./x.py test -vv --config="${S}"/config.toml -j$(makeopts_jobs) --no-doc --no-fail-fast \ |
432 |
+ src/test/codegen \ |
433 |
+ src/test/codegen-units \ |
434 |
+ src/test/compile-fail \ |
435 |
+ src/test/incremental \ |
436 |
+ src/test/mir-opt \ |
437 |
+ src/test/pretty \ |
438 |
+ src/test/run-fail \ |
439 |
+ src/test/run-make \ |
440 |
+ src/test/run-make-fulldeps \ |
441 |
+ src/test/ui \ |
442 |
+ src/test/ui-fulldeps || die |
443 |
+} |
444 |
+ |
445 |
+src_install() { |
446 |
+ env $(cat "${S}"/config.env) DESTDIR="${D}" \ |
447 |
+ "${EPYTHON}" ./x.py install -vv --config="${S}"/config.toml || die |
448 |
+ |
449 |
+ # bug #689562, #689160 |
450 |
+ rm "${D}/etc/bash_completion.d/cargo" || die |
451 |
+ rmdir "${D}"/etc{/bash_completion.d,} || die |
452 |
+ dobashcomp build/tmp/dist/cargo-image/etc/bash_completion.d/cargo |
453 |
+ |
454 |
+ mv "${ED}/usr/bin/rustc" "${ED}/usr/bin/rustc-${PV}" || die |
455 |
+ mv "${ED}/usr/bin/rustdoc" "${ED}/usr/bin/rustdoc-${PV}" || die |
456 |
+ mv "${ED}/usr/bin/rust-gdb" "${ED}/usr/bin/rust-gdb-${PV}" || die |
457 |
+ mv "${ED}/usr/bin/rust-gdbgui" "${ED}/usr/bin/rust-gdbgui-${PV}" || die |
458 |
+ mv "${ED}/usr/bin/rust-lldb" "${ED}/usr/bin/rust-lldb-${PV}" || die |
459 |
+ mv "${ED}/usr/bin/cargo" "${ED}/usr/bin/cargo-${PV}" || die |
460 |
+ if use clippy; then |
461 |
+ mv "${ED}/usr/bin/clippy-driver" "${ED}/usr/bin/clippy-driver-${PV}" || die |
462 |
+ mv "${ED}/usr/bin/cargo-clippy" "${ED}/usr/bin/cargo-clippy-${PV}" || die |
463 |
+ fi |
464 |
+ if use miri; then |
465 |
+ mv "${ED}/usr/bin/miri" "${ED}/usr/bin/miri-${PV}" || die |
466 |
+ mv "${ED}/usr/bin/cargo-miri" "${ED}/usr/bin/cargo-miri-${PV}" || die |
467 |
+ fi |
468 |
+ if use rls; then |
469 |
+ mv "${ED}/usr/bin/rls" "${ED}/usr/bin/rls-${PV}" || die |
470 |
+ fi |
471 |
+ if use rustfmt; then |
472 |
+ mv "${ED}/usr/bin/rustfmt" "${ED}/usr/bin/rustfmt-${PV}" || die |
473 |
+ mv "${ED}/usr/bin/cargo-fmt" "${ED}/usr/bin/cargo-fmt-${PV}" || die |
474 |
+ fi |
475 |
+ |
476 |
+ # Copy shared library versions of standard libraries for all targets |
477 |
+ # into the system's abi-dependent lib directories because the rust |
478 |
+ # installer only does so for the native ABI. |
479 |
+ |
480 |
+ local abi_libdir rust_target |
481 |
+ for v in $(multilib_get_enabled_abi_pairs); do |
482 |
+ if [ ${v##*.} = ${DEFAULT_ABI} ]; then |
483 |
+ continue |
484 |
+ fi |
485 |
+ abi_libdir=$(get_abi_LIBDIR ${v##*.}) |
486 |
+ rust_target=$(rust_abi $(get_abi_CHOST ${v##*.})) |
487 |
+ mkdir -p "${ED}/usr/${abi_libdir}/${P}" |
488 |
+ cp "${ED}/usr/$(get_libdir)/${P}/rustlib/${rust_target}/lib"/*.so \ |
489 |
+ "${ED}/usr/${abi_libdir}/${P}" || die |
490 |
+ done |
491 |
+ |
492 |
+ # versioned libdir/mandir support |
493 |
+ newenvd - "50${P}" <<-_EOF_ |
494 |
+ LDPATH="${EPREFIX}/usr/$(get_libdir)/${P}" |
495 |
+ MANPATH="${EPREFIX}/usr/share/${P}/man" |
496 |
+ _EOF_ |
497 |
+ |
498 |
+ dodoc COPYRIGHT |
499 |
+ rm "${ED}/usr/share/doc/${P}"/*.old || die |
500 |
+ rm "${ED}/usr/share/doc/${P}/LICENSE-APACHE" || die |
501 |
+ rm "${ED}/usr/share/doc/${P}/LICENSE-MIT" || die |
502 |
+ |
503 |
+ # note: eselect-rust adds EROOT to all paths below |
504 |
+ cat <<-EOF > "${T}/provider-${P}" |
505 |
+ /usr/bin/cargo |
506 |
+ /usr/bin/rustdoc |
507 |
+ /usr/bin/rust-gdb |
508 |
+ /usr/bin/rust-gdbgui |
509 |
+ /usr/bin/rust-lldb |
510 |
+ EOF |
511 |
+ if use clippy; then |
512 |
+ echo /usr/bin/clippy-driver >> "${T}/provider-${P}" |
513 |
+ echo /usr/bin/cargo-clippy >> "${T}/provider-${P}" |
514 |
+ fi |
515 |
+ if use miri; then |
516 |
+ echo /usr/bin/miri >> "${T}/provider-${P}" |
517 |
+ echo /usr/bin/cargo-miri >> "${T}/provider-${P}" |
518 |
+ fi |
519 |
+ if use rls; then |
520 |
+ echo /usr/bin/rls >> "${T}/provider-${P}" |
521 |
+ fi |
522 |
+ if use rustfmt; then |
523 |
+ echo /usr/bin/rustfmt >> "${T}/provider-${P}" |
524 |
+ echo /usr/bin/cargo-fmt >> "${T}/provider-${P}" |
525 |
+ fi |
526 |
+ |
527 |
+ insinto /etc/env.d/rust |
528 |
+ doins "${T}/provider-${P}" |
529 |
+} |
530 |
+ |
531 |
+pkg_postinst() { |
532 |
+ eselect rust update --if-unset |
533 |
+ |
534 |
+ elog "Rust installs a helper script for calling GDB and LLDB," |
535 |
+ elog "for your convenience it is installed under /usr/bin/rust-{gdb,lldb}-${PV}." |
536 |
+ |
537 |
+ if has_version app-editors/emacs; then |
538 |
+ elog "install app-emacs/rust-mode to get emacs support for rust." |
539 |
+ fi |
540 |
+ |
541 |
+ if has_version app-editors/gvim || has_version app-editors/vim; then |
542 |
+ elog "install app-vim/rust-vim to get vim support for rust." |
543 |
+ fi |
544 |
+ |
545 |
+ if use elibc_musl; then |
546 |
+ ewarn "${PN} on *-musl targets is configured with crt-static" |
547 |
+ ewarn "" |
548 |
+ ewarn "you will need to set RUSTFLAGS=\"-C target-feature=-crt-static\" in make.conf" |
549 |
+ ewarn "to use it with portage, otherwise you may see failures like" |
550 |
+ ewarn "error: cannot produce proc-macro for serde_derive v1.0.98 as the target " |
551 |
+ ewarn "x86_64-unknown-linux-musl does not support these crate types" |
552 |
+ fi |
553 |
+} |
554 |
+ |
555 |
+pkg_postrm() { |
556 |
+ eselect rust cleanup |
557 |
+} |