1 # Buildsheet autogenerated by ravenadm tool -- Do not edit.
7 VARIANTS= standard virtual xephyr nest
8 SDESC[xephyr]= X server from X.Org based on kdrive
9 SDESC[virtual]= X virtual framebuffer server from X.Org
10 SDESC[standard]= X.Org X server and related programs
11 SDESC[nest]= Nesting X server from X.Org
12 HOMEPAGE= https://www.x.org/
16 SITES[main]= XORG/individual/xserver
17 DISTFILE[1]= xorg-server-21.1.11.tar.xz:main
19 SPKGS[xephyr]= complete
22 SPKGS[virtual]= complete
25 SPKGS[standard]= complete
33 OPTIONS_AVAILABLE= XORG VIRTUAL XEPHYR NEST UDEV
34 OPTIONS_STANDARD= XORG UDEV
35 VOPTS[xephyr]= XORG=OFF VIRTUAL=OFF XEPHYR=ON NEST=OFF UDEV=OFF
36 VOPTS[virtual]= XORG=OFF VIRTUAL=ON XEPHYR=OFF NEST=OFF UDEV=OFF
37 VOPTS[nest]= XORG=OFF VIRTUAL=OFF XEPHYR=OFF NEST=ON UDEV=OFF
41 OPT_ON[midnightbsd]= UDEV
43 BUILD_DEPENDS= libdrm:dev:standard
44 libgpg-error:dev:standard
45 BUILDRUN_DEPENDS= xorg-xkbcomp:single:standard
46 RUN_DEPENDS= xorg-xkeyboard-config:primary:standard
47 EXRUN[dev]= xorg-pixman:dev:standard
48 xorg-pciaccess:dev:standard
50 USES= cpe perl:build ssl solaris-funcs meson zlib:build
51 XORG_COMPONENTS= xorgproto xtransproto pixman xshmfence xau xdmcp
55 LICENSE_FILE= MIT:{{WRKSRC}}/COPYING
59 FPC_EQUIVALENT= x11-servers/xorg-server
60 MESON_ARGS= -Dxkb_dir="{{LOCALBASE}}/share/X11/xkb"
61 -Ddefault_font_path="{{fontlist:ts,}}"
69 -Dsystemd_logind=false
71 -Dfallback_input_driver=libinput
72 -Dxkb_dir={{LOCALBASE}}/share/X11/xkb
73 -Dxkb_output_dir=/var/lib/xkb
74 SOL_FUNCTIONS= strnlen:xkb/XKBGAlloc.c
76 VAR_OPSYS[sunos]= CFLAGS=-DO_CLOEXEC=0
77 VAR_OPSYS[netbsd]= CPPFLAGS=-D_OPENBSD_SOURCE
78 CONFIGURE_ARGS=-Dsecure-rpc=false
80 [NEST].DESCRIPTION= Build as nesting X server
81 [NEST].BUILDRUN_DEPENDS_ON= libglvnd:primary:standard
82 [NEST].BUILD_DEPENDS_ON= libepoxy:primary:standard
87 [NEST].CONFIGURE_ARGS_OFF= -Dxnest=false
88 [NEST].CONFIGURE_ARGS_ON= -Dxnest=true
89 [NEST].XORG_COMPONENTS_ON= x11
92 [UDEV].DESCRIPTION= Use udev for autoconfiguration of input devices
93 [UDEV].BUILDRUN_DEPENDS_ON= libudev-devd:primary:standard
94 [UDEV].BUILD_DEPENDS_ON= libudev-devd:dev:standard
95 [UDEV].CONFIGURE_ARGS_OFF= -Dudev=false
96 [UDEV].CONFIGURE_ARGS_ON= -Dudev=true
98 [XEPHYR].DESCRIPTION= Build as kdrive-base X server
99 [XEPHYR].BUILDRUN_DEPENDS_ON= libdrm:primary:standard
100 libepoxy:primary:standard
101 libglvnd:primary:standard
102 [XEPHYR].BUILD_DEPENDS_ON= mesa:drivers:standard
104 libepoxy:dev:standard
105 libglvnd:dev:standard
106 [XEPHYR].CONFIGURE_ARGS_OFF= -Dxephyr=false
107 [XEPHYR].CONFIGURE_ARGS_ON= -Dxephyr=true
108 [XEPHYR].XORG_COMPONENTS_ON= x11
116 [VIRTUAL].DESCRIPTION= Build as virtual framebuffer server
117 [VIRTUAL].BUILDRUN_DEPENDS_ON= libglvnd:primary:standard
118 [VIRTUAL].BUILD_DEPENDS_ON= libepoxy:primary:standard
119 libepoxy:dev:standard
120 mesa:drivers:standard
122 libglvnd:dev:standard
123 [VIRTUAL].CONFIGURE_ARGS_OFF= -Dxvfb=false
124 [VIRTUAL].CONFIGURE_ARGS_ON= -Dxvfb=true
126 [XORG].DESCRIPTION= Build as X server (don't change setting!)
127 [XORG].BUILDRUN_DEPENDS_ON= libdrm:primary:standard
128 libepoxy:primary:standard
129 mesa:drivers:standard
130 xorg-xcvt:primary:standard
131 [XORG].BUILD_DEPENDS_ON= xmlto:single:standard
132 xorg-sgml-doctools:single:standard
134 libepoxy:dev:standard
135 xorg-xcvt:dev:standard
136 [XORG].CONFIGURE_ARGS_OFF= -Ddocs=false
139 [XORG].CONFIGURE_ARGS_ON= -Ddocs=true
144 [XORG].XORG_COMPONENTS_ON= pciaccess
147 post-install-XORG-OFF:
148 ${RM} -r ${STAGEDIR}${PREFIX}/lib/xorg
149 ${RM} ${STAGEDIR}${PREFIX}/share/man/man1/Xserver.1
150 ${MKDIR} ${STAGEDIR}/var/lib/xkb
152 post-install-XORG-ON:
153 ${RM} -r ${STAGEDIR}${STD_DOCDIR}
154 ${MKDIR} ${STAGEDIR}${PREFIX}/share/X11/xorg.conf.d
155 ${MKDIR} ${STAGEDIR}${PREFIX}/etc/X11/xorg.conf.d
156 ${MKDIR} ${STAGEDIR}${fontpathd}
157 ${MKDIR} ${STAGEDIR}/var/lib/xkb
158 ${INSTALL_DATA} ${FILESDIR}/20-evdev-kbd.conf \
159 ${STAGEDIR}${PREFIX}/share/X11/xorg.conf.d
161 [FILE:71:descriptions/desc.primary.standard]
162 This package contains the X.Org X server and some associated programs.
165 [FILE:60:descriptions/desc.primary.virtual]
166 This package contains Xvfb, a virtual framebuffer X server.
169 [FILE:173:descriptions/desc.primary.xephyr]
170 Xephyr is a kdrive server that outputs to a window on a pre-existing
171 'host' X display. Think Xnest but with support for modern extensions
172 like composite, damage and randr.
175 [FILE:78:descriptions/desc.primary.nest]
176 This package contains Xnest, a nesting X Server that displays on an X
181 1d3dadbd57fb86b16a018e9f5f957aeeadf744f56c0553f55737628d06d326ef 4985464 xorg-server-21.1.11.tar.xz
184 [FILE:432:manifests/plist.primary.standard]
189 etc/X11/xorg.conf.d/10-quirks.conf
190 lib/xorg/protocol.txt
199 lib/xorg/modules/drivers/modesetting_drv.so
200 lib/xorg/modules/extensions/libglx.so
201 lib/xorg/modules/input/inputtest_drv.so
203 @(,,4555) libexec/Xorg.wrap
204 share/X11/xorg.conf.d/20-evdev-kbd.conf
206 @dir etc/X11/fontpath.d
209 [FILE:216:manifests/plist.man.standard]
226 [FILE:1983:manifests/plist.dev.standard]
227 %%ONLY-SUNOS%%include/xorg/solaris-amd64.il
343 xf86-input-inputtest-protocol.h
385 lib/pkgconfig/xorg-server.pc
386 share/aclocal/xorg-server.m4
389 [FILE:27:manifests/plist.primary.virtual]
394 [FILE:25:manifests/plist.man.virtual]
395 share/man/man1/Xvfb.1.gz
398 [FILE:29:manifests/plist.primary.xephyr]
403 [FILE:27:manifests/plist.man.xephyr]
404 share/man/man1/Xephyr.1.gz
407 [FILE:28:manifests/plist.primary.nest]
412 [FILE:26:manifests/plist.man.nest]
413 share/man/man1/Xnest.1.gz
416 [FILE:293:patches/patch-config_config-backends.h]
417 --- config/config-backends.h.orig 2023-12-13 01:31:04 UTC
418 +++ config/config-backends.h
419 @@ -44,3 +44,8 @@ void config_hal_fini(void);
420 int config_wscons_init(void);
421 void config_wscons_fini(void);
425 +int config_devd_init(void);
426 +void config_devd_fini(void);
430 [FILE:537:patches/patch-config_config.c]
431 --- config/config.c.orig 2023-12-13 01:31:04 UTC
433 @@ -55,6 +55,9 @@ config_init(void)
434 #elif defined(CONFIG_WSCONS)
435 if (!config_wscons_init())
436 ErrorF("[config] failed to initialise wscons\n");
437 +#elif defined(CONFIG_DEVD)
438 + if (!config_devd_init())
439 + ErrorF("[config] failed to initialise devd\n");
443 @@ -67,6 +70,8 @@ config_fini(void)
445 #elif defined(CONFIG_WSCONS)
446 config_wscons_fini();
447 +#elif defined(CONFIG_DEVD)
448 + config_devd_fini();
454 [FILE:12171:patches/patch-config_devd.c]
455 --- /dev/null 2024-01-16 12:14:31 UTC
459 + * Copyright (c) 2012 Baptiste Daroussin
460 + * Copyright (c) 2013, 2014 Alex Kozlov
461 + * Copyright (c) 2014 Robert Millan
462 + * Copyright (c) 2014 Jean-Sebastien Pedron
464 + * Permission is hereby granted, free of charge, to any person obtaining a
465 + * copy of this software and associated documentation files (the "Software"),
466 + * to deal in the Software without restriction, including without limitation
467 + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
468 + * and/or sell copies of the Software, and to permit persons to whom the
469 + * Software is furnished to do so, subject to the following conditions:
471 + * The above copyright notice and this permission notice (including the next
472 + * paragraph) shall be included in all copies or substantial portions of the
475 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
476 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
477 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
478 + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
479 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
480 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
481 + * DEALINGS IN THE SOFTWARE.
483 + * Author: Baptiste Daroussin <bapt@FreeBSD.org>
486 +#ifdef HAVE_DIX_CONFIG_H
487 +#include <dix-config.h>
490 +#include <sys/types.h>
491 +#include <sys/kbio.h>
492 +#include <sys/socket.h>
493 +#include <sys/stat.h>
494 +#include <sys/sysctl.h>
502 +#include <stdbool.h>
506 +#include "inputstr.h"
507 +#include "hotplug.h"
508 +#include "config-backends.h"
511 +#define DEVD_SOCK_PATH "/var/run/devd.pipe"
513 +#define DEVD_EVENT_ADD '+'
514 +#define DEVD_EVENT_REMOVE '-'
516 +#define RECONNECT_DELAY 5 * 1000
518 +static int sock_devd;
519 +static bool is_console_kbd = false;
520 +static bool is_kbdmux = false;
521 +static OsTimerPtr rtimer = NULL;
524 + const char *driver;
526 + const char *xdriver;
529 +static struct hw_type hw_types[] = {
530 + { "ukbd", ATTR_KEYBOARD, "kbd" },
531 + { "atkbd", ATTR_KEYBOARD, "kbd" },
532 + { "kbdmux", ATTR_KEYBOARD, "kbd" },
533 + { "sysmouse", ATTR_POINTER, "mouse" },
534 + { "ums", ATTR_POINTER, "mouse" },
535 + { "psm", ATTR_POINTER, "mouse" },
536 + { "vboxguest", ATTR_POINTER, "vboxmouse" },
537 + { "joy", ATTR_JOYSTICK, NULL },
538 + { "atp", ATTR_TOUCHPAD, NULL },
539 + { "uep", ATTR_TOUCHSCREEN, NULL },
540 + { NULL, -1, NULL },
544 +sysctl_exists(const struct hw_type *device, int unit,
545 + char *devname, size_t devname_len)
547 + char sysctlname[PATH_MAX];
551 + if (device == NULL || device->driver == NULL)
554 + /* Check if a sysctl exists. */
555 + snprintf(sysctlname, sizeof(sysctlname), "dev.%s.%i.%%desc",
556 + device->driver, unit);
557 + ret = sysctlbyname(sysctlname, NULL, &len, NULL, 0);
559 + if (ret == 0 && len > 0) {
560 + snprintf(devname, devname_len, "%s%i", device->driver, unit);
568 +devpath_exists(const struct hw_type *device,
569 + char *devname, size_t devname_len)
575 + if (device == NULL || device->driver == NULL)
578 + /* Check if /dev/$driver exists. */
579 + asprintf(&devpath, "/dev/%s", device->driver);
580 + if (devpath == NULL)
583 + ret = stat(devpath, &st);
587 + strncpy(devname, device->driver, devname_len);
595 +sysctl_get_str(const char *sysctlname)
600 + if (sysctlname == NULL)
603 + if (sysctlbyname(sysctlname, NULL, &len, NULL, 0) == 0) {
604 + dest = malloc(len + 1);
606 + if (sysctlbyname(sysctlname, dest, &len, NULL, 0) == 0)
619 +device_added(const char *devname)
621 + char path[PATH_MAX];
622 + char sysctlname[PATH_MAX];
624 + char *product = NULL;
625 + char *config_info = NULL;
627 + InputOption *options = NULL;
628 + InputAttributes attrs = { };
629 + DeviceIntPtr dev = NULL;
633 + for (i = 0; hw_types[i].driver != NULL; i++) {
636 + len = strlen(hw_types[i].driver);
637 + if (strcmp(devname, hw_types[i].driver) == 0 ||
638 + (strncmp(devname, hw_types[i].driver, len) == 0 &&
639 + isnumber(*(devname + len)))) {
640 + attrs.flags |= hw_types[i].flag;
645 + if (hw_types[i].driver == NULL || hw_types[i].xdriver == NULL) {
646 + LogMessage(X_INFO, "config/devd: ignoring device %s\n",
651 + /* Skip keyboard devices if kbdmux is enabled */
652 + if (is_kbdmux && is_console_kbd && hw_types[i].flag & ATTR_KEYBOARD) {
653 + LogMessage(X_INFO, "config/devd: kbdmux is enabled, ignoring device %s\n",
658 + snprintf(path, sizeof(path), "/dev/%s", devname);
660 + options = input_option_new(NULL, "_source", "server/devd");
664 + snprintf(sysctlname, sizeof(sysctlname), "dev.%s.%s.%%desc",
665 + hw_types[i].driver, devname + strlen(hw_types[i].driver));
666 + vendor = sysctl_get_str(sysctlname);
667 + if (vendor == NULL) {
668 + options = input_option_new(options, "name", devname);
671 + if ((walk = strchr(vendor, ' ')) != NULL) {
675 + if ((walk = strchr(product, ',')) != NULL)
679 + attrs.vendor = strdup(vendor);
681 + attrs.product = strdup(product);
682 + options = input_option_new(options, "name", product);
685 + options = input_option_new(options, "name", "(unnamed)");
690 + /* XXX implement usb_id */
691 + attrs.usb_id = NULL;
692 + attrs.device = strdup(path);
693 + options = input_option_new(options, "driver", hw_types[i].xdriver);
695 + fd = open(path, O_RDONLY);
698 + options = input_option_new(options, "device", path);
701 + if (attrs.flags & ~ATTR_KEYBOARD) {
702 + LogMessage(X_INFO, "config/devd: device %s already opened\n",
706 + * Fail if cannot open device, it breaks AllowMouseOpenFail,
707 + * but it should not matter when config/devd enabled
712 + if (is_console_kbd) {
714 + * There can be only one keyboard attached to console and
715 + * it is already added.
717 + LogMessage(X_WARNING, "config/devd: console keyboard is "
718 + "already added, ignoring %s (%s)\n",
719 + attrs.product, path);
724 + * Don't pass "device" option if the keyboard is already
725 + * attached to the console (ie. open() fails).
726 + * This would activate a special logic in xf86-input-keyboard.
727 + * Prevent any other attached to console keyboards being
728 + * processed. There can be only one such device.
730 + is_console_kbd = true;
733 + if (asprintf(&config_info, "devd:%s", devname) == -1) {
734 + config_info = NULL;
738 + if (device_is_duplicate(config_info)) {
739 + LogMessage(X_WARNING, "config/devd: device %s (%s) already added. "
740 + "ignoring\n", attrs.product, path);
744 + options = input_option_new(options, "config_info", config_info);
745 + LogMessage(X_INFO, "config/devd: adding input device %s (%s)\n",
746 + attrs.product, path);
748 + NewInputDeviceRequest(options, &attrs, &dev);
752 + input_option_free_list(&options);
753 + free(attrs.usb_id);
754 + free(attrs.product);
755 + free(attrs.device);
756 + free(attrs.vendor);
760 +device_removed(char *devname)
764 + if (asprintf(&config_info, "devd:%s", devname) == -1)
767 + remove_devices("devd", config_info);
772 +static bool is_kbdmux_enabled(void)
774 + /* Xorg uses /dev/ttyv0 as a console device */
775 + /* const char device[]="/dev/console"; */
776 + const char device[]="/dev/ttyv0";
777 + keyboard_info_t info;
780 + fd = open(device, O_RDONLY);
785 + if (ioctl(fd, KDGKBINFO, &info) == -1) {
792 + if (!strncmp(info.kb_name, "kbdmux", 6))
799 +disconnect_devd(int sock)
802 + RemoveGeneralSocket(sock);
810 + struct sockaddr_un devd;
813 + sock = socket(AF_UNIX, SOCK_STREAM, 0);
815 + LogMessage(X_ERROR, "config/devd: fail opening stream socket\n");
819 + devd.sun_family = AF_UNIX;
820 + strlcpy(devd.sun_path, DEVD_SOCK_PATH, sizeof(devd.sun_path));
822 + if (connect(sock, (struct sockaddr *) &devd, sizeof(devd)) < 0) {
824 + LogMessage(X_ERROR, "config/devd: fail to connect to devd\n");
828 + AddGeneralSocket(sock);
834 +reconnect_handler(OsTimerPtr timer, CARD32 time, void *arg)
838 + if ((newsock = connect_devd()) > 0) {
839 + sock_devd = newsock;
842 + LogMessage(X_INFO, "config/devd: reopening devd socket\n");
846 + /* Try again after RECONNECT_DELAY */
847 + return RECONNECT_DELAY;
851 +socket_getline(int fd, char **out)
853 + char *buf, *newbuf;
854 + ssize_t ret, cap, sz = 0;
858 + buf = malloc(cap * sizeof(char));
863 + ret = read(sock_devd, &c, 1);
865 + if (errno == EINTR)
869 + /* EOF - devd socket is lost */
870 + } else if (ret == 0) {
871 + disconnect_devd(sock_devd);
872 + rtimer = TimerSet(NULL, 0, 1, reconnect_handler, NULL);
873 + LogMessage(X_WARNING, "config/devd: devd socket is lost\n");
880 + if (sz + 1 >= cap) {
882 + newbuf = realloc(buf, cap * sizeof(char));
899 + /* Number of bytes in the line, not counting the line break */
904 +wakeup_handler(void *data, int err, void *read_mask)
912 + if (FD_ISSET(sock_devd, (fd_set *) read_mask)) {
913 + if (socket_getline(sock_devd, &line) < 0)
916 + walk = strchr(line + 1, ' ');
921 + case DEVD_EVENT_ADD:
922 + device_added(line + 1);
924 + case DEVD_EVENT_REMOVE:
925 + device_removed(line + 1);
935 +block_handler(void *data, struct timeval **tv, void *read_mask)
940 +config_devd_init(void)
942 + char devicename[1024];
945 + LogMessage(X_INFO, "config/devd: probing input devices...\n");
948 + * Add fake keyboard and give up on keyboards management
949 + * if kbdmux is enabled
951 + if ((is_kbdmux = is_kbdmux_enabled()) == true)
952 + device_added("kbdmux");
954 + for (i = 0; hw_types[i].driver != NULL; i++) {
955 + /* First scan the sysctl to determine the hardware */
956 + for (j = 0; j < 16; j++) {
957 + if (sysctl_exists(&hw_types[i], j,
958 + devicename, sizeof(devicename)) != 0)
959 + device_added(devicename);
962 + if (devpath_exists(&hw_types[i], devicename, sizeof(devicename)) != 0)
963 + device_added(devicename);
966 + if ((sock_devd = connect_devd()) < 0)
969 + RegisterBlockAndWakeupHandlers(block_handler, wakeup_handler, NULL);
975 +config_devd_fini(void)
977 + LogMessage(X_INFO, "config/devd: terminating backend...\n");
984 + disconnect_devd(sock_devd);
986 + RemoveBlockAndWakeupHandlers(block_handler, wakeup_handler, NULL);
988 + is_console_kbd = false;
992 [FILE:391:patches/patch-config_meson.build]
993 --- config/meson.build.orig 2023-12-13 01:31:04 UTC
994 +++ config/meson.build
995 @@ -25,7 +25,7 @@ endif
998 install_data('10-quirks.conf',
999 - install_dir: join_paths(get_option('datadir'), 'X11/xorg.conf.d'))
1000 + install_dir: join_paths(get_option('prefix'), 'etc/X11/xorg.conf.d'))
1003 libxserver_config = static_library('libxserver_config',
1006 [FILE:3104:patches/patch-config_udev.c]
1007 --- config/udev.c.orig 2023-12-13 01:31:04 UTC
1011 #include <libudev.h>
1017 @@ -67,6 +68,45 @@ config_udev_odev_setup_attribs(struct ud
1019 static char itoa_buf[16];
1021 +#if defined(__DragonFly__)
1022 +// Taken from FreeBSD's lib/libc/gen/feature_present.c
1024 +#include <sys/cdefs.h>
1025 +#include <sys/types.h>
1026 +#include <sys/sysctl.h>
1028 +#include <stdlib.h>
1029 +#include <unistd.h>
1031 +int feature_present(const char *);
1033 + * Returns true if the named feature is present in the currently
1034 + * running kernel. A feature's presence is indicated by an integer
1035 + * sysctl node called kern.feature.<feature> that is non-zero.
1038 +feature_present(const char *feature)
1044 + if (asprintf(&mib, "kern.features.%s", feature) < 0)
1047 + if (sysctlbyname(mib, &i, &len, NULL, 0) < 0) {
1052 + if (len != sizeof(i))
1057 +// end of FreeBSD's lib/libc/gen/feature_present.c
1060 static const char *itoa(int i)
1062 snprintf(itoa_buf, sizeof(itoa_buf), "%d", i);
1063 @@ -198,7 +238,21 @@ device_added(struct udev_device *udev_de
1064 attrs.product = strdup(name);
1065 input_options = input_option_new(input_options, "name", name);
1066 input_options = input_option_new(input_options, "path", path);
1067 - input_options = input_option_new(input_options, "device", path);
1068 + if(strstr(path, "kbdmux") != NULL) {
1070 + * Don't pass "device" option if the keyboard is already attached
1071 + * to the console (ie. open() fails). This would activate a special
1072 + * logic in xf86-input-keyboard. Prevent any other attached to console
1073 + * keyboards being processed. There can be only one such device.
1075 + int fd = open(path, O_RDONLY);
1078 + input_options = input_option_new(input_options, "device", path);
1082 + input_options = input_option_new(input_options, "device", path);
1083 input_options = input_option_new(input_options, "major", itoa(major(devnum)));
1084 input_options = input_option_new(input_options, "minor", itoa(minor(devnum)));
1086 @@ -280,6 +334,18 @@ device_added(struct udev_device *udev_de
1090 + if (attrs.flags & (ATTR_KEY | ATTR_KEYBOARD)) {
1091 + if (!feature_present("evdev_support"))
1092 + input_options = input_option_new(input_options, "driver", "kbd");
1093 + } else if (attrs.flags & ATTR_POINTER) {
1094 + if (strstr(path, "vbox"))
1095 + input_options = input_option_new(input_options, "driver", "vboxmouse");
1097 + if (!feature_present("evdev_support"))
1098 + input_options = input_option_new(input_options, "driver", "mouse");
1102 input_options = input_option_new(input_options, "config_info", config_info);
1104 /* Default setting needed for non-seat0 seats */
1107 [FILE:1646:patches/patch-configure]
1108 --- configure.orig 2023-12-13 01:31:14 UTC
1110 @@ -24707,14 +24707,14 @@ printf "%s\n" "#define USE_ALPHA_PIO 1"
1115 + *freebsd*|*midnight*)
1116 printf "%s\n" "#define USE_DEV_IO 1" >>confdefs.h
1119 printf "%s\n" "#define USE_DEV_IO 1" >>confdefs.h
1122 -printf "%s\n" "#define USE_I386_IOPL 1" >>confdefs.h
1123 +printf "%s\n" "#define USE_AMD64_IOPL 1" >>confdefs.h
1127 @@ -24778,7 +24778,7 @@ fi
1131 - *freebsd* | *dragonfly*)
1132 + *freebsd* | *dragonfly*| *midnight*)
1136 @@ -26588,7 +26588,8 @@ case ${host_os} in
1138 # use libc stubs, don't link against libpthread, to allow
1140 - ax_pthread_flags=""
1141 + ax_pthread_flags="none"
1142 + ax_pthread_ok="yes"
1146 @@ -28097,7 +28098,7 @@ fi
1147 case "x$XTRANS_SEND_FDS" in
1150 - linux*|solaris*|freebsd*|dragonfly*|openbsd*)
1151 + linux*|solaris*|freebsd*|dragonfly*|openbsd*|midnight*)
1155 @@ -30713,7 +30714,7 @@ printf "%s\n" "#define PCI_TXT_IDS_PATH
1156 test "$exec_prefix_NONE" && exec_prefix=NONE
1159 - gnu* | freebsd* | kfreebsd*-gnu | netbsd* | openbsd* | solaris* | dragonfly*)
1160 + gnu* | freebsd* | kfreebsd*-gnu | netbsd* | openbsd* | solaris* | dragonfly* | midnight*)
1161 xorg_bus_bsdpci="yes"
1164 @@ -30763,7 +30764,7 @@ fi
1168 - freebsd* | kfreebsd*-gnu | dragonfly*)
1169 + freebsd* | kfreebsd*-gnu | dragonfly* | midnight*)
1170 XORG_OS_SUBDIR="bsd"
1175 [FILE:256:patches/patch-hw_kdrive_ephyr_hostx.c]
1176 --- hw/kdrive/ephyr/hostx.c.orig 2023-12-13 01:31:04 UTC
1177 +++ hw/kdrive/ephyr/hostx.c
1179 #include <string.h> /* for memset */
1184 #include <sys/ipc.h>
1185 #include <sys/shm.h>
1188 [FILE:791:patches/patch-hw_xfree86_common_xf86AutoConfig.c]
1189 --- hw/xfree86/common/xf86AutoConfig.c.orig 2023-12-13 01:31:04 UTC
1190 +++ hw/xfree86/common/xf86AutoConfig.c
1191 @@ -294,7 +294,7 @@ listPossibleVideoDrivers(XF86MatchedDriv
1192 xf86PciMatchDriver(md);
1195 -#if defined(__linux__)
1196 +#if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__)
1197 xf86AddMatchedDriver(md, "modesetting");
1200 @@ -302,8 +302,10 @@ listPossibleVideoDrivers(XF86MatchedDriv
1201 /* Fallback to platform default frame buffer driver */
1202 #if !defined(__linux__) && defined(__sparc__)
1203 xf86AddMatchedDriver(md, "wsfb");
1205 +#elif defined(__linux__)
1206 xf86AddMatchedDriver(md, "fbdev");
1207 +#elif defined(__FreeBSD__) || defined(__DragonFly__)
1208 + xf86AddMatchedDriver(md, "scfb");
1214 [FILE:700:patches/patch-hw_xfree86_common_xf86Config.c]
1215 --- hw/xfree86/common/xf86Config.c.orig 2023-12-13 01:31:04 UTC
1216 +++ hw/xfree86/common/xf86Config.c
1217 @@ -1279,13 +1279,16 @@ checkCoreInputDevices(serverLayoutPtr se
1220 if (!xf86Info.forceInputDevices && !(foundPointer && foundKeyboard)) {
1221 -#if defined(CONFIG_HAL) || defined(CONFIG_UDEV) || defined(CONFIG_WSCONS)
1222 +#if defined(CONFIG_HAL) || defined(CONFIG_UDEV) || defined(CONFIG_WSCONS) || \
1223 + defined(CONFIG_DEVD)
1224 const char *config_backend;
1226 #if defined(CONFIG_HAL)
1227 config_backend = "HAL";
1228 #elif defined(CONFIG_UDEV)
1229 config_backend = "udev";
1230 +#elif defined(CONFIG_DEVD)
1231 + config_backend = "devd";
1233 config_backend = "wscons";
1237 [FILE:510:patches/patch-hw_xfree86_common_xf86Globals.c]
1238 --- hw/xfree86/common/xf86Globals.c.orig 2023-12-13 01:31:04 UTC
1239 +++ hw/xfree86/common/xf86Globals.c
1240 @@ -118,7 +118,7 @@ xf86InfoRec xf86Info = {
1241 .miscModInDevEnabled = TRUE,
1242 .miscModInDevAllowNonLocal = FALSE,
1244 -#if defined(CONFIG_HAL) || defined(CONFIG_UDEV) || defined(CONFIG_WSCONS)
1245 +#if defined(CONFIG_HAL) || defined(CONFIG_UDEV) || defined(CONFIG_WSCONS) || defined(CONFIG_DEVD)
1246 .forceInputDevices = FALSE,
1247 .autoAddDevices = TRUE,
1248 .autoEnableDevices = TRUE,
1251 [FILE:483:patches/patch-hw_xfree86_common_xf86Xinput.c]
1252 --- hw/xfree86/common/xf86Xinput.c.orig 2023-12-13 01:31:04 UTC
1253 +++ hw/xfree86/common/xf86Xinput.c
1254 @@ -1065,6 +1065,7 @@ NewInputDeviceRequest(InputOption *optio
1255 if (strcmp(key, "_source") == 0 &&
1256 (strcmp(value, "server/hal") == 0 ||
1257 strcmp(value, "server/udev") == 0 ||
1258 + strcmp(value, "server/devd") == 0 ||
1259 strcmp(value, "server/wscons") == 0)) {
1261 if (!xf86Info.autoAddDevices) {
1264 [FILE:343:patches/patch-hw_xfree86_common_xf86str.h]
1265 --- hw/xfree86/common/xf86str.h.orig 2023-12-13 01:31:04 UTC
1266 +++ hw/xfree86/common/xf86str.h
1267 @@ -249,7 +249,7 @@ typedef struct _DriverRec {
1270 /* Tolerate prior #include <linux/input.h> */
1271 -#if defined(__linux__)
1272 +#if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__)
1278 [FILE:596:patches/patch-hw_xfree86_drivers_modesetting_driver.c]
1279 --- hw/xfree86/drivers/modesetting/driver.c.orig 2023-12-13 01:31:04 UTC
1280 +++ hw/xfree86/drivers/modesetting/driver.c
1281 @@ -925,8 +925,12 @@ try_enable_glamor(ScrnInfoPtr pScrn)
1282 modesettingPtr ms = modesettingPTR(pScrn);
1283 const char *accel_method_str = xf86GetOptValString(ms->drmmode.Options,
1284 OPTION_ACCEL_METHOD);
1285 +#if defined(__DragonFly__)
1286 + Bool do_glamor = FALSE;
1288 Bool do_glamor = (!accel_method_str ||
1289 strcmp(accel_method_str, "glamor") == 0);
1292 ms->drmmode.glamor = FALSE;
1296 [FILE:359:patches/patch-hw_xfree86_meson.build]
1297 --- hw/xfree86/meson.build.orig 2023-12-13 01:31:04 UTC
1298 +++ hw/xfree86/meson.build
1299 @@ -152,7 +152,6 @@ if get_option('suid_wrapper')
1300 c_args: xorg_c_args,
1302 install_dir: get_option('libexecdir'),
1303 - install_mode: ['r-sr-xr-x', 0, 0],
1306 # meson gets confused when there are two targets of the same name
1309 [FILE:2566:patches/patch-hw_xfree86_os-support_bsd_bsd__init.c]
1310 --- hw/xfree86/os-support/bsd/bsd_init.c.orig 2023-12-13 01:31:04 UTC
1311 +++ hw/xfree86/os-support/bsd/bsd_init.c
1312 @@ -48,6 +48,8 @@ static int devConsoleFd = -1;
1313 #if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
1314 static int VTnum = -1;
1315 static int initialVT = -1;
1316 +static struct termios tty_attr; /* tty state to restore */
1317 +static int tty_mode; /* kbd mode to restore */
1320 #ifdef PCCONS_SUPPORT
1321 @@ -230,6 +232,9 @@ xf86OpenConsole()
1322 * Add cases for other *BSD that behave the same.
1324 #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
1325 +#if defined(__sparc64__)
1326 + pci_system_init_dev_mem(fd);
1329 i = atof(uts.release) * 100;
1331 @@ -253,6 +258,7 @@ xf86OpenConsole()
1334 if (!xf86Info.ShareVTs) {
1335 + struct termios nTty;
1339 @@ -287,6 +293,26 @@ xf86OpenConsole()
1340 if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS) < 0) {
1341 FatalError("xf86OpenConsole: KDSETMODE KD_GRAPHICS failed");
1344 + tcgetattr(xf86Info.consoleFd, &tty_attr);
1345 + ioctl(xf86Info.consoleFd, KDGKBMODE, &tty_mode);
1347 + /* disable special keys */
1348 + if (ioctl(xf86Info.consoleFd, KDSKBMODE, K_RAW) < 0) {
1349 + FatalError("xf86OpenConsole: KDSKBMODE K_RAW failed (%s)",
1354 + nTty.c_iflag = IGNPAR | IGNBRK;
1356 + nTty.c_cflag = CREAD | CS8;
1358 + nTty.c_cc[VTIME] = 0;
1359 + nTty.c_cc[VMIN] = 1;
1360 + cfsetispeed(&nTty, 9600);
1361 + cfsetospeed(&nTty, 9600);
1362 + tcsetattr(xf86Info.consoleFd, TCSANOW, &nTty);
1364 else { /* xf86Info.ShareVTs */
1365 close(xf86Info.consoleFd);
1366 @@ -594,6 +620,8 @@ xf86CloseConsole()
1369 ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT); /* Back to text mode */
1370 + ioctl(xf86Info.consoleFd, KDSKBMODE, tty_mode);
1371 + tcsetattr(xf86Info.consoleFd, TCSANOW, &tty_attr);
1372 if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) != -1) {
1374 ioctl(xf86Info.consoleFd, VT_SETMODE, &VT); /* dflt vt handling */
1377 [FILE:519:patches/patch-hw_xfree86_os-support_bsd_i386__video.c]
1378 --- hw/xfree86/os-support/bsd/i386_video.c.orig 2023-12-13 01:31:04 UTC
1379 +++ hw/xfree86/os-support/bsd/i386_video.c
1381 #include "xf86Priv.h"
1384 +#include <sys/types.h>
1385 #include <sys/mman.h>
1387 #include "xf86_OSlib.h"
1390 #define MAP_FLAGS (MAP_FILE | MAP_SHARED)
1392 +#if defined(__NetBSD__) && defined(USE_AMD64_IOPL)
1393 +#define amd64_iopl x86_64_iopl
1397 #define SYSCTL_MSG "\tCheck that you have set 'machdep.allowaperture=1'\n"\
1400 [FILE:380:patches/patch-hw_xfree86_os-support_bsd_ppc__video.c]
1401 --- hw/xfree86/os-support/bsd/ppc_video.c.orig 2023-12-13 01:31:04 UTC
1402 +++ hw/xfree86/os-support/bsd/ppc_video.c
1403 @@ -79,7 +79,11 @@ xf86DisableIO()
1406 if (ioBase != MAP_FAILED) {
1407 +#if defined(__FreeBSD__)
1408 + munmap(__DEVOLATILE(unsigned char *, ioBase), 0x10000);
1410 munmap(__UNVOLATILE(ioBase), 0x10000);
1412 ioBase = MAP_FAILED;
1417 [FILE:1280:patches/patch-hw_xfree86_os-support_meson.build]
1418 --- hw/xfree86/os-support/meson.build.orig 2023-12-13 01:31:04 UTC
1419 +++ hw/xfree86/os-support/meson.build
1420 @@ -91,11 +91,12 @@ elif host_machine.system() == 'sunos'
1421 error('Unknown CPU family for Solaris build')
1424 -elif host_machine.system().endswith('bsd')
1425 +elif host_machine.system().endswith('bsd') or host_machine.system() == 'dragonfly'
1426 srcs_xorg_os_support += [
1430 + 'misc/SlowBcopy.c',
1434 @@ -120,14 +121,14 @@ elif host_machine.system().endswith('bsd
1435 srcs_xorg_os_support += 'shared/ioperm_noop.c'
1436 elif host_machine.cpu_family() == 'alpha'
1437 srcs_xorg_os_support += 'bsd/alpha_video.c'
1438 - if host_machine.system() == 'freebsd'
1439 + if host_machine.system() == 'freebsd' or host_machine.system() == 'midnightbsd'
1440 os_dep += cc.find_library('io')
1441 elif host_machine.system() == 'netbsd'
1442 os_c_args += '-DUSE_ALPHA_PIO'
1446 - if host_machine.system() == 'freebsd'
1447 + if ['freebsd', 'dragonfly', 'midnightbsd'].contains(host_machine.system())
1448 srcs_xorg_os_support += 'bsd/bsd_kmod.c'
1450 srcs_xorg_os_support += 'shared/kmod_noop.c'
1453 [FILE:714:patches/patch-hw_xfree86_os-support_solaris_sun__init.c]
1454 --- hw/xfree86/os-support/solaris/sun_init.c.orig 2023-12-13 01:31:04 UTC
1455 +++ hw/xfree86/os-support/solaris/sun_init.c
1456 @@ -54,6 +54,22 @@ static int xf86StartVT = -1;
1457 static int vtEnabled = 0;
1461 +#define VTIOC ('V'<<8)
1462 +#define VT_OPENQRY (VTIOC|1)
1463 +#define VT_SETMODE (VTIOC|2)
1464 +#define VT_GETMODE (VTIOC|3)
1465 +#define VT_ACTIVATE (VTIOC|5)
1466 +#define VT_WAITACTIVE (VTIOC|6)
1467 +#define VT_GETSTATE (VTIOC|100)
1468 +#define VT_ENABLED (VTIOC|101)
1469 +#define VT_SETDISPINFO (VTIOC|103)
1470 +#define VT_GET_CONSUSER (VTIOC|108)
1471 +#define VT_SET_CONSUSER (VTIOC|109)
1473 +enum { VT_AUTO = 0, VT_PROCESS };
1476 /* Device to open as xf86Info.consoleFd */
1477 static char consoleDev[PATH_MAX] = "/dev/fb";
1481 [FILE:520:patches/patch-hw_xfree86_os-support_xf86__OSlib.h]
1482 --- hw/xfree86/os-support/xf86_OSlib.h.orig 2023-12-13 01:31:04 UTC
1483 +++ hw/xfree86/os-support/xf86_OSlib.h
1484 @@ -241,7 +241,7 @@ extern _X_HIDDEN char xf86SolarisFbDev[P
1485 #ifdef SYSCONS_SUPPORT
1486 #define COMPAT_SYSCONS
1487 #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
1488 -#if defined(__DragonFly__) || (__FreeBSD_kernel_version >= 410000)
1489 +#if defined(__DragonFly__) || (__FreeBSD_kernel_version >= 410000) || defined(__MidnightBSD__)
1490 #include <sys/consio.h>
1491 #include <sys/kbio.h>
1495 [FILE:1986:patches/patch-hw_xfree86_xorg-wrapper.c]
1496 * Skip the detection of root rights requirement, the assumption that presence
1497 * of KMS drivers removes the root requirement is only valid for Linux
1499 --- hw/xfree86/xorg-wrapper.c.orig 2023-12-13 01:31:04 UTC
1500 +++ hw/xfree86/xorg-wrapper.c
1502 #include <sys/sysmacros.h>
1504 #include <sys/types.h>
1505 -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
1506 +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
1507 #include <sys/consio.h>
1510 @@ -170,7 +170,7 @@ static int on_console(int fd)
1512 if (r == 0 && S_ISCHR(st.st_mode) && major(st.st_rdev) == 4)
1514 -#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
1515 +#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
1518 if (ioctl(fd, VT_GETINDEX, &idx) != -1)
1519 @@ -191,7 +191,7 @@ static int on_console(int fd)
1521 int main(int argc, char *argv[])
1524 +#if defined(WITH_LIBDRM) && defined(__linux__)
1525 struct drm_mode_card_res res;
1528 @@ -230,7 +230,7 @@ int main(int argc, char *argv[])
1533 +#if defined(WITH_LIBDRM) && defined(__linux__)
1534 /* Detect if we need root rights, except when overridden by the config */
1535 if (needs_root_rights == -1) {
1536 for (i = 0; i < 16; i++) {
1537 @@ -256,6 +256,8 @@ int main(int argc, char *argv[])
1538 gid_t realgid = getgid();
1539 uid_t realuid = getuid();
1541 +#if !defined(__NetBSD__)
1542 + /* setresgid and setresuid are not implemented on NetBSD */
1543 if (setresgid(-1, realgid, realgid) != 0) {
1544 fprintf(stderr, "%s: Could not drop setgid privileges: %s\n",
1545 progname, strerror(errno));
1546 @@ -266,6 +268,7 @@ int main(int argc, char *argv[])
1547 progname, strerror(errno));
1553 snprintf(buf, sizeof(buf), "%s/Xorg", SUID_WRAPPER_DIR);
1556 [FILE:1214:patches/patch-include_meson.build]
1557 --- include/meson.build.orig 2023-12-13 01:31:04 UTC
1558 +++ include/meson.build
1559 @@ -278,7 +278,7 @@ supports_syscons = false
1560 supports_wscons = false
1563 -if host_machine.system() == 'freebsd' or host_machine.system() == 'dragonfly'
1564 +if ['freebsd', 'dragonfly', 'midnightbsd'].contains(host_machine.system())
1565 supports_pccons = true
1566 supports_pcvt = true
1567 supports_syscons = true
1568 @@ -377,13 +377,13 @@ xorg_data.set('HAVE_STROPTS_H', cc.has_h
1569 xorg_data.set('HAVE_SYS_KD_H', cc.has_header('sys/kd.h') ? '1' : false)
1570 xorg_data.set('HAVE_SYS_VT_H', cc.has_header('sys/vt.h') ? '1' : false)
1572 -if host_machine.system() == 'freebsd' or host_machine.system() == 'dragonfly'
1573 +if ['freebsd', 'dragonfly', 'midnightbsd'].contains(host_machine.system())
1574 if host_machine.cpu_family() == 'x86' or host_machine.cpu_family() == 'x86_64'
1575 xorg_data.set('USE_DEV_IO', '1')
1577 elif host_machine.system() == 'netbsd'
1578 if host_machine.cpu_family() == 'x86' or host_machine.cpu_family() == 'x86_64'
1579 - xorg_data.set('USE_I386_IOPL', '1')
1580 + xorg_data.set('USE_AMD64_IOPL', '1')
1582 elif host_machine.system() == 'openbsd'
1583 if host_machine.cpu_family() == 'x86'
1586 [FILE:193:patches/patch-os_backtrace.c]
1587 --- os/backtrace.c.orig 2023-12-13 01:31:04 UTC
1593 +#include <unistd.h>
1595 #ifdef HAVE_LIBUNWIND
1599 [FILE:1021:patches/patch-test_simple-xinit.c]
1600 --- test/simple-xinit.c.orig 2023-12-13 01:31:04 UTC
1601 +++ test/simple-xinit.c
1603 #include <sys/wait.h>
1607 +#include <sys/varargs.h>
1609 +vasprintf(char **strp, const char *fmt, va_list args)
1611 + va_list args_copy;
1612 + int status, needed;
1614 + va_copy(args_copy, args);
1615 + needed = vsnprintf(NULL, 0, fmt, args_copy);
1616 + va_end(args_copy);
1621 + *strp = malloc(needed + 1);
1622 + if (*strp == NULL)
1624 + status = vsnprintf(*strp, needed + 1, fmt, args);
1635 +asprintf(char **strp, const char *fmt, ...)
1640 + va_start(args, fmt);
1641 + status = vasprintf(strp, fmt, args);
1648 kill_server(int server_pid)
1652 [FILE:152:files/20-evdev-kbd.conf]
1653 Section "InputClass"
1654 Identifier "Evdev keyboard"
1655 MatchDevicePath "/dev/input/event*"
1656 MatchIsKeyboard "on"
1657 Option "XkbRules" "evdev"
1661 [FILE:251:files/special.mk]
1662 sharefonts= ${LOCALBASE}/share/fonts
1663 fontpathd= ${PREFIX}/etc/X11/fontpath.d
1665 fontlist= ${sharefonts}/misc \
1668 ${sharefonts}/Type1 \
1669 ${sharefonts}/100dpi \
1670 ${sharefonts}/75dpi \
1671 catalogue:${fontpathd}