diff options
author | Georgy Yakovlev <gyakovlev@gentoo.org> | 2020-08-04 16:39:45 -0700 |
---|---|---|
committer | Georgy Yakovlev <gyakovlev@gentoo.org> | 2020-08-04 16:43:11 -0700 |
commit | ef89cb77bf9fc16eec9e140e29138adb8d74258a (patch) | |
tree | 0b2b150cab07c05553a9a0467b75421ac962862f /dev-lang/rust | |
parent | net-misc/curl: ~riscv has dependency problems (diff) | |
download | gentoo-ef89cb77bf9fc16eec9e140e29138adb8d74258a.tar.gz gentoo-ef89cb77bf9fc16eec9e140e29138adb8d74258a.tar.bz2 gentoo-ef89cb77bf9fc16eec9e140e29138adb8d74258a.zip |
dev-lang/rust: improve pre-build checks in 1.45.2
Bug: https://bugs.gentoo.org/709362
Bug: https://bugs.gentoo.org/706292
Package-Manager: Portage-3.0.1, Repoman-2.3.23
Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>
Diffstat (limited to 'dev-lang/rust')
-rw-r--r-- | dev-lang/rust/rust-1.45.2.ebuild | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/dev-lang/rust/rust-1.45.2.ebuild b/dev-lang/rust/rust-1.45.2.ebuild index f0ade3a593c0..60b307bbd5f1 100644 --- a/dev-lang/rust/rust-1.45.2.ebuild +++ b/dev-lang/rust/rust-1.45.2.ebuild @@ -129,14 +129,41 @@ toml_usex() { usex "$1" true false } +boostrap_rust_version_check() { + # never call from pkg_pretend. eselect-rust may be not installed yet. + local rustc_wanted="$(ver_cut 1).$(($(ver_cut 2) - 1))" + local rustc_version=( $(eselect --brief rust show 2>/dev/null) ) + rustc_version=${rustc_version[0]#rust-bin-} + rustc_version=${rustc_version#rust-} + + [[ -z "${rustc_version}" ]] && die "Failed to determine rustc version!" + + if ver_test "${rustc_version}" -lt "${rustc_wanted}" ; then + eerror "Rust >=${rustc_wanted} is required" + eerror "please run \'eselect rust\' and set correct rust version" + die + else + einfo "Using rust ${rustc_version} to build" + fi +} + pre_build_checks() { - CHECKREQS_DISK_BUILD="9G" + local M=6144 + M=$(( $(usex clippy 128 0) + ${M} )) + M=$(( $(usex miri 128 0) + ${M} )) + M=$(( $(usex rls 512 0) + ${M} )) + M=$(( $(usex rustfmt 256 0) + ${M} )) + M=$(( $(usex system-llvm 0 2048) + ${M} )) + M=$(( $(usex wasm 256 0) + ${M} )) + M=$(( $(usex debug 15 10) * ${M} / 10 )) eshopts_push -s extglob if is-flagq '-g?(gdb)?([1-9])'; then - CHECKREQS_DISK_BUILD="15G" + M=$(( 15 * ${M} / 10 )) fi eshopts_pop - check-reqs_pkg_setup + M=$(( $(usex system-bootstrap 0 1024) + ${M} )) + M=$(( $(usex doc 256 0) + ${M} )) + CHECKREQS_DISK_BUILD=${M}M check-reqs_pkg_${EBUILD_PHASE} } pkg_pretend() { @@ -146,6 +173,7 @@ pkg_pretend() { pkg_setup() { pre_build_checks python-any-r1_pkg_setup + use system-bootstrap && boostrap_rust_version_check # required to link agains system libs, otherwise # crates use bundled sources and compile own static version |