defpkgbuild(mesa, #:pkgname, ["mesa", "mesa-gallium-sdk"], #:pkgver, "24.2.8", #:pkgrel, 1, #:pkgdesc, "Mesa EGL, GLES, GBM and Gallium for the Vinix desktop", #:arch, [#:x86-64, #:aarch64], #:url, "https://www.mesa3d.org/", #:license, "MIT AND SGI-B-2.0 AND BSD-3-Clause", #:depends, ["mesa-platform-headers", "mesa-glx-legacy", "llvm19-libs", "musl", "gcc-libs", "libdrm", "libelf", "libx11", "libxcb", "libxshmfence", "wayland", "expat", "zlib", "zstd"], #:makedepends, ["llvm19-dev", "linux-headers", "wayland-protocols", "xorgproto", "libxext", "libxfixes", "libxrandr", "libxxf86vm"], #:source, ["https://archive.mesa3d.org/mesa-24.2.8.tar.xz", "https://raw.githubusercontent.com/alpinelinux/aports/a7de3e63cc8015474a4feadd8bb7c0ecc097b1fa/main/mesa/29401.patch", "https://raw.githubusercontent.com/alpinelinux/aports/a7de3e63cc8015474a4feadd8bb7c0ecc097b1fa/main/mesa/23630.patch", "https://raw.githubusercontent.com/alpinelinux/aports/a7de3e63cc8015474a4feadd8bb7c0ecc097b1fa/main/mesa/riscv64-tls.patch", "nouveau-atomic-refcount.patch"], #:sha256sums, ["999d0a854f43864fc098266aaf25600ce7961318a1e2e358bff94a7f53580e30", "2975b35c7cc0c66074bc38b906863c9b5da90718b2c7764f78b6486466f15061", "9f29a0cebfebdc8f9aab2452b86b289f863d128f67e197fcb5ad5a886c74dfc1", "57cb89d086c4c3c0e4fbac3f84ab7409ac13df2a7c540f677d87c1ee8676076f", "7dbd1aa85acb5e818964fb44baf69bff1c3f065dee4141c8010d7975856d8438"], #:prepare, fn() { for-each(fn(file) { run("patch", "--batch", "-d", "mesa-24.2.8", "-p1", "-i", string-append("../", file)) }, list("29401.patch", "23630.patch", "riscv64-tls.patch")) ; The bootstrap compiler and target libc can use different fast integer widths. run("patch", "--batch", "--fuzz=0", "-d", "mesa-24.2.8", "-p1", "-i", "../nouveau-atomic-refcount.patch") }, #:build, fn() { run("vinix-mesa", "current", "mesa-24.2.8", "build") run("vinix-ninja", "build", "src/nouveau/winsys/libnouveau_ws.a.p/nouveau_bo.c.o") run("vinix-ninja", "build", "all") }, #:check, fn() { for-each(fn(file) { run("readelf", "-d", string-append("build/", file)) }, list("src/egl/libEGL.so", "src/gbm/libgbm.so", "src/gallium/targets/dri/libgallium-24.2.8.so", "src/gallium/targets/osmesa/libOSMesa.so", "src/gallium/targets/xa/libxatracker.so")) }, #:package, fn() { stage := string-append(srcdir(), "/mesa-install") staged := string-append(srcdir(), "/mesa-install-complete") if not(file-exists?(staged)) { run("meson", "install", "--no-rebuild", "-C", "build", "--destdir", stage) run("touch", staged) } name := get-environment-variable("VPAC_PKGNAME") profile := if string=?("mesa-gallium-sdk", name) { "sdk" } else { "current" } run("vinix-mesa", "package", profile, stage, pkgdir()) if string=?("mesa", name) { ; The release includes this header while omitting the off-screen renderer DSO. run("install", "-Dm644", "mesa-24.2.8/include/GL/osmesa.h", string-append(pkgdir(), "/usr/include/GL/osmesa.h")) } run("install", "-Dm644", "mesa-24.2.8/docs/license.rst", string-append(pkgdir(), "/usr/share/licenses/", name, "/license.rst")) })