Saturday, July 30, 2022

update: wayland/wayland and wayland/wayland-protocols

Hi,

The following diff updates wayland/wayland to 1.21.0 and
wayland/wayland-protocols to 1.26.

wayland-protocols is simple.

wayland is more complex.

- I bumped SHARED_LIBS for wayland-client and wayland-server (new symbols
added). For the comment with the upstream version, I looked at meson.build
file, but I am a bit unsure (wayland-client seems to have switched from 3.0 to
0.21.0 ?!)

- Regarding the code, I sent a MR request to upstream. The current patches
permits to build wayland on OpenBSD (and still on Linux), all tests are
passing.

- define _BSD_SOURCE to get SOCK_CLOEXEC and mkostemp (there is a
_POSIX_C_SOURCE on command-line which hide it else)
- in tests, use llvm-nm(1) instead of nm(1) (BSD nm has incompatible options with GNU)
- provide a compat layer for waitid()
- epoll(7) has userspace wrapper around kqueue(2) is upstreamed: use it for OpenBSD
- when using SO_PEERCRED, the struct to use onOpenBSD is `struct sockpeercred`
- provide a compat layer for count_open_fds() (for tests)

Comments or OK ?
--
Sebastien Marie



diff /data/semarie/repos/openbsd/ports
commit - 0150291b1a3b6581d1519c18d130d81b43e52d16
path + /data/semarie/repos/openbsd/ports
blob - 2bf739823fadd261a14b1dae72d53626f6a73983
file + wayland/wayland/Makefile
--- wayland/wayland/Makefile
+++ wayland/wayland/Makefile
@@ -1,16 +1,15 @@
COMMENT = Display server protocol

-DISTNAME = wayland-1.19.0
-REVISION = 0
+DISTNAME = wayland-1.21.0

CATEGORIES = wayland

HOMEPAGE = https://wayland.freedesktop.org/

-SHARED_LIBS += wayland-client 0.0 # 3.0
-SHARED_LIBS += wayland-cursor 0.0 # 0.0
+SHARED_LIBS += wayland-client 0.1 # 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.0 # 1.0
+SHARED_LIBS += wayland-server 0.1 # 0.21.0

WANTLIB += c epoll-shim expat ffi xml2

@@ -30,8 +29,8 @@ LIB_DEPENDS = devel/libffi \
textproc/libxml \
devel/epoll-shim

-CFLAGS+= "-I${LOCALBASE}/include/libepoll-shim"
-
MODMESON_CONFIGURE_ARGS += -Ddocumentation=false

+TEST_DEPENDS = devel/llvm,-main
+
.include <bsd.port.mk>
blob - c6681ae77df3d933cb641234e3c341b7a979dbc6
file + wayland/wayland/distinfo
--- wayland/wayland/distinfo
+++ wayland/wayland/distinfo
@@ -1,2 +1,2 @@
-SHA256 (wayland-1.19.0.tar.xz) = uszZAjANNUWBzVrTzEnapJIdVftBaliD4hh1D+8WbRU=
-SIZE (wayland-1.19.0.tar.xz) = 456380
+SHA256 (wayland-1.21.0.tar.xz) = bcZNf8FoN6aTpRz9suVo21OL/cn0V9RlYoW7lZTvEaw=
+SIZE (wayland-1.21.0.tar.xz) = 225936
blob - /dev/null
file + wayland/wayland/patches/patch-cursor_os-compatibility_c
--- /dev/null
+++ wayland/wayland/patches/patch-cursor_os-compatibility_c
@@ -0,0 +1,14 @@
+https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/256
+
+Index: cursor/os-compatibility.c
+--- cursor/os-compatibility.c.orig
++++ cursor/os-compatibility.c
+@@ -23,6 +23,8 @@
+ * SOFTWARE.
+ */
+
++#define _BSD_SOURCE
++#define _DEFAULT_SOURCE
+ #define _GNU_SOURCE
+
+ #include "config.h"
blob - /dev/null
file + wayland/wayland/patches/patch-egl_meson_build
--- /dev/null
+++ wayland/wayland/patches/patch-egl_meson_build
@@ -0,0 +1,14 @@
+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',
blob - 5dec069d72a7e55f745948e7da377dd53f3ffbd9
file + wayland/wayland/patches/patch-meson_build
--- wayland/wayland/patches/patch-meson_build
+++ wayland/wayland/patches/patch-meson_build
@@ -1,34 +1,36 @@
+https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/256
+
Index: meson.build
--- meson.build.orig
+++ meson.build
-@@ -26,7 +26,14 @@ add_project_arguments(
+@@ -34,7 +34,12 @@ add_project_arguments(
language: 'c'
)

--foreach h: [ 'sys/prctl.h' ]
+-foreach h: [ 'sys/prctl.h', 'sys/procctl.h', 'sys/ucred.h' ]
+have_headers = [
-+ 'signal.h',
-+ 'sys/epoll.h',
-+ 'sys/prctl.h',
-+ 'sys/ucred.h',
-+ ]
-+
++ 'sys/prctl.h',
++ 'sys/procctl.h',
++ 'sys/ucred.h',
++]
+foreach h: have_headers
config_h.set('HAVE_' + h.underscorify().to_upper(), cc.has_header(h))
endforeach

