ports: Split mesa into two packages: osmesa, glx

Now SDL and other stuff that use opengl dont have to pull X11 libraries

We now also compile glx backend with DRI instead of xlib. This allows
building EGL support as well!
This commit is contained in:
2026-07-05 14:05:14 +03:00
parent e78fcf63b6
commit 97d26b5d4e
5 changed files with 67 additions and 8 deletions

View File

@@ -3,11 +3,11 @@
NAME='libepoxy'
VERSION='1.5.10'
DOWNLOAD_URL="https://download.gnome.org/sources/libepoxy/1.5/libepoxy-$VERSION.tar.xz#072cda4b59dd098bba8c2363a6247299db1fa89411dc221c8b81b8ee8192e623"
DEPENDENCIES=('mesa' 'libX11')
DEPENDENCIES=('mesa-glx' 'libX11')
CONFIGURE_OPTIONS=(
'-Dprefix=/usr'
'-Dbuildtype=release'
'-Dtests=false'
'-Degl=no'
)
configure() {

4
ports/mesa-glx/build.sh Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/bash
export MESA_VARIANT='glx'
exec ../mesa/build.sh

View File

@@ -0,0 +1 @@
../../mesa/patches/0002-add-support-for-banan-os.patch

View File

@@ -0,0 +1,41 @@
diff -ruN mesa-26.1.4/meson.build mesa-26.1.4-banan_os/meson.build
--- mesa-26.1.4/meson.build 2026-07-01 17:16:13.000000000 +0300
+++ mesa-26.1.4-banan_os/meson.build 2026-07-05 12:36:39.810545892 +0300
@@ -156,7 +156,7 @@
with_any_opengl = with_opengl or with_gles1 or with_gles2
-system_has_kms_drm = ['openbsd', 'netbsd', 'freebsd', 'gnu/kfreebsd', 'dragonfly', 'linux', 'sunos', 'android', 'managarm'].contains(host_machine.system())
+system_has_kms_drm = ['openbsd', 'netbsd', 'freebsd', 'gnu/kfreebsd', 'dragonfly', 'linux', 'sunos', 'android', 'managarm', 'banan_os'].contains(host_machine.system())
gallium_drivers = get_option('gallium-drivers')
if gallium_drivers.contains('auto')
diff -ruN mesa-26.1.4/src/gallium/frontends/dri/drisw.c mesa-26.1.4-banan_os/src/gallium/frontends/dri/drisw.c
--- mesa-26.1.4/src/gallium/frontends/dri/drisw.c 2026-07-01 17:16:13.000000000 +0300
+++ mesa-26.1.4-banan_os/src/gallium/frontends/dri/drisw.c 2026-07-05 12:36:40.392717334 +0300
@@ -43,12 +43,12 @@
#include "dri_helpers.h"
#include "dri_query_renderer.h"
-#include "util/libsync.h"
-
#ifdef HAVE_LIBDRM
#include <xf86drm.h>
#endif
+#include "util/libsync.h"
+
DEBUG_GET_ONCE_BOOL_OPTION(swrast_no_present, "SWRAST_NO_PRESENT", false);
static inline void
diff -ruN mesa-26.1.4/src/glx/drisw_glx.c mesa-26.1.4-banan_os/src/glx/drisw_glx.c
--- mesa-26.1.4/src/glx/drisw_glx.c 2026-07-01 17:16:13.000000000 +0300
+++ mesa-26.1.4-banan_os/src/glx/drisw_glx.c 2026-07-05 12:36:40.748941796 +0300
@@ -23,6 +23,7 @@
#if defined(GLX_DIRECT_RENDERING) && (!defined(GLX_USE_APPLEGL) || defined(GLX_USE_APPLE))
+#include <stddef.h>
#include <xcb/xcb.h>
#include <xcb/xproto.h>
#include <xcb/shm.h>

View File

@@ -3,17 +3,30 @@
NAME='mesa'
VERSION='26.1.4'
DOWNLOAD_URL="https://archive.mesa3d.org/mesa-$VERSION.tar.xz#072705caa9adf4740f1489194b13e278ad959166863b5271fe423a86353c9ab6"
DEPENDENCIES=('zlib' 'zstd' 'expat' 'libX11' 'libXext')
TAR_CONTENT="mesa-$VERSION"
DEPENDENCIES=('zlib' 'zstd' 'expat')
CONFIGURE_OPTIONS=(
'-Dprefix=/usr'
'-Dosmesa=true'
'-Dvulkan-drivers=[]'
'-Dgallium-drivers=llvmpipe'
'-Dplatforms=x11'
'-Dglx=xlib'
'-Dbuildtype=release'
'-Dvulkan-drivers='
'-Dgallium-drivers=llvmpipe'
)
if [[ "$MESA_VARIANT" == "glx" ]]; then
NAME='mesa-glx'
DEPENDENCIES+=('libX11' 'libXext' 'libXfixes' 'libxshmfence' 'libXxf86vm' 'libXrandr' 'libdrm')
CONFIGURE_OPTIONS+=(
'-Dplatforms=x11'
'-Dglx=dri'
)
else
CONFIGURE_OPTIONS+=(
'-Dplatforms='
'-Dglx=disabled'
'-Dosmesa=true'
)
fi
pre_configure() {
llvm_version='22.1.8'
llvm_dir_name="llvm-banan_os-$llvm_version-$BANAN_ARCH"