Historically, OpenGL was provided by libGL in Mesa, which in turn only came from GLX. Therefore, if someone wanted (full) OpenGL (as opposed to GLES) from Mesa, they needed USE=X on Mesa. Since splitting libGlVnd from Mesa, OpenGL is now provided by libOpenGL, which is decoupled from GLX. Therefore, we can have OpenGL without X11 related components. Bug 560096 added IUSE=X to Mesa to enable/disable GLX, but at the same time introduced the mesa[X] dependency into virtual/opengl with 105caec6052322f095a5ee26ae097798aa9b5a9e to make sure everyone requiring OpenGL would still get it from Mesa. However, this means effectively a dependency on GLX and thereby X11, which is uneeded in many cases where the consumer works with libOpenGl instead of libGl (e.g. media-gfx/blender). I suppose that ideally, those consumers of OpenGL which explicitly require GLX (X11 related APIs from OpenGL) would express this besides their dependence on virtual/opengl (by depending on mesa[X]) while virtual/opengl should depend on media-libs/mesa only in a way that guarantees either libGL or libOpenGL (I'm not entirely sure how/if the presence of libOpenGL is controlled in Mesa, currently). Alternatively (but I think it's the worse alternative), IUSE=X could be reflected on virtual/opengl to control its dependence on mesa[X].
Something between "closely related" and "dupe of" bug 301337.
Created attachment 865594 [details, diff] Patch for opengl-7.0-r2.ebuild Allows virtual/opengl and media-libs/mesa to be built without X USE flag.
(In reply to junkmailnotread from comment #2) > Created attachment 865594 [details, diff] [details, diff] > Patch for opengl-7.0-r2.ebuild > > Allows virtual/opengl and media-libs/mesa to be built without X USE flag. It's not something that can just be changed on virtual/opengl without extra work. Some revdeps need libglvnd[X] and some others don't -- and then mesa[X] at least guarantee libglvnd is built with USE=X for now preventing anything from breaking. So if add a USE=X, would still need to check all revdeps for which ones need virtual/opengl[X] and which don't. Given little reason for this virtual nowadays, virtual/opengl is slowly getting replaced by libglvnd or libglvnd[X] (as needed) in ebuilds though.
Understood. I encountered this bug in my attempt to build a pure Wayland desktop. This patch was my path of least resistance.
OP did write up a plan at https://wiki.gentoo.org/wiki/User:ManDay/Deprecating_the_virtual_OpenGL_ebuild. Just someone has to start executing it.