summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorgy Yakovlev <gyakovlev@gentoo.org>2020-12-16 12:49:38 -0800
committerGeorgy Yakovlev <gyakovlev@gentoo.org>2020-12-16 12:49:38 -0800
commitec98673b8287ce4dabcd8b673b2d4b56e86a173e (patch)
tree1dcf17f2629ddf9191157cdae6939350b468c044 /dev-lang
parentsys-process/parallel: Stabilize 20201022 amd64, #758824 (diff)
downloadgentoo-ec98673b8287ce4dabcd8b673b2d4b56e86a173e.tar.gz
gentoo-ec98673b8287ce4dabcd8b673b2d4b56e86a173e.tar.bz2
gentoo-ec98673b8287ce4dabcd8b673b2d4b56e86a173e.zip
dev-lang/rust: update requirements check function
Bug: https://bugs.gentoo.org/757276 Package-Manager: Portage-3.0.12, Repoman-3.0.2 Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>
Diffstat (limited to 'dev-lang')
-rw-r--r--dev-lang/rust/rust-1.47.0-r2.ebuild45
1 files changed, 37 insertions, 8 deletions
diff --git a/dev-lang/rust/rust-1.47.0-r2.ebuild b/dev-lang/rust/rust-1.47.0-r2.ebuild
index eb492a7361c1..841365e2bef7 100644
--- a/dev-lang/rust/rust-1.47.0-r2.ebuild
+++ b/dev-lang/rust/rust-1.47.0-r2.ebuild
@@ -169,21 +169,50 @@ boostrap_rust_version_check() {
}
pre_build_checks() {
- local M=6144
- M=$(( $(usex clippy 128 0) + ${M} ))
- M=$(( $(usex miri 128 0) + ${M} ))
+ # minimal useflags with system-llvm and system-bootstrap
+ local M=7680
+
+ # approximate component sizes
+ M=$(( $(usex clippy 256 0) + ${M} ))
+ M=$(( $(usex miri 256 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 rustfmt 512 0) + ${M} ))
+ M=$(( $(usex wasm 512 0) + ${M} ))
+
+ # multiply by 1.5 if debug enabled
M=$(( $(usex debug 15 10) * ${M} / 10 ))
+
+ # multiply by 1.5 if target-cpu in rustflags
+ case "${RUSTFLAGS}" in
+ *target-cpu=*)
+ M=$(( 15 * ${M} / 10 ))
+ ;;
+ esac
+
+ # count all enabled llvm targets
+ if ! use system-llvm; then
+ # base requirement is about 2G and 0.5 per llvm target
+ M=$(( 2048 + ${M} ))
+ local llvm_target
+ for llvm_target in ${ALL_LLVM_TARGETS}; do
+ use "${llvm_target}" && M=$(( 512 + ${M} ))
+ done
+ fi
+
+ # multiply by 1.5 if debugging *flags found
eshopts_push -s extglob
if is-flagq '-g?(gdb)?([1-9])'; then
M=$(( 15 * ${M} / 10 ))
fi
eshopts_pop
- M=$(( $(usex system-bootstrap 0 1024) + ${M} ))
- M=$(( $(usex doc 256 0) + ${M} ))
+
+ # account for bootstrap compiler
+ # on ppc64 we unpack both BE and LE archive, so double that.
+ M=$(( $(usex system-bootstrap 0 $(usex ppc64 2048 1024) ) + ${M} ))
+
+ # docs appended last as those usually don't depend on flags
+ M=$(( $(usex doc 512 0) + ${M} ))
+
CHECKREQS_DISK_BUILD=${M}M check-reqs_pkg_${EBUILD_PHASE}
}