Skip to the text
KDOS
Menu
kdos.dev KDOS from Scratch KDOS 0.2 · 4dd4a10 · 2026-11-30 Contents Index

193.4. mesa-26.2.3

OpenGL compatible 3D graphics library: EGL and Vulkan for Wayland, GLX for X11 clients under Xwayland

Version 26.2.3, release 1
Shelf gpu — The GPU stack: Mesa, DRM, GL and Vulkan loaders and headers, shader compilers, VA-API, OpenCL
Phase 42_graphics (Graphics Stack), 11 of 189 in build order
Licence MIT
Homepage https://mesa3d.org/
Build time 28.4 SBU
Installed size 149.7 MiB in 115 files
Recipe ports/core/gpu/mesa/kpkgbuild

About

Mesa is the graphics driver stack: the OpenGL, OpenGL ES, EGL, GBM and Vulkan drivers for every GPU family the image supports, the software renderers that stand in when there is none and a VA-API video driver. Mesa’s OpenCL implementation, rusticl, is the separate port mesa-opencl, built from the same source. On KDOS the port that leans on it hardest is KWin: the compositor draws through EGL and OpenGL ES from here, and on a machine with only software rendering, such as a virtual machine with plain graphics, Phosphor mode’s effect stays off.

Mesa is built behind libglvnd, which owns libGL, libEGL and libGLX and dispatches to Mesa’s libEGL_mesa and libGLX_mesa. It is built for Wayland and for X11 alike: there is no X server on the login path, but X11 clients run under Xwayland and draw through Mesa’s GLX; see No Xorg server, and one carve-out and Desktop GL and GLX.

Every probed dependency that has a switch is named on or off, so the set of drivers and features does not depend on what happens to be installed when Mesa builds. Some probes have no switch: libudev, xcb-keysyms and libelf are linked whenever they are found, which is why eudev, xcb-util-keysyms and elfutils are in depends. Without libelf the build stops, because radeonsi and NVK require it.

Sources

Dependencies

Depends on: llvm, python3-mako, elfutils, bison, flex, libdrm, libglvnd, glslang, expat, rust, bindgen, python3-yaml, spirv-llvm-translator, cbindgen, wayland, wayland-protocols, zlib, zstd, spirv-tools, clang, libva, libdisplay-info, lm-sensors, eudev, libX11, libxcb, libXext, libXxf86vm, libXrandr, libxshmfence, xorgproto, xcb-util-keysyms.

Required by (112): amiberry, avidemux, avogadrolibs, blender, candle2, chromium, coin, crawl-tiles, cubicsdr, ddnet, digikam, dosbox-staging, dosbox-x, dsda-doom, endless-sky, firefox-esr, fltk, freecad, freeglut, frei0r-plugins, furnace, gl2ps, glew, glfw, glmark2, gmsh, goxel, gst-plugins-base, imhex, imv, inlyne, ioquake3, ironwail, kicad, kodi, kpipewire, ksudoku, kubrick, kwayland, kwin, libepoxy, libreoffice, librepcb, libretro-beetle-psx, libretro-melonds, libretro-mupen64plus-next, librewolf, limesuite-gui, linuxcnc, luanti, mesa-demos, mesa-opencl, mgba, movit, mpv, mupdf, mupen64plus, neverball, obs-studio, octave, opencascade, opencolorio, opencpn, opencsg, openmsx, openrct2, openscad, opensubdiv, openttd, orcaslicer, pioneer, ppsspp, prusaslicer, python3-kivy, python3-opengl, qcad, qemu, qt5-qtbase, qt5-qtmultimedia, qt5-qtwayland, qt6-qtbase, qt6-qtmultimedia, qt6-qtwayland, qt6-qtwebengine, qv4l2, retroarch, satdump, sauerbraten, scummvm, sdl3, sdrangel, sdrpp, sniffnet, solvespace, soqt, srb2, supertux, supertuxkart, surfer, thunderbird, vlc, vtk, waylandpp, waypipe, webkitgtk, webkitgtk6, widelands, wine, wlvncc, wxwidgets, xwayland, yamagi-quake2.

