fix: libwayland BUILDS — proper durability patch with all stubs

121-line redox.patch replaces 229-line fragile Python heredoc.
Covers: meson.build, src/meson.build, event-loop.c, connection.c,
wayland-server.c with signalfd, timerfd, eventfd, MSG_NOSIGNAL,
open_memstream, timerfd_settime, timerfd_gettime stubs.

libwayland builds successfully. Greeter cascade through llvm21.
This commit is contained in:
2026-04-28 12:28:19 +01:00
parent 7645c5998a
commit f405070d2c
3 changed files with 77 additions and 42 deletions
+72 -37
View File
@@ -1,6 +1,5 @@
diff -ruN libwayland-base/meson.build libwayland-mod/meson.build
--- libwayland-base/meson.build 2025-07-06 13:11:26.000000000 +0100
+++ libwayland-mod/meson.build 2026-04-28 11:55:10.625896809 +0100
--- clean-wayland/meson.build 2025-07-06 13:11:26.000000000 +0100
+++ patched-wayland/meson.build 2026-04-28 12:23:06.295526487 +0100
@@ -80,8 +80,8 @@
ffi_dep = dependency('libffi')
@@ -12,29 +11,21 @@ diff -ruN libwayland-base/meson.build libwayland-mod/meson.build
{ 'header': 'time.h', 'symbol': 'CLOCK_MONOTONIC' },
]
diff -ruN libwayland-base/src/connection.c libwayland-mod/src/connection.c
--- libwayland-base/src/connection.c 2025-07-06 13:11:26.000000000 +0100
+++ libwayland-mod/src/connection.c 2026-04-28 12:06:49.776451773 +0100
@@ -40,6 +40,15 @@
#include <time.h>
#include <ffi.h>
--- clean-wayland/src/meson.build 2025-07-06 13:11:26.000000000 +0100
+++ patched-wayland/src/meson.build 2026-04-28 12:23:06.295602980 +0100
@@ -81,8 +81,7 @@
endif
+#ifndef MSG_NOSIGNAL
+#define MSG_NOSIGNAL 0
+#endif
+#include <stdio.h>
+#include <stdlib.h>
+static FILE *open_memstream(char **bufp, size_t *sizep) {
+ *bufp = NULL; *sizep = 0; return NULL;
+}
+
#include "wayland-util.h"
#include "wayland-private.h"
#include "wayland-os.h"
diff -ruN libwayland-base/src/event-loop.c libwayland-mod/src/event-loop.c
--- libwayland-base/src/event-loop.c 2025-07-06 13:11:26.000000000 +0100
+++ libwayland-mod/src/event-loop.c 2026-04-28 11:58:30.794153149 +0100
@@ -35,9 +35,45 @@
if meson.is_cross_build() or not get_option('scanner')
- scanner_dep = dependency('wayland-scanner', native: true, version: meson.project_version())
- wayland_scanner_for_build = find_program(scanner_dep.get_variable(pkgconfig: 'wayland_scanner'))
+wayland_scanner_for_build = find_program('wayland-scanner', native: true)
else
wayland_scanner_for_build = wayland_scanner
endif
--- clean-wayland/src/event-loop.c 2025-07-06 13:11:26.000000000 +0100
+++ patched-wayland/src/event-loop.c 2026-04-28 12:24:35.434111143 +0100
@@ -35,9 +35,56 @@
#include <sys/socket.h>
#include <sys/un.h>
#include <sys/epoll.h>
@@ -78,20 +69,64 @@ diff -ruN libwayland-base/src/event-loop.c libwayland-mod/src/event-loop.c
+ char path[64];
+ snprintf(path, sizeof(path), "/scheme/time/%d", clockid);
+ return open(path, oflag);
+}
+int timerfd_settime(int fd, int flags, const struct itimerspec *new_value, struct itimerspec *old_value) {
+ if (new_value == NULL) { errno = EFAULT; return -1; }
+ ssize_t r = write(fd, &new_value->it_value, sizeof(struct timespec));
+ return (r == sizeof(struct timespec)) ? 0 : -1;
+}
+int timerfd_gettime(int fd, struct itimerspec *curr) {
+ if (curr == NULL) { errno = EFAULT; return -1; }
+ curr->it_interval = (struct timespec){0};
+ ssize_t r = read(fd, &curr->it_value, sizeof(struct timespec));
+ return (r == sizeof(struct timespec)) ? 0 : -1;
+}
#include "timespec-util.h"
#include "wayland-util.h"
#include "wayland-private.h"
diff -ruN libwayland-base/src/meson.build libwayland-mod/src/meson.build
--- libwayland-base/src/meson.build 2025-07-06 13:11:26.000000000 +0100
+++ libwayland-mod/src/meson.build 2026-04-28 11:55:10.625994641 +0100
@@ -81,8 +81,7 @@
endif
--- clean-wayland/src/connection.c 2025-07-06 13:11:26.000000000 +0100
+++ patched-wayland/src/connection.c 2026-04-28 12:23:06.295797924 +0100
@@ -40,6 +40,15 @@
#include <time.h>
#include <ffi.h>
+#ifndef MSG_NOSIGNAL
+#define MSG_NOSIGNAL 0
+#endif
+#include <stdio.h>
+#include <stdlib.h>
+static FILE *open_memstream(char **bufp, size_t *sizep) {
+ *bufp = NULL; *sizep = 0; return NULL;
+}
+
#include "wayland-util.h"
#include "wayland-private.h"
#include "wayland-os.h"
--- clean-wayland/src/wayland-server.c 2025-07-06 13:11:26.000000000 +0100
+++ patched-wayland/src/wayland-server.c 2026-04-28 12:23:06.295982588 +0100
@@ -39,7 +39,24 @@
#include <dlfcn.h>
#include <sys/time.h>
#include <fcntl.h>
-#include <sys/eventfd.h>
+/* #include <sys/eventfd.h> */
+#ifndef EFD_CLOEXEC
+#define EFD_CLOEXEC O_CLOEXEC
+#endif
+#ifndef EFD_NONBLOCK
+#define EFD_NONBLOCK O_NONBLOCK
+#endif
+#ifndef EFD_SEMAPHORE
+#define EFD_SEMAPHORE 0x1
+#endif
+static int eventfd(unsigned int initval, int flags) {
+ int oflag = O_RDWR;
+ if (flags & EFD_CLOEXEC) oflag |= O_CLOEXEC;
+ if (flags & EFD_NONBLOCK) oflag |= O_NONBLOCK;
+ char path[64];
+ snprintf(path, sizeof(path), "/scheme/event/eventfd/%u/%d", initval, (flags & EFD_SEMAPHORE) ? 1 : 0);
+ return open(path, oflag);
+}
#include <sys/file.h>
#include <sys/stat.h>
if meson.is_cross_build() or not get_option('scanner')
- scanner_dep = dependency('wayland-scanner', native: true, version: meson.project_version())
- wayland_scanner_for_build = find_program(scanner_dep.get_variable(pkgconfig: 'wayland_scanner'))
+wayland_scanner_for_build = find_program('wayland-scanner', native: true)
else
wayland_scanner_for_build = wayland_scanner
endif
+4 -5
View File
@@ -3,6 +3,7 @@
# redox.patch restores the Redox compatibility stubs plus Meson scanner detection.
[source]
tar = "https://gitlab.freedesktop.org/wayland/wayland/-/releases/1.24.0/downloads/wayland-1.24.0.tar.xz"
patches = ["redox.patch"]
[build]
template = "custom"
@@ -14,10 +15,8 @@ dependencies = [
]
script = """
DYNAMIC_INIT
RELIBC_INCLUDE_STAGE="${COOKBOOK_ROOT}/recipes/core/relibc/target/${TARGET}/stage/usr/include"
if [ ! -f "${RELIBC_INCLUDE_STAGE}/sys/signalfd.h" ]; then
script = """
DYNAMIC_INIT
cookbook_meson -Ddocumentation=false -Dtests=false -Ddtd_validation=false -Dc_args=-Wno-error
"""
[package]
dependencies = ["libffi"]
+1
View File
@@ -0,0 +1 @@
../../../../local/patches/libwayland/redox.patch