mesa: fix build for musl (#463575)

This commit is contained in:
K900
2025-11-21 08:54:39 +00:00
committed by GitHub
2 changed files with 40 additions and 0 deletions
@@ -150,6 +150,7 @@ stdenv.mkDerivation {
patches = [
./opencl.patch
./musl.patch
];
postPatch = ''
@@ -0,0 +1,39 @@
From 571dedac8881649cd94c59488413b835cbcf0498 Mon Sep 17 00:00:00 2001
From: Alyssa Ross <hi@alyssa.is>
Date: Thu, 20 Nov 2025 23:16:47 +0100
Subject: [PATCH] rocket: fix building for musl
musl follows POSIX and provides ioctl as int ioctl(int, int, ...).
Fixes: 5b829658f74 ("rocket: Initial commit of a driver for Rockchip's NPU")
Signed-off-by: Alyssa Ross <hi@alyssa.is>
Link: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38561
---
src/gallium/drivers/rocket/intercept.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/gallium/drivers/rocket/intercept.c b/src/gallium/drivers/rocket/intercept.c
index 6ffb8647d61f5..88e55893d9520 100644
--- a/src/gallium/drivers/rocket/intercept.c
+++ b/src/gallium/drivers/rocket/intercept.c
@@ -294,9 +294,15 @@ handle_action(struct rknpu_action *args)
}
}
-typedef int (*real_ioctl_t)(int fd, unsigned long request, ...);
+#ifdef __GLIBC__
+typedef unsigned long ioctl_req;
+#else
+typedef int ioctl_req; // per POSIX
+#endif
+
+typedef int (*real_ioctl_t)(int fd, ioctl_req request, ...);
int
-ioctl(int fd, unsigned long request, ...)
+ioctl(int fd, ioctl_req request, ...)
{
int ret;
uint32_t output_address = 0;
--
GitLab