diff mbox series

[meta-gnome,3/7] mutter: only enable desktop OpenGL when x11 is in DISTRO_FEATURES

Message ID 20260911141756.2275517-3-khem.raj@oss.qualcomm.com
State New
Headers show
Series [meta-oe,1/7] bit7z: Fix build with clang | expand

Commit Message

Khem Raj Sept. 11, 2026, 2:17 p.m. UTC
mutter fails to configure on a wayland-only distro configuration:

  Run-time dependency gl found: NO  (tried pkg-config and system)
  ../sources/mutter-50.4/meson.build:191:11: ERROR: Dependency "gl" not found (tried pkg-config and system)

The recipe enabled the opengl PACKAGECONFIG unconditionally, which
passes -Dopengl=true and makes meson require desktop OpenGL:

  have_gl = get_option('opengl')
  if have_gl
    gl_dep = dependency('gl')

Desktop GL is not available here. libGL.so and gl.pc are products of
mesa's GLX library - see FILES:libgl-mesa-dev in mesa.inc - and mesa
only builds GLX when its x11 PACKAGECONFIG is on, since
PACKAGECONFIG[x11] passes -Dglx=disabled when it is off. Without x11 in
DISTRO_FEATURES mesa is therefore configured -Dopengl=true -Dglx=disabled
-Dplatforms='wayland' and stages only egl.pc, glesv1_cm.pc and
glesv2.pc, with no libGL and no gl.pc.

The dependency looked satisfied because mesa PROVIDES virtual/libgl
unconditionally, so the virtual/libgl entry in PACKAGECONFIG[opengl]
resolves at the bitbake level even though nothing ever lands in the
sysroot. mesa also installs the GL/*.h headers regardless of GLX, so
meson's 'system' fallback clears the header probe before failing on the
missing library.

mutter builds fine against GLESv2 alone - it only errors out if neither
GL nor GLES2 is enabled - and egl plus gles2 are already enabled here,
which is the usual configuration for a wayland-only compositor. Gate
opengl on x11 so it follows the same condition that decides whether
desktop GL exists at all; x11 builds are unaffected.

AI-Generated: Uses Claude Code
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta-gnome/recipes-gnome/mutter/mutter_50.4.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/meta-gnome/recipes-gnome/mutter/mutter_50.4.bb b/meta-gnome/recipes-gnome/mutter/mutter_50.4.bb
index 91ba3f5489..f9b3e9d5e5 100644
--- a/meta-gnome/recipes-gnome/mutter/mutter_50.4.bb
+++ b/meta-gnome/recipes-gnome/mutter/mutter_50.4.bb
@@ -46,7 +46,7 @@  PACKAGECONFIG ??= " \
     native-backend \
     egl \
     gles2 \
-    opengl \
+    ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'opengl', '', d)} \
     fonts \
     bash-completion \
     gnome-desktop \