Installation

From the repository root, inside the build container, this is the line kdosbuild runs for the port:

script/chroot/exec.sh bash -c 'source script/phases/42_graphics/phase.env && kpkg install mesa'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/gpu/mesa.

1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.

cd /ports/core/gpu/mesa
echo '1628058a8d2c0615975de5a15ab7bbb9638c50000b5bed9456ff423ea034a81f  mesa-26.2.3.tar.xz' | sha256sum -c -
echo 'de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c  paste-1.0.14.tar.gz' | sha256sum -c -
echo '5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77  proc-macro2-1.0.86.tar.gz' | sha256sum -c -
echo '291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef  quote-1.0.35.tar.gz' | sha256sum -c -
echo '357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d  rustc-hash-2.1.1.tar.gz' | sha256sum -c -
echo '25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d  syn-2.0.87.tar.gz' | sha256sum -c -
echo '3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b  unicode-ident-1.0.12.tar.gz' | sha256sum -c -

2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.

SRC_ROOT=/var/cache/kpkg/work/mesa
SRC=$SRC_ROOT/mesa-26.2.3
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf mesa-26.2.3.tar.xz -C "$SRC" --strip-components=1
tar --no-same-permissions --warning=no-unknown-keyword -xf syn-2.0.87.tar.gz -C "$SRC_ROOT"
tar --no-same-permissions --warning=no-unknown-keyword -xf unicode-ident-1.0.12.tar.gz -C "$SRC_ROOT"
tar --no-same-permissions --warning=no-unknown-keyword -xf quote-1.0.35.tar.gz -C "$SRC_ROOT"
tar --no-same-permissions --warning=no-unknown-keyword -xf proc-macro2-1.0.86.tar.gz -C "$SRC_ROOT"
tar --no-same-permissions --warning=no-unknown-keyword -xf paste-1.0.14.tar.gz -C "$SRC_ROOT"
tar --no-same-permissions --warning=no-unknown-keyword -xf rustc-hash-2.1.1.tar.gz -C "$SRC_ROOT"

Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.

3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the recipe’s helpers group and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:

