Hi, so rsadowski@ reported that my previsous diff to upgrade wayland to 1.23.1 is breaking kwayland ports.
I've tracked down the build error to the wrong assumption that __STDC_VERSION__ is defined for C++ too, in combinaison with strict -Werror -Wundef CFLAGS. Reported upstreams: https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/438 New diff, with the new patch : @rsadowski: can you put it in your next build and tell me if it's ok now? Index: Makefile =================================================================== RCS file: /cvs/OpenBSD/ports/wayland/wayland/Makefile,v diff -u -p -u -r1.10 Makefile --- Makefile 27 Sep 2023 18:13:48 -0000 1.10 +++ Makefile 20 Oct 2024 11:05:44 -0000 @@ -1,17 +1,16 @@ COMMENT = Display server protocol DISTNAME = wayland-${V} -V = 1.22.0 -REVISION = 0 +V = 1.23.1 CATEGORIES = wayland HOMEPAGE = https://wayland.freedesktop.org/ -SHARED_LIBS += wayland-client 0.1 # 0.21.0 +SHARED_LIBS += wayland-client 0.2 # 0.21.0 SHARED_LIBS += wayland-cursor 0.0 # 0.21.0 SHARED_LIBS += wayland-egl 0.0 # 1.0 -SHARED_LIBS += wayland-server 0.2 # 0.21.0 +SHARED_LIBS += wayland-server 0.3 # 0.21.0 WANTLIB += c epoll-shim expat ffi xml2 Index: distinfo =================================================================== RCS file: /cvs/OpenBSD/ports/wayland/wayland/distinfo,v diff -u -p -u -r1.4 distinfo --- distinfo 5 Jul 2023 13:37:54 -0000 1.4 +++ distinfo 20 Oct 2024 11:05:44 -0000 @@ -1,2 +1,2 @@ -SHA256 (wayland-1.22.0.tar.xz) = FUCvHqaYpHHC2OnSiDMsfg/TYMjx0Sk267fny8JCWEI= -SIZE (wayland-1.22.0.tar.xz) = 229544 +SHA256 (wayland-1.23.1.tar.xz) = hk+yqDmeLQ7DnVbp2bdTwJN3W+rcYCLOgfRBkpqB5e0= +SIZE (wayland-1.23.1.tar.xz) = 238212 Index: patches/patch-egl_meson_build =================================================================== RCS file: patches/patch-egl_meson_build diff -N patches/patch-egl_meson_build --- patches/patch-egl_meson_build 19 Aug 2022 06:39:55 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,14 +0,0 @@ -https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/256 - -Index: egl/meson.build ---- egl/meson.build.orig -+++ egl/meson.build -@@ -11,7 +11,7 @@ wayland_egl = library( - - executable('wayland-egl-abi-check', 'wayland-egl-abi-check.c') - --nm_path = find_program('nm').full_path() -+nm_path = find_program(['llvm-nm', 'nm']).full_path() - - test( - 'wayland-egl symbols check', Index: patches/patch-meson_build =================================================================== RCS file: patches/patch-meson_build diff -N patches/patch-meson_build --- patches/patch-meson_build 19 Aug 2022 06:39:55 -0000 1.3 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,23 +0,0 @@ -https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/256 - -Index: meson.build ---- meson.build.orig -+++ meson.build -@@ -16,7 +16,7 @@ config_h.set_quoted('PACKAGE', meson.project_name()) - config_h.set_quoted('PACKAGE_VERSION', meson.project_version()) - - cc_args = [] --if host_machine.system() != 'freebsd' -+if host_machine.system() not in ['freebsd', 'openbsd'] - cc_args += ['-D_POSIX_C_SOURCE=200809L'] - endif - add_project_arguments(cc_args, language: 'c') -@@ -69,7 +69,7 @@ endif - config_h.set10('HAVE_BROKEN_MSG_CMSG_CLOEXEC', have_broken_msg_cmsg_cloexec) - - if get_option('libraries') -- if host_machine.system() == 'freebsd' -+ if host_machine.system() in ['freebsd', 'openbsd'] - # When building for FreeBSD, epoll(7) is provided by a userspace - # wrapper around kqueue(2). - epoll_dep = dependency('epoll-shim') Index: patches/patch-src_wayland-os_c =================================================================== RCS file: patches/patch-src_wayland-os_c diff -N patches/patch-src_wayland-os_c --- patches/patch-src_wayland-os_c 19 Aug 2022 06:39:55 -0000 1.3 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,17 +0,0 @@ -https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/256 - -Index: src/wayland-os.c ---- src/wayland-os.c.orig -+++ src/wayland-os.c -@@ -105,7 +105,11 @@ int - wl_os_socket_peercred(int sockfd, uid_t *uid, gid_t *gid, pid_t *pid) - { - socklen_t len; -+#if defined(__OpenBSD__) -+ struct sockpeercred ucred; -+#else - struct ucred ucred; -+#endif - - len = sizeof(ucred); - if (getsockopt(sockfd, SOL_SOCKET, SO_PEERCRED, &ucred, &len) < 0) Index: patches/patch-src_wayland-util_h =================================================================== RCS file: patches/patch-src_wayland-util_h diff -N patches/patch-src_wayland-util_h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-src_wayland-util_h 20 Oct 2024 11:05:44 -0000 @@ -0,0 +1,21 @@ +Index: src/wayland-util.h +--- src/wayland-util.h.orig ++++ src/wayland-util.h +@@ -48,7 +48,7 @@ extern "C" { + #endif + + /** Deprecated attribute */ +-#if __STDC_VERSION__ >= 202311L ++#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L + #define WL_DEPRECATED [[deprecated]] + #elif defined(__GNUC__) && __GNUC__ >= 4 + #define WL_DEPRECATED __attribute__ ((deprecated)) +@@ -70,7 +70,7 @@ extern "C" { + #define WL_PRINTF(x, y) + #endif + +-#if __STDC_VERSION__ >= 202311L ++#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L + #define WL_TYPEOF(expr) typeof(expr) + #else + #define WL_TYPEOF(expr) __typeof__(expr) Index: patches/patch-tests_test-helpers_c =================================================================== RCS file: patches/patch-tests_test-helpers_c diff -N patches/patch-tests_test-helpers_c --- patches/patch-tests_test-helpers_c 19 Aug 2022 06:39:55 -0000 1.3 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,39 +0,0 @@ -https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/256 - -Index: tests/test-helpers.c ---- tests/test-helpers.c.orig -+++ tests/test-helpers.c -@@ -61,6 +61,33 @@ count_open_fds(void) - assert(error == 0 && "sysctl KERN_PROC_NFDS failed."); - return nfds; - } -+#elif defined(__OpenBSD__) -+#include <sys/sysctl.h> -+ -+/* -+ * On OpenBSD, get file descriptor information using sysctl() -+ */ -+int -+count_open_fds(void) -+{ -+ int error; -+ int mib[6]; -+ size_t size; -+ -+ mib[0] = CTL_KERN; -+ mib[1] = KERN_FILE; -+ mib[2] = KERN_FILE_BYPID; -+ mib[3] = getpid(); -+ mib[4] = sizeof(struct kinfo_file); -+ mib[5] = 0; -+ -+ /* find the size required to store all the entries */ -+ error = sysctl(mib, 6, NULL, &size, NULL, 0); -+ assert(error != -1 && "sysctl KERN_FILE_BYPID failed."); -+ -+ /* return the current number of entries */ -+ return size / sizeof(struct kinfo_file); -+} - #else - int - count_open_fds(void) Index: patches/patch-tests_test-runner_c =================================================================== RCS file: patches/patch-tests_test-runner_c diff -N patches/patch-tests_test-runner_c --- patches/patch-tests_test-runner_c 19 Aug 2022 06:39:55 -0000 1.3 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,73 +0,0 @@ -https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/256 - -Index: tests/test-runner.c ---- tests/test-runner.c.orig -+++ tests/test-runner.c -@@ -308,6 +308,13 @@ is_debugger_attached(void) - - return rc; - } -+#else -+static int -+is_debugger_attached(void) -+{ -+ /* 0=debugger can't be determined */ -+ return 0; -+} - #endif - - int main(int argc, char *argv[]) -@@ -315,7 +322,7 @@ int main(int argc, char *argv[]) - const struct test *t; - pid_t pid; - int total, pass; -- siginfo_t info; -+ int info; - - if (isatty(fileno(stderr))) - is_atty = 1; -@@ -358,37 +365,32 @@ int main(int argc, char *argv[]) - if (pid == 0) - run_test(t); /* never returns */ - -- if (waitid(P_PID, pid, &info, WEXITED)) { -+ if (waitpid(pid, &info, 0) == -1) { - stderr_set_color(RED); -- fprintf(stderr, "waitid failed: %s\n", -+ fprintf(stderr, "waitpid failed: %s\n", - strerror(errno)); - stderr_reset_color(); - - abort(); - } - -- switch (info.si_code) { -- case CLD_EXITED: -- if (info.si_status == EXIT_SUCCESS) -+ if (WIFEXITED(info)) { -+ if (WEXITSTATUS(info) == EXIT_SUCCESS) - success = !t->must_fail; - else - success = t->must_fail; - - stderr_set_color(success ? GREEN : RED); - fprintf(stderr, "test \"%s\":\texit status %d", -- t->name, info.si_status); -+ t->name, WEXITSTATUS(info)); - -- break; -- case CLD_KILLED: -- case CLD_DUMPED: -+ } else if (WIFSIGNALED(info)) { - if (t->must_fail) - success = 1; - - stderr_set_color(success ? GREEN : RED); - fprintf(stderr, "test \"%s\":\tsignal %d", -- t->name, info.si_status); -- -- break; -+ t->name, WTERMSIG(info)); - } - - if (success) {