summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2017-10-04 12:03:18 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2017-10-04 12:30:08 -0700
commit5f21d6aacd144e990402609aa3b3f118cc391447 (patch)
treea409a5aa915d31622deedfce2ca8a3cde446c76f /eclass
parentdev-libs/botan: remove unneeded c++11 patch (diff)
downloadgentoo-5f21d6aacd144e990402609aa3b3f118cc391447.tar.gz
gentoo-5f21d6aacd144e990402609aa3b3f118cc391447.tar.bz2
gentoo-5f21d6aacd144e990402609aa3b3f118cc391447.zip
meson.eclass: MESON_AUTO_DEPEND support
Make it possible to use the meson eclass without it automatically adding meson to DEPEND. Intended for cases where meson usage is conditional (e.g. hidden behind a USE flag). This is a direct copy of the AUTOTOOLS_AUTO_DEPEND functionality & implementation from autotools.eclass, including the guard for multiple inheritance. Closes: https://bugs.gentoo.org/626054 Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> Signed-off-by: Mike Gilbert <floppym@gentoo.org>
Diffstat (limited to 'eclass')
-rw-r--r--eclass/meson.eclass23
1 files changed, 22 insertions, 1 deletions
diff --git a/eclass/meson.eclass b/eclass/meson.eclass
index 5b63f0ef3a33..b339017f9017 100644
--- a/eclass/meson.eclass
+++ b/eclass/meson.eclass
@@ -38,6 +38,16 @@ case ${EAPI:-0} in
*) die "EAPI=${EAPI} is not supported" ;;
esac
+if [[ ${__MESON_AUTO_DEPEND+set} == "set" ]] ; then
+ # See if we were included already, but someone changed the value
+ # of MESON_AUTO_DEPEND on us. We could reload the entire
+ # eclass at that point, but that adds overhead, and it's trivial
+ # to re-order inherit in eclasses/ebuilds instead. #409611
+ if [[ ${__MESON_AUTO_DEPEND} != ${MESON_AUTO_DEPEND} ]] ; then
+ die "MESON_AUTO_DEPEND changed value between inherits; please inherit meson.eclass first! ${__MESON_AUTO_DEPEND} -> ${MESON_AUTO_DEPEND}"
+ fi
+fi
+
if [[ -z ${_MESON_ECLASS} ]]; then
inherit ninja-utils python-utils-r1 toolchain-funcs
@@ -49,9 +59,20 @@ EXPORT_FUNCTIONS src_configure src_compile src_test src_install
if [[ -z ${_MESON_ECLASS} ]]; then
_MESON_ECLASS=1
-DEPEND=">=dev-util/meson-0.40.0
+MESON_DEPEND=">=dev-util/meson-0.40.0
>=dev-util/ninja-1.7.2"
+# @ECLASS-VARIABLE: MESON_AUTO_DEPEND
+# @DESCRIPTION:
+# Set to 'no' to disable automatically adding to DEPEND. This lets
+# ebuilds form conditional depends by using ${MESON_DEPEND} in
+# their own DEPEND string.
+: ${MESON_AUTO_DEPEND:=yes}
+if [[ ${MESON_AUTO_DEPEND} != "no" ]] ; then
+ DEPEND=${MESON_DEPEND}
+fi
+__MESON_AUTO_DEPEND=${MESON_AUTO_DEPEND} # See top of eclass
+
# @ECLASS-VARIABLE: BUILD_DIR
# @DEFAULT_UNSET
# @DESCRIPTION: