public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH] meson.eclass: stop calling ninja
@ 2021-08-24  5:35 William Hubbs
  2021-08-24  7:55 ` Michał Górny
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: William Hubbs @ 2021-08-24  5:35 UTC (permalink / raw
  To: gentoo-dev; +Cc: William Hubbs

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 <williamh@gentoo.org>
---
 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
+		mesoncompileargs+=(
+			--jobs "$(makeopts_jobs ${NINJAOPTS})"
+			--load-average "$(makeopts_loadavg ${NINJAOPTS})"
+		)
+	elif [[ -n ${MAKEOPTS} ]]; then
+		mesoncompileargs+=(
+			--jobs "$(makeopts_jobs ${MAKEOPTS})"
+			--load-average "$(makeopts_loadavg ${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
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [gentoo-dev] [PATCH] meson.eclass: stop calling ninja
  2021-08-24  5:35 [gentoo-dev] [PATCH] meson.eclass: stop calling ninja William Hubbs
@ 2021-08-24  7:55 ` Michał Górny
  2021-08-24  7:59 ` Florian Schmaus
  2021-08-24 15:16 ` Mike Gilbert
  2 siblings, 0 replies; 5+ messages in thread
From: Michał Górny @ 2021-08-24  7:55 UTC (permalink / raw
  To: gentoo-dev; +Cc: William Hubbs

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 <williamh@gentoo.org>
> ---
>  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




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gentoo-dev] [PATCH] meson.eclass: stop calling ninja
  2021-08-24  5:35 [gentoo-dev] [PATCH] meson.eclass: stop calling ninja William Hubbs
  2021-08-24  7:55 ` Michał Górny
@ 2021-08-24  7:59 ` Florian Schmaus
  2021-08-24 15:09   ` Mike Gilbert
  2021-08-24 15:16 ` Mike Gilbert
  2 siblings, 1 reply; 5+ messages in thread
From: Florian Schmaus @ 2021-08-24  7:59 UTC (permalink / raw
  To: gentoo-dev

On 24/08/2021 07.35, 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 <williamh@gentoo.org>
> ---
>   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
> +		mesoncompileargs+=(
> +			--jobs "$(makeopts_jobs ${NINJAOPTS})"
> +			--load-average "$(makeopts_loadavg ${NINJAOPTS})"
> +		)
> +	elif [[ -n ${MAKEOPTS} ]]; then
> +		mesoncompileargs+=(
> +			--jobs "$(makeopts_jobs ${MAKEOPTS})"
> +			--load-average "$(makeopts_loadavg ${MAKEOPTS})"
> +		)
> +
> +	meson compile "${mesoncompileargs[@]}" "$@" || die "compile failed"
>   }
>   
>   # @FUNCTION: meson_src_test

Missing 'fi'?

I'd probably drop NINJAOPTS and simply have MAKEOPTS the one place where 
users can specify --jobs and --load values.

- Flow


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gentoo-dev] [PATCH] meson.eclass: stop calling ninja
  2021-08-24  7:59 ` Florian Schmaus
@ 2021-08-24 15:09   ` Mike Gilbert
  0 siblings, 0 replies; 5+ messages in thread
From: Mike Gilbert @ 2021-08-24 15:09 UTC (permalink / raw
  To: Gentoo Dev

On Tue, Aug 24, 2021 at 3:59 AM Florian Schmaus <flow@gentoo.org> wrote:
>
> On 24/08/2021 07.35, 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 <williamh@gentoo.org>
> > ---
> >   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
> > +             mesoncompileargs+=(
> > +                     --jobs "$(makeopts_jobs ${NINJAOPTS})"
> > +                     --load-average "$(makeopts_loadavg ${NINJAOPTS})"
> > +             )
> > +     elif [[ -n ${MAKEOPTS} ]]; then
> > +             mesoncompileargs+=(
> > +                     --jobs "$(makeopts_jobs ${MAKEOPTS})"
> > +                     --load-average "$(makeopts_loadavg ${MAKEOPTS})"
> > +             )
> > +
> > +     meson compile "${mesoncompileargs[@]}" "$@" || die "compile failed"
> >   }
> >
> >   # @FUNCTION: meson_src_test
>
> Missing 'fi'?
>
> I'd probably drop NINJAOPTS and simply have MAKEOPTS the one place where
> users can specify --jobs and --load values.

I agree: drop NINJAOPTS.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gentoo-dev] [PATCH] meson.eclass: stop calling ninja
  2021-08-24  5:35 [gentoo-dev] [PATCH] meson.eclass: stop calling ninja William Hubbs
  2021-08-24  7:55 ` Michał Górny
  2021-08-24  7:59 ` Florian Schmaus
@ 2021-08-24 15:16 ` Mike Gilbert
  2 siblings, 0 replies; 5+ messages in thread
From: Mike Gilbert @ 2021-08-24 15:16 UTC (permalink / raw
  To: Gentoo Dev; +Cc: William Hubbs

On Tue, Aug 24, 2021 at 1:35 AM William Hubbs <williamh@gentoo.org> 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 <williamh@gentoo.org>
> ---
>  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
> +               mesoncompileargs+=(
> +                       --jobs "$(makeopts_jobs ${NINJAOPTS})"
> +                       --load-average "$(makeopts_loadavg ${NINJAOPTS})"
> +               )
> +       elif [[ -n ${MAKEOPTS} ]]; then
> +               mesoncompileargs+=(
> +                       --jobs "$(makeopts_jobs ${MAKEOPTS})"
> +                       --load-average "$(makeopts_loadavg ${MAKEOPTS})"

${MAKEOPTS} should be quoted on the above 2 lines.

makeopts_loadavg outputs 999 by default if the load average is not
specified. Please override this as "0" by passing it as the second
argument.

> +               )
> +
> +       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[@]}" "$@"

You are including "$@" twice: once in mesoninstallargs, and once on
the above line. Please remove it from mesoninstallargs.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-08-24 15:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-24  5:35 [gentoo-dev] [PATCH] meson.eclass: stop calling ninja William Hubbs
2021-08-24  7:55 ` Michał Górny
2021-08-24  7:59 ` Florian Schmaus
2021-08-24 15:09   ` Mike Gilbert
2021-08-24 15:16 ` Mike Gilbert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox