commit:     897fe9a5c1e0eb6de341346ec33b50d63fe146f6
Author:     David Seifert <soap <AT> gentoo <DOT> org>
AuthorDate: Sat May  1 19:01:53 2021 +0000
Commit:     David Seifert <soap <AT> gentoo <DOT> org>
CommitDate: Sat May  1 19:01:53 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=897fe9a5

wxwidgets.eclass: Make WX_GTK_VER a PRE_INHERIT variable

Signed-off-by: David Seifert <soap <AT> gentoo.org>

 eclass/wxwidgets.eclass | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/eclass/wxwidgets.eclass b/eclass/wxwidgets.eclass
index 5d6d175392b..80c0fc5dea3 100644
--- a/eclass/wxwidgets.eclass
+++ b/eclass/wxwidgets.eclass
@@ -24,6 +24,19 @@
 if [[ -z ${_WXWIDGETS_ECLASS} ]]; then
 _WXWIDGETS_ECLASS=1
 
+# @ECLASS-VARIABLE: WX_GTK_VER
+# @PRE_INHERIT
+# @REQUIRED
+# @DESCRIPTION:
+# The SLOT of the x11-libs/wxGTK you're targeting.  Needs to be defined before
+# inheriting the eclass.  Can be either "3.0" or "3.0-gtk3".
+case ${WX_GTK_VER} in
+       3.0|3.0-gtk3) ;;
+       "")           die "WX_GTK_VER not declared" ;;
+       *)            die "Invalid WX_GTK_VER: must be set to a valid wxGTK 
SLOT ('3.0' or '3.0-gtk3')" ;;
+esac
+readonly WX_GTK_VER
+
 inherit flag-o-matic
 
 case ${EAPI:-0} in
@@ -83,9 +96,6 @@ esac
 setup-wxwidgets() {
        local w wxtoolkit wxdebug wxconf
 
-       [[ -z ${WX_GTK_VER} ]] \
-               && die "WX_GTK_VER must be set before calling $FUNCNAME."
-
        case "${WX_GTK_VER}" in
                3.0-gtk3)
                        wxtoolkit=gtk3

Reply via email to