ln -sf "$SRC_ROOT/syn-2.0.87" subprojects/syn-2.0.87
cp -r subprojects/packagefiles/syn-2-rs/* subprojects/syn-2.0.87/

ln -sf "$SRC_ROOT/unicode-ident-1.0.12" subprojects/unicode-ident-1.0.12
cp -r subprojects/packagefiles/unicode-ident-1-rs/* subprojects/unicode-ident-1.0.12/

ln -sf "$SRC_ROOT/quote-1.0.35" subprojects/quote-1.0.35
cp -r subprojects/packagefiles/quote-1-rs/* subprojects/quote-1.0.35/

ln -sf "$SRC_ROOT/proc-macro2-1.0.86" subprojects/proc-macro2-1.0.86
cp -r subprojects/packagefiles/proc-macro2-1-rs/* subprojects/proc-macro2-1.0.86/

ln -sf "$SRC_ROOT/paste-1.0.14" subprojects/paste-1.0.14
cp -r subprojects/packagefiles/paste-1-rs/* subprojects/paste-1.0.14/

ln -sf "$SRC_ROOT/rustc-hash-2.1.1" subprojects/rustc-hash-2.1.1
cp -r subprojects/packagefiles/rustc-hash-2-rs/* subprojects/rustc-hash-2.1.1/

export LIBCLANG_PATH=/usr/lib/
export LIBCLANG_STATIC_PATH=/usr/lib/
export RUST_BACKTRACE=1
export RUSTC="rustc -C target-feature=-crt-static"

meson setup build \
	--prefix=/usr --libdir=lib --sysconfdir=/etc \
	--buildtype=release \
	-D b_ndebug=true \
	-D opengl=true \
	-D gallium-extra-hud=true \
	-D xmlconfig=enabled \
	-D expat=enabled \
	-D egl=enabled \
	-D llvm=enabled \
	-D shared-llvm=enabled \
	-D gbm=enabled \
	-D gles1=disabled \
	-D gles2=enabled \
	-D glx=dri \
	-D gallium-drivers=zink,crocus,iris,nouveau,r300,r600,radeonsi,svga,llvmpipe,softpipe,virgl,i915 \
	-D gallium-rusticl=false \
	-D platforms=wayland,x11 \
	-D xlib-lease=enabled \
	-D vulkan-drivers=amd,intel,intel_hasvk,nouveau,swrast,virtio \
	-D vulkan-layers=device-select,intel-nullhw,overlay,anti-lag \
	-D video-codecs=all \
	-D gallium-va=enabled \
	-D display-info=enabled \
	-D lmsensors=enabled \
	-D zstd=enabled \
	-D spirv-tools=enabled \
	-D intel-rt=enabled \
	-D libunwind=disabled \
	-D valgrind=disabled \
	-D glvnd=enabled

meson compile -C build
DESTDIR=$PKG meson install --no-rebuild -C build

for so in $(find "$PKG/usr/lib" -type f -name '*.so*'); do
	if readelf -Ws "$so" | awk '$5 == "LOCAL" && ($8 == "__libc" || $8 == "__libc_malloc_impl" || $8 == "__stdio_write") { f = 1 } END { exit !f }'; then
		echo "mesa: ${so#$PKG} carries a private copy of the C library" >&2
		exit 1
	fi
done

The switches, and why each is set:

The common switches of each build system are explained in the Flag glossary.

4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/mesa, prunes what the image does not ship, lints the tree and rolls it reproducibly:

tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
    --mtime=@$SOURCE_DATE_EPOCH \
    --use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
    -cf mesa-26.2.3-1.tar.xz -C "$PKG" .

5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/mesa, and runs the triggers its paths call for.

Contents

Installed programs: mesa-overlay-control.py.

Installed libraries: libEGL_mesa.so, libGLX_mesa.so, libVkLayer_INTEL_nullhw.so, libVkLayer_MESA_anti_lag.so, libVkLayer_MESA_device_select.so, libVkLayer_MESA_overlay.so, libgallium-26.2.3.so, libgbm.so, libvulkan_intel.so, libvulkan_intel_hasvk.so, libvulkan_lvp.so, libvulkan_nouveau.so, libvulkan_radeon.so, libvulkan_virtio.so.

Installed directories: /usr/lib/gbm, /usr/share/drirc.d, /usr/share/glvnd, /usr/share/licenses/mesa, /usr/share/vulkan/explicit_layer.d, /usr/share/vulkan/icd.d, /usr/share/vulkan/implicit_layer.d.

Short descriptions

dri.pc Direct Rendering Infrastructure
gbm.pc Mesa gbm library

Notes

After the install, the recipe reads the symbol table of every shared library in the package and fails the build if one defines musl’s __libc, __libc_malloc_impl or __stdio_write as a local symbol, the mark of a private C library. It runs before the packager strips the symbol table of every file over 32 MiB, after which no check of the installed tree can see the copy in one.

The crate blocks have to match the wrap files of the Mesa version being built. A bump that moves a crate’s version changes the wrap’s directory, and a block left at the old name leaves meson wanting a download the build cannot make; the crate’s source and sha256 lines in the recipe move with it.

The Intel drivers (iris, crocus, ANV, intel_hasvk) and NVK carry compute kernels written in OpenCL C, which Mesa compiles at build time with its own mesa_clc through clang, spirv-llvm-translator and spirv-tools; the drivers link none of them, so they are build dependencies only and ports/buildonly keeps clang and the translator off the installation medium. The kernels need no libclc: only rusticl reads it.