Skip to content

Commit

Permalink
x11-servers/xorg-server : enable udev to follow FreeBSD port configur…
Browse files Browse the repository at this point in the history
…ation
  • Loading branch information
daftaupe committed Dec 3, 2022
1 parent ea74715 commit 4106400
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 9 deletions.
17 changes: 8 additions & 9 deletions ports/x11-servers/xorg-server/diffs/Makefile.diff
@@ -1,18 +1,17 @@
--- Makefile.orig 2022-10-15 16:10:43.598460000 +0200
+++ Makefile 2022-10-15 16:12:16.366351000 +0200
@@ -69,9 +69,8 @@
--- Makefile.orig 2022-11-28 21:27:58.401842000 +0100
+++ Makefile 2022-11-28 21:28:41.162536000 +0100
@@ -69,8 +69,8 @@
.endfor

.if ${FLAVOR} == xorg
-LIB_DEPENDS+= libudev.so:devel/libudev-devd \
- libxcvt.so:x11/libxcvt
-MESON_ARGS+= -Dudev=true \
+LIB_DEPENDS+= libxcvt.so:x11/libxcvt
+MESON_ARGS+= -Dudev=false \
+LIB_DEPENDS+= libudev.so:devel/libudev-devd \
+ libxcvt.so:x11/libxcvt
MESON_ARGS+= -Dudev=true \
-Dlog_dir=/var/log \
-Dsuid_wrapper=true
.else
@@ -82,6 +81,10 @@
@@ -82,6 +82,10 @@
MESON_ARGS+= -Ddrm=true
LIB_DEPENDS+= libdrm.so:graphics/libdrm \
libepoxy.so:graphics/libepoxy
Expand All @@ -23,7 +22,7 @@
.endif

.if ${FLAVOR} == xephyr
@@ -120,7 +123,7 @@
@@ -120,7 +124,7 @@
MESON_ARGS+= -Dsha1=libmd
.endif

Expand Down
47 changes: 47 additions & 0 deletions ports/x11-servers/xorg-server/dragonfly/patch-config_udev.c
@@ -0,0 +1,47 @@
--- config/udev.c.orig 2022-11-29 08:50:23.563278000 +0100
+++ config/udev.c 2022-11-29 08:52:42.005561000 +0100
@@ -68,6 +68,44 @@

static char itoa_buf[16];

+// Taken from FreeBSD's lib/libc/gen/feature_present.c
+
+#include <sys/cdefs.h>
+
+#include <sys/types.h>
+#include <sys/sysctl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+int feature_present(const char *);
+/*
+ * Returns true if the named feature is present in the currently
+ * running kernel. A feature's presence is indicated by an integer
+ * sysctl node called kern.feature.<feature> that is non-zero.
+ */
+int
+feature_present(const char *feature)
+{
+ char *mib;
+ size_t len;
+ int i;
+
+ if (asprintf(&mib, "kern.features.%s", feature) < 0)
+ return (0);
+ len = sizeof(i);
+ if (sysctlbyname(mib, &i, &len, NULL, 0) < 0) {
+ free(mib);
+ return (0);
+ }
+ free(mib);
+ if (len != sizeof(i))
+ return (0);
+ return (i != 0);
+}
+
+// end of FreeBSD's lib/libc/gen/feature_present.c
+
static const char *itoa(int i)
{
snprintf(itoa_buf, sizeof(itoa_buf), "%d", i);

0 comments on commit 4106400

Please sign in to comment.