public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH 0/2] New meson-multilib eclass
@ 2021-06-02  1:38 Matt Turner
  2021-06-02  1:38 ` [gentoo-dev] [PATCH 1/2] meson.eclass: Run einstalldocs from ${S} Matt Turner
  2021-06-02  1:38 ` [gentoo-dev] [PATCH 2/2] meson-multilib.eclass: Add new eclass Matt Turner
  0 siblings, 2 replies; 3+ messages in thread
From: Matt Turner @ 2021-06-02  1:38 UTC (permalink / raw
  To: gentoo-dev

Please review my proposed meson-multlib.eclass. It's modeled on
cmake-multilib.eclass and is useful for cutting large amounts of
boilerplate from ebuilds of multilib packages using meson.

The diff stat of the 50 commits to switch the tree over (available in
[1]) is

 90 files changed, 307 insertions(+), 1296 deletions(-)

[1] https://github.com/gentoo/gentoo/pull/20986




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

* [gentoo-dev] [PATCH 1/2] meson.eclass: Run einstalldocs from ${S}
  2021-06-02  1:38 [gentoo-dev] [PATCH 0/2] New meson-multilib eclass Matt Turner
@ 2021-06-02  1:38 ` Matt Turner
  2021-06-02  1:38 ` [gentoo-dev] [PATCH 2/2] meson-multilib.eclass: Add new eclass Matt Turner
  1 sibling, 0 replies; 3+ messages in thread
From: Matt Turner @ 2021-06-02  1:38 UTC (permalink / raw
  To: gentoo-dev; +Cc: Matt Turner

This is how cmake.eclass works.

Signed-off-by: Matt Turner <mattst88@gentoo.org>
---
 eclass/meson.eclass | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/eclass/meson.eclass b/eclass/meson.eclass
index 0acc490452f..c9a5e0b5956 100644
--- a/eclass/meson.eclass
+++ b/eclass/meson.eclass
@@ -420,7 +420,10 @@ meson_src_install() {
 	debug-print-function ${FUNCNAME} "$@"
 
 	DESTDIR="${D}" eninja -C "${BUILD_DIR}" install "$@"
+
+	pushd "${S}" > /dev/null || die
 	einstalldocs
+	popd > /dev/null || die
 }
 
 fi
-- 
2.26.3



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

* [gentoo-dev] [PATCH 2/2] meson-multilib.eclass: Add new eclass
  2021-06-02  1:38 [gentoo-dev] [PATCH 0/2] New meson-multilib eclass Matt Turner
  2021-06-02  1:38 ` [gentoo-dev] [PATCH 1/2] meson.eclass: Run einstalldocs from ${S} Matt Turner
@ 2021-06-02  1:38 ` Matt Turner
  1 sibling, 0 replies; 3+ messages in thread
From: Matt Turner @ 2021-06-02  1:38 UTC (permalink / raw
  To: gentoo-dev; +Cc: Matt Turner

Signed-off-by: Matt Turner <mattst88@gentoo.org>
---
 eclass/meson-multilib.eclass | 126 +++++++++++++++++++++++++++++++++++
 1 file changed, 126 insertions(+)
 create mode 100644 eclass/meson-multilib.eclass

diff --git a/eclass/meson-multilib.eclass b/eclass/meson-multilib.eclass
new file mode 100644
index 00000000000..4a46661d695
--- /dev/null
+++ b/eclass/meson-multilib.eclass
@@ -0,0 +1,126 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# @ECLASS: meson-multilib.eclass
+# @MAINTAINER:
+# gx86-multilib team <multilib@gentoo.org>
+# @AUTHOR:
+# Author: Michał Górny <mgorny@gentoo.org>
+# Author: Matt Turner <mattst88@gentoo.org>
+# @SUPPORTED_EAPIS: 7
+# @BLURB: meson wrapper for multilib builds
+# @DESCRIPTION:
+# The meson-multilib.eclass provides a glue between meson.eclass(5)
+# and multilib-minimal.eclass(5), aiming to provide a convenient way
+# to build packages using meson for multiple ABIs.
+#
+# Inheriting this eclass sets IUSE and exports default multilib_src_*()
+# sub-phases that call meson phase functions for each ABI enabled.
+# The multilib_src_*() functions can be defined in ebuild just like
+# in multilib-minimal, yet they ought to call appropriate meson
+# phase rather than 'default'.
+
+case ${EAPI:-0} in
+	7) ;;
+	*) die "EAPI=${EAPI} is not supported" ;;
+esac
+
+inherit meson multilib-minimal
+
+EXPORT_FUNCTIONS src_configure src_compile src_test src_install
+
+# @FUNCTION: meson_native_bool
+# @USAGE: <USE flag> [option name]
+# @DESCRIPTION:
+# Given a USE flag and a meson project option, output a string like:
+#
+#   -Doption=true
+#   -Doption=false
+#
+# if building for the native ABI (multilib_is_native_abi is true). Otherwise,
+# output -Doption=false. If the project option is unspecified, it defaults
+# to the USE flag.
+meson_native_bool() {
+	multilib_native_usex "${1}" "-D${2-${1}}=true" "-D${2-${1}}=false"
+}
+
+# @FUNCTION: meson_native_feature
+# @USAGE: <USE flag> [option name]
+# @DESCRIPTION:
+# Given a USE flag and a meson project option, output a string like:
+#
+#   -Doption=enabled
+#   -Doption=disabled
+#
+# if building for the native ABI (multilib_is_native_abi is true). Otherwise,
+# output -Doption=disabled. If the project option is unspecified, it defaults
+# to the USE flag.
+meson_native_feature() {
+	multilib_native_usex "${1}" "-D${2-${1}}=enabled" "-D${2-${1}}=disabled"
+}
+
+# @FUNCTION: meson_native_enabled
+# @USAGE: <option name>
+# @DESCRIPTION:
+# Output -Doption=enabled option if executables are being built
+# (multilib_is_native_abi is true). Otherwise, output -Doption=disabled option.
+meson_native_enabled() {
+	if multilib_is_native_abi; then
+		echo "-D${1}=enabled"
+	else
+		echo "-D${1}=disabled"
+	fi
+}
+
+# @FUNCTION: meson_native_true
+# @USAGE: <option name>
+# @DESCRIPTION:
+# Output -Doption=true option if executables are being built
+# (multilib_is_native_abi is true). Otherwise, output -Doption=false option.
+meson_native_true() {
+	if multilib_is_native_abi; then
+		echo "-D${1}=true"
+	else
+		echo "-D${1}=false"
+	fi
+}
+
+meson-multilib_src_configure() {
+	local _meson_args=( "${@}" )
+
+	multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+	meson_src_configure "${_meson_args[@]}"
+}
+
+meson-multilib_src_compile() {
+	local _meson_args=( "${@}" )
+
+	multilib-minimal_src_compile
+}
+
+multilib_src_compile() {
+	meson_src_compile "${_meson_args[@]}"
+}
+
+meson-multilib_src_test() {
+	local _meson_args=( "${@}" )
+
+	multilib-minimal_src_test
+}
+
+multilib_src_test() {
+	meson_src_test "${_meson_args[@]}"
+}
+
+meson-multilib_src_install() {
+	local _meson_args=( "${@}" )
+
+	multilib-minimal_src_install
+}
+
+multilib_src_install() {
+	meson_src_install "${_meson_args[@]}"
+}
-- 
2.26.3



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

end of thread, other threads:[~2021-06-02  1:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-02  1:38 [gentoo-dev] [PATCH 0/2] New meson-multilib eclass Matt Turner
2021-06-02  1:38 ` [gentoo-dev] [PATCH 1/2] meson.eclass: Run einstalldocs from ${S} Matt Turner
2021-06-02  1:38 ` [gentoo-dev] [PATCH 2/2] meson-multilib.eclass: Add new eclass Matt Turner

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