Ravenports generated: 21 Aug 2017 14:35
[ravenports.git] / bucket_E7 / xorg-server
1 # Buildsheet autogenerated by ravenadm tool -- Do not edit.
2
3 NAMEBASE=               xorg-server
4 VERSION=                1.19.3
5 KEYWORDS=               x11_servers
6 VARIANTS=               standard virtual dmx xephyr nest wayland
7 SDESC[xephyr]=          X server from X.Org based on kdrive
8 SDESC[virtual]=         X virtual framebuffer server from X.Org
9 SDESC[wayland]=         X Clients under Wayland
10 SDESC[standard]=        X.Org X server and related programs
11 SDESC[dmx]=             Distributed Multihead X from X.Org
12 SDESC[nest]=            Nesting X server from X.Org
13 HOMEPAGE=               https://www.x.org/
14 CONTACT=                nobody
15
16 DOWNLOAD_GROUPS=        main
17 SITES[main]=            XORG/individual/xserver
18 DISTFILE[1]=            xorg-server-1.19.3.tar.bz2:main
19 DF_INDEX=               1
20 SPKGS[xephyr]=          single
21 SPKGS[virtual]=         single
22 SPKGS[wayland]=         single
23 SPKGS[standard]=        single
24 SPKGS[dmx]=             single
25 SPKGS[nest]=            single
26
27 OPTIONS_AVAILABLE=      XORG VIRTUAL DMX XEPHYR NEST WAYLAND DEVD SUID
28 OPTIONS_STANDARD=       XORG DEVD SUID
29 VOPTS[xephyr]=          XORG=OFF VIRTUAL=OFF DMX=OFF XEPHYR=ON NEST=OFF
30                         WAYLAND=OFF DEVD=OFF SUID=OFF
31 VOPTS[virtual]=         XORG=OFF VIRTUAL=ON DMX=OFF XEPHYR=OFF NEST=OFF
32                         WAYLAND=OFF DEVD=OFF SUID=OFF
33 VOPTS[wayland]=         XORG=OFF VIRTUAL=OFF DMX=OFF XEPHYR=OFF NEST=OFF
34                         WAYLAND=ON DEVD=OFF SUID=OFF
35 VOPTS[dmx]=             XORG=OFF VIRTUAL=OFF DMX=ON XEPHYR=OFF NEST=OFF
36                         WAYLAND=OFF DEVD=OFF SUID=OFF
37 VOPTS[nest]=            XORG=OFF VIRTUAL=OFF DMX=OFF XEPHYR=OFF NEST=ON
38                         WAYLAND=OFF DEVD=OFF SUID=OFF
39 OPT_ON[all]=            XORG SUID
40
41 BUILD_DEPENDS=          xorg-fontutil:single:standard
42                         xorg-xkbfile:single:standard
43 RUN_DEPENDS=            xorg-xkeyboard-config:single:standard
44                         xorg-xkbcomp:single:standard
45
46 USES=                   gmake libtool perl:build ssl
47 XORG_COMPONENTS=        bigreqsproto compositeproto damageproto dri2proto
48                         dri3proto fixesproto fontsproto glproto inputproto
49                         kbproto pixman presentproto randrproto recordproto
50                         renderproto resourceproto scrnsaverproto videoproto
51                         xtransproto xcmiscproto xextproto xf86driproto
52                         xineramaproto xproto xshmfence xau xdmcp xfont2
53
54 FPC_EQUIVALENT=         x11-servers/xorg-server
55
56 MUST_CONFIGURE=         gnu
57 CONFIGURE_ARGS=         --with-xkb-path={{LOCALBASE}}/share/X11/xkb
58                         --with-fontrootdir={{LOCALBASE}}/share/fonts
59                         --without-doxygen
60                         --without-xmlto
61                         --without-fop
62                         --localstatedir=/var
63                         --with-shared-memory-dir=/tmp
64                         --disable-config-hal
65                         --disable-config-udev
66                         --disable-config-udev-kms
67                         --disable-install-setuid
68                         --without-dtrace
69                         --enable-glamor
70                         --enable-xcsecurity
71
72 INSTALL_TARGET=         install-strip
73
74 [DEVD].DESCRIPTION=                     Use devd for autoconfiguration of input devices
75
76 [NEST].DESCRIPTION=                     Build as nesting X server
77 [NEST].BUILD_DEPENDS_ON=                libepoxy:single:standard
78                                         mesa:drivers:standard
79 [NEST].CONFIGURE_ENABLE_BOTH=           xnest
80 [NEST].USES_ON=                         mesa
81 [NEST].XORG_COMPONENTS_ON=              x11
82                                         xext
83
84 [XEPHYR].DESCRIPTION=                   Build as kdrive-base X server
85 [XEPHYR].BUILDRUN_DEPENDS_ON=           libdrm:single:standard
86                                         libepoxy:single:standard
87 [XEPHYR].BUILD_DEPENDS_ON=              mesa:drivers:standard
88 [XEPHYR].CONFIGURE_ENABLE_BOTH=         xephyr
89                                         kdrive
90 [XEPHYR].USES_ON=                       mesa
91 [XEPHYR].XORG_COMPONENTS_ON=            x11
92                                         xcb
93                                         xcb-util
94                                         xcb-util-image
95                                         xcb-util-wm
96                                         xcb-util-keysyms
97                                         xcb-render-util
98
99 [DMX].DESCRIPTION=                      Build as distributed multihead X server
100 [DMX].BUILD_DEPENDS_ON=                 libepoxy:single:standard
101                                         mesa:drivers:standard
102                                         xorg-xtst:single:standard
103                                         xorg-xres:single:standard
104 [DMX].CONFIGURE_ENABLE_BOTH=            dmx
105 [DMX].XORG_COMPONENTS_ON=               dmx
106                                         x11
107                                         xaw
108                                         xext
109                                         xfixes
110                                         xi
111                                         xmu
112                                         xpm
113                                         xrender
114                                         xt
115
116 [VIRTUAL].DESCRIPTION=                  Build as virtual framebuffer server
117 [VIRTUAL].BUILD_DEPENDS_ON=             libepoxy:single:standard
118                                         mesa:drivers:standard
119 [VIRTUAL].CONFIGURE_ENABLE_BOTH=        xvfb
120 [VIRTUAL].USES_ON=                      mesa
121
122 [XORG].DESCRIPTION=                     Build as X server (don't change setting!)
123 [XORG].BUILDRUN_DEPENDS_ON=             libdrm:single:standard
124                                         libepoxy:single:standard
125                                         mesa:drivers:standard
126 [XORG].CONFIGURE_ENABLE_BOTH=           docs
127                                         devel-docs
128                                         xorg
129 [XORG].SUB_FILES_ON=                    pkg-install
130                                         pkg-deinstall
131 [XORG].USES_ON=                         mesa
132 [XORG].XORG_COMPONENTS_ON=              pciaccess
133                                         xf86dgaproto
134                                         xf86vidmodeproto
135                                         xfont2
136
137 [WAYLAND].DESCRIPTION=                  Build Wayland X clients
138 [WAYLAND].BROKEN_ON=                    Wayland itself not yet implemented
139 [WAYLAND].BUILDRUN_DEPENDS_ON=          libdrm:single:standard
140                                         libepoxy:single:standard
141 [WAYLAND].BUILD_DEPENDS_ON=             mesa:drivers:standard
142 [WAYLAND].CONFIGURE_ARGS_ON=            --disable-xquartz
143                                         --disable-xwin
144 [WAYLAND].CONFIGURE_ENABLE_BOTH=        xwayland
145 [WAYLAND].XORG_COMPONENTS_ON=           x11
146                                         xext
147
148 [SUID].DESCRIPTION=                     Install the Xorg server with setuid bit set
149
150 post-patch:
151         @${REINPLACE_CMD} 's/test.*-traditional.*;/true;/' ${WRKSRC}/configure
152         # build libglx.so but don't install it yet. (done in pre-install)
153         @${REINPLACE_CMD} -e 's|@GLX_TRUE@GLXMODS =|@GLX_BOGUS@GLXMODS =|g' \
154                 -e 's|^LTLIBRARIES = |LTLIBRARIES = libglx.la |g' \
155                 ${WRKSRC}/hw/xfree86/dixmods/Makefile.in
156
157 do-install-XEPHYR-ON:
158         (cd ${WRKSRC}/hw/kdrive/ephyr && \
159                 DESTDIR=${STAGEDIR} ${MAKE_CMD} install)
160
161 do-install-WAYLAND-ON:
162         (cd ${WRKSRC}/hw/xwayland && \
163                 DESTDIR=${STAGEDIR} ${MAKE_CMD} install)
164
165 post-install-XORG-OFF:
166         ${RM} -r ${STAGEDIR}${PREFIX}/lib/xorg
167         ${RM} ${STAGEDIR}${PREFIX}/share/man/man1/Xserver.1
168
169 post-configure-DEVD-ON:
170         @${REINPLACE_CMD} -e 's|config\.c|config.c devd.c|g' \
171                 -e 's|config\.lo|config.lo devd.lo|g' \
172                 ${WRKSRC}/config/Makefile
173         @${REINPLACE_CMD} -e 's|^/\* #undef CONFIG_UDEV \*/|#define CONFIG_DEVD 1|' \
174                 ${WRKSRC}/include/dix-config.h
175
176 do-install-VIRTUAL-ON:
177         (cd ${WRKSRC}/hw/vfb && \
178                 DESTDIR=${STAGEDIR} ${MAKE_CMD} install)
179
180 do-install-NEST-ON:
181         (cd ${WRKSRC}/hw/xnest && \
182                 DESTDIR=${STAGEDIR} ${MAKE_CMD} install)
183
184 do-install-DMX-ON:
185         (cd ${WRKSRC}/hw/dmx && \
186                 DESTDIR=${STAGEDIR} ${MAKE_CMD} install)
187
188 post-install-XORG-ON:
189         # The .xorg dir because else the xorg-server might not load the
190         # correct libglx module.
191         @${MKDIR} ${STAGEDIR}${PREFIX}/lib/xorg/modules/extensions/.xorg
192         ${INSTALL_LIB} ${WRKSRC}/hw/xfree86/dixmods/.libs/libglx.so \
193                 ${STAGEDIR}${PREFIX}/lib/xorg/modules/extensions/.xorg/
194         @${MKDIR} ${STAGEDIR}${PREFIX}/etc/X11/xorg.conf.d
195         ${RM} -r ${STAGEDIR}/var
196
197 [FILE:71:descriptions/desc.single.standard]
198 This package contains the X.Org X server and some associated programs.
199
200
201 [FILE:60:descriptions/desc.single.virtual]
202 This package contains Xvfb, a virtual framebuffer X server.
203
204
205 [FILE:287:descriptions/desc.single.dmx]
206 Xdmx is proxy X server that provides multi-head support for multiple
207 displays attached to different machines (each of which is running a
208 typical X server).  When Xinerama is used with Xdmx, the multiple displays
209 on multiple machines are presented to the user as a single unified screen.
210
211
212 [FILE:173:descriptions/desc.single.xephyr]
213 Xephyr is a kdrive server that outputs to a window on a pre-existing
214 'host' X display.  Think Xnest but with support for modern extensions
215 like composite, damage and randr.
216
217
218 [FILE:78:descriptions/desc.single.nest]
219 This package contains Xnest, a nesting X Server that displays on an X
220 Server.
221
222
223 [FILE:148:descriptions/desc.single.wayland]
224 XWayland is an X Server running as a Wayland client, thus capable of
225 displaying native X11 client applications in a Wayland compositor
226 environment.
227
228
229 [FILE:105:distinfo]
230 677a8166e03474719238dfe396ce673c4234735464d6dadf2959b600d20e5a98      6050221 xorg-server-1.19.3.tar.bz2
231
232
233 [FILE:2433:manifests/plist.single.standard]
234 bin/
235  X
236 %%SUID-ON%%@(,,4555) bin/Xorg
237 %%SUID-OFF%%bin/Xorg
238  cvt
239  gtf
240 include/xorg/
241  BT.h
242  IBM.h
243  TI.h
244  XIstubs.h
245  Xprintf.h
246  callback.h
247  client.h
248  closestr.h
249  closure.h
250  colormap.h
251  colormapst.h
252  compiler.h
253  compositeext.h
254  cursor.h
255  cursorstr.h
256  damage.h
257  damagestr.h
258  dbestruct.h
259  dgaproc.h
260  displaymode.h
261  dix.h
262  dixaccess.h
263  dixevents.h
264  dixfont.h
265  dixfontstr.h
266  dixgrabs.h
267  dixstruct.h
268  dri.h
269  dri2.h
270  dri3.h
271  dristruct.h
272  edid.h
273  events.h
274  exa.h
275  exevents.h
276  extension.h
277  extinit.h
278  extnsionst.h
279  fb.h
280  fbdevhw.h
281  fboverlay.h
282  fbpict.h
283  fbrop.h
284  fourcc.h
285  gc.h
286  gcstruct.h
287  geext.h
288  geint.h
289  glamor.h
290  globals.h
291  glx_extinit.h
292  glyphstr.h
293  hotplug.h
294  i2c_def.h
295  input.h
296  inputstr.h
297  list.h
298  mi.h
299  micmap.h
300  micoord.h
301  migc.h
302  miline.h
303  mioverlay.h
304  mipict.h
305  mipointer.h
306  mipointrst.h
307  misc.h
308  miscstruct.h
309  mistruct.h
310  misync.h
311  misyncfd.h
312  misyncshm.h
313  misyncstr.h
314  mizerarc.h
315  nonsdk_extinit.h
316  opaque.h
317  optionstr.h
318  os.h
319  panoramiX.h
320  panoramiXsrv.h
321  picture.h
322  picturestr.h
323  pixmap.h
324  pixmapstr.h
325  present.h
326  presentext.h
327  privates.h
328  property.h
329  propertyst.h
330  ptrveloc.h
331  randrstr.h
332  region.h
333  regionstr.h
334  registry.h
335  resource.h
336  rgb.h
337  rrtransform.h
338  sarea.h
339  screenint.h
340  scrnintstr.h
341  selection.h
342  servermd.h
343  shadow.h
344  shadowfb.h
345  shmint.h
346  site.h
347  syncsdk.h
348  validate.h
349  vbe.h
350  vbeModes.h
351  vgaHW.h
352  wfbrename.h
353  window.h
354  windowstr.h
355  xaarop.h
356  xace.h
357  xacestr.h
358  xf86.h
359  xf86Crtc.h
360  xf86Cursor.h
361  xf86DDC.h
362  xf86Modes.h
363  xf86Module.h
364  xf86Opt.h
365  xf86Optionstr.h
366  xf86Optrec.h
367  xf86Parser.h
368  xf86Pci.h
369  xf86PciInfo.h
370  xf86Priv.h
371  xf86Privstr.h
372  xf86RamDac.h
373  xf86RandR12.h
374  xf86VGAarbiter.h
375  xf86Xinput.h
376  xf86_OSlib.h
377  xf86_OSproc.h
378  xf86cmap.h
379  xf86fbman.h
380  xf86i2c.h
381  xf86int10.h
382  xf86platformBus.h
383  xf86sbusBus.h
384  xf86str.h
385  xf86xv.h
386  xf86xvmc.h
387  xf86xvpriv.h
388  xisb.h
389  xkbfile.h
390  xkbrules.h
391  xkbsrv.h
392  xkbstr.h
393  xorg-server.h
394  xorgVersion.h
395  xserver_poll.h
396  xserver-properties.h
397  xvdix.h
398  xvmcext.h
399 lib/xorg/modules/drivers/modesetting_drv.so
400 lib/xorg/modules/extensions/.xorg/libglx.so
401 lib/xorg/modules/
402  libexa.so
403  libfb.so
404  libfbdevhw.so
405  libglamoregl.so
406  libint10.so
407  libshadow.so
408  libshadowfb.so
409  libvbe.so
410  libvgahw.so
411  libwfb.so
412 lib/xorg/protocol.txt
413 lib/pkgconfig/xorg-server.pc
414 share/man/man1/
415  Xorg.1.gz
416  Xserver.1.gz
417  cvt.1.gz
418  gtf.1.gz
419 share/man/man4/
420  exa.4.gz
421  fbdevhw.4.gz
422  modesetting.4.gz
423 share/man/man5/
424  xorg.conf.5.gz
425  xorg.conf.d.5.gz
426 share/aclocal/xorg-server.m4
427 @dir etc/X11/xorg.conf.d
428
429
430 [FILE:34:manifests/plist.single.virtual]
431 bin/Xvfb
432 share/man/man1/Xvfb.1.gz
433
434
435 [FILE:214:manifests/plist.single.dmx]
436 bin/
437  Xdmx
438  dmxaddinput
439  dmxaddscreen
440  dmxinfo
441  dmxreconfig
442  dmxresize
443  dmxrminput
444  dmxrmscreen
445  dmxtodmx
446  dmxwininfo
447  vdltodmx
448  xdmxconfig
449 share/man/man1/
450  Xdmx.1.gz
451  dmxtodmx.1.gz
452  vdltodmx.1.gz
453  xdmxconfig.1.gz
454
455
456 [FILE:38:manifests/plist.single.xephyr]
457 bin/Xephyr
458 share/man/man1/Xephyr.1.gz
459
460
461 [FILE:36:manifests/plist.single.nest]
462 bin/Xnest
463 share/man/man1/Xnest.1.gz
464
465
466 [FILE:13:manifests/plist.single.wayland]
467 bin/Xwayland
468
469
470 [FILE:293:patches/patch-config_config-backends.h]
471 --- config/config-backends.h.orig       2016-07-15 16:17:45 UTC
472 +++ config/config-backends.h
473 @@ -44,3 +44,8 @@ void config_hal_fini(void);
474  int config_wscons_init(void);
475  void config_wscons_fini(void);
476  #endif
477 +
478 +#ifdef CONFIG_DEVD
479 +int config_devd_init(void);
480 +void config_devd_fini(void);
481 +#endif
482
483
484 [FILE:537:patches/patch-config_config.c]
485 --- config/config.c.orig        2016-07-19 17:07:29 UTC
486 +++ config/config.c
487 @@ -55,6 +55,9 @@ config_init(void)
488  #elif defined(CONFIG_WSCONS)
489      if (!config_wscons_init())
490          ErrorF("[config] failed to initialise wscons\n");
491 +#elif defined(CONFIG_DEVD)
492 +    if (!config_devd_init())
493 +        ErrorF("[config] failed to initialise devd\n");
494  #endif
495  }
496  
497 @@ -67,6 +70,8 @@ config_fini(void)
498      config_hal_fini();
499  #elif defined(CONFIG_WSCONS)
500      config_wscons_fini();
501 +#elif defined(CONFIG_DEVD)
502 +    config_devd_fini();
503  #endif
504  }
505  
506
507
508 [FILE:12180:patches/patch-config_devd.c]
509 --- config/devd.c.orig  2017-01-19 15:20:42 UTC
510 +++ config/devd.c
511 @@ -0,0 +1,532 @@
512 +/*
513 + * Copyright (c) 2012 Baptiste Daroussin
514 + * Copyright (c) 2013, 2014 Alex Kozlov
515 + * Copyright (c) 2014 Robert Millan
516 + * Copyright (c) 2014 Jean-Sebastien Pedron
517 + *
518 + * Permission is hereby granted, free of charge, to any person obtaining a
519 + * copy of this software and associated documentation files (the "Software"),
520 + * to deal in the Software without restriction, including without limitation
521 + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
522 + * and/or sell copies of the Software, and to permit persons to whom the
523 + * Software is furnished to do so, subject to the following conditions:
524 + *
525 + * The above copyright notice and this permission notice (including the next
526 + * paragraph) shall be included in all copies or substantial portions of the
527 + * Software.
528 + *
529 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
530 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
531 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
532 + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
533 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
534 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
535 + * DEALINGS IN THE SOFTWARE.
536 + *
537 + * Author: Baptiste Daroussin <bapt@FreeBSD.org>
538 + */
539 +
540 +#ifdef HAVE_DIX_CONFIG_H
541 +#include <dix-config.h>
542 +#endif
543 +
544 +#include <sys/types.h>
545 +#include <sys/kbio.h>
546 +#include <sys/socket.h>
547 +#include <sys/stat.h>
548 +#include <sys/sysctl.h>
549 +#include <sys/un.h>
550 +
551 +#include <ctype.h>
552 +#include <errno.h>
553 +#include <fcntl.h>
554 +#include <stdlib.h>
555 +#include <stdio.h>
556 +#include <stdbool.h>
557 +#include <unistd.h>
558 +
559 +#include "input.h"
560 +#include "inputstr.h"
561 +#include "hotplug.h"
562 +#include "config-backends.h"
563 +#include "os.h"
564 +
565 +#define DEVD_SOCK_PATH "/var/run/devd.pipe"
566 +
567 +#define DEVD_EVENT_ADD         '+'
568 +#define DEVD_EVENT_REMOVE      '-'
569 +
570 +#define RECONNECT_DELAY                5 * 1000
571 +
572 +static int sock_devd;
573 +static bool is_console_kbd = false;
574 +static bool is_kbdmux = false;
575 +static OsTimerPtr rtimer = NULL;
576 +
577 +struct hw_type {
578 +       const char *driver;
579 +       int flag;
580 +       const char *xdriver;
581 +};
582 +
583 +static struct hw_type hw_types[] = {
584 +       { "ukbd", ATTR_KEYBOARD, "kbd" },
585 +       { "atkbd", ATTR_KEYBOARD, "kbd" },
586 +       { "kbdmux", ATTR_KEYBOARD, "kbd" },
587 +       { "sysmouse", ATTR_POINTER, "mouse" },
588 +       { "ums", ATTR_POINTER, "mouse" },
589 +       { "psm", ATTR_POINTER, "mouse" },
590 +       { "vboxguest", ATTR_POINTER, "vboxmouse" },
591 +       { "joy", ATTR_JOYSTICK, NULL },
592 +       { "atp", ATTR_TOUCHPAD, NULL },
593 +       { "uep", ATTR_TOUCHSCREEN, NULL },
594 +       { NULL, -1, NULL },
595 +};
596 +
597 +static bool
598 +sysctl_exists(const struct hw_type *device, int unit,
599 +       char *devname, size_t devname_len)
600 +{
601 +       char sysctlname[PATH_MAX];
602 +       size_t len;
603 +       int ret;
604 +
605 +       if (device == NULL || device->driver == NULL)
606 +               return false;
607 +
608 +       /* Check if a sysctl exists. */
609 +       snprintf(sysctlname, sizeof(sysctlname), "dev.%s.%i.%%desc",
610 +           device->driver, unit);
611 +       ret = sysctlbyname(sysctlname, NULL, &len, NULL, 0);
612 +
613 +       if (ret == 0 && len > 0) {
614 +               snprintf(devname, devname_len, "%s%i", device->driver, unit);
615 +               return true;
616 +       }
617 +
618 +       return false;
619 +}
620 +
621 +static bool
622 +devpath_exists(const struct hw_type *device,
623 +       char *devname, size_t devname_len)
624 +{
625 +       char *devpath;
626 +       struct stat st;
627 +       int ret;
628 +
629 +       if (device == NULL || device->driver == NULL)
630 +               return false;
631 +
632 +       /* Check if /dev/$driver exists. */
633 +       asprintf(&devpath, "/dev/%s", device->driver);
634 +       if (devpath == NULL)
635 +               return false;
636 +
637 +       ret = stat(devpath, &st);
638 +       free(devpath);
639 +
640 +       if (ret == 0) {
641 +               strncpy(devname, device->driver, devname_len);
642 +               return true;
643 +       }
644 +
645 +       return false;
646 +}
647 +
648 +static char *
649 +sysctl_get_str(const char *sysctlname)
650 +{
651 +       char *dest = NULL;
652 +       size_t len;
653 +
654 +       if (sysctlname == NULL)
655 +               return NULL;
656 +
657 +       if (sysctlbyname(sysctlname, NULL, &len, NULL, 0) == 0) {
658 +               dest = malloc(len + 1);
659 +               if (dest) {
660 +                       if (sysctlbyname(sysctlname, dest, &len, NULL, 0) == 0)
661 +                               dest[len] = '\0';
662 +                       else {
663 +                               free(dest);
664 +                               dest = NULL;
665 +                       }
666 +               }
667 +       }
668 +
669 +       return dest;
670 +}
671 +
672 +static void
673 +device_added(const char *devname)
674 +{
675 +       char path[PATH_MAX];
676 +       char sysctlname[PATH_MAX];
677 +       char *vendor;
678 +       char *product = NULL;
679 +       char *config_info = NULL;
680 +       char *walk;
681 +       InputOption *options = NULL;
682 +       InputAttributes attrs = { };
683 +       DeviceIntPtr dev = NULL;
684 +       int i;
685 +       int fd;
686 +
687 +       for (i = 0; hw_types[i].driver != NULL; i++) {
688 +               size_t len;
689 +
690 +               len = strlen(hw_types[i].driver);
691 +               if (strcmp(devname, hw_types[i].driver) == 0 ||
692 +                       (strncmp(devname, hw_types[i].driver, len) == 0 &&
693 +                               isnumber(*(devname + len)))) {
694 +                       attrs.flags |= hw_types[i].flag;
695 +                       break;
696 +               }
697 +       }
698 +
699 +       if (hw_types[i].driver == NULL || hw_types[i].xdriver == NULL) {
700 +               LogMessage(X_INFO, "config/devd: ignoring device %s\n",
701 +                               devname);
702 +               return;
703 +       }
704 +
705 +       /* Skip keyboard devices if kbdmux is enabled */
706 +       if (is_kbdmux && is_console_kbd && hw_types[i].flag & ATTR_KEYBOARD) {
707 +               LogMessage(X_INFO, "config/devd: kbdmux is enabled, ignoring device %s\n",
708 +                               devname);
709 +               return;
710 +       }
711 +
712 +       snprintf(path, sizeof(path), "/dev/%s", devname);
713 +
714 +       options = input_option_new(NULL, "_source", "server/devd");
715 +       if (!options)
716 +               return;
717 +
718 +       snprintf(sysctlname, sizeof(sysctlname), "dev.%s.%s.%%desc",
719 +           hw_types[i].driver, devname + strlen(hw_types[i].driver));
720 +       vendor = sysctl_get_str(sysctlname);
721 +       if (vendor == NULL) {
722 +               options = input_option_new(options, "name", devname);
723 +       }
724 +       else {
725 +               if ((walk = strchr(vendor, ' ')) != NULL) {
726 +                       walk[0] = '\0';
727 +                       walk++;
728 +                       product = walk;
729 +                       if ((walk = strchr(product, ',')) != NULL)
730 +                               walk[0] = '\0';
731 +               }
732 +
733 +               attrs.vendor = strdup(vendor);
734 +               if (product) {
735 +                       attrs.product = strdup(product);
736 +                       options = input_option_new(options, "name", product);
737 +               }
738 +               else
739 +                       options = input_option_new(options, "name", "(unnamed)");
740 +
741 +               free(vendor);
742 +       }
743 +
744 +       /* XXX implement usb_id */
745 +       attrs.usb_id = NULL;
746 +       attrs.device = strdup(path);
747 +       options = input_option_new(options, "driver", hw_types[i].xdriver);
748 +
749 +       fd = open(path, O_RDONLY);
750 +       if (fd > 0) {
751 +               close(fd);
752 +               options = input_option_new(options, "device", path);
753 +       }
754 +       else {
755 +               if (attrs.flags & ~ATTR_KEYBOARD) {
756 +                       LogMessage(X_INFO, "config/devd: device %s already opened\n",
757 +                                        path);
758 +
759 +                       /*
760 +                        * Fail if cannot open device, it breaks AllowMouseOpenFail,
761 +                        * but it should not matter when config/devd enabled
762 +                        */
763 +                       goto unwind;
764 +               }
765 +
766 +               if (is_console_kbd) {
767 +                       /*
768 +                        * There can be only one keyboard attached to console and
769 +                        * it is already added.
770 +                        */
771 +                       LogMessage(X_WARNING, "config/devd: console keyboard is "
772 +                                       "already added, ignoring %s (%s)\n",
773 +                                       attrs.product, path);
774 +                       goto unwind;
775 +               }
776 +               else
777 +                       /*
778 +                        * Don't pass "device" option if the keyboard is already
779 +                        * attached to the console (ie. open() fails).
780 +                        * This would activate a special logic in xf86-input-keyboard.
781 +                        * Prevent any other attached to console keyboards being
782 +                        * processed. There can be only one such device.
783 +                        */
784 +                       is_console_kbd = true;
785 +       }
786 +
787 +       if (asprintf(&config_info, "devd:%s", devname) == -1) {
788 +               config_info = NULL;
789 +               goto unwind;
790 +       }
791 +
792 +       if (device_is_duplicate(config_info)) {
793 +               LogMessage(X_WARNING, "config/devd: device %s (%s) already added. "
794 +                               "ignoring\n", attrs.product, path);
795 +               goto unwind;
796 +       }
797 +
798 +       options = input_option_new(options, "config_info", config_info);
799 +       LogMessage(X_INFO, "config/devd: adding input device %s (%s)\n",
800 +                       attrs.product, path);
801 +
802 +       NewInputDeviceRequest(options, &attrs, &dev);
803 +
804 +unwind:
805 +       free(config_info);
806 +       input_option_free_list(&options);
807 +       free(attrs.usb_id);
808 +       free(attrs.product);
809 +       free(attrs.device);
810 +       free(attrs.vendor);
811 +}
812 +
813 +static void
814 +device_removed(char *devname)
815 +{
816 +       char *config_info;
817 +
818 +       if (asprintf(&config_info, "devd:%s", devname) == -1)
819 +               return;
820 +
821 +       remove_devices("devd", config_info);
822 +
823 +       free(config_info);
824 +}
825 +
826 +static bool is_kbdmux_enabled(void)
827 +{
828 +       /* Xorg uses /dev/ttyv0 as a console device */
829 +       /* const char device[]="/dev/console"; */
830 +       const char device[]="/dev/ttyv0";
831 +       keyboard_info_t info;
832 +       int fd;
833 +
834 +       fd = open(device, O_RDONLY);
835 +
836 +       if (fd < 0)
837 +               return false;
838 +
839 +       if (ioctl(fd, KDGKBINFO, &info) == -1) {
840 +               close(fd);
841 +               return false;
842 +       }
843 +
844 +       close(fd);
845 +
846 +       if (!strncmp(info.kb_name, "kbdmux", 6))
847 +               return true;
848 +
849 +       return false;
850 +}
851 +
852 +static void
853 +disconnect_devd(int sock)
854 +{
855 +       if (sock >= 0) {
856 +               RemoveGeneralSocket(sock);
857 +               close(sock);
858 +       }
859 +}
860 +
861 +static int
862 +connect_devd(void)
863 +{
864 +       struct sockaddr_un devd;
865 +       int sock;
866 +
867 +       sock = socket(AF_UNIX, SOCK_STREAM, 0);
868 +       if (sock < 0) {
869 +               LogMessage(X_ERROR, "config/devd: fail opening stream socket\n");
870 +               return -1;
871 +       }
872 +
873 +       devd.sun_family = AF_UNIX;
874 +       strlcpy(devd.sun_path, DEVD_SOCK_PATH, sizeof(devd.sun_path));
875 +
876 +       if (connect(sock, (struct sockaddr *) &devd, sizeof(devd)) < 0) {
877 +               close(sock);
878 +               LogMessage(X_ERROR, "config/devd: fail to connect to devd\n");
879 +               return -1;
880 +       }
881 +
882 +       AddGeneralSocket(sock);
883 +
884 +       return  sock;
885 +}
886 +
887 +static CARD32
888 +reconnect_handler(OsTimerPtr timer, CARD32 time, void *arg)
889 +{
890 +       int newsock;
891 +
892 +       if ((newsock = connect_devd()) > 0) {
893 +               sock_devd = newsock;
894 +               TimerFree(rtimer);
895 +               rtimer = NULL;
896 +               LogMessage(X_INFO, "config/devd: reopening devd socket\n");
897 +               return 0;
898 +       }
899 +
900 +       /* Try again after RECONNECT_DELAY */
901 +       return RECONNECT_DELAY;
902 +}
903 +
904 +static ssize_t
905 +socket_getline(int fd, char **out)
906 +{
907 +       char *buf, *newbuf;
908 +       ssize_t ret, cap, sz = 0;
909 +       char c;
910 +
911 +       cap = 1024;
912 +       buf = malloc(cap * sizeof(char));
913 +       if (!buf)
914 +               return -1;
915 +
916 +       for (;;) {
917 +               ret = read(sock_devd, &c, 1);
918 +               if (ret < 0) {
919 +                       if (errno == EINTR)
920 +                               continue;
921 +                       free(buf);
922 +                       return -1;
923 +               /* EOF - devd socket is lost */
924 +               } else if (ret == 0) {
925 +                       disconnect_devd(sock_devd);
926 +                       rtimer = TimerSet(NULL, 0, 1, reconnect_handler, NULL);
927 +                       LogMessage(X_WARNING, "config/devd: devd socket is lost\n");
928 +                       free(buf);
929 +                       return -1;
930 +               }
931 +               if (c == '\n')
932 +                       break;
933 +
934 +               if (sz + 1 >= cap) {
935 +                       cap *= 2;
936 +                       newbuf = realloc(buf, cap * sizeof(char));
937 +                       if (!newbuf) {
938 +                               free(buf);
939 +                               return -1;
940 +                       }
941 +                       buf = newbuf;
942 +               }
943 +               buf[sz] = c;
944 +               sz++;
945 +       }
946 +
947 +       buf[sz] = '\0';
948 +       if (sz >= 0)
949 +               *out = buf;
950 +       else
951 +               free(buf);
952 +
953 +       /* Number of bytes in the line, not counting the line break */
954 +       return sz;
955 +}
956 +
957 +static void
958 +wakeup_handler(void *data, int err, void *read_mask)
959 +{
960 +       char *line = NULL;
961 +       char *walk;
962 +
963 +       if (err < 0)
964 +               return;
965 +
966 +       if (FD_ISSET(sock_devd, (fd_set *) read_mask)) {
967 +               if (socket_getline(sock_devd, &line) < 0)
968 +                       return;
969 +
970 +               walk = strchr(line + 1, ' ');
971 +               if (walk != NULL)
972 +                       walk[0] = '\0';
973 +
974 +               switch (*line) {
975 +               case DEVD_EVENT_ADD:
976 +                       device_added(line + 1);
977 +                       break;
978 +               case DEVD_EVENT_REMOVE:
979 +                       device_removed(line + 1);
980 +                       break;
981 +               default:
982 +                       break;
983 +               }
984 +               free(line);
985 +       }
986 +}
987 +
988 +static void
989 +block_handler(void *data, struct timeval **tv, void *read_mask)
990 +{
991 +}
992 +
993 +int
994 +config_devd_init(void)
995 +{
996 +       char devicename[1024];
997 +       int i, j;
998 +
999 +       LogMessage(X_INFO, "config/devd: probing input devices...\n");
1000 +
1001 +       /*
1002 +        * Add fake keyboard and give up on keyboards management
1003 +        * if kbdmux is enabled
1004 +        */
1005 +       if ((is_kbdmux = is_kbdmux_enabled()) == true)
1006 +               device_added("kbdmux");
1007 +
1008 +       for (i = 0; hw_types[i].driver != NULL; i++) {
1009 +               /* First scan the sysctl to determine the hardware */
1010 +               for (j = 0; j < 16; j++) {
1011 +                       if (sysctl_exists(&hw_types[i], j,
1012 +                                       devicename, sizeof(devicename)) != 0)
1013 +                               device_added(devicename);
1014 +               }
1015 +
1016 +               if (devpath_exists(&hw_types[i], devicename, sizeof(devicename)) != 0)
1017 +                       device_added(devicename);
1018 +       }
1019 +
1020 +       if ((sock_devd = connect_devd()) < 0)
1021 +               return 0;
1022 +
1023 +       RegisterBlockAndWakeupHandlers(block_handler, wakeup_handler, NULL);
1024 +
1025 +       return 1;
1026 +}
1027 +
1028 +void
1029 +config_devd_fini(void)
1030 +{
1031 +       LogMessage(X_INFO, "config/devd: terminating backend...\n");
1032 +
1033 +       if (rtimer) {
1034 +               TimerFree(rtimer);
1035 +               rtimer = NULL;
1036 +       }
1037 +
1038 +       disconnect_devd(sock_devd);
1039 +
1040 +       RemoveBlockAndWakeupHandlers(block_handler, wakeup_handler, NULL);
1041 +
1042 +       is_console_kbd = false;
1043 +}
1044
1045
1046 [FILE:372:patches/patch-configure]
1047 --- configure.orig      2017-03-15 18:05:39 UTC
1048 +++ configure
1049 @@ -23280,9 +23280,14 @@ $as_echo "#define USE_ALPHA_PIO 1" >>con
1050         esac
1051         GLX_ARCH_DEFINES="-D__GLX_ALIGN64 -mieee"
1052         ;;
1053 -  arm*)
1054 +  arm*|aarch64*)
1055         ARM_VIDEO=yes
1056         DEFAULT_INT10="stub"
1057 +       case $host_os in
1058 +               *freebsd*)
1059 +                       $as_echo "#define USE_DEV_IO 1" >>confdefs.h
1060 +                ;;
1061 +       esac
1062         ;;
1063    i*86)
1064         I386_VIDEO=yes
1065
1066
1067 [FILE:785:patches/patch-hw_xfree86_common_xf86AutoConfig.c]
1068 --- hw/xfree86/common/xf86AutoConfig.c.orig     2017-01-11 20:00:58 UTC
1069 +++ hw/xfree86/common/xf86AutoConfig.c
1070 @@ -276,7 +276,7 @@ listPossibleVideoDrivers(char *matches[]
1071          i += xf86PciMatchDriver(&matches[i], nmatches - i);
1072  #endif
1073  
1074 -#if defined(__linux__)
1075 +#if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__)
1076      matches[i++] = xnfstrdup("modesetting");
1077  #endif
1078  
1079 @@ -285,8 +285,10 @@ listPossibleVideoDrivers(char *matches[]
1080      if (i < (nmatches - 1)) {
1081  #if !defined(__linux__) && defined(__sparc__)
1082          matches[i++] = xnfstrdup("wsfb");
1083 -#else
1084 +#elif defined(__linux__)
1085          matches[i++] = xnfstrdup("fbdev");
1086 +#elif defined(__FreeBSD__)
1087 +        matches[i++] = xnfstrdup("scfb");
1088  #endif
1089      }
1090  #endif                          /* !__sun */
1091
1092
1093 [FILE:700:patches/patch-hw_xfree86_common_xf86Config.c]
1094 --- hw/xfree86/common/xf86Config.c.orig 2016-07-19 17:14:30 UTC
1095 +++ hw/xfree86/common/xf86Config.c
1096 @@ -1410,13 +1410,16 @@ checkCoreInputDevices(serverLayoutPtr se
1097      }
1098  
1099      if (!xf86Info.forceInputDevices && !(foundPointer && foundKeyboard)) {
1100 -#if defined(CONFIG_HAL) || defined(CONFIG_UDEV) || defined(CONFIG_WSCONS)
1101 +#if defined(CONFIG_HAL) || defined(CONFIG_UDEV) || defined(CONFIG_WSCONS) || \
1102 +               defined(CONFIG_DEVD)
1103          const char *config_backend;
1104  
1105  #if defined(CONFIG_HAL)
1106          config_backend = "HAL";
1107  #elif defined(CONFIG_UDEV)
1108          config_backend = "udev";
1109 +#elif defined(CONFIG_DEVD)
1110 +        config_backend = "devd";
1111  #else
1112          config_backend = "wscons";
1113  #endif
1114
1115
1116 [FILE:496:patches/patch-hw_xfree86_common_xf86Globals.c]
1117 --- hw/xfree86/common/xf86Globals.c.orig        2016-07-19 17:07:29 UTC
1118 +++ hw/xfree86/common/xf86Globals.c
1119 @@ -122,7 +122,8 @@ xf86InfoRec xf86Info = {
1120      .pmFlag = TRUE,
1121      .disableRandR = FALSE,
1122      .randRFrom = X_DEFAULT,
1123 -#if defined(CONFIG_HAL) || defined(CONFIG_UDEV) || defined(CONFIG_WSCONS)
1124 +#if defined(CONFIG_HAL) || defined(CONFIG_UDEV) || defined(CONFIG_WSCONS) || \
1125 +       defined(CONFIG_DEVD)
1126      .forceInputDevices = FALSE,
1127      .autoAddDevices = TRUE,
1128      .autoEnableDevices = TRUE,
1129
1130
1131 [FILE:688:patches/patch-hw_xfree86_common_xf86Xinput.c]
1132 --- hw/xfree86/common/xf86Xinput.c.orig 2016-07-19 17:07:29 UTC
1133 +++ hw/xfree86/common/xf86Xinput.c
1134 @@ -841,7 +841,7 @@ xf86NewInputDevice(InputInfoPtr pInfo, D
1135  {
1136      InputDriverPtr drv = NULL;
1137      DeviceIntPtr dev = NULL;
1138 -    Bool paused;
1139 +    Bool paused = 0;
1140      int rval;
1141      char *path = NULL;
1142  
1143 @@ -996,6 +996,7 @@ NewInputDeviceRequest(InputOption *optio
1144          if (strcmp(key, "_source") == 0 &&
1145              (strcmp(value, "server/hal") == 0 ||
1146               strcmp(value, "server/udev") == 0 ||
1147 +             strcmp(value, "server/devd") == 0 ||
1148               strcmp(value, "server/wscons") == 0)) {
1149              is_auto = 1;
1150              if (!xf86Info.autoAddDevices) {
1151
1152
1153 [FILE:450:patches/patch-hw_xfree86_os-support_bsd_bsd__init.c]
1154 --- hw/xfree86/os-support/bsd/bsd_init.c.orig   2016-07-19 17:07:29 UTC
1155 +++ hw/xfree86/os-support/bsd/bsd_init.c
1156 @@ -230,6 +230,9 @@ xf86OpenConsole()
1157               * Add cases for other *BSD that behave the same.
1158               */
1159  #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
1160 +#if defined(__sparc64__)
1161 +           pci_system_init_dev_mem(fd);
1162 +#endif
1163              uname(&uts);
1164              i = atof(uts.release) * 100;
1165              if (i >= 310)
1166
1167
1168 [FILE:315:patches/patch-hw_xfree86_os-support_bsd_i386__video.c]
1169 Index: programs/Xserver/hw/xfree86/os-support/bsd/i386_video.c
1170 --- hw/xfree86/os-support/bsd/i386_video.c.orig 2016-07-15 16:18:11 UTC
1171 +++ hw/xfree86/os-support/bsd/i386_video.c
1172 @@ -32,6 +32,7 @@
1173  #include "xf86Priv.h"
1174  
1175  #include <errno.h>
1176 +#include <sys/types.h>
1177  #include <sys/mman.h>
1178  
1179  #include "xf86_OSlib.h"
1180
1181
1182 [FILE:380:patches/patch-hw_xfree86_os-support_bsd_ppc__video.c]
1183 --- hw/xfree86/os-support/bsd/ppc_video.c.orig  2016-07-15 16:18:11 UTC
1184 +++ hw/xfree86/os-support/bsd/ppc_video.c
1185 @@ -79,7 +79,11 @@ xf86DisableIO()
1186  {
1187  
1188      if (ioBase != MAP_FAILED) {
1189 +#if defined(__FreeBSD__)
1190 +        munmap(__DEVOLATILE(unsigned char *, ioBase), 0x10000);
1191 +#else
1192          munmap(__UNVOLATILE(ioBase), 0x10000);
1193 +#endif
1194          ioBase = MAP_FAILED;
1195      }
1196  }
1197
1198
1199 [FILE:215:patches/patch-xkb_Makefile.in]
1200 --- xkb/Makefile.in.orig        2017-01-19 15:20:42 UTC
1201 +++ xkb/Makefile.in
1202 @@ -878,7 +878,7 @@ info: info-am
1203  
1204  info-am:
1205  
1206 -install-data-am: install-dist_xkbcompiledDATA
1207 +install-data-am:
1208  
1209  install-dvi: install-dvi-am
1210  
1211
1212
1213 [FILE:135:files/pkg-deinstall.in]
1214 #!/bin/sh
1215
1216 PREFIX="${PKG_PREFIX-/raven}"
1217
1218 case $2 in
1219 DEINSTALL)
1220         /bin/rm -rf ${PREFIX}/lib/xorg/modules/extensions/libglx.so*
1221         ;;
1222 esac
1223
1224
1225 [FILE:531:files/pkg-install.in]
1226 #!/bin/sh
1227
1228 PREFIX="${PKG_PREFIX-/raven}"
1229
1230 case $2 in
1231 POST-INSTALL)
1232         if [ -f ${PREFIX}/lib/xorg/modules/extensions/.nvidia/libglx.so.1 ]; then
1233           /bin/ln -f ${PREFIX}/lib/xorg/modules/extensions/.nvidia/libglx.so.1 \
1234                 ${PREFIX}/lib/xorg/modules/extensions/libglx.so
1235           /bin/ln -f ${PREFIX}/lib/xorg/modules/extensions/.nvidia/libglx.so.1 \
1236                 ${PREFIX}/lib/xorg/modules/extensions/libglx.so.1
1237         else
1238           /bin/ln -f ${PREFIX}/lib/xorg/modules/extensions/.xorg/libglx.so \
1239                 ${PREFIX}/lib/xorg/modules/extensions/libglx.so
1240         fi
1241         ;;
1242 esac
1243