summaryrefslogtreecommitdiff
path: root/sysutils
diff options
context:
space:
mode:
Diffstat (limited to 'sysutils')
-rw-r--r--sysutils/seatd/Makefile26
-rw-r--r--sysutils/seatd/distinfo2
-rw-r--r--sysutils/seatd/patches/patch-seatd-0_7_0_common_drm_c12
-rw-r--r--sysutils/seatd/patches/patch-seatd-0_7_0_common_evdev_c12
-rw-r--r--sysutils/seatd/patches/patch-seatd-0_7_0_common_terminal_c36
-rw-r--r--sysutils/seatd/patches/patch-seatd-0_7_0_meson_build40
-rw-r--r--sysutils/seatd/patches/patch-seatd-0_7_0_seatd_client_c27
-rw-r--r--sysutils/seatd/patches/patch-seatd-0_7_0_tests_poller_c14
-rw-r--r--sysutils/seatd/pkg/DESCR16
-rw-r--r--sysutils/seatd/pkg/PLIST5
10 files changed, 190 insertions, 0 deletions
diff --git a/sysutils/seatd/Makefile b/sysutils/seatd/Makefile
new file mode 100644
index 0000000..b8083a9
--- /dev/null
+++ b/sysutils/seatd/Makefile
@@ -0,0 +1,26 @@
+COMMENT = Minimal seat management daemon and universal library
+
+V = 0.7.0
+PKGNAME = seatd-$V
+CATEGORIES = sysutils
+
+MASTER_SITES = https://git.sr.ht/~kennylevinsen/seatd/archive/
+
+DISTFILES = seatd-{}$V${EXTRACT_SUFX}
+
+SHARED_LIBS += seat 0.0 # 0.0
+
+WRKSRC = ${WRKDIR}/${PKGNAME}
+
+# MIT
+PERMIT_PACKAGE = Yes
+
+MODULES = devel/meson
+
+WANTLIB = c
+
+CONFIGURE_ARGS = -Dlibseat-logind=disabled \
+ -Dman-pages=disabled
+
+.include <bsd.port.mk>
+
diff --git a/sysutils/seatd/distinfo b/sysutils/seatd/distinfo
new file mode 100644
index 0000000..02448ab
--- /dev/null
+++ b/sysutils/seatd/distinfo
@@ -0,0 +1,2 @@
+SHA256 (seatd-0.7.0.tar.gz) = IQ3fjvoRSc3k3TWQi++OnmPC7aoM21Q18ubbJ3+v/zw=
+SIZE (seatd-0.7.0.tar.gz) = 39198
diff --git a/sysutils/seatd/patches/patch-seatd-0_7_0_common_drm_c b/sysutils/seatd/patches/patch-seatd-0_7_0_common_drm_c
new file mode 100644
index 0000000..33aca5a
--- /dev/null
+++ b/sysutils/seatd/patches/patch-seatd-0_7_0_common_drm_c
@@ -0,0 +1,12 @@
+Index: seatd-0.7.0/common/drm.c
+--- seatd-0.7.0/common/drm.c.orig
++++ seatd-0.7.0/common/drm.c
+@@ -20,7 +20,7 @@ int drm_drop_master(int fd) {
+ return ioctl(fd, DRM_IOCTL_DROP_MASTER, 0);
+ }
+
+-#if defined(__linux__) || defined(__NetBSD__)
++#if defined(__linux__) || defined(__NetBSD__) || defined(__OpenBSD__)
+ int path_is_drm(const char *path) {
+ static const char prefix[] = "/dev/dri/";
+ static const int prefixlen = STRLEN(prefix);
diff --git a/sysutils/seatd/patches/patch-seatd-0_7_0_common_evdev_c b/sysutils/seatd/patches/patch-seatd-0_7_0_common_evdev_c
new file mode 100644
index 0000000..a6d34b5
--- /dev/null
+++ b/sysutils/seatd/patches/patch-seatd-0_7_0_common_evdev_c
@@ -0,0 +1,12 @@
+Index: seatd-0.7.0/common/evdev.c
+--- seatd-0.7.0/common/evdev.c.orig
++++ seatd-0.7.0/common/evdev.c
+@@ -25,7 +25,7 @@ int path_is_evdev(const char *path) {
+ int evdev_revoke(int fd) {
+ return ioctl(fd, EVIOCREVOKE, NULL);
+ }
+-#elif defined(__NetBSD__)
++#elif defined(__NetBSD__) || defined(__OpenBSD__)
+ int path_is_evdev(const char *path) {
+ (void)path;
+ return 0;
diff --git a/sysutils/seatd/patches/patch-seatd-0_7_0_common_terminal_c b/sysutils/seatd/patches/patch-seatd-0_7_0_common_terminal_c
new file mode 100644
index 0000000..712cf18
--- /dev/null
+++ b/sysutils/seatd/patches/patch-seatd-0_7_0_common_terminal_c
@@ -0,0 +1,36 @@
+Index: seatd-0.7.0/common/terminal.c
+--- seatd-0.7.0/common/terminal.c.orig
++++ seatd-0.7.0/common/terminal.c
+@@ -21,7 +21,7 @@
+ #define K_ENABLE K_XLATE
+ #define K_DISABLE K_RAW
+ #define FRSIG SIGIO
+-#elif defined(__NetBSD__)
++#elif defined(__NetBSD__) || defined(__OpenBSD__)
+ #include <dev/wscons/wsdisplay_usl_io.h>
+ #define K_ENABLE K_XLATE
+ #define K_DISABLE K_RAW
+@@ -147,6 +147,14 @@ static int get_tty_path(int tty, char path[static TTYP
+ }
+ return 0;
+ }
++#elif defined(__OpenBSD__)
++static int get_tty_path(int tty, char path[static TTYPATHLEN]) {
++ assert(tty >= 0);
++ if (snprintf(path, TTYPATHLEN, "/dev/ttyC%d", tty) == -1) {
++ return -1;
++ }
++ return 0;
++}
+ #else
+ #error Unsupported platform
+ #endif
+@@ -175,7 +183,7 @@ int terminal_current_vt(int fd) {
+ return -1;
+ }
+ return st.v_active;
+-#elif defined(__FreeBSD__)
++#elif defined(__FreeBSD__) || defined(__OpenBSD__)
+ int vt;
+ int res = ioctl(fd, VT_GETACTIVE, &vt);
+ close(fd);
diff --git a/sysutils/seatd/patches/patch-seatd-0_7_0_meson_build b/sysutils/seatd/patches/patch-seatd-0_7_0_meson_build
new file mode 100644
index 0000000..82decfc
--- /dev/null
+++ b/sysutils/seatd/patches/patch-seatd-0_7_0_meson_build
@@ -0,0 +1,40 @@
+Index: seatd-0.7.0/meson.build
+--- seatd-0.7.0/meson.build.orig
++++ seatd-0.7.0/meson.build
+@@ -29,7 +29,7 @@ cc = meson.get_compiler('c')
+ add_project_arguments(
+ [
+ '-D_XOPEN_SOURCE=700',
+- '-D__BSD_VISIBLE',
++ '-D_BSD_SOURCE',
+ '-D_NETBSD_SOURCE',
+ '-DSEATD_VERSION="@0@"'.format(meson.project_version()),
+ '-DSEATD_DEFAULTPATH="@0@"'.format(defaultpath),
+@@ -158,8 +158,8 @@ if get_option('libseat-logind') != 'disabled'
+ endif
+
+ # needed for cross-compilation
+-realtime = meson.get_compiler('c').find_library('rt')
+-private_deps += realtime
++# realtime = meson.get_compiler('c').find_library('rt')
++# private_deps += realtime
+
+ if with_builtin
+ libseat_c_args += '-DBUILTIN_ENABLED=1'
+@@ -220,14 +220,14 @@ if with_server
+ [ server_files, 'seatd/seatd.c' ],
+ include_directories: [include_directories('.', 'include')],
+ install: true,
+- dependencies: [realtime],
++# dependencies: [realtime],
+ )
+ executable(
+ 'seatd-launch',
+ [ 'seatd-launch/seatd-launch.c' ],
+ include_directories: [include_directories('.', 'include')],
+ install: true,
+- dependencies: [realtime],
++# dependencies: [realtime],
+ )
+ endif
+
diff --git a/sysutils/seatd/patches/patch-seatd-0_7_0_seatd_client_c b/sysutils/seatd/patches/patch-seatd-0_7_0_seatd_client_c
new file mode 100644
index 0000000..887351c
--- /dev/null
+++ b/sysutils/seatd/patches/patch-seatd-0_7_0_seatd_client_c
@@ -0,0 +1,27 @@
+Index: seatd-0.7.0/seatd/client.c
+--- seatd-0.7.0/seatd/client.c.orig
++++ seatd-0.7.0/seatd/client.c
+@@ -55,6 +55,23 @@ static int get_peer(int fd, pid_t *pid, uid_t *uid, gi
+ *uid = cred.unp_euid;
+ *gid = cred.unp_egid;
+ return 0;
++#elif defined(__OpenBSD__)
++ struct sockpeercred peercred;
++ socklen_t len = sizeof(peercred);
++ if (getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &peercred, &len) == -1) {
++ // assume builtin backend
++ if (errno == EINVAL) {
++ *pid = getpid();
++ *uid = getuid();
++ *gid = getgid();
++ return 0;
++ }
++ return -1;
++ }
++ *pid = peercred.pid;
++ *uid = peercred.uid;
++ *gid = peercred.gid;
++ return 0;
+ #elif defined(__FreeBSD__)
+ struct xucred cred;
+ socklen_t len = sizeof cred;
diff --git a/sysutils/seatd/patches/patch-seatd-0_7_0_tests_poller_c b/sysutils/seatd/patches/patch-seatd-0_7_0_tests_poller_c
new file mode 100644
index 0000000..3dbcdd8
--- /dev/null
+++ b/sysutils/seatd/patches/patch-seatd-0_7_0_tests_poller_c
@@ -0,0 +1,14 @@
+Index: seatd-0.7.0/tests/poller.c
+--- seatd-0.7.0/tests/poller.c.orig
++++ seatd-0.7.0/tests/poller.c
+@@ -123,6 +123,10 @@ static int test_signal_event(int signal, void *data) {
+ return 0;
+ }
+
++#ifdef __OpenBSD__
++#define SIGRTMIN SIGUSR1
++#endif
++
+ static void test_poller_single_signal(void) {
+ struct poller poller;
+ test_assert(poller_init(&poller) == 0);
diff --git a/sysutils/seatd/pkg/DESCR b/sysutils/seatd/pkg/DESCR
new file mode 100644
index 0000000..1a38c14
--- /dev/null
+++ b/sysutils/seatd/pkg/DESCR
@@ -0,0 +1,16 @@
+seatd is a seat management daemon, that does everything it needs to
+do. Nothing more, nothing less. Depends only on libc.
+
+libseat is a seat management library allowing applications to use
+whatever seat management is available.
+
+Supports:
+- seatd
+- (e)logind
+- embedded seatd for standalone operation
+
+Each backend can be compile-time included and is runtime auto-detected
+or manually selected with the `LIBSEAT_BACKEND` environment variable.
+
+Which backend is in use is transparent to the application, providing a
+simple common interface.
diff --git a/sysutils/seatd/pkg/PLIST b/sysutils/seatd/pkg/PLIST
new file mode 100644
index 0000000..fa8d42c
--- /dev/null
+++ b/sysutils/seatd/pkg/PLIST
@@ -0,0 +1,5 @@
+@bin bin/seatd
+@bin bin/seatd-launch
+include/libseat.h
+@lib lib/libseat.so.${LIBseat_VERSION}
+lib/pkgconfig/libseat.pc