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