On Sun, May 8, 2022 at 7:07 PM Sam James <s...@gentoo.org> wrote:
>
> From: orbea <or...@riseup.net>
>
> samurai is a ninja-compatible build tool written in C which
> works with cmake, meson and other users of ninja.
>
> It is feature-complete and supports most of the same options
> as ninja.
>
> Signed-off-by: orbea <or...@riseup.net>
> Signed-off-by: Sam James <s...@gentoo.org>
> ---
>  eclass/ninja-utils.eclass | 24 +++++++++++++++++++++++-
>  1 file changed, 23 insertions(+), 1 deletion(-)
>
> diff --git a/eclass/ninja-utils.eclass b/eclass/ninja-utils.eclass
> index c5f34934192f..67f7a6b5e8a7 100644
> --- a/eclass/ninja-utils.eclass
> +++ b/eclass/ninja-utils.eclass
> @@ -26,6 +26,15 @@ esac
>  if [[ -z ${_NINJA_UTILS_ECLASS} ]]; then
>  _NINJA_UTILS_ECLASS=1
>
> +# @ECLASS_VARIABLE: NINJA
> +# @PRE_INHERIT
> +# @DEFAULT_UNSET
> +# @DESCRIPTION:
> +# Specify a compatible ninja implementation to be used by eninja.
> +# At this point only "ninja" and "samu" are supported.
> +# The default is set to "ninja".
> +: ${NINJA:=ninja}

This is tagged as @DEFAULT_UNSET, but the description and
implementation indicate that it defaults to "ninja".

>  # @ECLASS_VARIABLE: NINJAOPTS
>  # @DEFAULT_UNSET
>  # @DESCRIPTION:
> @@ -35,6 +44,19 @@ _NINJA_UTILS_ECLASS=1
>
>  inherit multiprocessing
>
> +case "${NINJA}" in
> +       ninja)
> +               NINJA_DEPEND=">=dev-util/ninja-1.8.2"
> +       ;;
> +       samu)
> +               NINJA_DEPEND="dev-util/samurai"
> +       ;;
> +       *)
> +               eerror "Unknown value for \${NINJA}"
> +               die "Value ${NINJA} is not supported"
> +       ;;
> +esac

The NINJA environment variable is used directly by meson and may
contain an absolute path. I don't think it makes sense to restrict
possible values to just "ninja" and "samu". That will make it more
difficult for users to override it with a local copy of either tool,
or to use a different implementation should someone write one in the
future.

It might make sense to introduce a different eclass variable to
control NINJA_DEPEND and the default value for NINJA.

Reply via email to