public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: William Hubbs <williamh@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Cc: William Hubbs <williamh@gentoo.org>
Subject: [gentoo-dev] [PATCH v4] meson.eclass: several cleanups
Date: Tue, 24 Aug 2021 12:27:32 -0500	[thread overview]
Message-ID: <20210824172732.27359-1-williamh@gentoo.org> (raw)

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



                 reply	other threads:[~2021-08-24 17:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210824172732.27359-1-williamh@gentoo.org \
    --to=williamh@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox