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
mesa-26.2.3.tar.xz(65.4 MiB)
sha2561628058a8d2c0615975de5a15ab7bbb9638c50000b5bed9456ff423ea034a81f
upstream: https://mesa.freedesktop.org/archive/mesa-26.2.3.tar.xz
archive copy: sources-2/gpu--mesa-26.2.3.tar.xzpaste-1.0.14.tar.gz(17.7 KiB)
sha256de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c
upstream: https://crates.io/api/v1/crates/paste/1.0.14/download#/paste-1.0.14.tar.gz
archive copy: sources-2/gpu--paste-1.0.14.tar.gzproc-macro2-1.0.86.tar.gz(47.8 KiB)
sha2565e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77
upstream: https://crates.io/api/v1/crates/proc-macro2/1.0.86/download#/proc-macro2-1.0.86.tar.gz
archive copy: sources-2/gpu--proc-macro2-1.0.86.tar.gzquote-1.0.35.tar.gz(27.5 KiB)
sha256291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef
upstream: https://crates.io/api/v1/crates/quote/1.0.35/download#/quote-1.0.35.tar.gz
archive copy: sources-2/gpu--quote-1.0.35.tar.gzrustc-hash-2.1.1.tar.gz(13.8 KiB)
sha256357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d
upstream: https://crates.io/api/v1/crates/rustc-hash/2.1.1/download#/rustc-hash-2.1.1.tar.gz
archive copy: sources-2/gpu--rustc-hash-2.1.1.tar.gzsyn-2.0.87.tar.gz(271.6 KiB)
sha25625aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d
upstream: https://crates.io/api/v1/crates/syn/2.0.87/download#/syn-2.0.87.tar.gz
archive copy: sources-2/gpu--syn-2.0.87.tar.gzunicode-ident-1.0.12.tar.gz(41.2 KiB)
sha2563354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b
upstream: https://crates.io/api/v1/crates/unicode-ident/1.0.12/download#/unicode-ident-1.0.12.tar.gz
archive copy: sources-2/gpu--unicode-ident-1.0.12.tar.gz
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:
ln -sf "$SRC_ROOT/syn-2.0.87" subprojects/syn-2.0.87— The first of the blocks, one per Rust crate (syn,unicode-ident,quote,proc-macro2,paste,rustc-hash). Mesa’s meson wraps would download each crate from crates.io; the recipe fetches the crates as sources of its own, links each unpacked crate where its wrap file says the directory goes, and copies the wrap’spackagefilesoverlay (the crate’smeson.build) into it, so meson finds the subproject present and fetches nothing. The crates are for the Rust parts of Mesa, NVK’s compiler among them.LIBCLANG_PATH=/usr/lib/,LIBCLANG_STATIC_PATH=/usr/lib/— Wherebindgen, which generates NVK’s Rust bindings to the Mesa headers, finds libclang.RUST_BACKTRACE=1— Print a backtrace when a Rust build step panics, so a failure in the log says where.RUSTC="rustc -C target-feature=-crt-static"— Link Mesa’s Rust code against the shared C library. The musl target defaults tocrt-static, and NVK’s compiler and rusticl are Rust static libraries linked intolibvulkan_nouveau.so(and, in mesa-opencl,libRusticlOpenCL.so): with the default, each carries a private copy of musl, uninitialised, and every Vulkan, zink or OpenCL client that loads the driver faults in it, on a machine with no NVIDIA GPU as well. The flag goes inRUSTCand not inRUSTFLAGSbecause meson reads only the compiler command when it asksrustcwhether the target iscrt-staticand which native libraries a static library needs; given the flag inRUSTFLAGSalone, it still puts Rust’sself-containeddirectory, which holds alibc.a, on the final link line and the copy is linked in anyway.-C prefer-dynamicis not passed: withcrt-staticoff it takes effect, and meson’s sanity program then needs alibstd-*.sothe loader does not find.-D b_ndebug=true— Compile withNDEBUG, so Mesa’s assertions are off in the release build.-D opengl=true,-D gles1=disabled,-D gles2=enabled— Desktop OpenGL and OpenGL ES 2 and 3; no OpenGL ES 1.-D egl=enabled,-D gbm=enabled— EGL, which every Wayland client and the compositor draw through, and GBM, the buffer allocator the compositor and Xwayland use on a DRM device.-D glx=dri— The GLX that X11 clients under Xwayland draw with, aslibGLX_mesabehind libglvnd. It needs libXxf86vm for direct rendering.-D glvnd=enabled— Install the drivers as libglvnd vendor libraries,libEGL_mesaandlibGLX_mesa, and leavelibGL,libEGLandlibGLXto libglvnd.-D platforms=wayland,x11— The window systems EGL and Vulkan support. Wayland is the desktop; X11 is for clients under Xwayland, and its EGL and Vulkan code linkslibxcbandlibX11whether or not any X11 client runs.-D xlib-lease=enabled— Vulkan’sVK_EXT_acquire_xlib_display, which needs libXrandr. It is named because onautoit turns itself on with the X11 platform.-D llvm=enabled,-D shared-llvm=enabled— Use llvm, which llvmpipe, lavapipe and rusticl need and the AMD drivers link, and link it shared rather than statically into each driver. The llvm port installs one shared library per component and no singlelibLLVM, solibgallium, lavapipe and RADV carry aDT_NEEDEDfor each component they use (libLLVMCore.so,libLLVMAMDGPUCodeGen.soand the rest).-D gallium-drivers=zink,crocus,iris,nouveau,r300,r600,radeonsi,svga,llvmpipe,softpipe,virgl,i915— The OpenGL drivers: Intel (i915,crocus,iris, oldest to newest), NVIDIA (nouveau), AMD (r300,r600,radeonsi), VMware’s virtual GPU (svga), QEMU’s virtio GPU (virgl), OpenGL on top of a Vulkan driver (zink), and the two software renderers,llvmpipeandsoftpipe. It is the set upstream’sautopicks on x86-64, written out.-D vulkan-drivers=amd,intel,intel_hasvk,nouveau,swrast,virtio— The Vulkan drivers: RADV for AMD, ANV and the older-generationintel_hasvkfor Intel, NVK for NVIDIA, lavapipe on the CPU (swrast), and Venus for a virtual machine’s virtio GPU. It is upstream’sautoset on x86-64 with Venus added.-D vulkan-layers=device-select,intel-nullhw,overlay,anti-lag— The Vulkan layers: GPU selection on a machine with more than one, Intel’s null-hardware layer for testing, the statistics overlay, and Mesa’s implementation of AMD’sVK_AMD_anti_laglatency extension.-D gallium-extra-hud=true— Add the disk, network and CPU-frequency sources to the Gallium HUD, the overlayGALLIUM_HUDdraws over any GL client; see The overlay, which is already on every machine.-D lmsensors=enabled— Let the HUD show temperatures and other readings from lm-sensors.-D xmlconfig=enabled,-D expat=enabled— Read driconf files (/usr/share/drirc.d,/etc/drirc,~/.drirc) with expat, so options such asvblank_modecan be set per application. Disabled, Mesa compiles its default driconf in.-D gallium-rusticl=false— No OpenCL. rusticl linkslibclang-cppand reads libclc’s kernels at run time, which would put more than a gigabyte of clang on the installation medium beside Mesa; mesa-opencl builds it instead.-D spirv-tools=enabled— Link spirv-tools, which the OpenCL C path requires and which also dumps SPIR-V for debugging.-D video-codecs=all— Build hardware video decoding and encoding for every codec Mesa knows, including the patent-encumbered H.264, H.265 and VC-1 that upstream’s default,all_free, leaves out. It applies to both VA-API and Vulkan Video.-D gallium-va=enabled— The VA-API driver for the Gallium GPUs upstream supports it on (radeonsi,r600,nouveau,virgl), loaded through libva.-D display-info=enabled— Parse a display’s EDID with libdisplay-info.-D zstd=enabled— Use zstd instead of zlib where Mesa compresses, the on-disk shader cache among them.-D intel-rt=enabled— Vulkan ray tracing on Intel GPUs that support it.-D libunwind=disabled— No libunwind, which Mesa uses only for the stack traces it prints when debugging.-D valgrind=disabled— No Valgrind client requests compiled into the drivers.
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.