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

193.1. libdrm-2.4.134

Provides a user space library for accessing the DRM, direct rendering manager, on operating systems that support the ioctl interface

Version 2.4.134, 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), 1 of 189 in build order
Licence MIT
Homepage https://gitlab.freedesktop.org/mesa/drm
Build time 0.1 SBU
Installed size 1.4 MiB in 77 files
Recipe ports/core/gpu/libdrm/kpkgbuild

About

libdrm is the user-space side of the kernel’s Direct Rendering Manager: libdrm wraps the DRM and KMS ioctls (devices, connectors, modes, planes, buffers), and one library per GPU family wraps that driver’s own command-submission and memory ioctls. Mesa’s drivers, KWin’s DRM backend, VA-API, Xwayland and every program that opens /dev/dri sit on it. This build keeps the driver libraries for PC hardware and none of the ARM SoC ones.

Sources

Dependencies

Depends on: libpciaccess, meson, python3-docutils.

Required by (41): chromium, ddcutil, fastfetch, ffmpeg, firefox-esr, fwupd, glmark2, gst-plugins-bad, gst-plugins-base, gtk4, intel-media-driver, kinfocenter, kodi, kpipewire, kwin, libcamera, libksysguard, librewolf, libva, libva-intel-driver, libva-utils, mesa, mesa-demos, mesa-opencl, mpv, nvtop, obs-studio, qt5-qtwayland, qt6-qtbase, qt6-qtwayland, qt6-qtwebengine, retroarch, sdl3, swayimg, switcheroo-control, thunderbird, wayland-utils, webkitgtk, webkitgtk6, wlvncc, xwayland.

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 libdrm'

What kpkg does

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

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/libdrm
echo 'ac5e74d157830eb8bee44c6a6bf3ad49774ef0dd2a72bdad74a8f20308b52a95  libdrm-2.4.134.tar.xz' | 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/libdrm
SRC=$SRC_ROOT/libdrm-2.4.134
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf libdrm-2.4.134.tar.xz -C "$SRC" --strip-components=1

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 five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:

meson setup build --buildtype=release \
	--prefix=/usr --sysconfdir=/etc --libdir=lib \
	-D man-pages=enabled \
	-D valgrind=disabled \
	-D cairo-tests=disabled \
	-D intel=enabled \
	-D amdgpu=enabled \
	-D radeon=enabled \
	-D nouveau=enabled \
	-D vmwgfx=enabled \
	-D install-test-programs=true
meson compile -C build
DESTDIR=$PKG meson install --no-rebuild -C build

install -Dm644 "$SRC/xf86drm.h" "$PKG/usr/share/licenses/$name/xf86drm.h"

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/libdrm, 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 libdrm-2.4.134-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/libdrm, and runs the triggers its paths call for.

Contents

Installed programs: amdgpu_stress, drmdevice, modeprint, modetest, proptest, vbltest.

Installed libraries: libdrm.so, libdrm_amdgpu.so, libdrm_intel.so, libdrm_nouveau.so, libdrm_radeon.so.

Installed directories: /usr/include/libdrm, /usr/share/libdrm, /usr/share/licenses/libdrm.

Short descriptions

libdrm.pc Userspace interface to kernel DRM services
libdrm_amdgpu.pc Userspace interface to kernel DRM services for amdgpu
libdrm_intel.pc Userspace interface to intel kernel DRM services
libdrm_nouveau.pc Userspace interface to nouveau kernel DRM services
libdrm_radeon.pc Userspace interface to kernel DRM services for radeon