git: 16ce45fc2070 - main - x11/waylock: add new port

From: Jan Beich <jbeich_at_FreeBSD.org>
Date: Mon, 06 Feb 2023 19:26:04 UTC
The branch main has been updated by jbeich:

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

commit 16ce45fc2070b7333d7c4f7d0040c14426f37748
Author:     Jan Beich <jbeich@FreeBSD.org>
AuthorDate: 2023-02-06 19:04:21 +0000
Commit:     Jan Beich <jbeich@FreeBSD.org>
CommitDate: 2023-02-06 19:25:58 +0000

    x11/waylock: add new port
    
    Waylock is a small screenlocker for Wayland compositors implementing
    ext-session-lock-v1. The ext-session-lock-v1 protocol is significantly
    more robust than previous client-side Wayland screen locking approaches.
    Importantly, the screenlocker crashing does not cause the session to be
    unlocked.
    
    https://github.com/ifreund/waylock
    
    PR:             269320
    Tested by:      Oleh Vinichenko
---
 x11/Makefile                          |  1 +
 x11/waylock/Makefile                  | 54 +++++++++++++++++++++++++++++++++++
 x11/waylock/distinfo                  |  7 +++++
 x11/waylock/files/patch-pam.d_waylock | 11 +++++++
 x11/waylock/pkg-descr                 |  5 ++++
 5 files changed, 78 insertions(+)

diff --git a/x11/Makefile b/x11/Makefile
index 72debe1a0ad2..bfc64723b375 100644
--- a/x11/Makefile
+++ b/x11/Makefile
@@ -407,6 +407,7 @@
     SUBDIR += way-displays
     SUBDIR += waybar
     SUBDIR += wayland-logout
+    SUBDIR += waylock
     SUBDIR += wayout
     SUBDIR += wbar
     SUBDIR += wcm
diff --git a/x11/waylock/Makefile b/x11/waylock/Makefile
new file mode 100644
index 000000000000..055a9769ae0e
--- /dev/null
+++ b/x11/waylock/Makefile
@@ -0,0 +1,54 @@
+PORTNAME=	waylock
+DISTVERSIONPREFIX=	v
+DISTVERSION=	0.6.2
+CATEGORIES=	x11 wayland
+
+MAINTAINER=	jbeich@FreeBSD.org
+COMMENT=	Small screenlocker for Wayland compositors
+WWW=		https://github.com/ifreund/waylock
+
+LICENSE=	ISCL
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+BUILD_DEPENDS=	wayland-protocols>0:graphics/wayland-protocols \
+		zig>=0.10.0:lang/zig
+LIB_DEPENDS=	libwayland-client.so:graphics/wayland \
+		libxkbcommon.so:x11/libxkbcommon
+RUN_DEPENDS=	unix-selfauth-helper>0:security/unix-selfauth-helper
+
+USES=		pkgconfig
+USE_GITHUB=	yes
+GH_ACCOUNT=	ifreund
+GH_TUPLE=	ifreund:zig-wayland:ace6aee:zig_wayland/deps/zig-wayland \
+		ifreund:zig-xkbcommon:bfd1f97:zig_xkbcommon/deps/zig-xkbcommon
+MAKE_ENV=	DESTDIR="${STAGEDIR}"
+CONFIGURE_ARGS=	--prefix "${PREFIX}" \
+		${WITH_DEBUG:D:U-Drelease-fast} \
+		${WITH_PIE:D-Dpie} \
+		${STRIP:C/.+/-Dstrip/} \
+		-Dcpu=${CPUTYPE:Ubaseline} \
+		--verbose
+NO_INSTALL=	yes # strip(1) breaks runtime
+PLIST_FILES=	bin/${PORTNAME} \
+		etc/pam.d/${PORTNAME}
+
+OPTIONS_DEFINE=	MANPAGES
+OPTIONS_DEFAULT=MANPAGES
+
+MANPAGES_BUILD_DEPENDS=	scdoc:textproc/scdoc
+MANPAGES_CONFIGURE_ON=	-Dman-pages=true
+MANPAGES_CONFIGURE_OFF=	-Dman-pages=false
+MANPAGES_PLIST_FILES=	share/man/man1/${PORTNAME}.1.gz
+
+post-patch:
+# Respect LOCALBASE for unix-selfauth-helper
+	@${REINPLACE_CMD} -e 's,/usr/local,${LOCALBASE},' \
+		${WRKSRC}/pam.d/${PORTNAME}
+
+do-build:
+	@(cd ${WRKSRC} && ${MAKE_ENV} zig build ${CONFIGURE_ARGS})
+
+do-test:
+	@(cd ${WRKSRC} && ${TEST_ENV} zig build test ${CONFIGURE_ARGS})
+
+.include <bsd.port.mk>
diff --git a/x11/waylock/distinfo b/x11/waylock/distinfo
new file mode 100644
index 000000000000..22fd6660b452
--- /dev/null
+++ b/x11/waylock/distinfo
@@ -0,0 +1,7 @@
+TIMESTAMP = 1675710261
+SHA256 (ifreund-waylock-v0.6.2_GH0.tar.gz) = b39e62241be0607339a531c0572805f7545f05292addd4708f99e836a6b14f59
+SIZE (ifreund-waylock-v0.6.2_GH0.tar.gz) = 18391
+SHA256 (ifreund-zig-wayland-ace6aee_GH0.tar.gz) = c6ebbf0d56db36a732d2e58deff090503b68928ceed538737de7cd4ea36681c6
+SIZE (ifreund-zig-wayland-ace6aee_GH0.tar.gz) = 55916
+SHA256 (ifreund-zig-xkbcommon-bfd1f97_GH0.tar.gz) = 0a5835a5eb216c1a59e20e59277270fc5ce5f440becadf6487965286ba4c1ce8
+SIZE (ifreund-zig-xkbcommon-bfd1f97_GH0.tar.gz) = 20467
diff --git a/x11/waylock/files/patch-pam.d_waylock b/x11/waylock/files/patch-pam.d_waylock
new file mode 100644
index 000000000000..ed32e2c01a3f
--- /dev/null
+++ b/x11/waylock/files/patch-pam.d_waylock
@@ -0,0 +1,11 @@
+"system-auth" doesn't exist on non-Linux.
+
+pam_unix(8) requires root priveleges to access master.passwd(5),
+so try authenticating via setuid helper first.
+
+--- pam.d/waylock.orig	2023-01-08 18:59:32 UTC
++++ pam.d/waylock
+@@ -1 +1,2 @@
+-auth include system-auth
++auth sufficient pam_exec.so return_prog_exit_status expose_authtok /usr/local/libexec/unix-selfauth-helper
++auth include system
diff --git a/x11/waylock/pkg-descr b/x11/waylock/pkg-descr
new file mode 100644
index 000000000000..1ac8f9906242
--- /dev/null
+++ b/x11/waylock/pkg-descr
@@ -0,0 +1,5 @@
+Waylock is a small screenlocker for Wayland compositors implementing
+ext-session-lock-v1. The ext-session-lock-v1 protocol is significantly
+more robust than previous client-side Wayland screen locking approaches.
+Importantly, the screenlocker crashing does not cause the session to be
+unlocked.