diff --git a/x11-servers/Makefile b/x11-servers/Makefile index 2942aa453f6b..0640585416a5 100644 --- a/x11-servers/Makefile +++ b/x11-servers/Makefile @@ -1,12 +1,13 @@ COMMENT = X11 servers SUBDIR += Xfstt SUBDIR += x2vnc SUBDIR += x2x SUBDIR += xarcan SUBDIR += xlibre-ephyr SUBDIR += xlibre-nest + SUBDIR += xlibre-server SUBDIR += xorg-server SUBDIR += xwayland .include diff --git a/x11-servers/xlibre-server/Makefile b/x11-servers/xlibre-server/Makefile new file mode 100644 index 000000000000..829d8dacc862 --- /dev/null +++ b/x11-servers/xlibre-server/Makefile @@ -0,0 +1,54 @@ +PORTNAME= xlibre-server +PORTVERSION= ${XLIBRE_VER} +CATEGORIES= x11-servers + +MAINTAINER= b-aazbsd@proton.me +COMMENT= Xlibre X server +WWW= https://github.com/X11Libre/xserver/ + +LICENSE= MIT + +CONFLICTS= xorg-server + +USES+= xlibre-cat:server + +OPTIONS_SUB= YES +OPTIONS_DEFINE= UDEV SUID +OPTIONS_DEFAULT=UDEV SUID + +UDEV_DESC= Enable udev (For libinput & autoconfiguration/hotplug). +UDEV_MESON_ON= -Dudev=true -Dudev_kms=true +UDEV_MESON_OFF= -Dudev=false -Dudev_kms=false +UDEV_LIB_DEPENDS= libudev.so:devel/libudev-devd + +SUID_DESC= Enable the setuid binary (For starting X as a normal user). +SUID_MESON_ON= -Dsuid_wrapper=true +SUID_MESON_OFF= -Dsuid_wrapper=false + +LIB_DEPENDS+= libxcvt.so:x11/libxcvt \ + libdrm.so:graphics/libdrm \ + libepoxy.so:graphics/libepoxy \ + libepoll-shim.so:devel/libepoll-shim + +MESON_ARGS+= -Dlog_dir=/var/log \ + -Ddrm=true + +PLIST_SUB+= FONTPATHD="${FONTPATHD:S,^${PREFIX}/,,}" + +USE_XORG+= pciaccess + +USE_GL+= gbm + +.include "../xlibre-server/Makefile.common" + +OLDMODULEDIR= /lib/xorg/modules +post-install: + @${MKDIR} ${STAGEDIR}${PREFIX}/etc/X11/xorg.conf.d + @${MKDIR} ${STAGEDIR}${PREFIX}${OLDMODULEDIR}/extensions + @${MKDIR} ${STAGEDIR}${PREFIX}${OLDMODULEDIR}/drivers + @${MKDIR} ${STAGEDIR}${PREFIX}${OLDMODULEDIR}/input + @${MKDIR} ${STAGEDIR}${FONTPATHD} + @${MKDIR} ${STAGEDIR}${PREFIX}/share/X11/xorg.conf.d + @${INSTALL_DATA} ${FILESDIR}/20-evdev-kbd.conf \ + ${STAGEDIR}${PREFIX}/share/X11/xorg.conf.d +.include diff --git a/x11-servers/xlibre-server/Makefile.common b/x11-servers/xlibre-server/Makefile.common new file mode 100644 index 000000000000..60f301137b51 --- /dev/null +++ b/x11-servers/xlibre-server/Makefile.common @@ -0,0 +1,90 @@ +_XMASTERDIR_REL=../xlibre-server/ +XMASTERDIR= ${_XMASTERDIR_REL:tA} +PATCHDIR?= ${XMASTERDIR}/files +DISTINFO_FILE?= ${XMASTERDIR}/distinfo + +.include "${XMASTERDIR}/Makefile.version" + + +USES+= gl compiler:c11 meson pkgconfig tar:xz xorg +USE_GL+= gl +USE_XORG+= pixman xau xdmcp xfont2 xkbfile xorgproto xshmfence xtrans + +OPTIONS_DEFINE+=LIBUNWIND +OPTIONS_DEFAULT+=LIBUNWIND +LIBUNWIND_DESC= Enable libunwind for better stack traces in case of an error. + +SERVERS= xorg xnest xephyr xvfb +SERVERNAME= ${PORTNAME:S/^xlibre-/x/:S/xserver/xorg/} + +BUILD_DEPENDS+= ${LOCALBASE}/libdata/pkgconfig/dri.pc:graphics/mesa-dri +RUN_DEPENDS+= xkeyboard-config>=2.5:x11/xkeyboard-config \ + xkbcomp:x11/xkbcomp \ + ${LOCALBASE}/libdata/pkgconfig/dri.pc:graphics/mesa-dri + +MESON_ARGS+= -Dxwin=false \ + -Dxquartz=false \ + -Ddtrace=false \ + -Dhal=false \ + -Dsystemd_logind=false \ + -Dxselinux=false \ + -Dfallback_input_driver=libinput \ + -Ddocs=false \ + -Dxcsecurity=true +MESON_ARGS+= -D${SERVERNAME}=true + +.for f in ${SERVERS:N${SERVERNAME}} +MESON_ARGS+= -D${f}=false +.endfor + +FONTPATH_ROOT?= ${LOCALBASE}/share/fonts +FONTPATHD?= ${PREFIX}/etc/X11/fontpath.d +DEFAULT_FONTPATH_LIST= \ + ${FONTPATH_ROOT}/misc/ \ + ${FONTPATH_ROOT}/TTF/ \ + ${FONTPATH_ROOT}/OTF/ \ + ${FONTPATH_ROOT}/Type1/ \ + ${FONTPATH_ROOT}/100dpi/ \ + ${FONTPATH_ROOT}/75dpi/ \ + catalogue:${FONTPATHD} +MESON_ARGS+= -Ddefault_font_path=${DEFAULT_FONTPATH_LIST:ts,} + + +# Non X server common flags +.if ${SERVERNAME} != xorg +MESON_ARGS+= -Dudev=false \ + -Dudev_kms=false +PLIST= +PKGMESSAGE= +BINARY_NAME= ${SERVERNAME:C/^(.).*/\1/:tu}${SERVERNAME:C/^.//} +PLIST_FILES= bin/${BINARY_NAME} \ + share/man/man1/${BINARY_NAME}.1.gz +.endif + +.include +.if ${OPSYS}==FreeBSD +AMD64=amd64 +.else +AMD64=x86_64 +.endif + +.if ${PORT_OPTIONS:MLIBUNWIND} +. if ${ARCH} == aarch64 || ${ARCH} == ${AMD64} || ${ARCH} == armv7 || ${ARCH} == i386 || ${ARCH} == powerpc || ${ARCH} == powerpc64 || ${ARCH} == powerpc64le +LIB_DEPENDS+= libunwind.so:devel/libunwind +MESON_ARGS+= -Dlibunwind=true +. endif +.else +MESON_ARGS+= -Dlibunwind=false +.endif + +.if ${OPSYS} == FreeBSD +MESON_ARGS+= -Dsha1=libmd +.endif + +.if ${SERVERNAME} != xorg +post-install: + ${RM} -r ${STAGEDIR}${PREFIX}/lib/xorg/protocol.txt + ${RMDIR} ${STAGEDIR}${PREFIX}/lib/xorg + ${RM} ${STAGEDIR}${PREFIX}/share/man/man1/Xserver.1 +.include +.endif diff --git a/x11-servers/xlibre-server/Makefile.version b/x11-servers/xlibre-server/Makefile.version new file mode 100644 index 000000000000..762f9dcca745 --- /dev/null +++ b/x11-servers/xlibre-server/Makefile.version @@ -0,0 +1,4 @@ +XLIBRE_MJR_VER=25.0 +XLIBRE_MIN_VER=0.16 + +XLIBRE_VER=${XLIBRE_MJR_VER}.${XLIBRE_MIN_VER} diff --git a/x11-servers/xlibre-server/distinfo b/x11-servers/xlibre-server/distinfo new file mode 100644 index 000000000000..9e7aa077a41f --- /dev/null +++ b/x11-servers/xlibre-server/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1763716462 +SHA256 (xlibre/server/X11Libre-xserver-25.0.0.16-xlibre-xserver-25.0.0.16_GH0.tar.gz) = 0187e57331daefa75ddc33a4f878ef4c08526b83dc91dbc51a25375d2ff33b8c +SIZE (xlibre/server/X11Libre-xserver-25.0.0.16-xlibre-xserver-25.0.0.16_GH0.tar.gz) = 5415775 diff --git a/x11-servers/xlibre-server/files/20-evdev-kbd.conf b/x11-servers/xlibre-server/files/20-evdev-kbd.conf new file mode 100644 index 000000000000..7a73fb641c36 --- /dev/null +++ b/x11-servers/xlibre-server/files/20-evdev-kbd.conf @@ -0,0 +1,6 @@ +Section "InputClass" + Identifier "Evdev keyboard" + MatchDevicePath "/dev/input/event*" + MatchIsKeyboard "on" + Option "XkbRules" "evdev" +EndSection diff --git a/x11-servers/xlibre-server/files/patch-config_udev.c b/x11-servers/xlibre-server/files/patch-config_udev.c new file mode 100644 index 000000000000..38b3e84db5ad --- /dev/null +++ b/x11-servers/xlibre-server/files/patch-config_udev.c @@ -0,0 +1,56 @@ +* Don't pass the device parameter when using kbdmux to prevent conflict +* +* Specify a driver to use for basic devices (keyboard and mouse), otherwise none attaches +* +--- config/udev.c.orig 2017-03-15 18:05:25 UTC ++++ config/udev.c +@@ -29,6 +29,7 @@ + + #include + #include ++#include + #include + + #include "input.h" +@@ -188,7 +189,21 @@ device_added(struct udev_device *udev_de + attrs.product = strdup(name); + input_options = input_option_new(input_options, "name", name); + input_options = input_option_new(input_options, "path", path); +- input_options = input_option_new(input_options, "device", path); ++ if(strstr(path, "kbdmux") != NULL) { ++ /* ++ * Don't pass "device" option if the keyboard is already attached ++ * to the console (ie. open() fails). This would activate a special ++ * logic in xf86-input-keyboard. Prevent any other attached to console ++ * keyboards being processed. There can be only one such device. ++ */ ++ int fd = open(path, O_RDONLY); ++ if (fd > -1) { ++ close(fd); ++ input_options = input_option_new(input_options, "device", path); ++ } ++ } ++ else ++ input_options = input_option_new(input_options, "device", path); + input_options = input_option_new(input_options, "major", itoa(major(devnum))); + input_options = input_option_new(input_options, "minor", itoa(minor(devnum))); + if (path) +@@ -272,6 +287,18 @@ device_added(struct udev_device *udev_de + } + } + ++ if (attrs.flags & (ATTR_KEY | ATTR_KEYBOARD)) { ++ if (!feature_present("evdev_support")) ++ input_options = input_option_new(input_options, "driver", "kbd"); ++ } else if (attrs.flags & ATTR_POINTER) { ++ if (strstr(path, "vbox")) ++ input_options = input_option_new(input_options, "driver", "vboxmouse"); ++ else { ++ if (!feature_present("evdev_support")) ++ input_options = input_option_new(input_options, "driver", "mouse"); ++ } ++ } ++ + input_options = input_option_new(input_options, "config_info", config_info); + + /* Default setting needed for non-seat0 seats */ diff --git a/x11-servers/xlibre-server/files/patch-hw_xfree86_compat_ones.c b/x11-servers/xlibre-server/files/patch-hw_xfree86_compat_ones.c new file mode 100644 index 000000000000..1a296ff48141 --- /dev/null +++ b/x11-servers/xlibre-server/files/patch-hw_xfree86_compat_ones.c @@ -0,0 +1,15 @@ +--- hw/xfree86/compat/ones.c.orig ++++ hw/xfree86/compat/ones.c +@@ -20,8 +20,12 @@ int + Ones(unsigned long mask) + { /* HACKMEM 169 */ + /* can't add a message here because this should be fast */ ++#if defined __has_builtin + #if __has_builtin(__builtin_popcountl) + return __builtin_popcountl (mask); ++#endif ++#elif defined __builtin_popcountl ++ return __builtin_popcountl (mask); + #else + unsigned long y; + diff --git a/x11-servers/xlibre-server/files/patch-hw_xfree86_meson.build b/x11-servers/xlibre-server/files/patch-hw_xfree86_meson.build new file mode 100644 index 000000000000..5b5e9e9bc038 --- /dev/null +++ b/x11-servers/xlibre-server/files/patch-hw_xfree86_meson.build @@ -0,0 +1,11 @@ +--- hw/xfree86/meson.build.orig 2022-06-29 14:37:28.042085000 +0000 ++++ hw/xfree86/meson.build 2022-06-29 14:37:36.259147000 +0000 +@@ -152,7 +152,7 @@ if get_option('suid_wrapper') + c_args: xorg_c_args, + install: true, + install_dir: get_option('libexecdir'), +- install_mode: ['r-sr-xr-x', 0, 0], ++ # install_mode: ['r-sr-xr-x', 0, 0], + ) + + # meson gets confused when there are two targets of the same name diff --git a/x11-servers/xlibre-server/files/patch-hw_xfree86_os-support_bsd_bsd__init.c b/x11-servers/xlibre-server/files/patch-hw_xfree86_os-support_bsd_bsd__init.c new file mode 100644 index 000000000000..54bedf2a4c75 --- /dev/null +++ b/x11-servers/xlibre-server/files/patch-hw_xfree86_os-support_bsd_bsd__init.c @@ -0,0 +1,55 @@ +--- hw/xfree86/os-support/bsd/bsd_init.c.orig 2023-10-25 01:40:28 UTC ++++ hw/xfree86/os-support/bsd/bsd_init.c +@@ -48,6 +48,8 @@ static int initialVT = -1; + #if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) + static int VTnum = -1; + static int initialVT = -1; ++static struct termios tty_attr; /* tty state to restore */ ++static int tty_mode; /* kbd mode to restore */ + #endif + + #ifdef PCCONS_SUPPORT +@@ -253,6 +255,7 @@ xf86OpenConsole() + #endif + acquire_vt: + if (!xf86Info.ShareVTs) { ++ struct termios nTty; + /* + * now get the VT + */ +@@ -287,6 +290,26 @@ xf86OpenConsole() + if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS) < 0) { + FatalError("xf86OpenConsole: KDSETMODE KD_GRAPHICS failed"); + } ++ ++ tcgetattr(xf86Info.consoleFd, &tty_attr); ++ ioctl(xf86Info.consoleFd, KDGKBMODE, &tty_mode); ++ ++ /* disable special keys */ ++ if (ioctl(xf86Info.consoleFd, KDSKBMODE, K_RAW) < 0) { ++ FatalError("xf86OpenConsole: KDSKBMODE K_RAW failed (%s)", ++ strerror(errno)); ++ } ++ ++ nTty = tty_attr; ++ nTty.c_iflag = IGNPAR | IGNBRK; ++ nTty.c_oflag = 0; ++ nTty.c_cflag = CREAD | CS8; ++ nTty.c_lflag = 0; ++ nTty.c_cc[VTIME] = 0; ++ nTty.c_cc[VMIN] = 1; ++ cfsetispeed(&nTty, 9600); ++ cfsetospeed(&nTty, 9600); ++ tcsetattr(xf86Info.consoleFd, TCSANOW, &nTty); + } + else { /* xf86Info.ShareVTs */ + close(xf86Info.consoleFd); +@@ -594,6 +617,8 @@ xf86CloseConsole() + case SYSCONS: + case PCVT: + ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT); /* Back to text mode */ ++ ioctl(xf86Info.consoleFd, KDSKBMODE, tty_mode); ++ tcsetattr(xf86Info.consoleFd, TCSANOW, &tty_attr); + if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) != -1) { + VT.mode = VT_AUTO; + ioctl(xf86Info.consoleFd, VT_SETMODE, &VT); /* dflt vt handling */ diff --git a/x11-servers/xlibre-server/files/patch-hw_xfree86_os-support_meson.build b/x11-servers/xlibre-server/files/patch-hw_xfree86_os-support_meson.build new file mode 100644 index 000000000000..24b04eec83ec --- /dev/null +++ b/x11-servers/xlibre-server/files/patch-hw_xfree86_os-support_meson.build @@ -0,0 +1,10 @@ +--- hw/xfree86/os-support/meson.build.orig 2025-07-20 14:22:32 UTC ++++ hw/xfree86/os-support/meson.build +@@ -98,6 +98,7 @@ elif host_machine.system().endswith('bsd') + 'bsd/bsd_bell.c', + 'bsd/bsd_init.c', + 'shared/drm_platform.c', ++ 'misc/SlowBcopy.c', + 'shared/pm_noop.c' + ] + diff --git a/x11-servers/xlibre-server/files/patch-hw_xfree86_xorg-wrapper.c b/x11-servers/xlibre-server/files/patch-hw_xfree86_xorg-wrapper.c new file mode 100644 index 000000000000..9a4327eff91f --- /dev/null +++ b/x11-servers/xlibre-server/files/patch-hw_xfree86_xorg-wrapper.c @@ -0,0 +1,23 @@ +* Skip the detection of root rights requirement, the assumption that presence +* of KMS drivers removes the root requirement is only valid for Linux +* +--- hw/xfree86/xorg-wrapper.c.orig 2022-01-02 23:41:56.000000000 +0100 ++++ hw/xfree86/xorg-wrapper.c 2022-06-29 16:28:24.797008000 +0200 +@@ -191,7 +191,7 @@ int main(int argc, char *argv[]) + + int main(int argc, char *argv[]) + { +-#ifdef WITH_LIBDRM ++#if defined(WITH_LIBDRM) && defined(__linux__) + struct drm_mode_card_res res; + #endif + char buf[PATH_MAX]; +@@ -230,7 +230,7 @@ int main(int argc, char *argv[]) + } + } + +-#ifdef WITH_LIBDRM ++#if defined(WITH_LIBDRM) && defined(__linux__) + /* Detect if we need root rights, except when overridden by the config */ + if (needs_root_rights == -1) { + for (i = 0; i < 16; i++) { diff --git a/x11-servers/xlibre-server/files/patch-meson.build b/x11-servers/xlibre-server/files/patch-meson.build new file mode 100644 index 000000000000..f933599bfac2 --- /dev/null +++ b/x11-servers/xlibre-server/files/patch-meson.build @@ -0,0 +1,11 @@ +--- meson.build.orig 2025-09-16 15:49:48 UTC ++++ meson.build +@@ -456,7 +456,7 @@ else + build_dri2 = get_option('dri2') == 'true' + endif + +-if host_machine.system() in ['freebsd', 'openbsd'] ++if host_machine.system() in ['dragonfly', 'freebsd', 'openbsd'] + epoll_dep = dependency('epoll-shim') + else + epoll_dep = [] diff --git a/x11-servers/xlibre-server/files/patch-os-utils.c b/x11-servers/xlibre-server/files/patch-os-utils.c new file mode 100644 index 000000000000..8f9c4f1f137d --- /dev/null +++ b/x11-servers/xlibre-server/files/patch-os-utils.c @@ -0,0 +1,18 @@ +--- os/utils.c.orig 2014-04-15 01:01:57 UTC ++++ os/utils.c +@@ -443,11 +443,11 @@ GetTimeInMillis(void) + static clockid_t clockid; + + if (!clockid) { +-#ifdef CLOCK_MONOTONIC_COARSE +- if (clock_getres(CLOCK_MONOTONIC_COARSE, &tp) == 0 && ++#ifdef CLOCK_MONOTONIC_FAST ++ if (clock_getres(CLOCK_MONOTONIC_FAST, &tp) == 0 && + (tp.tv_nsec / 1000) <= 1000 && +- clock_gettime(CLOCK_MONOTONIC_COARSE, &tp) == 0) +- clockid = CLOCK_MONOTONIC_COARSE; ++ clock_gettime(CLOCK_MONOTONIC_FAST, &tp) == 0) ++ clockid = CLOCK_MONOTONIC_FAST; + else + #endif + if (clock_gettime(CLOCK_MONOTONIC, &tp) == 0) diff --git a/x11-servers/xlibre-server/files/pkg-message.in b/x11-servers/xlibre-server/files/pkg-message.in new file mode 100644 index 000000000000..07198f4e1924 --- /dev/null +++ b/x11-servers/xlibre-server/files/pkg-message.in @@ -0,0 +1,35 @@ +[ +{ type: install + message: <