EGL is the only available OpenGL support on Wayland, so add the egl USE
flag and do not add --disable-glcanvasegl to configure args if it is
enabled.

Explain the rationale for GLX being the default and the egl USE flag, as
well as the upstream issue link to improve the situation in the ebuild
comments.

PR: https://github.com/gentoo/gentoo/pull/32452

Signed-off-by: Rafael Kitover <rkito...@gmail.com>
---
 x11-libs/wxGTK/wxGTK-3.2.2.1-r3.ebuild | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/x11-libs/wxGTK/wxGTK-3.2.2.1-r3.ebuild 
b/x11-libs/wxGTK/wxGTK-3.2.2.1-r3.ebuild
index 1411650e6df9..b6d95a3df4a5 100644
--- a/x11-libs/wxGTK/wxGTK-3.2.2.1-r3.ebuild
+++ b/x11-libs/wxGTK/wxGTK-3.2.2.1-r3.ebuild
@@ -21,7 +21,7 @@ S="${WORKDIR}/wxWidgets-${PV}"
 LICENSE="wxWinLL-3 GPL-2 doc? ( wxWinFDL-3 )"
 SLOT="${WXRELEASE}"
 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~mips ~ppc ~ppc64 
~riscv ~sparc ~x86 ~amd64-linux ~x86-linux"
-IUSE="+X curl doc debug keyring gstreamer libnotify +lzma opengl pch sdl 
+spell test tiff wayland webkit"
+IUSE="+X curl doc debug keyring gstreamer libnotify +lzma opengl egl pch sdl 
+spell test tiff wayland webkit"
 REQUIRED_USE="test? ( tiff ) tiff? ( X ) spell? ( X ) keyring? ( X )"
 RESTRICT="!test? ( test )"
 
@@ -146,8 +146,19 @@ multilib_src_configure() {
                --libdir='${prefix}'/$(get_libdir)
        )
 
-       # Switch to wxGLCanvas GLX instead of EGL, resolves many OpenGL issues.
-       myeconfargs+=( "--disable-glcanvasegl" )
+       # By default, we now build with the GLX GLCanvas because some software 
like
+       # PrusaSlicer does not yet support EGL.  However, under Wayland EGL is 
the
+       # only working OpenGL implementation, so we allow the user to specify 
the
+       # egl USE flag to override this behavior and not disable the EGL 
GLCanvas.
+       #
+       # Upstream issue to improve this situation by instantiating the GLX
+       # GLCanvas under X11 dynamically:
+       #
+       # https://github.com/wxWidgets/wxWidgets/issues/23833
+       #
+       if ! use egl; then
+               myeconfargs+=( "--disable-glcanvasegl" )
+       fi
 
        # debug in >=2.9
        # there is no longer separate debug libraries (gtk2ud)
-- 
2.42.0


Reply via email to