--with-gallium-drivers=$(subst $(space),$(comma),$(MESA3D_GALLIUM_DRIVERS-y))
endif
+define MESA3D_REMOVE_OPENGL_PC
+ rm -f $(STAGING_DIR)/usr/lib/pkgconfig/dri.pc
+ rm -f $(STAGING_DIR)/usr/lib/pkgconfig/gl.pc
+ rm -rf $(STAGING_DIR)/usr/include/GL/
+endef
+
ifeq ($(BR2_PACKAGE_MESA3D_DRI_DRIVER),)
MESA3D_CONF_OPTS += \
--without-dri-drivers --without-dri --disable-dri3
+MESA3D_POST_INSTALL_STAGING_HOOKS += MESA3D_REMOVE_OPENGL_PC
else
ifeq ($(BR2_PACKAGE_XPROTO_DRI3PROTO),y)
MESA3D_DEPENDENCIES += xlib_libxshmfence xproto_dri3proto xproto_presentproto
# Always enable OpenGL:
# - it is needed for GLES (mesa3d's ./configure is a bit weird)
-# - but if no DRI driver is enabled, then libgl is not built
+# - but if no DRI driver is enabled, then libgl is not built,
+# remove dri.pc and gl.pc in this case (MESA3D_REMOVE_OPENGL_PC)
MESA3D_CONF_OPTS += --enable-opengl
ifeq ($(BR2_PACKAGE_MESA3D_OPENGL_EGL),y)