From f405070d2cfe9fe070e6f37d1d321c74ae2275a4 Mon Sep 17 00:00:00 2001 From: Vasilito Date: Tue, 28 Apr 2026 12:28:19 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20libwayland=20BUILDS=20=E2=80=94=20proper?= =?UTF-8?q?=20durability=20patch=20with=20all=20stubs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- local/patches/libwayland/redox.patch | 109 ++++++++++++++------- recipes/wip/wayland/libwayland/recipe.toml | 9 +- recipes/wip/wayland/libwayland/redox.patch | 1 + 3 files changed, 77 insertions(+), 42 deletions(-) create mode 120000 recipes/wip/wayland/libwayland/redox.patch diff --git a/local/patches/libwayland/redox.patch b/local/patches/libwayland/redox.patch index c4bff45a..b8d43496 100644 --- a/local/patches/libwayland/redox.patch +++ b/local/patches/libwayland/redox.patch @@ -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 - #include +--- 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 -+#include -+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 #include #include @@ -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 + #include + ++#ifndef MSG_NOSIGNAL ++#define MSG_NOSIGNAL 0 ++#endif ++#include ++#include ++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 + #include + #include +-#include ++/* #include */ ++#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 + #include - 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 diff --git a/recipes/wip/wayland/libwayland/recipe.toml b/recipes/wip/wayland/libwayland/recipe.toml index 0cdecfb2..9213fdef 100644 --- a/recipes/wip/wayland/libwayland/recipe.toml +++ b/recipes/wip/wayland/libwayland/recipe.toml @@ -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"] diff --git a/recipes/wip/wayland/libwayland/redox.patch b/recipes/wip/wayland/libwayland/redox.patch new file mode 120000 index 00000000..4aef53e7 --- /dev/null +++ b/recipes/wip/wayland/libwayland/redox.patch @@ -0,0 +1 @@ +../../../../local/patches/libwayland/redox.patch \ No newline at end of file