Ravenports generated: 26 Oct 2018 12:37
[ravenports.git] / bucket_E7 / xorg-server
1 # Buildsheet autogenerated by ravenadm tool -- Do not edit.
2
3 NAMEBASE=               xorg-server
4 VERSION=                1.20.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.20.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=        xorgproto xtransproto pixman xshmfence xau xdmcp
48                         xfont2
49
50 LICENSE=                MIT:single
51 LICENSE_FILE=           MIT:{{WRKSRC}}/COPYING
52 LICENSE_SCHEME=         solo
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                                         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         # build libglx.so but don't install it yet. (done in pre-install)
152         ${REINPLACE_CMD} -e 's|@GLX_TRUE@GLXMODS =|@GLX_BOGUS@GLXMODS =|g' \
153                 -e 's|^LTLIBRARIES = |LTLIBRARIES = libglx.la |g' \
154                 ${WRKSRC}/hw/xfree86/dixmods/Makefile.in
155
156 do-install-XEPHYR-ON:
157         (cd ${WRKSRC}/hw/kdrive/ephyr && \
158                 DESTDIR=${STAGEDIR} ${MAKE_CMD} install)
159
160 do-install-WAYLAND-ON:
161         (cd ${WRKSRC}/hw/xwayland && \
162                 DESTDIR=${STAGEDIR} ${MAKE_CMD} install)
163
164 post-install-XORG-OFF:
165         ${RM} -r ${STAGEDIR}${PREFIX}/lib/xorg
166         ${RM} ${STAGEDIR}${PREFIX}/share/man/man1/Xserver.1
167
168 post-configure-DEVD-ON:
169         ${REINPLACE_CMD} -e 's|config\.c|config.c devd.c|g' \
170                 -e 's|config\.lo|config.lo devd.lo|g' \
171                 ${WRKSRC}/config/Makefile
172         ${REINPLACE_CMD} -e 's|^/\* #undef CONFIG_UDEV \*/|#define CONFIG_DEVD 1|' \
173                 ${WRKSRC}/include/dix-config.h
174
175 do-install-VIRTUAL-ON:
176         (cd ${WRKSRC}/hw/vfb && \
177                 DESTDIR=${STAGEDIR} ${MAKE_CMD} install)
178
179 do-install-NEST-ON:
180         (cd ${WRKSRC}/hw/xnest && \
181                 DESTDIR=${STAGEDIR} ${MAKE_CMD} install)
182
183 do-install-DMX-ON:
184         (cd ${WRKSRC}/hw/dmx && \
185                 DESTDIR=${STAGEDIR} ${MAKE_CMD} install)
186
187 post-install-XORG-ON:
188         # The .xorg dir because else the xorg-server might not load the
189         # correct libglx module.
190         @${MKDIR} ${STAGEDIR}${PREFIX}/lib/xorg/modules/extensions/.xorg
191         ${INSTALL_LIB} ${WRKSRC}/hw/xfree86/dixmods/.libs/libglx.so \
192                 ${STAGEDIR}${PREFIX}/lib/xorg/modules/extensions/.xorg/
193         @${MKDIR} ${STAGEDIR}${PREFIX}/etc/X11/xorg.conf.d
194         ${RM} -r ${STAGEDIR}/var
195
196 [FILE:71:descriptions/desc.single.standard]
197 This package contains the X.Org X server and some associated programs.
198
199
200 [FILE:60:descriptions/desc.single.virtual]
201 This package contains Xvfb, a virtual framebuffer X server.
202
203
204 [FILE:287:descriptions/desc.single.dmx]
205 Xdmx is proxy X server that provides multi-head support for multiple
206 displays attached to different machines (each of which is running a
207 typical X server).  When Xinerama is used with Xdmx, the multiple displays
208 on multiple machines are presented to the user as a single unified screen.
209
210
211 [FILE:173:descriptions/desc.single.xephyr]
212 Xephyr is a kdrive server that outputs to a window on a pre-existing
213 'host' X display.  Think Xnest but with support for modern extensions
214 like composite, damage and randr.
215
216
217 [FILE:78:descriptions/desc.single.nest]
218 This package contains Xnest, a nesting X Server that displays on an X
219 Server.
220
221
222 [FILE:148:descriptions/desc.single.wayland]
223 XWayland is an X Server running as a Wayland client, thus capable of
224 displaying native X11 client applications in a Wayland compositor
225 environment.
226
227
228 [FILE:105:distinfo]
229 1b3ce466c12cacbe2252b3ad5b0ed561972eef9d09e75900d65fb1e21f9201de      6205000 xorg-server-1.20.3.tar.bz2
230
231
232 [FILE:2523:manifests/plist.single.standard]
233 %%ONLY-SUNOS%%include/xorg/solaris-amd64.il
234 %%SUID-OFF%%bin/Xorg
235 %%SUID-ON%%@(,,4555) bin/Xorg
236 bin/
237  X
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  glxvndabi.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  syncsdk.h
349  validate.h
350  vbe.h
351  vbeModes.h
352  vgaHW.h
353  vndserver.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  xf86MatchDrivers.h
365  xf86Modes.h
366  xf86Module.h
367  xf86Opt.h
368  xf86Optionstr.h
369  xf86Optrec.h
370  xf86Parser.h
371  xf86Pci.h
372  xf86PciInfo.h
373  xf86Priv.h
374  xf86Privstr.h
375  xf86RamDac.h
376  xf86RandR12.h
377  xf86VGAarbiter.h
378  xf86Xinput.h
379  xf86_OSlib.h
380  xf86_OSproc.h
381  xf86cmap.h
382  xf86fbman.h
383  xf86i2c.h
384  xf86int10.h
385  xf86platformBus.h
386  xf86sbusBus.h
387  xf86str.h
388  xf86xv.h
389  xf86xvmc.h
390  xf86xvpriv.h
391  xisb.h
392  xkbfile.h
393  xkbrules.h
394  xkbsrv.h
395  xkbstr.h
396  xorg-server.h
397  xorgVersion.h
398  xserver-properties.h
399  xserver_poll.h
400  xvdix.h
401  xvmcext.h
402 lib/pkgconfig/xorg-server.pc
403 lib/xorg/protocol.txt
404 lib/xorg/modules/
405  libexa.so
406  libfb.so
407  libfbdevhw.so
408  libglamoregl.so
409  libint10.so
410  libshadow.so
411  libshadowfb.so
412  libvbe.so
413  libvgahw.so
414  libwfb.so
415 lib/xorg/modules/drivers/modesetting_drv.so
416 lib/xorg/modules/extensions/.xorg/libglx.so
417 share/aclocal/xorg-server.m4
418 share/man/man1/
419  Xorg.1.gz
420  Xserver.1.gz
421  cvt.1.gz
422  gtf.1.gz
423 share/man/man4/
424  exa.4.gz
425  fbdevhw.4.gz
426  modesetting.4.gz
427 share/man/man5/
428  xorg.conf.5.gz
429  xorg.conf.d.5.gz
430 @dir etc/X11/xorg.conf.d
431
432
433 [FILE:34:manifests/plist.single.virtual]
434 bin/Xvfb
435 share/man/man1/Xvfb.1.gz
436
437
438 [FILE:214:manifests/plist.single.dmx]
439 bin/
440  Xdmx
441  dmxaddinput
442  dmxaddscreen
443  dmxinfo
444  dmxreconfig
445  dmxresize
446  dmxrminput
447  dmxrmscreen
448  dmxtodmx
449  dmxwininfo
450  vdltodmx
451  xdmxconfig
452 share/man/man1/
453  Xdmx.1.gz
454  dmxtodmx.1.gz
455  vdltodmx.1.gz
456  xdmxconfig.1.gz
457
458
459 [FILE:38:manifests/plist.single.xephyr]
460 bin/Xephyr
461 share/man/man1/Xephyr.1.gz
462
463
464 [FILE:36:manifests/plist.single.nest]
465 bin/Xnest
466 share/man/man1/Xnest.1.gz
467
468
469 [FILE:13:manifests/plist.single.wayland]
470 bin/Xwayland
471
472
473 [FILE:293:patches/patch-config_config-backends.h]
474 --- config/config-backends.h.orig       2018-10-25 14:13:21 UTC
475 +++ config/config-backends.h
476 @@ -44,3 +44,8 @@ void config_hal_fini(void);
477  int config_wscons_init(void);
478  void config_wscons_fini(void);
479  #endif
480 +
481 +#ifdef CONFIG_DEVD
482 +int config_devd_init(void);
483 +void config_devd_fini(void);
484 +#endif
485
486
487 [FILE:537:patches/patch-config_config.c]
488 --- config/config.c.orig        2018-10-25 14:13:21 UTC
489 +++ config/config.c
490 @@ -55,6 +55,9 @@ config_init(void)
491  #elif defined(CONFIG_WSCONS)
492      if (!config_wscons_init())
493          ErrorF("[config] failed to initialise wscons\n");
494 +#elif defined(CONFIG_DEVD)
495 +    if (!config_devd_init())
496 +        ErrorF("[config] failed to initialise devd\n");
497  #endif
498  }
499  
500 @@ -67,6 +70,8 @@ config_fini(void)
501      config_hal_fini();
502  #elif defined(CONFIG_WSCONS)
503      config_wscons_fini();
504 +#elif defined(CONFIG_DEVD)
505 +    config_devd_fini();
506  #endif
507  }
508  
509
510
511 [FILE:12171:patches/patch-config_devd.c]
512 --- /dev/null   2018-10-26 15:33:17 UTC
513 +++ config/devd.c
514 @@ -0,0 +1,532 @@
515 +/*
516 + * Copyright (c) 2012 Baptiste Daroussin
517 + * Copyright (c) 2013, 2014 Alex Kozlov
518 + * Copyright (c) 2014 Robert Millan
519 + * Copyright (c) 2014 Jean-Sebastien Pedron
520 + *
521 + * Permission is hereby granted, free of charge, to any person obtaining a
522 + * copy of this software and associated documentation files (the "Software"),
523 + * to deal in the Software without restriction, including without limitation
524 + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
525 + * and/or sell copies of the Software, and to permit persons to whom the
526 + * Software is furnished to do so, subject to the following conditions:
527 + *
528 + * The above copyright notice and this permission notice (including the next
529 + * paragraph) shall be included in all copies or substantial portions of the
530 + * Software.
531 + *
532 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
533 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
534 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
535 + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
536 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
537 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
538 + * DEALINGS IN THE SOFTWARE.
539 + *
540 + * Author: Baptiste Daroussin <bapt@FreeBSD.org>
541 + */
542 +
543 +#ifdef HAVE_DIX_CONFIG_H
544 +#include <dix-config.h>
545 +#endif
546 +
547 +#include <sys/types.h>
548 +#include <sys/kbio.h>
549 +#include <sys/socket.h>
550 +#include <sys/stat.h>
551 +#include <sys/sysctl.h>
552 +#include <sys/un.h>
553 +
554 +#include <ctype.h>
555 +#include <errno.h>
556 +#include <fcntl.h>
557 +#include <stdlib.h>
558 +#include <stdio.h>
559 +#include <stdbool.h>
560 +#include <unistd.h>
561 +
562 +#include "input.h"
563 +#include "inputstr.h"
564 +#include "hotplug.h"
565 +#include "config-backends.h"
566 +#include "os.h"
567 +
568 +#define DEVD_SOCK_PATH "/var/run/devd.pipe"
569 +
570 +#define DEVD_EVENT_ADD         '+'
571 +#define DEVD_EVENT_REMOVE      '-'
572 +
573 +#define RECONNECT_DELAY                5 * 1000
574 +
575 +static int sock_devd;
576 +static bool is_console_kbd = false;
577 +static bool is_kbdmux = false;
578 +static OsTimerPtr rtimer = NULL;
579 +
580 +struct hw_type {
581 +       const char *driver;
582 +       int flag;
583 +       const char *xdriver;
584 +};
585 +
586 +static struct hw_type hw_types[] = {
587 +       { "ukbd", ATTR_KEYBOARD, "kbd" },
588 +       { "atkbd", ATTR_KEYBOARD, "kbd" },
589 +       { "kbdmux", ATTR_KEYBOARD, "kbd" },
590 +       { "sysmouse", ATTR_POINTER, "mouse" },
591 +       { "ums", ATTR_POINTER, "mouse" },
592 +       { "psm", ATTR_POINTER, "mouse" },
593 +       { "vboxguest", ATTR_POINTER, "vboxmouse" },
594 +       { "joy", ATTR_JOYSTICK, NULL },
595 +       { "atp", ATTR_TOUCHPAD, NULL },
596 +       { "uep", ATTR_TOUCHSCREEN, NULL },
597 +       { NULL, -1, NULL },
598 +};
599 +
600 +static bool
601 +sysctl_exists(const struct hw_type *device, int unit,
602 +       char *devname, size_t devname_len)
603 +{
604 +       char sysctlname[PATH_MAX];
605 +       size_t len;
606 +       int ret;
607 +
608 +       if (device == NULL || device->driver == NULL)
609 +               return false;
610 +
611 +       /* Check if a sysctl exists. */
612 +       snprintf(sysctlname, sizeof(sysctlname), "dev.%s.%i.%%desc",
613 +           device->driver, unit);
614 +       ret = sysctlbyname(sysctlname, NULL, &len, NULL, 0);
615 +
616 +       if (ret == 0 && len > 0) {
617 +               snprintf(devname, devname_len, "%s%i", device->driver, unit);
618 +               return true;
619 +       }
620 +
621 +       return false;
622 +}
623 +
624 +static bool
625 +devpath_exists(const struct hw_type *device,
626 +       char *devname, size_t devname_len)
627 +{
628 +       char *devpath;
629 +       struct stat st;
630 +       int ret;
631 +
632 +       if (device == NULL || device->driver == NULL)
633 +               return false;
634 +
635 +       /* Check if /dev/$driver exists. */
636 +       asprintf(&devpath, "/dev/%s", device->driver);
637 +       if (devpath == NULL)
638 +               return false;
639 +
640 +       ret = stat(devpath, &st);
641 +       free(devpath);
642 +
643 +       if (ret == 0) {
644 +               strncpy(devname, device->driver, devname_len);
645 +               return true;
646 +       }
647 +
648 +       return false;
649 +}
650 +
651 +static char *
652 +sysctl_get_str(const char *sysctlname)
653 +{
654 +       char *dest = NULL;
655 +       size_t len;
656 +
657 +       if (sysctlname == NULL)
658 +               return NULL;
659 +
660 +       if (sysctlbyname(sysctlname, NULL, &len, NULL, 0) == 0) {
661 +               dest = malloc(len + 1);
662 +               if (dest) {
663 +                       if (sysctlbyname(sysctlname, dest, &len, NULL, 0) == 0)
664 +                               dest[len] = '\0';
665 +                       else {
666 +                               free(dest);
667 +                               dest = NULL;
668 +                       }
669 +               }
670 +       }
671 +
672 +       return dest;
673 +}
674 +
675 +static void
676 +device_added(const char *devname)
677 +{
678 +       char path[PATH_MAX];
679 +       char sysctlname[PATH_MAX];
680 +       char *vendor;
681 +       char *product = NULL;
682 +       char *config_info = NULL;
683 +       char *walk;
684 +       InputOption *options = NULL;
685 +       InputAttributes attrs = { };
686 +       DeviceIntPtr dev = NULL;
687 +       int i;
688 +       int fd;
689 +
690 +       for (i = 0; hw_types[i].driver != NULL; i++) {
691 +               size_t len;
692 +
693 +               len = strlen(hw_types[i].driver);
694 +               if (strcmp(devname, hw_types[i].driver) == 0 ||
695 +                       (strncmp(devname, hw_types[i].driver, len) == 0 &&
696 +                               isnumber(*(devname + len)))) {
697 +                       attrs.flags |= hw_types[i].flag;
698 +                       break;
699 +               }
700 +       }
701 +
702 +       if (hw_types[i].driver == NULL || hw_types[i].xdriver == NULL) {
703 +               LogMessage(X_INFO, "config/devd: ignoring device %s\n",
704 +                               devname);
705 +               return;
706 +       }
707 +
708 +       /* Skip keyboard devices if kbdmux is enabled */
709 +       if (is_kbdmux && is_console_kbd && hw_types[i].flag & ATTR_KEYBOARD) {
710 +               LogMessage(X_INFO, "config/devd: kbdmux is enabled, ignoring device %s\n",
711 +                               devname);
712 +               return;
713 +       }
714 +
715 +       snprintf(path, sizeof(path), "/dev/%s", devname);
716 +
717 +       options = input_option_new(NULL, "_source", "server/devd");
718 +       if (!options)
719 +               return;
720 +
721 +       snprintf(sysctlname, sizeof(sysctlname), "dev.%s.%s.%%desc",
722 +           hw_types[i].driver, devname + strlen(hw_types[i].driver));
723 +       vendor = sysctl_get_str(sysctlname);
724 +       if (vendor == NULL) {
725 +               options = input_option_new(options, "name", devname);
726 +       }
727 +       else {
728 +               if ((walk = strchr(vendor, ' ')) != NULL) {
729 +                       walk[0] = '\0';
730 +                       walk++;
731 +                       product = walk;
732 +                       if ((walk = strchr(product, ',')) != NULL)
733 +                               walk[0] = '\0';
734 +               }
735 +
736 +               attrs.vendor = strdup(vendor);
737 +               if (product) {
738 +                       attrs.product = strdup(product);
739 +                       options = input_option_new(options, "name", product);
740 +               }
741 +               else
742 +                       options = input_option_new(options, "name", "(unnamed)");
743 +
744 +               free(vendor);
745 +       }
746 +
747 +       /* XXX implement usb_id */
748 +       attrs.usb_id = NULL;
749 +       attrs.device = strdup(path);
750 +       options = input_option_new(options, "driver", hw_types[i].xdriver);
751 +
752 +       fd = open(path, O_RDONLY);
753 +       if (fd > 0) {
754 +               close(fd);
755 +               options = input_option_new(options, "device", path);
756 +       }
757 +       else {
758 +               if (attrs.flags & ~ATTR_KEYBOARD) {
759 +                       LogMessage(X_INFO, "config/devd: device %s already opened\n",
760 +                                        path);
761 +
762 +                       /*
763 +                        * Fail if cannot open device, it breaks AllowMouseOpenFail,
764 +                        * but it should not matter when config/devd enabled
765 +                        */
766 +                       goto unwind;
767 +               }
768 +
769 +               if (is_console_kbd) {
770 +                       /*
771 +                        * There can be only one keyboard attached to console and
772 +                        * it is already added.
773 +                        */
774 +                       LogMessage(X_WARNING, "config/devd: console keyboard is "
775 +                                       "already added, ignoring %s (%s)\n",
776 +                                       attrs.product, path);
777 +                       goto unwind;
778 +               }
779 +               else
780 +                       /*
781 +                        * Don't pass "device" option if the keyboard is already
782 +                        * attached to the console (ie. open() fails).
783 +                        * This would activate a special logic in xf86-input-keyboard.
784 +                        * Prevent any other attached to console keyboards being
785 +                        * processed. There can be only one such device.
786 +                        */
787 +                       is_console_kbd = true;
788 +       }
789 +
790 +       if (asprintf(&config_info, "devd:%s", devname) == -1) {
791 +               config_info = NULL;
792 +               goto unwind;
793 +       }
794 +
795 +       if (device_is_duplicate(config_info)) {
796 +               LogMessage(X_WARNING, "config/devd: device %s (%s) already added. "
797 +                               "ignoring\n", attrs.product, path);
798 +               goto unwind;
799 +       }
800 +
801 +       options = input_option_new(options, "config_info", config_info);
802 +       LogMessage(X_INFO, "config/devd: adding input device %s (%s)\n",
803 +                       attrs.product, path);
804 +
805 +       NewInputDeviceRequest(options, &attrs, &dev);
806 +
807 +unwind:
808 +       free(config_info);
809 +       input_option_free_list(&options);
810 +       free(attrs.usb_id);
811 +       free(attrs.product);
812 +       free(attrs.device);
813 +       free(attrs.vendor);
814 +}
815 +
816 +static void
817 +device_removed(char *devname)
818 +{
819 +       char *config_info;
820 +
821 +       if (asprintf(&config_info, "devd:%s", devname) == -1)
822 +               return;
823 +
824 +       remove_devices("devd", config_info);
825 +
826 +       free(config_info);
827 +}
828 +
829 +static bool is_kbdmux_enabled(void)
830 +{
831 +       /* Xorg uses /dev/ttyv0 as a console device */
832 +       /* const char device[]="/dev/console"; */
833 +       const char device[]="/dev/ttyv0";
834 +       keyboard_info_t info;
835 +       int fd;
836 +
837 +       fd = open(device, O_RDONLY);
838 +
839 +       if (fd < 0)
840 +               return false;
841 +
842 +       if (ioctl(fd, KDGKBINFO, &info) == -1) {
843 +               close(fd);
844 +               return false;
845 +       }
846 +
847 +       close(fd);
848 +
849 +       if (!strncmp(info.kb_name, "kbdmux", 6))
850 +               return true;
851 +
852 +       return false;
853 +}
854 +
855 +static void
856 +disconnect_devd(int sock)
857 +{
858 +       if (sock >= 0) {
859 +               RemoveGeneralSocket(sock);
860 +               close(sock);
861 +       }
862 +}
863 +
864 +static int
865 +connect_devd(void)
866 +{
867 +       struct sockaddr_un devd;
868 +       int sock;
869 +
870 +       sock = socket(AF_UNIX, SOCK_STREAM, 0);
871 +       if (sock < 0) {
872 +               LogMessage(X_ERROR, "config/devd: fail opening stream socket\n");
873 +               return -1;
874 +       }
875 +
876 +       devd.sun_family = AF_UNIX;
877 +       strlcpy(devd.sun_path, DEVD_SOCK_PATH, sizeof(devd.sun_path));
878 +
879 +       if (connect(sock, (struct sockaddr *) &devd, sizeof(devd)) < 0) {
880 +               close(sock);
881 +               LogMessage(X_ERROR, "config/devd: fail to connect to devd\n");
882 +               return -1;
883 +       }
884 +
885 +       AddGeneralSocket(sock);
886 +
887 +       return  sock;
888 +}
889 +
890 +static CARD32
891 +reconnect_handler(OsTimerPtr timer, CARD32 time, void *arg)
892 +{
893 +       int newsock;
894 +
895 +       if ((newsock = connect_devd()) > 0) {
896 +               sock_devd = newsock;
897 +               TimerFree(rtimer);
898 +               rtimer = NULL;
899 +               LogMessage(X_INFO, "config/devd: reopening devd socket\n");
900 +               return 0;
901 +       }
902 +
903 +       /* Try again after RECONNECT_DELAY */
904 +       return RECONNECT_DELAY;
905 +}
906 +
907 +static ssize_t
908 +socket_getline(int fd, char **out)
909 +{
910 +       char *buf, *newbuf;
911 +       ssize_t ret, cap, sz = 0;
912 +       char c;
913 +
914 +       cap = 1024;
915 +       buf = malloc(cap * sizeof(char));
916 +       if (!buf)
917 +               return -1;
918 +
919 +       for (;;) {
920 +               ret = read(sock_devd, &c, 1);
921 +               if (ret < 0) {
922 +                       if (errno == EINTR)
923 +                               continue;
924 +                       free(buf);
925 +                       return -1;
926 +               /* EOF - devd socket is lost */
927 +               } else if (ret == 0) {
928 +                       disconnect_devd(sock_devd);
929 +                       rtimer = TimerSet(NULL, 0, 1, reconnect_handler, NULL);
930 +                       LogMessage(X_WARNING, "config/devd: devd socket is lost\n");
931 +                       free(buf);
932 +                       return -1;
933 +               }
934 +               if (c == '\n')
935 +                       break;
936 +
937 +               if (sz + 1 >= cap) {
938 +                       cap *= 2;
939 +                       newbuf = realloc(buf, cap * sizeof(char));
940 +                       if (!newbuf) {
941 +                               free(buf);
942 +                               return -1;
943 +                       }
944 +                       buf = newbuf;
945 +               }
946 +               buf[sz] = c;
947 +               sz++;
948 +       }
949 +
950 +       buf[sz] = '\0';
951 +       if (sz >= 0)
952 +               *out = buf;
953 +       else
954 +               free(buf);
955 +
956 +       /* Number of bytes in the line, not counting the line break */
957 +       return sz;
958 +}
959 +
960 +static void
961 +wakeup_handler(void *data, int err, void *read_mask)
962 +{
963 +       char *line = NULL;
964 +       char *walk;
965 +
966 +       if (err < 0)
967 +               return;
968 +
969 +       if (FD_ISSET(sock_devd, (fd_set *) read_mask)) {
970 +               if (socket_getline(sock_devd, &line) < 0)
971 +                       return;
972 +
973 +               walk = strchr(line + 1, ' ');
974 +               if (walk != NULL)
975 +                       walk[0] = '\0';
976 +
977 +               switch (*line) {
978 +               case DEVD_EVENT_ADD:
979 +                       device_added(line + 1);
980 +                       break;
981 +               case DEVD_EVENT_REMOVE:
982 +                       device_removed(line + 1);
983 +                       break;
984 +               default:
985 +                       break;
986 +               }
987 +               free(line);
988 +       }
989 +}
990 +
991 +static void
992 +block_handler(void *data, struct timeval **tv, void *read_mask)
993 +{
994 +}
995 +
996 +int
997 +config_devd_init(void)
998 +{
999 +       char devicename[1024];
1000 +       int i, j;
1001 +
1002 +       LogMessage(X_INFO, "config/devd: probing input devices...\n");
1003 +
1004 +       /*
1005 +        * Add fake keyboard and give up on keyboards management
1006 +        * if kbdmux is enabled
1007 +        */
1008 +       if ((is_kbdmux = is_kbdmux_enabled()) == true)
1009 +               device_added("kbdmux");
1010 +
1011 +       for (i = 0; hw_types[i].driver != NULL; i++) {
1012 +               /* First scan the sysctl to determine the hardware */
1013 +               for (j = 0; j < 16; j++) {
1014 +                       if (sysctl_exists(&hw_types[i], j,
1015 +                                       devicename, sizeof(devicename)) != 0)
1016 +                               device_added(devicename);
1017 +               }
1018 +
1019 +               if (devpath_exists(&hw_types[i], devicename, sizeof(devicename)) != 0)
1020 +                       device_added(devicename);
1021 +       }
1022 +
1023 +       if ((sock_devd = connect_devd()) < 0)
1024 +               return 0;
1025 +
1026 +       RegisterBlockAndWakeupHandlers(block_handler, wakeup_handler, NULL);
1027 +
1028 +       return 1;
1029 +}
1030 +
1031 +void
1032 +config_devd_fini(void)
1033 +{
1034 +       LogMessage(X_INFO, "config/devd: terminating backend...\n");
1035 +
1036 +       if (rtimer) {
1037 +               TimerFree(rtimer);
1038 +               rtimer = NULL;
1039 +       }
1040 +
1041 +       disconnect_devd(sock_devd);
1042 +
1043 +       RemoveBlockAndWakeupHandlers(block_handler, wakeup_handler, NULL);
1044 +
1045 +       is_console_kbd = false;
1046 +}
1047
1048
1049 [FILE:1457:patches/patch-configure]
1050 --- configure.orig      2018-10-25 14:13:27 UTC
1051 +++ configure
1052 @@ -12074,7 +12074,6 @@ fi
1053  
1054  if test x$FILE_MAN_SUFFIX = x    ; then
1055      case $host_os in
1056 -       solaris*)       FILE_MAN_SUFFIX=4  ;;
1057         *)              FILE_MAN_SUFFIX=5  ;;
1058      esac
1059  fi
1060 @@ -12084,7 +12083,6 @@ fi
1061  
1062  if test x$MISC_MAN_SUFFIX = x    ; then
1063      case $host_os in
1064 -       solaris*)       MISC_MAN_SUFFIX=5  ;;
1065         *)              MISC_MAN_SUFFIX=7  ;;
1066      esac
1067  fi
1068 @@ -12094,7 +12092,6 @@ fi
1069  
1070  if test x$DRIVER_MAN_SUFFIX = x    ; then
1071      case $host_os in
1072 -       solaris*)       DRIVER_MAN_SUFFIX=7  ;;
1073         *)              DRIVER_MAN_SUFFIX=4  ;;
1074      esac
1075  fi
1076 @@ -12104,7 +12101,6 @@ fi
1077  
1078  if test x$ADMIN_MAN_SUFFIX = x    ; then
1079      case $host_os in
1080 -       solaris*)       ADMIN_MAN_SUFFIX=1m ;;
1081         *)              ADMIN_MAN_SUFFIX=8  ;;
1082      esac
1083  fi
1084 @@ -21727,7 +21723,7 @@ if test `${RAWCPP} < conftest.$ac_ext |
1085         { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
1086  $as_echo "no" >&6; }
1087  else
1088 -       if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1089 +       if true; then
1090                 TRADITIONALCPPFLAGS="-traditional"
1091                 RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1092                 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
1093 @@ -23096,9 +23092,14 @@ $as_echo "#define USE_ALPHA_PIO 1" >>con
1094         esac
1095         GLX_ARCH_DEFINES="-D__GLX_ALIGN64 -mieee"
1096         ;;
1097 -  arm*)
1098 +  arm*|aarch64*)
1099         ARM_VIDEO=yes
1100         DEFAULT_INT10="stub"
1101 +       case $host_os in
1102 +               *freebsd*)
1103 +                       $as_echo "#define USE_DEV_IO 1" >>confdefs.h
1104 +                ;;
1105 +       esac
1106         ;;
1107    i*86)
1108         I386_VIDEO=yes
1109
1110
1111 [FILE:256:patches/patch-hw_kdrive_ephyr_hostx.c]
1112 --- hw/kdrive/ephyr/hostx.c.orig        2018-10-25 14:13:21 UTC
1113 +++ hw/kdrive/ephyr/hostx.c
1114 @@ -36,7 +36,6 @@
1115  #include <string.h>             /* for memset */
1116  #include <errno.h>
1117  #include <time.h>
1118 -#include <err.h>
1119  
1120  #include <sys/ipc.h>
1121  #include <sys/shm.h>
1122
1123
1124 [FILE:765:patches/patch-hw_xfree86_common_xf86AutoConfig.c]
1125 --- hw/xfree86/common/xf86AutoConfig.c.orig     2018-10-25 14:13:21 UTC
1126 +++ hw/xfree86/common/xf86AutoConfig.c
1127 @@ -294,7 +294,7 @@ listPossibleVideoDrivers(XF86MatchedDriv
1128      xf86PciMatchDriver(md);
1129  #endif
1130  
1131 -#if defined(__linux__)
1132 +#if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__)
1133      xf86AddMatchedDriver(md, "modesetting");
1134  #endif
1135  
1136 @@ -302,8 +302,10 @@ listPossibleVideoDrivers(XF86MatchedDriv
1137      /* Fallback to platform default frame buffer driver */
1138  #if !defined(__linux__) && defined(__sparc__)
1139      xf86AddMatchedDriver(md, "wsfb");
1140 -#else
1141 +#elif defined(__linux__)
1142      xf86AddMatchedDriver(md, "fbdev");
1143 +#elif defined(__FreeBSD__)
1144 +    xf86AddMatchedDriver(md, "scfb");
1145  #endif
1146  #endif                          /* !__sun */
1147  
1148
1149
1150 [FILE:700:patches/patch-hw_xfree86_common_xf86Config.c]
1151 --- hw/xfree86/common/xf86Config.c.orig 2018-10-25 14:13:21 UTC
1152 +++ hw/xfree86/common/xf86Config.c
1153 @@ -1264,13 +1264,16 @@ checkCoreInputDevices(serverLayoutPtr se
1154      }
1155  
1156      if (!xf86Info.forceInputDevices && !(foundPointer && foundKeyboard)) {
1157 -#if defined(CONFIG_HAL) || defined(CONFIG_UDEV) || defined(CONFIG_WSCONS)
1158 +#if defined(CONFIG_HAL) || defined(CONFIG_UDEV) || defined(CONFIG_WSCONS) || \
1159 +               defined(CONFIG_DEVD)
1160          const char *config_backend;
1161  
1162  #if defined(CONFIG_HAL)
1163          config_backend = "HAL";
1164  #elif defined(CONFIG_UDEV)
1165          config_backend = "udev";
1166 +#elif defined(CONFIG_DEVD)
1167 +        config_backend = "devd";
1168  #else
1169          config_backend = "wscons";
1170  #endif
1171
1172
1173 [FILE:510:patches/patch-hw_xfree86_common_xf86Globals.c]
1174 --- hw/xfree86/common/xf86Globals.c.orig        2018-10-25 14:13:21 UTC
1175 +++ hw/xfree86/common/xf86Globals.c
1176 @@ -119,7 +119,7 @@ xf86InfoRec xf86Info = {
1177      .miscModInDevEnabled = TRUE,
1178      .miscModInDevAllowNonLocal = FALSE,
1179      .pmFlag = TRUE,
1180 -#if defined(CONFIG_HAL) || defined(CONFIG_UDEV) || defined(CONFIG_WSCONS)
1181 +#if defined(CONFIG_HAL) || defined(CONFIG_UDEV) || defined(CONFIG_WSCONS) || 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 2018-10-25 14:13:21 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   2018-10-25 14:13:21 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 2018-10-25 14:13:21 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  2018-10-25 14:13:21 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       2018-10-25 14:13:21 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 2018-10-25 14:13:21 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    2018-10-25 14:13:21 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        2018-10-25 14:13:31 UTC
1351 +++ xkb/Makefile.in
1352 @@ -890,7 +890,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