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