On Tue, 2021-08-24 at 00:35 -0500, William Hubbs wrote:
> Use the compile and install subcommands of meson instead of calling
> ninja. This allows for the possibility of a different back end.
>
> Signed-off-by: William Hubbs <[email protected]>
> ---
> eclass/meson.eclass | 24 +++++++++++++++++++++---
> 1 file changed, 21 insertions(+), 3 deletions(-)
>
> diff --git a/eclass/meson.eclass b/eclass/meson.eclass
> index 2a563e367c6..e9c9b155096 100644
> --- a/eclass/meson.eclass
> +++ b/eclass/meson.eclass
> @@ -379,7 +379,21 @@ meson_src_configure() {
> meson_src_compile() {
> debug-print-function ${FUNCNAME} "$@"
>
> - eninja -C "${BUILD_DIR}" "$@"
> + local mesoncompileargs=(
> + -C "${BUILD_DIR}"
> + )
> + if [[ -n ${NINJAOPTS} ]]; then
Shouldn't NINJAOPTS be only used with the ninja backend then?
> + mesoncompileargs+=(
> + --jobs "$(makeopts_jobs ${NINJAOPTS})"
> + --load-average "$(makeopts_loadavg ${NINJAOPTS})"
> + )
> + elif [[ -n ${MAKEOPTS} ]]; then
> + mesoncompileargs+=(
> + --jobs "$(makeopts_jobs ${MAKEOPTS})"
> + --load-average "$(makeopts_loadavg ${MAKEOPTS})"
> + )
Does this really work without a 'fi'?
Also, you could avoid repetition by putting NINJAOPTS/MAKEOPTS into
a local variable, and passing that to makeopts_*.
> +
> + meson compile "${mesoncompileargs[@]}" "$@" || die "compile failed"
> }
>
> # @FUNCTION: meson_src_test
> @@ -406,13 +420,17 @@ meson_src_test() {
> }
>
> # @FUNCTION: meson_src_install
> -# @USAGE: [extra ninja install arguments]
> +# @USAGE: [extra meson install arguments]
> # @DESCRIPTION:
> # This is the meson_src_install function.
> meson_src_install() {
> debug-print-function ${FUNCNAME} "$@"
>
> - DESTDIR="${D}" eninja -C "${BUILD_DIR}" install "$@"
> + local mesoninstallargs=(
> + -C "${BUILD_DIR}" "$@"
> + --destdir "${D}"
> + )
> + meson install "${mesoninstallargs[@]}" "$@"
>
> pushd "${S}" > /dev/null || die
> einstalldocs
--
Best regards,
Michał Górny