git: 68a0a83b6089 - main - x11/waycheck: add port: Simple GUI that displays the protocols implemented by a Wayland compositor

From: Hiroki Tagato <tagattie_at_FreeBSD.org>
Date: Fri, 29 Aug 2025 14:14:55 UTC
The branch main has been updated by tagattie:

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

commit 68a0a83b60890ef5d9719e5b00b3559751ea6d2b
Author:     Hiroki Tagato <tagattie@FreeBSD.org>
AuthorDate: 2025-08-29 14:13:43 +0000
Commit:     Hiroki Tagato <tagattie@FreeBSD.org>
CommitDate: 2025-08-29 14:13:43 +0000

    x11/waycheck: add port: Simple GUI that displays the protocols implemented by a Wayland compositor
    
    Waycheck is a simple Qt6 application that displays all of the Wayland
    protocols that your compositor supports, and all of the protocols that
    it doesn't support. It can be used to compare protocol support between
    compositors, or if you're working on your own compositor, to keep
    track of which protocols you still need to implement.
    
    WWW: https://gitlab.freedesktop.org/serebit/waycheck
---
 x11/Makefile                             |  1 +
 x11/waycheck/Makefile                    | 30 +++++++++++++++++
 x11/waycheck/distinfo                    |  3 ++
 x11/waycheck/files/patch-meson.build     | 15 +++++++++
 x11/waycheck/files/patch-src_meson.build | 10 ++++++
 x11/waycheck/files/patch-src_window.cpp  | 56 ++++++++++++++++++++++++++++++++
 x11/waycheck/pkg-descr                   |  5 +++
 7 files changed, 120 insertions(+)

diff --git a/x11/Makefile b/x11/Makefile
index 4b4ee4a3f246..e641d7dcf4ed 100644
--- a/x11/Makefile
+++ b/x11/Makefile
@@ -460,6 +460,7 @@
     SUBDIR += watershot
     SUBDIR += way-displays
     SUBDIR += waybar
+    SUBDIR += waycheck
     SUBDIR += waycorner
     SUBDIR += wayidle
     SUBDIR += wayland-logout
