1 # Buildsheet autogenerated by ravenadm tool -- Do not edit.
6 VARIANTS= standard virtual xephyr nest
7 SDESC[xephyr]= X server from X.Org based on kdrive
8 SDESC[virtual]= X virtual framebuffer server from X.Org
9 SDESC[standard]= X.Org X server and related programs
10 SDESC[nest]= Nesting X server from X.Org
11 HOMEPAGE= https://www.x.org/
15 SITES[main]= XORG/individual/xserver
16 DISTFILE[1]= xorg-server-21.1.10.tar.xz:main
18 SPKGS[xephyr]= complete
21 SPKGS[virtual]= complete
24 SPKGS[standard]= complete
32 OPTIONS_AVAILABLE= XORG VIRTUAL XEPHYR NEST DEVD
33 OPTIONS_STANDARD= XORG DEVD
34 VOPTS[xephyr]= XORG=OFF VIRTUAL=OFF XEPHYR=ON NEST=OFF DEVD=OFF
35 VOPTS[virtual]= XORG=OFF VIRTUAL=ON XEPHYR=OFF NEST=OFF DEVD=OFF
36 VOPTS[nest]= XORG=OFF VIRTUAL=OFF XEPHYR=OFF NEST=ON DEVD=OFF
39 BUILD_DEPENDS= libdrm:dev:standard
40 libgpg-error:dev:standard
41 BUILDRUN_DEPENDS= xorg-xkbcomp:single:standard
42 RUN_DEPENDS= xorg-xkeyboard-config:primary:standard
43 EXRUN[dev]= xorg-pixman:dev:standard
44 xorg-pciaccess:dev:standard
46 USES= cpe perl:build ssl solaris-funcs meson zlib:build
47 XORG_COMPONENTS= xorgproto xtransproto pixman xshmfence xau xdmcp
51 LICENSE_FILE= MIT:{{WRKSRC}}/COPYING
55 FPC_EQUIVALENT= x11-servers/xorg-server
56 MESON_ARGS= -Dxkb_dir="{{LOCALBASE}}/share/X11/xkb"
57 -Ddefault_font_path="{{fontlist:ts,}}"
65 -Dsystemd_logind=false
67 -Dfallback_input_driver=libinput
68 -Dxkb_dir={{LOCALBASE}}/share/X11/xkb
69 -Dxkb_output_dir=/var/lib/xkb
70 SOL_FUNCTIONS= strnlen:xkb/XKBGAlloc.c
72 VAR_OPSYS[sunos]= CFLAGS=-DO_CLOEXEC=0
73 VAR_OPSYS[netbsd]= CPPFLAGS=-D_OPENBSD_SOURCE
74 CONFIGURE_ARGS=-Dsecure-rpc=false
76 [DEVD].DESCRIPTION= Use devd for autoconfiguration of input devices
77 [DEVD].BUILDRUN_DEPENDS_ON= libudev-devd:primary:standard
78 [DEVD].BUILD_DEPENDS_ON= libudev-devd:dev:standard
79 [DEVD].CONFIGURE_ARGS_OFF= -Dudev=false
80 [DEVD].CONFIGURE_ARGS_ON= -Dudev=true
82 [NEST].DESCRIPTION= Build as nesting X server
83 [NEST].BUILDRUN_DEPENDS_ON= libglvnd:primary:standard
84 [NEST].BUILD_DEPENDS_ON= libepoxy:primary:standard
89 [NEST].CONFIGURE_ARGS_OFF= -Dxnest=false
90 [NEST].CONFIGURE_ARGS_ON= -Dxnest=true
91 [NEST].XORG_COMPONENTS_ON= x11
94 [XEPHYR].DESCRIPTION= Build as kdrive-base X server
95 [XEPHYR].BUILDRUN_DEPENDS_ON= libdrm:primary:standard
96 libepoxy:primary:standard
97 libglvnd:primary:standard
98 [XEPHYR].BUILD_DEPENDS_ON= mesa:drivers:standard
100 libepoxy:dev:standard
101 libglvnd:dev:standard
102 [XEPHYR].CONFIGURE_ARGS_OFF= -Dxephyr=false
103 [XEPHYR].CONFIGURE_ARGS_ON= -Dxephyr=true
104 [XEPHYR].XORG_COMPONENTS_ON= x11
112 [VIRTUAL].DESCRIPTION= Build as virtual framebuffer server
113 [VIRTUAL].BUILDRUN_DEPENDS_ON= libglvnd:primary:standard
114 [VIRTUAL].BUILD_DEPENDS_ON= libepoxy:primary:standard
115 libepoxy:dev:standard
116 mesa:drivers:standard
118 libglvnd:dev:standard
119 [VIRTUAL].CONFIGURE_ARGS_OFF= -Dxvfb=false
120 [VIRTUAL].CONFIGURE_ARGS_ON= -Dxvfb=true
122 [XORG].DESCRIPTION= Build as X server (don't change setting!)
123 [XORG].BUILDRUN_DEPENDS_ON= libdrm:primary:standard
124 libepoxy:primary:standard
125 mesa:drivers:standard
126 xorg-xcvt:primary:standard
127 [XORG].BUILD_DEPENDS_ON= xmlto:single:standard
128 xorg-sgml-doctools:single:standard
130 libepoxy:dev:standard
131 xorg-xcvt:dev:standard
132 [XORG].CONFIGURE_ARGS_OFF= -Ddocs=false
135 [XORG].CONFIGURE_ARGS_ON= -Ddocs=true
140 [XORG].XORG_COMPONENTS_ON= pciaccess
143 post-install-XORG-OFF:
144 ${RM} -r ${STAGEDIR}${PREFIX}/lib/xorg
145 ${RM} ${STAGEDIR}${PREFIX}/share/man/man1/Xserver.1
146 ${MKDIR} ${STAGEDIR}/var/lib/xkb
148 post-install-XORG-ON:
149 ${RM} -r ${STAGEDIR}${STD_DOCDIR}
150 ${MKDIR} ${STAGEDIR}${PREFIX}/share/X11/xorg.conf.d
151 ${MKDIR} ${STAGEDIR}${PREFIX}/etc/X11/xorg.conf.d
152 ${MKDIR} ${STAGEDIR}${fontpathd}
153 ${MKDIR} ${STAGEDIR}/var/lib/xkb
154 ${INSTALL_DATA} ${FILESDIR}/20-evdev-kbd.conf \
155 ${STAGEDIR}${PREFIX}/share/X11/xorg.conf.d
157 [FILE:71:descriptions/desc.primary.standard]
158 This package contains the X.Org X server and some associated programs.
161 [FILE:60:descriptions/desc.primary.virtual]
162 This package contains Xvfb, a virtual framebuffer X server.
165 [FILE:173:descriptions/desc.primary.xephyr]
166 Xephyr is a kdrive server that outputs to a window on a pre-existing
167 'host' X display. Think Xnest but with support for modern extensions
168 like composite, damage and randr.
171 [FILE:78:descriptions/desc.primary.nest]
172 This package contains Xnest, a nesting X Server that displays on an X
177 ceb0b3a2efc57ac3ccf388d3dc88b97615068639fb284d469689ae3d105611d0 4935984 xorg-server-21.1.10.tar.xz
180 [FILE:432:manifests/plist.primary.standard]
185 etc/X11/xorg.conf.d/10-quirks.conf
186 lib/xorg/protocol.txt
195 lib/xorg/modules/drivers/modesetting_drv.so
196 lib/xorg/modules/extensions/libglx.so
197 lib/xorg/modules/input/inputtest_drv.so
199 @(,,4555) libexec/Xorg.wrap
200 share/X11/xorg.conf.d/20-evdev-kbd.conf
202 @dir etc/X11/fontpath.d
205 [FILE:216:manifests/plist.man.standard]
222 [FILE:1983:manifests/plist.dev.standard]
223 %%ONLY-SUNOS%%include/xorg/solaris-amd64.il
339 xf86-input-inputtest-protocol.h
381 lib/pkgconfig/xorg-server.pc
382 share/aclocal/xorg-server.m4
385 [FILE:27:manifests/plist.primary.virtual]
390 [FILE:25:manifests/plist.man.virtual]
391 share/man/man1/Xvfb.1.gz
394 [FILE:29:manifests/plist.primary.xephyr]
399 [FILE:27:manifests/plist.man.xephyr]
400 share/man/man1/Xephyr.1.gz
403 [FILE:28:manifests/plist.primary.nest]
408 [FILE:26:manifests/plist.man.nest]
409 share/man/man1/Xnest.1.gz
412 [FILE:293:patches/patch-config_config-backends.h]
413 --- config/config-backends.h.orig 2023-12-13 01:31:04 UTC
414 +++ config/config-backends.h
415 @@ -44,3 +44,8 @@ void config_hal_fini(void);
416 int config_wscons_init(void);
417 void config_wscons_fini(void);
421 +int config_devd_init(void);
422 +void config_devd_fini(void);
426 [FILE:537:patches/patch-config_config.c]
427 --- config/config.c.orig 2023-12-13 01:31:04 UTC
429 @@ -55,6 +55,9 @@ config_init(void)
430 #elif defined(CONFIG_WSCONS)
431 if (!config_wscons_init())
432 ErrorF("[config] failed to initialise wscons\n");
433 +#elif defined(CONFIG_DEVD)
434 + if (!config_devd_init())
435 + ErrorF("[config] failed to initialise devd\n");
439 @@ -67,6 +70,8 @@ config_fini(void)
441 #elif defined(CONFIG_WSCONS)
442 config_wscons_fini();
443 +#elif defined(CONFIG_DEVD)
444 + config_devd_fini();
450 [FILE:12171:patches/patch-config_devd.c]
451 --- /dev/null 2023-12-20 01:45:39 UTC
455 + * Copyright (c) 2012 Baptiste Daroussin
456 + * Copyright (c) 2013, 2014 Alex Kozlov
457 + * Copyright (c) 2014 Robert Millan
458 + * Copyright (c) 2014 Jean-Sebastien Pedron
460 + * Permission is hereby granted, free of charge, to any person obtaining a
461 + * copy of this software and associated documentation files (the "Software"),
462 + * to deal in the Software without restriction, including without limitation
463 + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
464 + * and/or sell copies of the Software, and to permit persons to whom the
465 + * Software is furnished to do so, subject to the following conditions:
467 + * The above copyright notice and this permission notice (including the next
468 + * paragraph) shall be included in all copies or substantial portions of the
471 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
472 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
473 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
474 + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
475 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
476 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
477 + * DEALINGS IN THE SOFTWARE.
479 + * Author: Baptiste Daroussin <bapt@FreeBSD.org>
482 +#ifdef HAVE_DIX_CONFIG_H
483 +#include <dix-config.h>
486 +#include <sys/types.h>
487 +#include <sys/kbio.h>
488 +#include <sys/socket.h>
489 +#include <sys/stat.h>
490 +#include <sys/sysctl.h>
498 +#include <stdbool.h>
502 +#include "inputstr.h"
503 +#include "hotplug.h"
504 +#include "config-backends.h"
507 +#define DEVD_SOCK_PATH "/var/run/devd.pipe"
509 +#define DEVD_EVENT_ADD '+'
510 +#define DEVD_EVENT_REMOVE '-'
512 +#define RECONNECT_DELAY 5 * 1000
514 +static int sock_devd;
515 +static bool is_console_kbd = false;
516 +static bool is_kbdmux = false;
517 +static OsTimerPtr rtimer = NULL;
520 + const char *driver;
522 + const char *xdriver;
525 +static struct hw_type hw_types[] = {
526 + { "ukbd", ATTR_KEYBOARD, "kbd" },
527 + { "atkbd", ATTR_KEYBOARD, "kbd" },
528 + { "kbdmux", ATTR_KEYBOARD, "kbd" },
529 + { "sysmouse", ATTR_POINTER, "mouse" },
530 + { "ums", ATTR_POINTER, "mouse" },
531 + { "psm", ATTR_POINTER, "mouse" },
532 + { "vboxguest", ATTR_POINTER, "vboxmouse" },
533 + { "joy", ATTR_JOYSTICK, NULL },
534 + { "atp", ATTR_TOUCHPAD, NULL },
535 + { "uep", ATTR_TOUCHSCREEN, NULL },
536 + { NULL, -1, NULL },
540 +sysctl_exists(const struct hw_type *device, int unit,
541 + char *devname, size_t devname_len)
543 + char sysctlname[PATH_MAX];
547 + if (device == NULL || device->driver == NULL)
550 + /* Check if a sysctl exists. */
551 + snprintf(sysctlname, sizeof(sysctlname), "dev.%s.%i.%%desc",
552 + device->driver, unit);
553 + ret = sysctlbyname(sysctlname, NULL, &len, NULL, 0);
555 + if (ret == 0 && len > 0) {
556 + snprintf(devname, devname_len, "%s%i", device->driver, unit);
564 +devpath_exists(const struct hw_type *device,
565 + char *devname, size_t devname_len)
571 + if (device == NULL || device->driver == NULL)
574 + /* Check if /dev/$driver exists. */
575 + asprintf(&devpath, "/dev/%s", device->driver);
576 + if (devpath == NULL)
579 + ret = stat(devpath, &st);
583 + strncpy(devname, device->driver, devname_len);
591 +sysctl_get_str(const char *sysctlname)
596 + if (sysctlname == NULL)
599 + if (sysctlbyname(sysctlname, NULL, &len, NULL, 0) == 0) {
600 + dest = malloc(len + 1);
602 + if (sysctlbyname(sysctlname, dest, &len, NULL, 0) == 0)
615 +device_added(const char *devname)
617 + char path[PATH_MAX];
618 + char sysctlname[PATH_MAX];
620 + char *product = NULL;
621 + char *config_info = NULL;
623 + InputOption *options = NULL;
624 + InputAttributes attrs = { };
625 + DeviceIntPtr dev = NULL;
629 + for (i = 0; hw_types[i].driver != NULL; i++) {
632 + len = strlen(hw_types[i].driver);
633 + if (strcmp(devname, hw_types[i].driver) == 0 ||
634 + (strncmp(devname, hw_types[i].driver, len) == 0 &&
635 + isnumber(*(devname + len)))) {
636 + attrs.flags |= hw_types[i].flag;
641 + if (hw_types[i].driver == NULL || hw_types[i].xdriver == NULL) {
642 + LogMessage(X_INFO, "config/devd: ignoring device %s\n",
647 + /* Skip keyboard devices if kbdmux is enabled */
648 + if (is_kbdmux && is_console_kbd && hw_types[i].flag & ATTR_KEYBOARD) {
649 + LogMessage(X_INFO, "config/devd: kbdmux is enabled, ignoring device %s\n",
654 + snprintf(path, sizeof(path), "/dev/%s", devname);
656 + options = input_option_new(NULL, "_source", "server/devd");
660 + snprintf(sysctlname, sizeof(sysctlname), "dev.%s.%s.%%desc",
661 + hw_types[i].driver, devname + strlen(hw_types[i].driver));
662 + vendor = sysctl_get_str(sysctlname);
663 + if (vendor == NULL) {
664 + options = input_option_new(options, "name", devname);
667 + if ((walk = strchr(vendor, ' ')) != NULL) {
671 + if ((walk = strchr(product, ',')) != NULL)
675 + attrs.vendor = strdup(vendor);
677 + attrs.product = strdup(product);
678 + options = input_option_new(options, "name", product);
681 + options = input_option_new(options, "name", "(unnamed)");
686 + /* XXX implement usb_id */
687 + attrs.usb_id = NULL;
688 + attrs.device = strdup(path);
689 + options = input_option_new(options, "driver", hw_types[i].xdriver);
691 + fd = open(path, O_RDONLY);
694 + options = input_option_new(options, "device", path);
697 + if (attrs.flags & ~ATTR_KEYBOARD) {
698 + LogMessage(X_INFO, "config/devd: device %s already opened\n",
702 + * Fail if cannot open device, it breaks AllowMouseOpenFail,
703 + * but it should not matter when config/devd enabled
708 + if (is_console_kbd) {
710 + * There can be only one keyboard attached to console and
711 + * it is already added.
713 + LogMessage(X_WARNING, "config/devd: console keyboard is "
714 + "already added, ignoring %s (%s)\n",
715 + attrs.product, path);
720 + * Don't pass "device" option if the keyboard is already
721 + * attached to the console (ie. open() fails).
722 + * This would activate a special logic in xf86-input-keyboard.
723 + * Prevent any other attached to console keyboards being
724 + * processed. There can be only one such device.
726 + is_console_kbd = true;
729 + if (asprintf(&config_info, "devd:%s", devname) == -1) {
730 + config_info = NULL;
734 + if (device_is_duplicate(config_info)) {
735 + LogMessage(X_WARNING, "config/devd: device %s (%s) already added. "
736 + "ignoring\n", attrs.product, path);
740 + options = input_option_new(options, "config_info", config_info);
741 + LogMessage(X_INFO, "config/devd: adding input device %s (%s)\n",
742 + attrs.product, path);
744 + NewInputDeviceRequest(options, &attrs, &dev);
748 + input_option_free_list(&options);
749 + free(attrs.usb_id);
750 + free(attrs.product);
751 + free(attrs.device);
752 + free(attrs.vendor);
756 +device_removed(char *devname)
760 + if (asprintf(&config_info, "devd:%s", devname) == -1)
763 + remove_devices("devd", config_info);
768 +static bool is_kbdmux_enabled(void)
770 + /* Xorg uses /dev/ttyv0 as a console device */
771 + /* const char device[]="/dev/console"; */
772 + const char device[]="/dev/ttyv0";
773 + keyboard_info_t info;
776 + fd = open(device, O_RDONLY);
781 + if (ioctl(fd, KDGKBINFO, &info) == -1) {
788 + if (!strncmp(info.kb_name, "kbdmux", 6))
795 +disconnect_devd(int sock)
798 + RemoveGeneralSocket(sock);
806 + struct sockaddr_un devd;
809 + sock = socket(AF_UNIX, SOCK_STREAM, 0);
811 + LogMessage(X_ERROR, "config/devd: fail opening stream socket\n");
815 + devd.sun_family = AF_UNIX;
816 + strlcpy(devd.sun_path, DEVD_SOCK_PATH, sizeof(devd.sun_path));
818 + if (connect(sock, (struct sockaddr *) &devd, sizeof(devd)) < 0) {
820 + LogMessage(X_ERROR, "config/devd: fail to connect to devd\n");
824 + AddGeneralSocket(sock);
830 +reconnect_handler(OsTimerPtr timer, CARD32 time, void *arg)
834 + if ((newsock = connect_devd()) > 0) {
835 + sock_devd = newsock;
838 + LogMessage(X_INFO, "config/devd: reopening devd socket\n");
842 + /* Try again after RECONNECT_DELAY */
843 + return RECONNECT_DELAY;
847 +socket_getline(int fd, char **out)
849 + char *buf, *newbuf;
850 + ssize_t ret, cap, sz = 0;
854 + buf = malloc(cap * sizeof(char));
859 + ret = read(sock_devd, &c, 1);
861 + if (errno == EINTR)
865 + /* EOF - devd socket is lost */
866 + } else if (ret == 0) {
867 + disconnect_devd(sock_devd);
868 + rtimer = TimerSet(NULL, 0, 1, reconnect_handler, NULL);
869 + LogMessage(X_WARNING, "config/devd: devd socket is lost\n");
876 + if (sz + 1 >= cap) {
878 + newbuf = realloc(buf, cap * sizeof(char));
895 + /* Number of bytes in the line, not counting the line break */
900 +wakeup_handler(void *data, int err, void *read_mask)
908 + if (FD_ISSET(sock_devd, (fd_set *) read_mask)) {
909 + if (socket_getline(sock_devd, &line) < 0)
912 + walk = strchr(line + 1, ' ');
917 + case DEVD_EVENT_ADD:
918 + device_added(line + 1);
920 + case DEVD_EVENT_REMOVE:
921 + device_removed(line + 1);
931 +block_handler(void *data, struct timeval **tv, void *read_mask)
936 +config_devd_init(void)
938 + char devicename[1024];
941 + LogMessage(X_INFO, "config/devd: probing input devices...\n");
944 + * Add fake keyboard and give up on keyboards management
945 + * if kbdmux is enabled
947 + if ((is_kbdmux = is_kbdmux_enabled()) == true)
948 + device_added("kbdmux");
950 + for (i = 0; hw_types[i].driver != NULL; i++) {
951 + /* First scan the sysctl to determine the hardware */
952 + for (j = 0; j < 16; j++) {
953 + if (sysctl_exists(&hw_types[i], j,
954 + devicename, sizeof(devicename)) != 0)
955 + device_added(devicename);
958 + if (devpath_exists(&hw_types[i], devicename, sizeof(devicename)) != 0)
959 + device_added(devicename);
962 + if ((sock_devd = connect_devd()) < 0)
965 + RegisterBlockAndWakeupHandlers(block_handler, wakeup_handler, NULL);
971 +config_devd_fini(void)
973 + LogMessage(X_INFO, "config/devd: terminating backend...\n");
980 + disconnect_devd(sock_devd);
982 + RemoveBlockAndWakeupHandlers(block_handler, wakeup_handler, NULL);
984 + is_console_kbd = false;
988 [FILE:391:patches/patch-config_meson.build]
989 --- config/meson.build.orig 2023-12-13 01:31:04 UTC
990 +++ config/meson.build
991 @@ -25,7 +25,7 @@ endif
994 install_data('10-quirks.conf',
995 - install_dir: join_paths(get_option('datadir'), 'X11/xorg.conf.d'))
996 + install_dir: join_paths(get_option('prefix'), 'etc/X11/xorg.conf.d'))
999 libxserver_config = static_library('libxserver_config',
1002 [FILE:3104:patches/patch-config_udev.c]
1003 --- config/udev.c.orig 2023-12-13 01:31:04 UTC
1007 #include <libudev.h>
1013 @@ -67,6 +68,45 @@ config_udev_odev_setup_attribs(struct ud
1015 static char itoa_buf[16];
1017 +#if defined(__DragonFly__)
1018 +// Taken from FreeBSD's lib/libc/gen/feature_present.c
1020 +#include <sys/cdefs.h>
1021 +#include <sys/types.h>
1022 +#include <sys/sysctl.h>
1024 +#include <stdlib.h>
1025 +#include <unistd.h>
1027 +int feature_present(const char *);
1029 + * Returns true if the named feature is present in the currently
1030 + * running kernel. A feature's presence is indicated by an integer
1031 + * sysctl node called kern.feature.<feature> that is non-zero.
1034 +feature_present(const char *feature)
1040 + if (asprintf(&mib, "kern.features.%s", feature) < 0)
1043 + if (sysctlbyname(mib, &i, &len, NULL, 0) < 0) {
1048 + if (len != sizeof(i))
1053 +// end of FreeBSD's lib/libc/gen/feature_present.c
1056 static const char *itoa(int i)
1058 snprintf(itoa_buf, sizeof(itoa_buf), "%d", i);
1059 @@ -198,7 +238,21 @@ device_added(struct udev_device *udev_de
1060 attrs.product = strdup(name);
1061 input_options = input_option_new(input_options, "name", name);
1062 input_options = input_option_new(input_options, "path", path);
1063 - input_options = input_option_new(input_options, "device", path);
1064 + if(strstr(path, "kbdmux") != NULL) {
1066 + * Don't pass "device" option if the keyboard is already attached
1067 + * to the console (ie. open() fails). This would activate a special
1068 + * logic in xf86-input-keyboard. Prevent any other attached to console
1069 + * keyboards being processed. There can be only one such device.
1071 + int fd = open(path, O_RDONLY);
1074 + input_options = input_option_new(input_options, "device", path);
1078 + input_options = input_option_new(input_options, "device", path);
1079 input_options = input_option_new(input_options, "major", itoa(major(devnum)));
1080 input_options = input_option_new(input_options, "minor", itoa(minor(devnum)));
1082 @@ -280,6 +334,18 @@ device_added(struct udev_device *udev_de
1086 + if (attrs.flags & (ATTR_KEY | ATTR_KEYBOARD)) {
1087 + if (!feature_present("evdev_support"))
1088 + input_options = input_option_new(input_options, "driver", "kbd");
1089 + } else if (attrs.flags & ATTR_POINTER) {
1090 + if (strstr(path, "vbox"))
1091 + input_options = input_option_new(input_options, "driver", "vboxmouse");
1093 + if (!feature_present("evdev_support"))
1094 + input_options = input_option_new(input_options, "driver", "mouse");
1098 input_options = input_option_new(input_options, "config_info", config_info);
1100 /* Default setting needed for non-seat0 seats */
1103 [FILE:1646:patches/patch-configure]
1104 --- configure.orig 2023-12-13 01:31:14 UTC
1106 @@ -24707,14 +24707,14 @@ printf "%s\n" "#define USE_ALPHA_PIO 1"
1111 + *freebsd*|*midnight*)
1112 printf "%s\n" "#define USE_DEV_IO 1" >>confdefs.h
1115 printf "%s\n" "#define USE_DEV_IO 1" >>confdefs.h
1118 -printf "%s\n" "#define USE_I386_IOPL 1" >>confdefs.h
1119 +printf "%s\n" "#define USE_AMD64_IOPL 1" >>confdefs.h
1123 @@ -24778,7 +24778,7 @@ fi
1127 - *freebsd* | *dragonfly*)
1128 + *freebsd* | *dragonfly*| *midnight*)
1132 @@ -26588,7 +26588,8 @@ case ${host_os} in
1134 # use libc stubs, don't link against libpthread, to allow
1136 - ax_pthread_flags=""
1137 + ax_pthread_flags="none"
1138 + ax_pthread_ok="yes"
1142 @@ -28097,7 +28098,7 @@ fi
1143 case "x$XTRANS_SEND_FDS" in
1146 - linux*|solaris*|freebsd*|dragonfly*|openbsd*)
1147 + linux*|solaris*|freebsd*|dragonfly*|openbsd*|midnight*)
1151 @@ -30713,7 +30714,7 @@ printf "%s\n" "#define PCI_TXT_IDS_PATH
1152 test "$exec_prefix_NONE" && exec_prefix=NONE
1155 - gnu* | freebsd* | kfreebsd*-gnu | netbsd* | openbsd* | solaris* | dragonfly*)
1156 + gnu* | freebsd* | kfreebsd*-gnu | netbsd* | openbsd* | solaris* | dragonfly* | midnight*)
1157 xorg_bus_bsdpci="yes"
1160 @@ -30763,7 +30764,7 @@ fi
1164 - freebsd* | kfreebsd*-gnu | dragonfly*)
1165 + freebsd* | kfreebsd*-gnu | dragonfly* | midnight*)
1166 XORG_OS_SUBDIR="bsd"
1171 [FILE:256:patches/patch-hw_kdrive_ephyr_hostx.c]
1172 --- hw/kdrive/ephyr/hostx.c.orig 2023-12-13 01:31:04 UTC
1173 +++ hw/kdrive/ephyr/hostx.c
1175 #include <string.h> /* for memset */
1180 #include <sys/ipc.h>
1181 #include <sys/shm.h>
1184 [FILE:791:patches/patch-hw_xfree86_common_xf86AutoConfig.c]
1185 --- hw/xfree86/common/xf86AutoConfig.c.orig 2023-12-13 01:31:04 UTC
1186 +++ hw/xfree86/common/xf86AutoConfig.c
1187 @@ -294,7 +294,7 @@ listPossibleVideoDrivers(XF86MatchedDriv
1188 xf86PciMatchDriver(md);
1191 -#if defined(__linux__)
1192 +#if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__)
1193 xf86AddMatchedDriver(md, "modesetting");
1196 @@ -302,8 +302,10 @@ listPossibleVideoDrivers(XF86MatchedDriv
1197 /* Fallback to platform default frame buffer driver */
1198 #if !defined(__linux__) && defined(__sparc__)
1199 xf86AddMatchedDriver(md, "wsfb");
1201 +#elif defined(__linux__)
1202 xf86AddMatchedDriver(md, "fbdev");
1203 +#elif defined(__FreeBSD__) || defined(__DragonFly__)
1204 + xf86AddMatchedDriver(md, "scfb");
1210 [FILE:700:patches/patch-hw_xfree86_common_xf86Config.c]
1211 --- hw/xfree86/common/xf86Config.c.orig 2023-12-13 01:31:04 UTC
1212 +++ hw/xfree86/common/xf86Config.c
1213 @@ -1279,13 +1279,16 @@ checkCoreInputDevices(serverLayoutPtr se
1216 if (!xf86Info.forceInputDevices && !(foundPointer && foundKeyboard)) {
1217 -#if defined(CONFIG_HAL) || defined(CONFIG_UDEV) || defined(CONFIG_WSCONS)
1218 +#if defined(CONFIG_HAL) || defined(CONFIG_UDEV) || defined(CONFIG_WSCONS) || \
1219 + defined(CONFIG_DEVD)
1220 const char *config_backend;
1222 #if defined(CONFIG_HAL)
1223 config_backend = "HAL";
1224 #elif defined(CONFIG_UDEV)
1225 config_backend = "udev";
1226 +#elif defined(CONFIG_DEVD)
1227 + config_backend = "devd";
1229 config_backend = "wscons";
1233 [FILE:510:patches/patch-hw_xfree86_common_xf86Globals.c]
1234 --- hw/xfree86/common/xf86Globals.c.orig 2023-12-13 01:31:04 UTC
1235 +++ hw/xfree86/common/xf86Globals.c
1236 @@ -118,7 +118,7 @@ xf86InfoRec xf86Info = {
1237 .miscModInDevEnabled = TRUE,
1238 .miscModInDevAllowNonLocal = FALSE,
1240 -#if defined(CONFIG_HAL) || defined(CONFIG_UDEV) || defined(CONFIG_WSCONS)
1241 +#if defined(CONFIG_HAL) || defined(CONFIG_UDEV) || defined(CONFIG_WSCONS) || defined(CONFIG_DEVD)
1242 .forceInputDevices = FALSE,
1243 .autoAddDevices = TRUE,
1244 .autoEnableDevices = TRUE,
1247 [FILE:483:patches/patch-hw_xfree86_common_xf86Xinput.c]
1248 --- hw/xfree86/common/xf86Xinput.c.orig 2023-12-13 01:31:04 UTC
1249 +++ hw/xfree86/common/xf86Xinput.c
1250 @@ -1065,6 +1065,7 @@ NewInputDeviceRequest(InputOption *optio
1251 if (strcmp(key, "_source") == 0 &&
1252 (strcmp(value, "server/hal") == 0 ||
1253 strcmp(value, "server/udev") == 0 ||
1254 + strcmp(value, "server/devd") == 0 ||
1255 strcmp(value, "server/wscons") == 0)) {
1257 if (!xf86Info.autoAddDevices) {
1260 [FILE:343:patches/patch-hw_xfree86_common_xf86str.h]
1261 --- hw/xfree86/common/xf86str.h.orig 2023-12-13 01:31:04 UTC
1262 +++ hw/xfree86/common/xf86str.h
1263 @@ -249,7 +249,7 @@ typedef struct _DriverRec {
1266 /* Tolerate prior #include <linux/input.h> */
1267 -#if defined(__linux__)
1268 +#if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__)
1274 [FILE:596:patches/patch-hw_xfree86_drivers_modesetting_driver.c]
1275 --- hw/xfree86/drivers/modesetting/driver.c.orig 2023-12-13 01:31:04 UTC
1276 +++ hw/xfree86/drivers/modesetting/driver.c
1277 @@ -925,8 +925,12 @@ try_enable_glamor(ScrnInfoPtr pScrn)
1278 modesettingPtr ms = modesettingPTR(pScrn);
1279 const char *accel_method_str = xf86GetOptValString(ms->drmmode.Options,
1280 OPTION_ACCEL_METHOD);
1281 +#if defined(__DragonFly__)
1282 + Bool do_glamor = FALSE;
1284 Bool do_glamor = (!accel_method_str ||
1285 strcmp(accel_method_str, "glamor") == 0);
1288 ms->drmmode.glamor = FALSE;
1292 [FILE:359:patches/patch-hw_xfree86_meson.build]
1293 --- hw/xfree86/meson.build.orig 2023-12-13 01:31:04 UTC
1294 +++ hw/xfree86/meson.build
1295 @@ -152,7 +152,6 @@ if get_option('suid_wrapper')
1296 c_args: xorg_c_args,
1298 install_dir: get_option('libexecdir'),
1299 - install_mode: ['r-sr-xr-x', 0, 0],
1302 # meson gets confused when there are two targets of the same name
1305 [FILE:2566:patches/patch-hw_xfree86_os-support_bsd_bsd__init.c]
1306 --- hw/xfree86/os-support/bsd/bsd_init.c.orig 2023-12-13 01:31:04 UTC
1307 +++ hw/xfree86/os-support/bsd/bsd_init.c
1308 @@ -48,6 +48,8 @@ static int devConsoleFd = -1;
1309 #if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
1310 static int VTnum = -1;
1311 static int initialVT = -1;
1312 +static struct termios tty_attr; /* tty state to restore */
1313 +static int tty_mode; /* kbd mode to restore */
1316 #ifdef PCCONS_SUPPORT
1317 @@ -230,6 +232,9 @@ xf86OpenConsole()
1318 * Add cases for other *BSD that behave the same.
1320 #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
1321 +#if defined(__sparc64__)
1322 + pci_system_init_dev_mem(fd);
1325 i = atof(uts.release) * 100;
1327 @@ -253,6 +258,7 @@ xf86OpenConsole()
1330 if (!xf86Info.ShareVTs) {
1331 + struct termios nTty;
1335 @@ -287,6 +293,26 @@ xf86OpenConsole()
1336 if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS) < 0) {
1337 FatalError("xf86OpenConsole: KDSETMODE KD_GRAPHICS failed");
1340 + tcgetattr(xf86Info.consoleFd, &tty_attr);
1341 + ioctl(xf86Info.consoleFd, KDGKBMODE, &tty_mode);
1343 + /* disable special keys */
1344 + if (ioctl(xf86Info.consoleFd, KDSKBMODE, K_RAW) < 0) {
1345 + FatalError("xf86OpenConsole: KDSKBMODE K_RAW failed (%s)",
1350 + nTty.c_iflag = IGNPAR | IGNBRK;
1352 + nTty.c_cflag = CREAD | CS8;
1354 + nTty.c_cc[VTIME] = 0;
1355 + nTty.c_cc[VMIN] = 1;
1356 + cfsetispeed(&nTty, 9600);
1357 + cfsetospeed(&nTty, 9600);
1358 + tcsetattr(xf86Info.consoleFd, TCSANOW, &nTty);
1360 else { /* xf86Info.ShareVTs */
1361 close(xf86Info.consoleFd);
1362 @@ -594,6 +620,8 @@ xf86CloseConsole()
1365 ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT); /* Back to text mode */
1366 + ioctl(xf86Info.consoleFd, KDSKBMODE, tty_mode);
1367 + tcsetattr(xf86Info.consoleFd, TCSANOW, &tty_attr);
1368 if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) != -1) {
1370 ioctl(xf86Info.consoleFd, VT_SETMODE, &VT); /* dflt vt handling */
1373 [FILE:519:patches/patch-hw_xfree86_os-support_bsd_i386__video.c]
1374 --- hw/xfree86/os-support/bsd/i386_video.c.orig 2023-12-13 01:31:04 UTC
1375 +++ hw/xfree86/os-support/bsd/i386_video.c
1377 #include "xf86Priv.h"
1380 +#include <sys/types.h>
1381 #include <sys/mman.h>
1383 #include "xf86_OSlib.h"
1386 #define MAP_FLAGS (MAP_FILE | MAP_SHARED)
1388 +#if defined(__NetBSD__) && defined(USE_AMD64_IOPL)
1389 +#define amd64_iopl x86_64_iopl
1393 #define SYSCTL_MSG "\tCheck that you have set 'machdep.allowaperture=1'\n"\
1396 [FILE:380:patches/patch-hw_xfree86_os-support_bsd_ppc__video.c]
1397 --- hw/xfree86/os-support/bsd/ppc_video.c.orig 2023-12-13 01:31:04 UTC
1398 +++ hw/xfree86/os-support/bsd/ppc_video.c
1399 @@ -79,7 +79,11 @@ xf86DisableIO()
1402 if (ioBase != MAP_FAILED) {
1403 +#if defined(__FreeBSD__)
1404 + munmap(__DEVOLATILE(unsigned char *, ioBase), 0x10000);
1406 munmap(__UNVOLATILE(ioBase), 0x10000);
1408 ioBase = MAP_FAILED;
1413 [FILE:1280:patches/patch-hw_xfree86_os-support_meson.build]
1414 --- hw/xfree86/os-support/meson.build.orig 2023-12-13 01:31:04 UTC
1415 +++ hw/xfree86/os-support/meson.build
1416 @@ -91,11 +91,12 @@ elif host_machine.system() == 'sunos'
1417 error('Unknown CPU family for Solaris build')
1420 -elif host_machine.system().endswith('bsd')
1421 +elif host_machine.system().endswith('bsd') or host_machine.system() == 'dragonfly'
1422 srcs_xorg_os_support += [
1426 + 'misc/SlowBcopy.c',
1430 @@ -120,14 +121,14 @@ elif host_machine.system().endswith('bsd
1431 srcs_xorg_os_support += 'shared/ioperm_noop.c'
1432 elif host_machine.cpu_family() == 'alpha'
1433 srcs_xorg_os_support += 'bsd/alpha_video.c'
1434 - if host_machine.system() == 'freebsd'
1435 + if host_machine.system() == 'freebsd' or host_machine.system() == 'midnightbsd'
1436 os_dep += cc.find_library('io')
1437 elif host_machine.system() == 'netbsd'
1438 os_c_args += '-DUSE_ALPHA_PIO'
1442 - if host_machine.system() == 'freebsd'
1443 + if ['freebsd', 'dragonfly', 'midnightbsd'].contains(host_machine.system())
1444 srcs_xorg_os_support += 'bsd/bsd_kmod.c'
1446 srcs_xorg_os_support += 'shared/kmod_noop.c'
1449 [FILE:714:patches/patch-hw_xfree86_os-support_solaris_sun__init.c]
1450 --- hw/xfree86/os-support/solaris/sun_init.c.orig 2023-12-13 01:31:04 UTC
1451 +++ hw/xfree86/os-support/solaris/sun_init.c
1452 @@ -54,6 +54,22 @@ static int xf86StartVT = -1;
1453 static int vtEnabled = 0;
1457 +#define VTIOC ('V'<<8)
1458 +#define VT_OPENQRY (VTIOC|1)
1459 +#define VT_SETMODE (VTIOC|2)
1460 +#define VT_GETMODE (VTIOC|3)
1461 +#define VT_ACTIVATE (VTIOC|5)
1462 +#define VT_WAITACTIVE (VTIOC|6)
1463 +#define VT_GETSTATE (VTIOC|100)
1464 +#define VT_ENABLED (VTIOC|101)
1465 +#define VT_SETDISPINFO (VTIOC|103)
1466 +#define VT_GET_CONSUSER (VTIOC|108)
1467 +#define VT_SET_CONSUSER (VTIOC|109)
1469 +enum { VT_AUTO = 0, VT_PROCESS };
1472 /* Device to open as xf86Info.consoleFd */
1473 static char consoleDev[PATH_MAX] = "/dev/fb";
1477 [FILE:520:patches/patch-hw_xfree86_os-support_xf86__OSlib.h]
1478 --- hw/xfree86/os-support/xf86_OSlib.h.orig 2023-12-13 01:31:04 UTC
1479 +++ hw/xfree86/os-support/xf86_OSlib.h
1480 @@ -241,7 +241,7 @@ extern _X_HIDDEN char xf86SolarisFbDev[P
1481 #ifdef SYSCONS_SUPPORT
1482 #define COMPAT_SYSCONS
1483 #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
1484 -#if defined(__DragonFly__) || (__FreeBSD_kernel_version >= 410000)
1485 +#if defined(__DragonFly__) || (__FreeBSD_kernel_version >= 410000) || defined(__MidnightBSD__)
1486 #include <sys/consio.h>
1487 #include <sys/kbio.h>
1491 [FILE:1986:patches/patch-hw_xfree86_xorg-wrapper.c]
1492 * Skip the detection of root rights requirement, the assumption that presence
1493 * of KMS drivers removes the root requirement is only valid for Linux
1495 --- hw/xfree86/xorg-wrapper.c.orig 2023-12-13 01:31:04 UTC
1496 +++ hw/xfree86/xorg-wrapper.c
1498 #include <sys/sysmacros.h>
1500 #include <sys/types.h>
1501 -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
1502 +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
1503 #include <sys/consio.h>
1506 @@ -170,7 +170,7 @@ static int on_console(int fd)
1508 if (r == 0 && S_ISCHR(st.st_mode) && major(st.st_rdev) == 4)
1510 -#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
1511 +#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
1514 if (ioctl(fd, VT_GETINDEX, &idx) != -1)
1515 @@ -191,7 +191,7 @@ static int on_console(int fd)
1517 int main(int argc, char *argv[])
1520 +#if defined(WITH_LIBDRM) && defined(__linux__)
1521 struct drm_mode_card_res res;
1524 @@ -230,7 +230,7 @@ int main(int argc, char *argv[])
1529 +#if defined(WITH_LIBDRM) && defined(__linux__)
1530 /* Detect if we need root rights, except when overridden by the config */
1531 if (needs_root_rights == -1) {
1532 for (i = 0; i < 16; i++) {
1533 @@ -256,6 +256,8 @@ int main(int argc, char *argv[])
1534 gid_t realgid = getgid();
1535 uid_t realuid = getuid();
1537 +#if !defined(__NetBSD__)
1538 + /* setresgid and setresuid are not implemented on NetBSD */
1539 if (setresgid(-1, realgid, realgid) != 0) {
1540 fprintf(stderr, "%s: Could not drop setgid privileges: %s\n",
1541 progname, strerror(errno));
1542 @@ -266,6 +268,7 @@ int main(int argc, char *argv[])
1543 progname, strerror(errno));
1549 snprintf(buf, sizeof(buf), "%s/Xorg", SUID_WRAPPER_DIR);
1552 [FILE:1214:patches/patch-include_meson.build]
1553 --- include/meson.build.orig 2023-12-13 01:31:04 UTC
1554 +++ include/meson.build
1555 @@ -278,7 +278,7 @@ supports_syscons = false
1556 supports_wscons = false
1559 -if host_machine.system() == 'freebsd' or host_machine.system() == 'dragonfly'
1560 +if ['freebsd', 'dragonfly', 'midnightbsd'].contains(host_machine.system())
1561 supports_pccons = true
1562 supports_pcvt = true
1563 supports_syscons = true
1564 @@ -377,13 +377,13 @@ xorg_data.set('HAVE_STROPTS_H', cc.has_h
1565 xorg_data.set('HAVE_SYS_KD_H', cc.has_header('sys/kd.h') ? '1' : false)
1566 xorg_data.set('HAVE_SYS_VT_H', cc.has_header('sys/vt.h') ? '1' : false)
1568 -if host_machine.system() == 'freebsd' or host_machine.system() == 'dragonfly'
1569 +if ['freebsd', 'dragonfly', 'midnightbsd'].contains(host_machine.system())
1570 if host_machine.cpu_family() == 'x86' or host_machine.cpu_family() == 'x86_64'
1571 xorg_data.set('USE_DEV_IO', '1')
1573 elif host_machine.system() == 'netbsd'
1574 if host_machine.cpu_family() == 'x86' or host_machine.cpu_family() == 'x86_64'
1575 - xorg_data.set('USE_I386_IOPL', '1')
1576 + xorg_data.set('USE_AMD64_IOPL', '1')
1578 elif host_machine.system() == 'openbsd'
1579 if host_machine.cpu_family() == 'x86'
1582 [FILE:193:patches/patch-os_backtrace.c]
1583 --- os/backtrace.c.orig 2023-12-13 01:31:04 UTC
1589 +#include <unistd.h>
1591 #ifdef HAVE_LIBUNWIND
1595 [FILE:1021:patches/patch-test_simple-xinit.c]
1596 --- test/simple-xinit.c.orig 2023-12-13 01:31:04 UTC
1597 +++ test/simple-xinit.c
1599 #include <sys/wait.h>
1603 +#include <sys/varargs.h>
1605 +vasprintf(char **strp, const char *fmt, va_list args)
1607 + va_list args_copy;
1608 + int status, needed;
1610 + va_copy(args_copy, args);
1611 + needed = vsnprintf(NULL, 0, fmt, args_copy);
1612 + va_end(args_copy);
1617 + *strp = malloc(needed + 1);
1618 + if (*strp == NULL)
1620 + status = vsnprintf(*strp, needed + 1, fmt, args);
1631 +asprintf(char **strp, const char *fmt, ...)
1636 + va_start(args, fmt);
1637 + status = vasprintf(strp, fmt, args);
1644 kill_server(int server_pid)
1648 [FILE:152:files/20-evdev-kbd.conf]
1649 Section "InputClass"
1650 Identifier "Evdev keyboard"
1651 MatchDevicePath "/dev/input/event*"
1652 MatchIsKeyboard "on"
1653 Option "XkbRules" "evdev"
1657 [FILE:251:files/special.mk]
1658 sharefonts= ${LOCALBASE}/share/fonts
1659 fontpathd= ${PREFIX}/etc/X11/fontpath.d
1661 fontlist= ${sharefonts}/misc \
1664 ${sharefonts}/Type1 \
1665 ${sharefonts}/100dpi \
1666 ${sharefonts}/75dpi \
1667 catalogue:${fontpathd}