public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH v4] meson.eclass: several cleanups
@ 2021-08-24 17:27 William Hubbs
  0 siblings, 0 replies; only message in thread
From: William Hubbs @ 2021-08-24 17:27 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.

Stop using the NINJAOPTS variable.

Add --num-processes to "meson test" call regardless of whether MAKEOPTS
is set since the default is 1 process.
Signed-off-by: William Hubbs <williamh@gentoo.org>
---
 eclass/meson.eclass | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/eclass/meson.eclass b/eclass/meson.eclass
index 2a563e367c6..a14d7412b56 100644
--- a/eclass/meson.eclass
+++ b/eclass/meson.eclass
@@ -379,7 +379,13 @@ meson_src_configure() {
 meson_src_compile() {
 	debug-print-function ${FUNCNAME} "$@"
 
-	eninja -C "${BUILD_DIR}" "$@"
+	local mesoncompileargs=(
+		-C "${BUILD_DIR}"
+		--jobs "$(makeopts_jobs "${MAKEOPTS}")"
+		--load-average "$(makeopts_loadavg "${MAKEOPTS}" 0)"
+	)
+
+	meson compile "${mesoncompileargs[@]}" "$@" || die "compile failed"
 }
 
 # @FUNCTION: meson_src_test
@@ -391,11 +397,8 @@ meson_src_test() {
 
 	local mesontestargs=(
 		-C "${BUILD_DIR}"
+		--num-processes "$(makeopts_jobs "${MAKEOPTS}" )"
 	)
-	[[ -n ${NINJAOPTS} || -n ${MAKEOPTS} ]] &&
-		mesontestargs+=(
-			--num-processes "$(makeopts_jobs ${NINJAOPTS:-${MAKEOPTS}})"
-		)
 
 	# Append additional arguments from ebuild
 	mesontestargs+=("${emesontestargs[@]}")
@@ -406,13 +409,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] only message in thread

only message in thread, other threads:[~2021-08-24 17:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-24 17:27 [gentoo-dev] [PATCH v4] meson.eclass: several cleanups William Hubbs

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