-@@ -37,12 +44,14 @@ have_funcs = [
- 'prctl',
+@@ -46,6 +51,7 @@ have_funcs = [
'memfd_create',
+ 'mremap',
'strndup',
+ 'waitid',
]
foreach f: have_funcs
config_h.set('HAVE_' + f.underscorify().to_upper(), cc.has_function(f))
- endforeach
+@@ -69,7 +75,7 @@ endif
+ config_h.set10('HAVE_BROKEN_MSG_CMSG_CLOEXEC', have_broken_msg_cmsg_cloexec)

if get_option('libraries')
-+ epoll_dep = dependency('epoll-shim', required: true)
- ffi_dep = dependency('libffi')
-
- decls = [
+- 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')
blob - 909dae7a06864d9cd67ca80a8ae8bc11fe25e90e
file + /dev/null
--- wayland/wayland/patches/patch-src_meson_build
+++ /dev/null
@@ -1,37 +0,0 @@
-Index: src/meson.build
---- src/meson.build.orig
-+++ src/meson.build
-@@ -77,7 +77,7 @@ if get_option('libraries')
- 'connection.c',
- 'wayland-os.c'
- ],
-- dependencies: [ ffi_dep, rt_dep ]
-+ dependencies: [ epoll_dep, ffi_dep, rt_dep ]
- )
-
- wayland_private_dep = declare_dependency(
-@@ -152,6 +152,7 @@ if get_option('libraries')
- version: '0.1.0',
- dependencies: [
- ffi_dep,
-+ epoll_dep,
- wayland_private_dep,
- wayland_util_dep,
- mathlib_dep,
-@@ -165,7 +166,7 @@ if get_option('libraries')
- wayland_server_dep = declare_dependency(
- link_with: wayland_server,
- include_directories: [ root_inc, include_directories('.') ],
-- dependencies: [ ffi_dep, mathlib_dep, threads_dep ],
-+ dependencies: [ epoll_dep, ffi_dep, mathlib_dep, threads_dep ],
- sources: [
- wayland_server_protocol_core_h,
- wayland_server_protocol_h
-@@ -195,6 +196,7 @@ if get_option('libraries')
- version: '0.3.0',
- dependencies: [
- ffi_dep,
-+ epoll_dep,
- wayland_private_dep,
- wayland_util_dep,
- mathlib_dep,
blob - 4a47017910072d6664a1b0fabe4717fb25c5a133
file + wayland/wayland/patches/patch-src_wayland-os_c
--- wayland/wayland/patches/patch-src_wayland-os_c
+++ wayland/wayland/patches/patch-src_wayland-os_c
@@ -1,98 +1,26 @@
+https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/256
+
Index: src/wayland-os.c
--- src/wayland-os.c.orig
+++ src/wayland-os.c
-@@ -25,6 +25,8 @@
+@@ -23,6 +23,8 @@
+ * SOFTWARE.
+ */

++#define _BSD_SOURCE
++#define _DEFAULT_SOURCE
#define _GNU_SOURCE

-+#include "../config.h"
-+
- #include <sys/types.h>
- #include <sys/socket.h>
- #include <unistd.h>
-@@ -32,7 +34,6 @@
- #include <errno.h>
- #include <sys/epoll.h>
-
--#include "../config.h"
- #include "wayland-os.h"
-
- static int
-@@ -62,26 +63,50 @@ wl_os_socket_cloexec(int domain, int type, int protoco
+ #include "../config.h"
+@@ -105,7 +107,11 @@ int
+ wl_os_socket_peercred(int sockfd, uid_t *uid, gid_t *gid, pid_t *pid)
{
- int fd;
-
-+#ifdef SOCK_CLOEXEC
- fd = socket(domain, type | SOCK_CLOEXEC, protocol);
- if (fd >= 0)
- return fd;
- if (errno != EINVAL)
- return -1;
+ socklen_t len;
++#if defined(__OpenBSD__)
++ struct sockpeercred ucred;
++#else
+ struct ucred ucred;
+

No comments:

Post a Comment