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