In my case, with_dri is true because: with_dri = dri_drivers.length() != 0 In turn, the reason is that the ebuild specifies -Ddri-drivers=swrast. However, it can also be set to true in this way: if with_gallium and system_has_kms_drm _glx = get_option('glx') _egl = get_option('egl') if _glx == 'dri' or _egl == 'enabled' or (_glx == 'disabled' and _egl != 'disabled') with_dri = true endif endif Breaking it down: with_gallium = true if -Dgallium-drivers is non-empty * for that to happen, the ebuild must have called gallium_enable() * and for that to happen, USE="gallium" must have been set; hence isolatable system_has_kms_drm = always true for linux _glx = "dri" if USE="X" (otherwise "disabled") _egl = "enabled" if USE="egl" (otherwise "disabled") Later, the check that raises the error happens: if with_dri if with_glx == 'disabled' and not with_egl and not with_gbm and with_osmesa != 'classic' error('building dri drivers require at least one windowing system or classic osmesa') endif endif with_glx = "disabled" because the ebuild specified -Dglx=disabled * in turn, that is because of USE="-X" with_gbm = "disabled" because the ebuild specified -Dgbm=disabled * in turn, that is because of USE="-gbm" with_osmesa = "none" because the ebuild specified -Dosmesa=none * in turn, that is because of USE="-gallium -classic" * In other words, USE="classic" would work around the problem * However, USE="classic" doesn't affect -Dosmesa unless USE="osmesa" also It looks as though DRI_DRIVERS is never empty in the ebuild. One potential solution (probably incomplete) is: || ( X classic egl gbm osmesa ) classic? ( || ( X egl gbm osmesa ) ) osmesa? ( || ( X classic egl gbm ) ) Alternatively: || ( X classic egl gbm osmesa ) classic? ( !osmesa? ( || ( X egl gbm ) ) ) osmesa? ( !classic? ( || ( X egl gbm ) ) ) There is another snag, which is that, if neither USE="X" nor USE="wayland" is in effect, the ebuild doesn't pass -Dplatforms at all. In that case, the build system infers that both x11 and wayland should be targetted, leading to this error: Build-time dependency wayland-scanner found: NO (tried pkgconfig and cmake) That much is easy to solve. Simply have the ebuild append -Dplatforms to emesonargs, unconditionally. For it not to specify a platform at all is tolerated by the build system. Alas, doing so reveals another QA issue. Testing with USE="classic osmesa", the build actually concludes successfully, which is good. However, mesa then produces some files that can also be provided by libglvnd, leading to a conflict. Specifically: /usr/include/GL/gl.h /usr/include/GL/glcorearb.h /usr/include/GL/glext.h /usr/include/KHR/khrplatform.h Once the appropriate solution/constraint is applied in view if this problem, an overall solution may be close at hand. Also, I should take a closer look at how USE="gallium" may need to factor into it, if at all.