diff --git a/x11/waycheck/Makefile b/x11/waycheck/Makefile
new file mode 100644
index 000000000000..65b41ff8c51d
--- /dev/null
+++ b/x11/waycheck/Makefile
@@ -0,0 +1,30 @@
+PORTNAME=	waycheck
+DISTVERSIONPREFIX=	v
+DISTVERSION=	1.7.0
+CATEGORIES=	x11 wayland
+
+MAINTAINER=	tagattie@FreeBSD.org
+COMMENT=	Simple GUI that displays the protocols implemented by a Wayland compositor
+WWW=		https://gitlab.freedesktop.org/serebit/waycheck
+
+LICENSE=		APACHE20 CC0-1.0
+LICENSE_COMB=		multi
+LICENSE_FILE_APACHE20=	${WRKSRC}/LICENSES/Apache-2.0.txt
+LICENSE_FILE_CC0-1.0=	${WRKSRC}/LICENSES/CC0-1.0.txt
+
+LIB_DEPENDS=	libwayland-client.so:graphics/wayland
+
+USES=		meson pkgconfig qt:6
+
+USE_GITLAB=	yes
+GL_SITE=	https://gitlab.freedesktop.org/
+GL_ACCOUNT=	serebit
+
+USE_QT=		base wayland
+
+PLIST_FILES=	bin/${PORTNAME} \
+		share/applications/dev.serebit.Waycheck.desktop \
+		share/icons/hicolor/scalable/apps/dev.serebit.Waycheck.svg \
+		share/metainfo/dev.serebit.Waycheck.metainfo.xml
+
+.include <bsd.port.mk>
diff --git a/x11/waycheck/distinfo b/x11/waycheck/distinfo
new file mode 100644
index 000000000000..c3dab321fc1d
--- /dev/null
+++ b/x11/waycheck/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1756195503
+SHA256 (waycheck-v1.7.0.tar.bz2) = 658caca3d967d9b23bb1f6d42c6fd67832263bb60fd600a26e97748d0e47e105
+SIZE (waycheck-v1.7.0.tar.bz2) = 21545
diff --git a/x11/waycheck/files/patch-meson.build b/x11/waycheck/files/patch-meson.build
new file mode 100644
index 000000000000..882534abc553
--- /dev/null
+++ b/x11/waycheck/files/patch-meson.build
@@ -0,0 +1,15 @@
+--- meson.build.orig	2025-08-27 20:19:12 UTC
++++ meson.build
+@@ -16,6 +16,12 @@ dep_wayland_client = dependency('wayland-client')
+ )
+ dep_wayland_client = dependency('wayland-client')
+ 
++cc = meson.get_compiler('cpp')
++dep_libutil = dependency('', required : false)
++if host_machine.system() == 'freebsd'
++  dep_libutil = cc.find_library('util', required : true)
++endif
++
+ datadir = get_option('datadir')
+ 
+ subdir('src')
diff --git a/x11/waycheck/files/patch-src_meson.build b/x11/waycheck/files/patch-src_meson.build
new file mode 100644
index 000000000000..decf26941ea7
--- /dev/null
+++ b/x11/waycheck/files/patch-src_meson.build
@@ -0,0 +1,10 @@
+--- src/meson.build.orig	2025-08-27 20:18:18 UTC
++++ src/meson.build
+@@ -15,6 +15,6 @@ waycheck = executable(
+ waycheck = executable(
+     'waycheck',
+     sources: waycheck_sources,
+-    dependencies: [dep_qt6, dep_wayland_client],
++    dependencies: [dep_qt6, dep_wayland_client, dep_libutil],
+     install: true,
+ )
diff --git a/x11/waycheck/files/patch-src_window.cpp b/x11/waycheck/files/patch-src_window.cpp
new file mode 100644
index 000000000000..6e976a9c5ffb
--- /dev/null
+++ b/x11/waycheck/files/patch-src_window.cpp
@@ -0,0 +1,56 @@
+--- src/window.cpp.orig	2025-06-27 19:43:51 UTC
++++ src/window.cpp
+@@ -13,7 +13,24 @@
+ #include <unistd.h>
+ #include <wayland-client-protocol.h>
+ 
++#if defined(__FreeBSD__)
++#include <sys/types.h>
++#include <sys/ucred.h>
++#include <sys/un.h>
++#include <sys/user.h>
++#include <libutil.h>
++#endif
++
+ static pid_t pid_from_fd(const int fd) {
++#if defined(__FreeBSD__)
++    xucred cred{};
++    socklen_t len = sizeof(struct xucred);
++    if (getsockopt(fd, SOL_LOCAL, LOCAL_PEERCRED, &cred, &len) == -1) {
++        perror("getsockopt failed");
++        exit(1);
++    }
++    return cred.cr_pid;
++#else
+     ucred cred{};
+     socklen_t len = sizeof(struct ucred);
+     if (getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &cred, &len) == -1) {
+@@ -21,9 +38,19 @@ static pid_t pid_from_fd(const int fd) {
+         exit(1);
+     }
+     return cred.pid;
++#endif
+ }
+ 
+ static std::string process_name_from_pid(const pid_t pid) {
++#if defined(__FreeBSD__)
++    struct kinfo_proc *proc = kinfo_getproc(pid);
++
++    if (proc) {
++        std::string out = proc->ki_comm;
++        free(proc);
++        return out;
++    }
++#else
+     const std::string procpath = QString::asprintf("/proc/%d/comm", pid).toStdString();
+ 
+     std::ifstream infile(procpath);
+@@ -38,7 +65,7 @@ static std::string process_name_from_pid(const pid_t p
+         // running in a flatpak or a snap, most likely
+         return "Unknown (Sandboxed)";
+     }
+-
++#endif
+     return "Unknown";
+ }
+ 
diff --git a/x11/waycheck/pkg-descr b/x11/waycheck/pkg-descr
new file mode 100644
index 000000000000..fcdbdc739f27
--- /dev/null
+++ b/x11/waycheck/pkg-descr
@@ -0,0 +1,5 @@
+Waycheck is a simple Qt6 application that displays all of the Wayland
+protocols that your compositor supports, and all of the protocols that
+it doesn't support. It can be used to compare protocol support between
+compositors, or if you're working on your own compositor, to keep
+track of which protocols you still need to implement.