mirror of
https://github.com/flatcar/scripts.git
synced 2025-12-06 18:02:02 +01:00
eclass/ninja-utils: Sync with gentoo
It's from gentoo commit cec274bcb2fde829ddf72c3a06ffad14d4adb373.
This commit is contained in:
parent
bc4a6d30a8
commit
9522ecbb6d
@ -1,4 +1,4 @@
|
|||||||
# Copyright 1999-2018 Gentoo Foundation
|
# Copyright 1999-2021 Gentoo Authors
|
||||||
# Distributed under the terms of the GNU General Public License v2
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
# @ECLASS: ninja-utils.eclass
|
# @ECLASS: ninja-utils.eclass
|
||||||
@ -8,7 +8,7 @@
|
|||||||
# @AUTHOR:
|
# @AUTHOR:
|
||||||
# Michał Górny <mgorny@gentoo.org>
|
# Michał Górny <mgorny@gentoo.org>
|
||||||
# Mike Gilbert <floppym@gentoo.org>
|
# Mike Gilbert <floppym@gentoo.org>
|
||||||
# @SUPPORTED_EAPIS: 2 4 5 6 7
|
# @SUPPORTED_EAPIS: 5 6 7 8
|
||||||
# @BLURB: common bits to run dev-util/ninja builder
|
# @BLURB: common bits to run dev-util/ninja builder
|
||||||
# @DESCRIPTION:
|
# @DESCRIPTION:
|
||||||
# This eclass provides a single function -- eninja -- that can be used
|
# This eclass provides a single function -- eninja -- that can be used
|
||||||
@ -18,15 +18,14 @@
|
|||||||
# be used indirectly by the eclasses for other build systems (CMake,
|
# be used indirectly by the eclasses for other build systems (CMake,
|
||||||
# Meson).
|
# Meson).
|
||||||
|
|
||||||
if [[ -z ${_NINJA_UTILS_ECLASS} ]]; then
|
case ${EAPI} in
|
||||||
|
5|6|7|8) ;;
|
||||||
case ${EAPI:-0} in
|
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
|
||||||
0|1|3) die "EAPI=${EAPI:-0} is not supported (too old)";;
|
|
||||||
# copied from cmake-utils
|
|
||||||
2|4|5|6|7) ;;
|
|
||||||
*) die "EAPI=${EAPI} is not yet supported" ;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
if [[ -z ${_NINJA_UTILS_ECLASS} ]]; then
|
||||||
|
_NINJA_UTILS_ECLASS=1
|
||||||
|
|
||||||
# @ECLASS-VARIABLE: NINJAOPTS
|
# @ECLASS-VARIABLE: NINJAOPTS
|
||||||
# @DEFAULT_UNSET
|
# @DEFAULT_UNSET
|
||||||
# @DESCRIPTION:
|
# @DESCRIPTION:
|
||||||
@ -44,7 +43,7 @@ inherit multiprocessing
|
|||||||
# with EAPI 6, it also supports being called via 'nonfatal'.
|
# with EAPI 6, it also supports being called via 'nonfatal'.
|
||||||
eninja() {
|
eninja() {
|
||||||
local nonfatal_args=()
|
local nonfatal_args=()
|
||||||
[[ ${EAPI:-0} != [245] ]] && nonfatal_args+=( -n )
|
[[ ${EAPI} != 5 ]] && nonfatal_args+=( -n )
|
||||||
|
|
||||||
if [[ -z ${NINJAOPTS+set} ]]; then
|
if [[ -z ${NINJAOPTS+set} ]]; then
|
||||||
NINJAOPTS="-j$(makeopts_jobs) -l$(makeopts_loadavg "${MAKEOPTS}" 0)"
|
NINJAOPTS="-j$(makeopts_jobs) -l$(makeopts_loadavg "${MAKEOPTS}" 0)"
|
||||||
@ -54,5 +53,4 @@ eninja() {
|
|||||||
"$@" || die "${nonfatal_args[@]}" "${*} failed"
|
"$@" || die "${nonfatal_args[@]}" "${*} failed"
|
||||||
}
|
}
|
||||||
|
|
||||||
_NINJA_UTILS_ECLASS=1
|
|
||||||
fi
|
fi
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user