mutter: only enable desktop OpenGL when x11 is in DISTRO_FEATURES

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>
This commit is contained in:
Khem Raj
2026-09-11 22:47:21 -07:00
parent a682b34999
commit 2bf3b37303
@@ -46,7 +46,7 @@ PACKAGECONFIG ??= " \
native-backend \
egl \
gles2 \
opengl \
${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'opengl', '', d)} \
fonts \
bash-completion \
gnome-desktop \