summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Ports/AvailablePorts.md1
-rwxr-xr-xPorts/wayland/package.sh36
-rw-r--r--Ports/wayland/patches/0001-Don-t-build-wayland-server.patch97
-rw-r--r--Ports/wayland/patches/0002-Use-native-wayland-scanner.patch23
-rw-r--r--Ports/wayland/patches/0003-Remove-unsupported-OS-features.patch60
-rw-r--r--Ports/wayland/patches/0004-Don-t-use-CMSG_CLOEXEC.patch22
-rw-r--r--Ports/wayland/patches/0005-Remove-call-to-open_memstream-3-from-wl_closure_prin.patch39
-rw-r--r--Ports/wayland/patches/ReadMe.md27
8 files changed, 305 insertions, 0 deletions
diff --git a/Ports/AvailablePorts.md b/Ports/AvailablePorts.md
index 6d277127cd..9801dcd79d 100644
--- a/Ports/AvailablePorts.md
+++ b/Ports/AvailablePorts.md
@@ -272,6 +272,7 @@ This list is also available at [ports.serenityos.net](https://ports.serenityos.n
| [`vlang`](vlang/) | V programming language | weekly.2021.31 | https://github.com/vlang/v |
| [`vttest`](vttest/) | vttest | 20220215 | https://invisible-island.net/vttest/ |
| [`VVVVVV`](VVVVVV/) | Terry Cavanagh's VVVVVV | 2.3.6 | https://github.com/TerryCavanagh/VVVVVV/ |
+| [`wayland`](wayland/) | Wayland client libraries | 1.21.0 | https://wayland.freedesktop.org/ |
| [`wget`](wget/) | GNU Wget | 1.21.3 | https://www.gnu.org/software/wget/ |
| [`which`](which/) | GNU which | 2.21 | https://www.gnu.org/software/which/ |
| [`wireguard-tools`](wireguard-tools/) | WireGuard Tools | 1.0.20210914 | https://www.wireguard.com/ |
diff --git a/Ports/wayland/package.sh b/Ports/wayland/package.sh
new file mode 100755
index 0000000000..d545f121ea
--- /dev/null
+++ b/Ports/wayland/package.sh
@@ -0,0 +1,36 @@
+#!/usr/bin/env -S bash ../.port_include.sh
+port='wayland'
+version='1.21.0'
+useconfigure='true'
+configopts=(
+ "--buildtype=release"
+ "--cross-file=${SERENITY_BUILD_DIR}/meson-cross-file.txt"
+ "-Dlibraries=true"
+ "-Dscanner=true"
+ "-Dtests=false"
+ "-Ddocumentation=false"
+)
+depends=(
+ 'expat'
+ 'libxml2'
+)
+files="https://gitlab.freedesktop.org/wayland/wayland/-/releases/${version}/downloads/wayland-${version}.tar.xz wayland-${version}.tar.xz 6dc64d7fc16837a693a51cfdb2e568db538bfdc9f457d4656285bb9594ef11ac"
+auth_type='sha256'
+
+configure() {
+ # TODO: Figure out why GCC doesn't autodetect that libgcc_s is needed.
+ if [ "${SERENITY_TOOLCHAIN}" = "GNU" ]; then
+ export LDFLAGS="-lgcc_s"
+ fi
+
+ run meson build "${configopts[@]}"
+}
+
+build() {
+ run ninja -C build
+}
+
+install() {
+ export DESTDIR="${SERENITY_INSTALL_ROOT}"
+ run meson install -C build
+}
diff --git a/Ports/wayland/patches/0001-Don-t-build-wayland-server.patch b/Ports/wayland/patches/0001-Don-t-build-wayland-server.patch
new file mode 100644
index 0000000000..6aa2dd8d3e
--- /dev/null
+++ b/Ports/wayland/patches/0001-Don-t-build-wayland-server.patch
@@ -0,0 +1,97 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Peter Elliott <pelliott@ualberta.ca>
+Date: Sat, 11 Feb 2023 13:22:20 -0700
+Subject: [PATCH] Don't build wayland-server
+
+---
+ meson.build | 4 ++--
+ src/meson.build | 54 -------------------------------------------------
+ 2 files changed, 2 insertions(+), 56 deletions(-)
+
+diff --git a/meson.build b/meson.build
+index 8bb47c258228985667f1c6e0cc4ed64a02fa777a..52bf93bb278c75ee77bd3fcb29810752a1bc4ded 100644
+--- a/meson.build
++++ b/meson.build
+@@ -80,8 +80,8 @@ if get_option('libraries')
+ ffi_dep = dependency('libffi')
+
+ decls = [
+- { 'header': 'sys/signalfd.h', 'symbol': 'SFD_CLOEXEC' },
+- { 'header': 'sys/timerfd.h', 'symbol': 'TFD_CLOEXEC' },
++ #{ 'header': 'sys/signalfd.h', 'symbol': 'SFD_CLOEXEC' },
++ #{ 'header': 'sys/timerfd.h', 'symbol': 'TFD_CLOEXEC' },
+ { 'header': 'time.h', 'symbol': 'CLOCK_MONOTONIC' },
+ ]
+
+diff --git a/src/meson.build b/src/meson.build
+index a8a1d2ba979411a09fd754ef9b8ddf44a6f74653..c20d9b9df042004bcbe0e1ae466c409bd51d3f82 100644
+--- a/src/meson.build
++++ b/src/meson.build
+@@ -167,58 +167,6 @@ if get_option('libraries')
+ error('We probably need to bump the SONAME of libwayland-server and -client')
+ endif
+
+- wayland_server = library(
+- 'wayland-server',
+- sources: [
+- wayland_server_protocol_core_h,
+- wayland_server_protocol_h,
+- wayland_protocol_c,
+- 'wayland-server.c',
+- 'wayland-shm.c',
+- 'event-loop.c'
+- ],
+- # To avoid an unnecessary SONAME bump, wayland 1.x.y produces
+- # libwayland-server.so.0.x.y.
+- version: '.'.join(['0', wayland_version[1], wayland_version[2]]),
+- dependencies: [
+- epoll_dep,
+- ffi_dep,
+- wayland_private_dep,
+- wayland_util_dep,
+- mathlib_dep,
+- threads_dep,
+- rt_dep
+- ],
+- include_directories: root_inc,
+- install: true
+- )
+-
+- wayland_server_dep = declare_dependency(
+- link_with: wayland_server,
+- include_directories: [ root_inc, include_directories('.') ],
+- dependencies: [ epoll_dep, ffi_dep, mathlib_dep, threads_dep ],
+- sources: [
+- wayland_server_protocol_core_h,
+- wayland_server_protocol_h
+- ]
+- )
+-
+- pkgconfig.generate(
+- wayland_server,
+- name: 'Wayland Server',
+- description: 'Server side implementation of the Wayland protocol',
+- version: meson.project_version(),
+- filebase: 'wayland-server',
+- variables: [
+- 'datarootdir=' + join_paths('${prefix}', get_option('datadir')),
+- 'pkgdatadir=' + join_paths('${datarootdir}', meson.project_name())
+- ]
+- )
+-
+- if meson.version().version_compare('>= 0.54.0')
+- meson.override_dependency('wayland-server', wayland_server_dep)
+- endif
+-
+ wayland_client = library(
+ 'wayland-client',
+ sources: [
+@@ -269,8 +217,6 @@ if get_option('libraries')
+
+ install_headers([
+ 'wayland-util.h',
+- 'wayland-server.h',
+- 'wayland-server-core.h',
+ 'wayland-client.h',
+ 'wayland-client-core.h',
+ ])
diff --git a/Ports/wayland/patches/0002-Use-native-wayland-scanner.patch b/Ports/wayland/patches/0002-Use-native-wayland-scanner.patch
new file mode 100644
index 0000000000..79f365fc5a
--- /dev/null
+++ b/Ports/wayland/patches/0002-Use-native-wayland-scanner.patch
@@ -0,0 +1,23 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Peter Elliott <pelliott@ualberta.ca>
+Date: Sat, 11 Feb 2023 13:40:47 -0700
+Subject: [PATCH] Use native wayland-scanner
+
+---
+ src/meson.build | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/src/meson.build b/src/meson.build
+index c20d9b9df042004bcbe0e1ae466c409bd51d3f82..2eafcdfb04ff05ab86eefcc06e8566d09e52cbfb 100644
+--- a/src/meson.build
++++ b/src/meson.build
+@@ -78,8 +78,7 @@ if get_option('scanner')
+ endif
+
+ 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')
+ else
+ wayland_scanner_for_build = wayland_scanner
+ endif
diff --git a/Ports/wayland/patches/0003-Remove-unsupported-OS-features.patch b/Ports/wayland/patches/0003-Remove-unsupported-OS-features.patch
new file mode 100644
index 0000000000..0bc53f5f75
--- /dev/null
+++ b/Ports/wayland/patches/0003-Remove-unsupported-OS-features.patch
@@ -0,0 +1,60 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Peter Elliott <pelliott@ualberta.ca>
+Date: Sat, 11 Feb 2023 13:52:12 -0700
+Subject: [PATCH] Remove unsupported OS features
+
+---
+ src/wayland-os.c | 18 ------------------
+ src/wayland-os.h | 3 ---
+ 2 files changed, 21 deletions(-)
+
+diff --git a/src/wayland-os.c b/src/wayland-os.c
+index a9066cae9c93b607ea92ad1da1746f3b37a2bcb3..4872c4837c67178f46e3ab05d9006a8c512664cc 100644
+--- a/src/wayland-os.c
++++ b/src/wayland-os.c
+@@ -33,7 +33,6 @@
+ #include <fcntl.h>
+ #include <errno.h>
+ #include <string.h>
+-#include <sys/epoll.h>
+ #include <sys/mman.h>
+ #include <sys/un.h>
+ #ifdef HAVE_SYS_UCRED_H
+@@ -188,23 +187,6 @@ wl_os_recvmsg_cloexec(int sockfd, struct msghdr *msg, int flags)
+ return recvmsg_cloexec_fallback(sockfd, msg, flags);
+ }
+
+-int
+-wl_os_epoll_create_cloexec(void)
+-{
+- int fd;
+-
+-#ifdef EPOLL_CLOEXEC
+- fd = epoll_create1(EPOLL_CLOEXEC);
+- if (fd >= 0)
+- return fd;
+- if (errno != EINVAL)
+- return -1;
+-#endif
+-
+- fd = epoll_create(1);
+- return set_cloexec_or_close(fd);
+-}
+-
+ int
+ wl_os_accept_cloexec(int sockfd, struct sockaddr *addr, socklen_t *addrlen)
+ {
+diff --git a/src/wayland-os.h b/src/wayland-os.h
+index 068fd2fea3da8e0a13a3ab993fcc7d4c609a366d..ca4de54161b39e612b14332364cfb697e53d9afc 100644
+--- a/src/wayland-os.h
++++ b/src/wayland-os.h
+@@ -41,9 +41,6 @@ wl_os_dupfd_cloexec(int fd, int minfd);
+ ssize_t
+ wl_os_recvmsg_cloexec(int sockfd, struct msghdr *msg, int flags);
+
+-int
+-wl_os_epoll_create_cloexec(void);
+-
+ int
+ wl_os_accept_cloexec(int sockfd, struct sockaddr *addr, socklen_t *addrlen);
+
diff --git a/Ports/wayland/patches/0004-Don-t-use-CMSG_CLOEXEC.patch b/Ports/wayland/patches/0004-Don-t-use-CMSG_CLOEXEC.patch
new file mode 100644
index 0000000000..9f361a0f31
--- /dev/null
+++ b/Ports/wayland/patches/0004-Don-t-use-CMSG_CLOEXEC.patch
@@ -0,0 +1,22 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Peter Elliott <pelliott@ualberta.ca>
+Date: Sat, 11 Feb 2023 14:58:38 -0700
+Subject: [PATCH] Don't use CMSG_CLOEXEC
+
+---
+ meson.build | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/meson.build b/meson.build
+index 52bf93bb278c75ee77bd3fcb29810752a1bc4ded..622899a3076577218d93f5075d03279765723acc 100644
+--- a/meson.build
++++ b/meson.build
+@@ -51,7 +51,7 @@ foreach f: have_funcs
+ config_h.set('HAVE_' + f.underscorify().to_upper(), cc.has_function(f))
+ endforeach
+ config_h.set10('HAVE_XUCRED_CR_PID', cc.has_member('struct xucred', 'cr_pid', prefix : '#include <sys/ucred.h>'))
+-have_broken_msg_cmsg_cloexec = false
++have_broken_msg_cmsg_cloexec = true
+ if host_machine.system() == 'freebsd'
+ have_broken_msg_cmsg_cloexec = not cc.compiles('''
+ #include <sys/param.h> /* To get __FreeBSD_version. */
diff --git a/Ports/wayland/patches/0005-Remove-call-to-open_memstream-3-from-wl_closure_prin.patch b/Ports/wayland/patches/0005-Remove-call-to-open_memstream-3-from-wl_closure_prin.patch
new file mode 100644
index 0000000000..6fbf8a3918
--- /dev/null
+++ b/Ports/wayland/patches/0005-Remove-call-to-open_memstream-3-from-wl_closure_prin.patch
@@ -0,0 +1,39 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Peter Elliott <pelliott@ualberta.ca>
+Date: Sat, 11 Feb 2023 15:17:27 -0700
+Subject: [PATCH] Remove call to open_memstream(3) from wl_closure_print
+
+---
+ src/connection.c | 11 +----------
+ 1 file changed, 1 insertion(+), 10 deletions(-)
+
+diff --git a/src/connection.c b/src/connection.c
+index bf976762df7d31205a4945cf6df0963c5f27c70a..1adf30fdd2b5e211dbbe69607f4c97eff182d99b 100644
+--- a/src/connection.c
++++ b/src/connection.c
+@@ -1273,12 +1273,8 @@ wl_closure_print(struct wl_closure *closure, struct wl_object *target,
+ unsigned int time;
+ uint32_t nval;
+ FILE *f;
+- char *buffer;
+- size_t buffer_length;
+
+- f = open_memstream(&buffer, &buffer_length);
+- if (f == NULL)
+- return;
++ f = stderr;
+
+ clock_gettime(CLOCK_REALTIME, &tp);
+ time = (tp.tv_sec * 1000000L) + (tp.tv_nsec / 1000);
+@@ -1354,11 +1350,6 @@ wl_closure_print(struct wl_closure *closure, struct wl_object *target,
+ }
+
+ fprintf(f, ")\n");
+-
+- if (fclose(f) == 0) {
+- fprintf(stderr, "%s", buffer);
+- free(buffer);
+- }
+ }
+
+ static int
diff --git a/Ports/wayland/patches/ReadMe.md b/Ports/wayland/patches/ReadMe.md
new file mode 100644
index 0000000000..deb75bc69d
--- /dev/null
+++ b/Ports/wayland/patches/ReadMe.md
@@ -0,0 +1,27 @@
+# Patches for wayland on SerenityOS
+
+## `0001-Don-t-build-wayland-server.patch`
+
+Don't build wayland-server
+
+
+## `0002-Use-native-wayland-scanner.patch`
+
+Use native wayland-scanner
+
+
+## `0003-Remove-unsupported-OS-features.patch`
+
+Remove unsupported OS features
+
+
+## `0004-Don-t-use-CMSG_CLOEXEC.patch`
+
+Don't use CMSG_CLOEXEC
+
+
+## `0005-Remove-call-to-open_memstream-3-from-wl_closure_prin.patch`
+
+Remove call to open_memstream(3) from wl_closure_print
+
+