From: Eli Schwartz <eschwartz93@gmail.com>
To: gentoo-dev@lists.gentoo.org
Subject: [gentoo-dev] [PATCH v2 3/5] meson.eclass: refactor src_configure into a setter function
Date: Tue, 20 Feb 2024 01:14:43 -0500 [thread overview]
Message-ID: <20240220063504.3959739-4-eschwartz93@gmail.com> (raw)
In-Reply-To: <20240220063504.3959739-1-eschwartz93@gmail.com>
This is necessary in order to get at the implementation of `meson setup`
from other eclasses, which do not simply call meson_src_configure. The
intended use case is distutils-r1, where a python build backend wraps
meson and needs its arguments while calling meson on its own.
This allows distutils-r1 to invoke `setup_meson_src_configure` followed
by gpep517, and get access to:
- the preparation which needs to be done, including setting up the
environment
- the array of setup arguments
Signed-off-by: Eli Schwartz <eschwartz93@gmail.com>
---
v2: new patch
eclass/meson.eclass | 49 +++++++++++++++++++++++++++------------------
1 file changed, 29 insertions(+), 20 deletions(-)
diff --git a/eclass/meson.eclass b/eclass/meson.eclass
index e1963e552710..620381ed7079 100644
--- a/eclass/meson.eclass
+++ b/eclass/meson.eclass
@@ -277,15 +277,12 @@ meson_feature() {
usex "$1" "-D${2-$1}=enabled" "-D${2-$1}=disabled"
}
-# @FUNCTION: meson_src_configure
-# @USAGE: [extra meson arguments]
+# @FUNCTION: setup_meson_src_configure
# @DESCRIPTION:
-# This is the meson_src_configure function.
-meson_src_configure() {
- debug-print-function ${FUNCNAME} "$@"
-
- [[ -n "${NINJA_DEPEND}" ]] || ewarn "Unknown value '${NINJA}' for \${NINJA}"
-
+# Calculate the command line which meson should use, and other relevant
+# variables. Invoke via "${mesonargs[@]}" in the calling environment.
+# This function is called from meson_src_configure.
+setup_meson_src_configure() {
local ltoflags=()
if tc-is-lto; then
# We want to connect -flto in *FLAGS to the dedicated meson option,
@@ -344,8 +341,7 @@ meson_src_configure() {
: "${BUILD_PKG_CONFIG_PATH:=${PKG_CONFIG_PATH}}"
fi
- local mesonargs=(
- meson setup
+ mesonargs=(
--libdir "$(get_libdir)"
--localstatedir "${EPREFIX}/var/lib"
--prefix "${EPREFIX}/usr"
@@ -390,12 +386,6 @@ meson_src_configure() {
# Arguments from user
"${MYMESONARGS[@]}"
-
- # Source directory
- "${EMESON_SOURCE:-${S}}"
-
- # Build directory
- "${BUILD_DIR}"
)
# Used by symbolextractor.py
@@ -407,13 +397,32 @@ meson_src_configure() {
python_export_utf8_locale
# https://bugs.gentoo.org/721786
- local -x BOOST_INCLUDEDIR="${BOOST_INCLUDEDIR-${EPREFIX}/usr/include}"
- local -x BOOST_LIBRARYDIR="${BOOST_LIBRARYDIR-${EPREFIX}/usr/$(get_libdir)}"
+ export BOOST_INCLUDEDIR="${BOOST_INCLUDEDIR-${EPREFIX}/usr/include}"
+ export BOOST_LIBRARYDIR="${BOOST_LIBRARYDIR-${EPREFIX}/usr/$(get_libdir)}"
+}
+
+# @FUNCTION: meson_src_configure
+# @USAGE: [extra meson arguments]
+# @DESCRIPTION:
+# This is the meson_src_configure function.
+meson_src_configure() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ [[ -n "${NINJA_DEPEND}" ]] || ewarn "Unknown value '${NINJA}' for \${NINJA}"
(
+ setup_meson_src_configure "$@"
+ mesonargs+=(
+ # Source directory
+ "${EMESON_SOURCE:-${S}}"
+
+ # Build directory
+ "${BUILD_DIR}"
+ )
+
export -n {C,CPP,CXX,F,OBJC,OBJCXX,LD}FLAGS PKG_CONFIG_{LIBDIR,PATH}
- echo "${mesonargs[@]}" >&2
- "${mesonargs[@]}"
+ echo meson setup "${mesonargs[@]}" >&2
+ meson setup "${mesonargs[@]}"
) || die
}
--
2.43.0
next prev parent reply other threads:[~2024-02-20 6:35 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-20 4:26 [gentoo-dev] [PATCH 0/3] eclass updates for meson <> distutils <> LTO Eli Schwartz
2024-02-20 4:26 ` [gentoo-dev] [PATCH 1/3] meson.eclass: wire up LTO support directly into the meson options Eli Schwartz
2024-02-20 5:58 ` Mike Gilbert
2024-02-20 6:09 ` Eli Schwartz
2024-02-20 6:24 ` Mike Gilbert
2024-02-20 6:33 ` Eli Schwartz
2024-02-20 6:37 ` Eli Schwartz
2024-02-20 6:40 ` Sam James
2024-02-20 4:26 ` [gentoo-dev] [PATCH 2/3] distutils-r1.eclass: wire up meson-python to meson.eclass Eli Schwartz
2024-02-20 4:42 ` Sam James
2024-02-20 5:12 ` Eli Schwartz
2024-02-20 6:14 ` [gentoo-dev] [PATCH v2 0/5] eclass updates for meson <> distutils <> LTO Eli Schwartz
2024-02-20 6:14 ` [gentoo-dev] [PATCH v2 1/5] meson.eclass: wire up LTO support directly into the meson options Eli Schwartz
2024-02-20 6:14 ` [gentoo-dev] [PATCH v2 2/5] meson.eclass: prefer -D buildtype instead of --buildtype Eli Schwartz
2024-02-20 6:14 ` Eli Schwartz [this message]
2024-02-20 6:42 ` [gentoo-dev] Re: [PATCH v2 3/5] meson.eclass: refactor src_configure into a setter function Eli Schwartz
2024-02-20 6:14 ` [gentoo-dev] [PATCH v2 4/5] distutils-r1.eclass: wire up meson-python to meson.eclass Eli Schwartz
2024-02-20 6:55 ` Michał Górny
2024-02-20 20:45 ` Eli Schwartz
2024-02-20 6:14 ` [gentoo-dev] [PATCH v2 5/5] distutils-r1.eclass: fix src_configure to handle flag-o-matic correctly Eli Schwartz
2024-02-20 6:28 ` [gentoo-dev] [PATCH 2/3] distutils-r1.eclass: wire up meson-python to meson.eclass Michał Górny
2024-02-20 4:26 ` [gentoo-dev] [PATCH 3/3] distutils-r1.eclass: fix src_configure to handle flag-o-matic correctly Eli Schwartz
2024-02-20 6:35 ` Michał Górny
2024-02-20 4:41 ` [gentoo-dev] [PATCH 0/3] eclass updates for meson <> distutils <> LTO Sam James
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=20240220063504.3959739-4-eschwartz93@gmail.com \
--to=eschwartz93@gmail.com \
--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