* [gentoo-dev] [PATCH 1/2] meson.eclass: clean up meson_src_configure
@ 2020-04-08 20:34 Mike Gilbert
2020-04-08 20:34 ` [gentoo-dev] [PATCH 2/2] meson.eclass: add MYMESONARGS variable Mike Gilbert
0 siblings, 1 reply; 3+ messages in thread
From: Mike Gilbert @ 2020-04-08 20:34 UTC (permalink / raw
To: gentoo-dev; +Cc: williamh, chewi, Mike Gilbert
This mainly rearranges some code to make it easier to read.
Also changes the bare 'meson' call to 'meson setup'.
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
---
eclass/meson.eclass | 30 ++++++++++++++++++++----------
1 file changed, 20 insertions(+), 10 deletions(-)
diff --git a/eclass/meson.eclass b/eclass/meson.eclass
index 16e17dd4a384..3e3a2e2f7a2e 100644
--- a/eclass/meson.eclass
+++ b/eclass/meson.eclass
@@ -219,32 +219,42 @@ meson_feature() {
meson_src_configure() {
debug-print-function ${FUNCNAME} "$@"
- # Common args
local mesonargs=(
+ meson setup
--buildtype plain
--libdir "$(get_libdir)"
--localstatedir "${EPREFIX}/var/lib"
--prefix "${EPREFIX}/usr"
--sysconfdir "${EPREFIX}/etc"
--wrap-mode nodownload
- )
+ )
if tc-is-cross-compiler || [[ ${ABI} != ${DEFAULT_ABI-${ABI}} ]]; then
_meson_create_cross_file || die "unable to write meson cross file"
mesonargs+=( --cross-file "${T}/meson.${CHOST}.${ABI}" )
fi
+ BUILD_DIR="${BUILD_DIR:-${WORKDIR}/${P}-build}"
+
+ mesonargs+=(
+ # Arguments from ebuild
+ "${emesonargs[@]}"
+
+ # Arguments passed to this function
+ "$@"
+
+ # Source directory
+ "${EMESON_SOURCE:-${S}}"
+
+ # Build directory
+ "${BUILD_DIR}"
+ )
+
# https://bugs.gentoo.org/625396
python_export_utf8_locale
- # Append additional arguments from ebuild
- mesonargs+=("${emesonargs[@]}")
-
- BUILD_DIR="${BUILD_DIR:-${WORKDIR}/${P}-build}"
- set -- meson "${mesonargs[@]}" "$@" \
- "${EMESON_SOURCE:-${S}}" "${BUILD_DIR}"
- echo "$@"
- tc-env_build "$@" || die
+ echo "${mesonargs[@]}" >&2
+ tc-env_build "${mesonargs[@]}" || die
}
# @FUNCTION: meson_src_compile
--
2.26.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [gentoo-dev] [PATCH 2/2] meson.eclass: add MYMESONARGS variable
2020-04-08 20:34 [gentoo-dev] [PATCH 1/2] meson.eclass: clean up meson_src_configure Mike Gilbert
@ 2020-04-08 20:34 ` Mike Gilbert
2020-04-08 22:40 ` James Le Cuirot
0 siblings, 1 reply; 3+ messages in thread
From: Mike Gilbert @ 2020-04-08 20:34 UTC (permalink / raw
To: gentoo-dev; +Cc: williamh, chewi, Mike Gilbert
This was requested to allow users to pass aribtrary arguments to meson.
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
---
eclass/meson.eclass | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/eclass/meson.eclass b/eclass/meson.eclass
index 3e3a2e2f7a2e..0932a7ed427f 100644
--- a/eclass/meson.eclass
+++ b/eclass/meson.eclass
@@ -84,6 +84,11 @@ fi
# Optional meson test arguments as Bash array; this should be defined before
# calling meson_src_test.
+# @VARIABLE: MYMESONARGS
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# User-controlled environment variable containing arguments to be passed to
+# meson in meson_src_configure.
read -d '' __MESON_ARRAY_PARSER <<"EOF"
import shlex
@@ -236,6 +241,9 @@ meson_src_configure() {
BUILD_DIR="${BUILD_DIR:-${WORKDIR}/${P}-build}"
+ # Handle quoted whitespace
+ eval "local -a MYMESONARGS=( ${MYMESONARGS} )"
+
mesonargs+=(
# Arguments from ebuild
"${emesonargs[@]}"
@@ -243,6 +251,9 @@ meson_src_configure() {
# Arguments passed to this function
"$@"
+ # Arguments from user
+ "${MYMESONARGS[@]}"
+
# Source directory
"${EMESON_SOURCE:-${S}}"
--
2.26.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [gentoo-dev] [PATCH 2/2] meson.eclass: add MYMESONARGS variable
2020-04-08 20:34 ` [gentoo-dev] [PATCH 2/2] meson.eclass: add MYMESONARGS variable Mike Gilbert
@ 2020-04-08 22:40 ` James Le Cuirot
0 siblings, 0 replies; 3+ messages in thread
From: James Le Cuirot @ 2020-04-08 22:40 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 1555 bytes --]
On Wed, 8 Apr 2020 16:34:52 -0400
Mike Gilbert <floppym@gentoo.org> wrote:
> This was requested to allow users to pass aribtrary arguments to meson.
>
> Signed-off-by: Mike Gilbert <floppym@gentoo.org>
> ---
> eclass/meson.eclass | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/eclass/meson.eclass b/eclass/meson.eclass
> index 3e3a2e2f7a2e..0932a7ed427f 100644
> --- a/eclass/meson.eclass
> +++ b/eclass/meson.eclass
> @@ -84,6 +84,11 @@ fi
> # Optional meson test arguments as Bash array; this should be defined before
> # calling meson_src_test.
>
> +# @VARIABLE: MYMESONARGS
> +# @DEFAULT_UNSET
> +# @DESCRIPTION:
> +# User-controlled environment variable containing arguments to be passed to
> +# meson in meson_src_configure.
>
> read -d '' __MESON_ARRAY_PARSER <<"EOF"
> import shlex
> @@ -236,6 +241,9 @@ meson_src_configure() {
>
> BUILD_DIR="${BUILD_DIR:-${WORKDIR}/${P}-build}"
>
> + # Handle quoted whitespace
> + eval "local -a MYMESONARGS=( ${MYMESONARGS} )"
> +
> mesonargs+=(
> # Arguments from ebuild
> "${emesonargs[@]}"
> @@ -243,6 +251,9 @@ meson_src_configure() {
> # Arguments passed to this function
> "$@"
>
> + # Arguments from user
> + "${MYMESONARGS[@]}"
> +
> # Source directory
> "${EMESON_SOURCE:-${S}}"
>
I didn't mean for you to do this yourself so thank you very much
indeed! You've done a nice job, I've tested it, and it works perfectly.
Cheers,
--
James Le Cuirot (chewi)
Gentoo Linux Developer
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-04-08 22:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-08 20:34 [gentoo-dev] [PATCH 1/2] meson.eclass: clean up meson_src_configure Mike Gilbert
2020-04-08 20:34 ` [gentoo-dev] [PATCH 2/2] meson.eclass: add MYMESONARGS variable Mike Gilbert
2020-04-08 22:40 ` James Le Cuirot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox