git: bb43067a6928 - main - x11-wm/sway: update to 1.11.r1

From: Jan Beich <jbeich_at_FreeBSD.org>
Date: Mon, 21 Apr 2025 22:59:42 UTC
The branch main has been updated by jbeich:

URL: https://cgit.FreeBSD.org/ports/commit/?id=bb43067a69287049a81ae44d1fa5c059540d6654

commit bb43067a69287049a81ae44d1fa5c059540d6654
Author:     Jan Beich <jbeich@FreeBSD.org>
AuthorDate: 2025-04-20 11:31:10 +0000
Commit:     Jan Beich <jbeich@FreeBSD.org>
CommitDate: 2025-04-21 22:58:27 +0000

    x11-wm/sway: update to 1.11.r1
    
    Changes:        https://github.com/swaywm/sway/releases/tag/1.11-rc1
    Reported by:    GitHub (watch releases)
---
 x11-wm/sway/Makefile                      | 10 ++++--
 x11-wm/sway/distinfo                      |  6 ++--
 x11-wm/sway/files/patch-common_stringop.c | 53 +++++++++++++++++++++++++++++++
 3 files changed, 63 insertions(+), 6 deletions(-)

diff --git a/x11-wm/sway/Makefile b/x11-wm/sway/Makefile
index 57282b7c3d42..5dc57e1f87c7 100644
--- a/x11-wm/sway/Makefile
+++ b/x11-wm/sway/Makefile
@@ -1,6 +1,5 @@
 PORTNAME=	sway
-DISTVERSION=	1.10.1
-PORTREVISION=	1
+DISTVERSION=	1.11-rc1
 CATEGORIES=	x11-wm wayland
 
 MAINTAINER=	jbeich@FreeBSD.org
@@ -18,7 +17,7 @@ LIB_DEPENDS=	libjson-c.so:devel/json-c \
 		libpcre2-8.so:devel/pcre2 \
 		libdrm.so:graphics/libdrm \
 		libwayland-egl.so:graphics/wayland \
-		libwlroots-0.18.so:x11-toolkits/wlroots018 \
+		libwlroots-0.19.so:x11-toolkits/wlroots019 \
 		libinput.so:x11/libinput \
 		libxkbcommon.so:x11/libxkbcommon
 
@@ -59,5 +58,10 @@ post-patch:
 	@${REINPLACE_CMD} -i .nogit -e 's/git.found()/false/' \
 		-e '/project_version/s/@0@/${DISTVERSIONFULL}/' \
 		${WRKSRC}/meson.build
+.if exists(${.CURDIR}/files/patch-common_stringop.c)
+# https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=275328
+	@${REINPLACE_CMD} -e 's/_POSIX_C_SOURCE=200809L/_XOPEN_SOURCE=700/' \
+		${WRKSRC}/meson.build
+.endif
 
 .include <bsd.port.mk>
diff --git a/x11-wm/sway/distinfo b/x11-wm/sway/distinfo
index 9920f6878fb7..d8e3cca705ea 100644
--- a/x11-wm/sway/distinfo
+++ b/x11-wm/sway/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1737899026
-SHA256 (swaywm-sway-1.10.1_GH0.tar.gz) = 8565ab3b359780f02b1dcb24dc48e5b6b82c64dd97ca795782c2fb4cab62457b
-SIZE (swaywm-sway-1.10.1_GH0.tar.gz) = 5582000
+TIMESTAMP = 1745148670
+SHA256 (swaywm-sway-1.11-rc1_GH0.tar.gz) = 12a6b49378d3a73bcd7e07f5a23655a63fc6b3d0b233eb0319dd5fd092b8a85a
+SIZE (swaywm-sway-1.11-rc1_GH0.tar.gz) = 5583472
diff --git a/x11-wm/sway/files/patch-common_stringop.c b/x11-wm/sway/files/patch-common_stringop.c
new file mode 100644
index 000000000000..5a9f187e11df
--- /dev/null
+++ b/x11-wm/sway/files/patch-common_stringop.c
@@ -0,0 +1,53 @@
+https://github.com/swaywm/sway/issues/8673#issuecomment-2818260191
+
+--- common/stringop.c.orig	2025-04-20 11:31:10 UTC
++++ common/stringop.c
+@@ -6,6 +6,8 @@
+ #include <string.h>
+ #include <strings.h>
+ #include <wordexp.h>
++#include <signal.h>
++#include <sys/wait.h>
+ #include "list.h"
+ #include "log.h"
+ #include "stringop.h"
+@@ -318,11 +320,34 @@ bool expand_path(char **path) {
+ 		char *ptr = strstr(*path, "  ") + 1;
+ 		memmove(ptr + 1, ptr, strlen(ptr) + 1);
+ 		*ptr = '\\';
+-	}
+-	if (wordexp(*path, &p, 0) != 0 || p.we_wordv[0] == NULL) {
+-		wordfree(&p);
+-		return false;
+-	}
++       }
++
++       // FreeBSD wordexp bug workaround:
++       // 1. Reset SIGCHLD handler
++       // 2. Run wordexp
++       // 3. Restore SIGCHLD handler and reap any processes that exited
++       struct sigaction prev_action;
++       struct sigaction new_action = {
++               .sa_flags = SA_RESETHAND,
++       };
++       if (sigaction(SIGCHLD, &new_action, &prev_action) != 0) {
++               sway_log(SWAY_ERROR, "Restoring sigchild before wordexp failed");
++               return false;
++       }
++
++       int res = wordexp(*path, &p, 0);
++
++       if (sigaction(SIGCHLD, &prev_action, NULL) != 0) {
++               sway_log(SWAY_ERROR, "Restoring sigchild after wordexp failed");
++       }
++
++       int status;
++       while (waitpid(-1, &status, WNOHANG) != -1 || errno == EINTR);
++
++       if (res != 0 || p.we_wordv[0] == NULL) {
++               wordfree(&p);
++               return false;
++       }
+ 	free(*path);
+ 	*path = join_args(p.we_wordv, p.we_wordc);
+ 	wordfree(&p);