Gentoo Archives: gentoo-commits

From: Mike Gilbert <floppym@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/
Date: Wed, 11 May 2022 02:19:56
Message-Id: 1652235197.1c01b84199785b35fa0b79f6ec990964bd09ceae.floppym@gentoo
1 commit: 1c01b84199785b35fa0b79f6ec990964bd09ceae
2 Author: orbea <orbea <AT> riseup <DOT> net>
3 AuthorDate: Fri Apr 9 18:38:55 2021 +0000
4 Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org>
5 CommitDate: Wed May 11 02:13:17 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1c01b841
7
8 ninja-utils.eclass: Support dev-util/samurai
9
10 samurai is a ninja-compatible build tool written in C which
11 works with cmake, meson and other users of ninja.
12
13 It is feature-complete and supports most of the same options
14 as ninja.
15
16 Signed-off-by: orbea <orbea <AT> riseup.net>
17 Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>
18
19 eclass/ninja-utils.eclass | 25 ++++++++++++++++++++++++-
20 1 file changed, 24 insertions(+), 1 deletion(-)
21
22 diff --git a/eclass/ninja-utils.eclass b/eclass/ninja-utils.eclass
23 index c5f34934192f..cf98e866d152 100644
24 --- a/eclass/ninja-utils.eclass
25 +++ b/eclass/ninja-utils.eclass
26 @@ -26,6 +26,16 @@ esac
27 if [[ -z ${_NINJA_UTILS_ECLASS} ]]; then
28 _NINJA_UTILS_ECLASS=1
29
30 +# @ECLASS_VARIABLE: NINJA
31 +# @PRE_INHERIT
32 +# @DESCRIPTION:
33 +# Specify a compatible ninja implementation to be used by eninja().
34 +# At this point only "ninja" and "samu" are explicitly supported,
35 +# but other values can be set where NINJA_DEPEND will then be set
36 +# to a blank variable.
37 +# The default is set to "ninja".
38 +: ${NINJA:=ninja}
39 +
40 # @ECLASS_VARIABLE: NINJAOPTS
41 # @DEFAULT_UNSET
42 # @DESCRIPTION:
43 @@ -35,6 +45,18 @@ _NINJA_UTILS_ECLASS=1
44
45 inherit multiprocessing
46
47 +case "${NINJA}" in
48 + ninja)
49 + NINJA_DEPEND=">=dev-util/ninja-1.8.2"
50 + ;;
51 + samu)
52 + NINJA_DEPEND="dev-util/samurai"
53 + ;;
54 + *)
55 + NINJA_DEPEND=""
56 + ;;
57 +esac
58 +
59 # @FUNCTION: eninja
60 # @USAGE: [<args>...]
61 # @DESCRIPTION:
62 @@ -48,7 +70,8 @@ eninja() {
63 if [[ -z ${NINJAOPTS+set} ]]; then
64 NINJAOPTS="-j$(makeopts_jobs "${MAKEOPTS}" 999) -l$(makeopts_loadavg "${MAKEOPTS}" 0)"
65 fi
66 - set -- ninja -v ${NINJAOPTS} "$@"
67 + [[ -n "${NINJA_DEPEND}" ]] || ewarn "Unknown value '${NINJA}' for \${NINJA}"
68 + set -- "${NINJA}" -v ${NINJAOPTS} "$@"
69 echo "$@" >&2
70 "$@" || die "${nonfatal_args[@]}" "${*} failed"
71 }