vinix-ports / ports / mesa / PKGBUILD.vile
53 lines · 53 sloc · 3.24 KB · 88e2574c64378f1baadbaa2c9ba482f05daf97ea
Raw
1defpkgbuild(mesa,
2 #:pkgname, ["mesa", "mesa-gallium-sdk"],
3 #:pkgver, "24.2.8",
4 #:pkgrel, 1,
5 #:pkgdesc, "Mesa EGL, GLES, GBM and Gallium for the Vinix desktop",
6 #:arch, [#:x86-64, #:aarch64],
7 #:url, "https://www.mesa3d.org/",
8 #:license, "MIT AND SGI-B-2.0 AND BSD-3-Clause",
9 #:depends, ["mesa-platform-headers", "mesa-glx-legacy", "llvm19-libs", "musl", "gcc-libs", "libdrm", "libelf", "libx11", "libxcb", "libxshmfence", "wayland", "expat", "zlib", "zstd"],
10 #:makedepends, ["llvm19-dev", "linux-headers", "wayland-protocols", "xorgproto", "libxext", "libxfixes", "libxrandr", "libxxf86vm"],
11 #:source, ["https://archive.mesa3d.org/mesa-24.2.8.tar.xz",
12 "https://raw.githubusercontent.com/alpinelinux/aports/a7de3e63cc8015474a4feadd8bb7c0ecc097b1fa/main/mesa/29401.patch",
13 "https://raw.githubusercontent.com/alpinelinux/aports/a7de3e63cc8015474a4feadd8bb7c0ecc097b1fa/main/mesa/23630.patch",
14 "https://raw.githubusercontent.com/alpinelinux/aports/a7de3e63cc8015474a4feadd8bb7c0ecc097b1fa/main/mesa/riscv64-tls.patch",
15 "nouveau-atomic-refcount.patch"],
16 #:sha256sums, ["999d0a854f43864fc098266aaf25600ce7961318a1e2e358bff94a7f53580e30",
17 "2975b35c7cc0c66074bc38b906863c9b5da90718b2c7764f78b6486466f15061",
18 "9f29a0cebfebdc8f9aab2452b86b289f863d128f67e197fcb5ad5a886c74dfc1",
19 "57cb89d086c4c3c0e4fbac3f84ab7409ac13df2a7c540f677d87c1ee8676076f",
20 "7dbd1aa85acb5e818964fb44baf69bff1c3f065dee4141c8010d7975856d8438"],
21 #:prepare, fn() {
22 for-each(fn(file) {
23 run("patch", "--batch", "-d", "mesa-24.2.8", "-p1", "-i", string-append("../", file))
24 }, list("29401.patch", "23630.patch", "riscv64-tls.patch"))
25 ; The bootstrap compiler and target libc can use different fast integer widths.
26 run("patch", "--batch", "--fuzz=0", "-d", "mesa-24.2.8", "-p1", "-i", "../nouveau-atomic-refcount.patch")
27 },
28 #:build, fn() {
29 run("vinix-mesa", "current", "mesa-24.2.8", "build")
30 run("vinix-ninja", "build", "src/nouveau/winsys/libnouveau_ws.a.p/nouveau_bo.c.o")
31 run("vinix-ninja", "build", "all")
32 },
33 #:check, fn() {
34 for-each(fn(file) { run("readelf", "-d", string-append("build/", file)) },
35 list("src/egl/libEGL.so", "src/gbm/libgbm.so", "src/gallium/targets/dri/libgallium-24.2.8.so",
36 "src/gallium/targets/osmesa/libOSMesa.so", "src/gallium/targets/xa/libxatracker.so"))
37 },
38 #:package, fn() {
39 stage := string-append(srcdir(), "/mesa-install")
40 staged := string-append(srcdir(), "/mesa-install-complete")
41 if not(file-exists?(staged)) {
42 run("meson", "install", "--no-rebuild", "-C", "build", "--destdir", stage)
43 run("touch", staged)
44 }
45 name := get-environment-variable("VPAC_PKGNAME")
46 profile := if string=?("mesa-gallium-sdk", name) { "sdk" } else { "current" }
47 run("vinix-mesa", "package", profile, stage, pkgdir())
48 if string=?("mesa", name) {
49 ; The release includes this header while omitting the off-screen renderer DSO.
50 run("install", "-Dm644", "mesa-24.2.8/include/GL/osmesa.h", string-append(pkgdir(), "/usr/include/GL/osmesa.h"))
51 }
52 run("install", "-Dm644", "mesa-24.2.8/docs/license.rst", string-append(pkgdir(), "/usr/share/licenses/", name, "/license.rst"))
53 })
54