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