summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2022-11-21 17:06:01 +0100
committerMichał Górny <mgorny@gentoo.org>2022-11-26 22:12:24 +0100
commitb591f294b6fa096b0cf9b489169a79a5525cea1d (patch)
tree2d682cf16ace3a8a9ab5a14dd2721b67eaff29c9 /eclass/ninja-utils.eclass
parentnet-ftp/proftpd: drop into maintainer-needed. (diff)
downloadgentoo-b591f294b6fa096b0cf9b489169a79a5525cea1d.tar.gz
gentoo-b591f294b6fa096b0cf9b489169a79a5525cea1d.tar.bz2
gentoo-b591f294b6fa096b0cf9b489169a79a5525cea1d.zip
ninja-utils.eclass: Split get_NINJAOPTS out
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'eclass/ninja-utils.eclass')
-rw-r--r--eclass/ninja-utils.eclass15
1 files changed, 11 insertions, 4 deletions
diff --git a/eclass/ninja-utils.eclass b/eclass/ninja-utils.eclass
index 0dffd2eb86ff..9be502fa8ad9 100644
--- a/eclass/ninja-utils.eclass
+++ b/eclass/ninja-utils.eclass
@@ -62,6 +62,16 @@ case "${NINJA}" in
;;
esac
+# @FUNCTION: get_NINJAOPTS
+# @DESCRIPTION:
+# Get the value of NINJAOPTS, inferring them from MAKEOPTS if unset.
+get_NINJAOPTS() {
+ if [[ -z ${NINJAOPTS+set} ]]; then
+ NINJAOPTS="-j$(makeopts_jobs "${MAKEOPTS}" 999) -l$(makeopts_loadavg "${MAKEOPTS}" 0)"
+ fi
+ echo "${NINJAOPTS}"
+}
+
# @FUNCTION: eninja
# @USAGE: [<args>...]
# @DESCRIPTION:
@@ -72,11 +82,8 @@ eninja() {
local nonfatal_args=()
[[ ${EAPI} != 5 ]] && nonfatal_args+=( -n )
- if [[ -z ${NINJAOPTS+set} ]]; then
- NINJAOPTS="-j$(makeopts_jobs "${MAKEOPTS}" 999) -l$(makeopts_loadavg "${MAKEOPTS}" 0)"
- fi
[[ -n "${NINJA_DEPEND}" ]] || ewarn "Unknown value '${NINJA}' for \${NINJA}"
- set -- "${NINJA}" -v ${NINJAOPTS} "$@"
+ set -- "${NINJA}" -v $(get_NINJAOPTS) "$@"
echo "$@" >&2
"$@" || die "${nonfatal_args[@]}" "${*} failed"
}