]> git.draconx.ca Git - gentoo-draconx.git/blob - x11-libs/libxcb/files/libxcb-1.7-interix.patch
Add xorg-x11 ebuild without nonfree fonts.
[gentoo-draconx.git] / x11-libs / libxcb / files / libxcb-1.7-interix.patch
1 reported upstream: http://lists.freedesktop.org/archives/xcb/2011-June/007095.html
2
3 diff -ru libxcb-1.7.orig/configure.ac libxcb-1.7/configure.ac
4 --- libxcb-1.7.orig/configure.ac        2011-06-08 09:12:30 +0200
5 +++ libxcb-1.7/configure.ac     2011-06-08 09:54:49 +0200
6 @@ -72,6 +72,8 @@
7  AC_SEARCH_LIBS(getaddrinfo, socket)
8  AC_SEARCH_LIBS(connect, socket)
9  
10 +AC_CHECK_FUNC(getaddrinfo, [AC_DEFINE(HAVE_GETADDRINFO, 1, [getaddrinfo() function is available])], )
11 +
12  case $host_os in
13  linux*)
14         AC_DEFINE([HAVE_ABSTRACT_SOCKETS], 1, [Define if your platform supports abstract sockets])
15 diff -ru libxcb-1.7.orig/src/xcb_auth.c libxcb-1.7/src/xcb_auth.c
16 --- libxcb-1.7.orig/src/xcb_auth.c      2011-06-08 09:12:30 +0200
17 +++ libxcb-1.7/src/xcb_auth.c   2011-06-08 09:54:49 +0200
18 @@ -33,6 +33,12 @@
19  #include <sys/param.h>
20  #include <unistd.h>
21  #include <stdlib.h>
22 +#include <arpa/inet.h>
23 +
24 +#ifdef __INTERIX
25 +/* _don't_ ask. interix has INADDR_LOOPBACK in here. */
26 +#include <rpc/types.h>
27 +#endif
28  
29  #include "xcb.h"
30  #include "xcbint.h"
31 diff -ru libxcb-1.7.orig/src/xcb_util.c libxcb-1.7/src/xcb_util.c
32 --- libxcb-1.7.orig/src/xcb_util.c      2011-06-08 09:12:30 +0200
33 +++ libxcb-1.7/src/xcb_util.c   2011-06-08 09:56:23 +0200
34 @@ -44,6 +44,7 @@
35  #include <unistd.h>
36  #include <fcntl.h>
37  #include <string.h>
38 +#include <arpa/inet.h>
39  
40  #include "xcb.h"
41  #include "xcbext.h"
42 @@ -281,10 +282,12 @@
43  static int _xcb_open_tcp(const char *host, char *protocol, const unsigned short port)
44  {
45      int fd = -1;
46 +#if HAVE_GETADDRINFO
47      struct addrinfo hints;
48      char service[6]; /* "65535" with the trailing '\0' */
49      struct addrinfo *results, *addr;
50      char *bracket;
51 +#endif
52  
53      if (protocol && strcmp("tcp",protocol) && strcmp("inet",protocol)
54  #ifdef AF_INET6
55 @@ -296,6 +299,7 @@
56      if (*host == '\0')
57         host = "localhost";
58  
59 +#if HAVE_GETADDRINFO
60      memset(&hints, 0, sizeof(hints));
61  #ifdef AI_ADDRCONFIG
62      hints.ai_flags |= AI_ADDRCONFIG;
63 @@ -338,6 +342,40 @@
64      }
65      freeaddrinfo(results);
66      return fd;
67 +#else
68 +    {
69 +        struct hostent* _h;
70 +        struct sockaddr_in _s;
71 +        struct in_addr ** _c;
72 +
73 +        if((_h = gethostbyname(host)) == NULL)
74 +            return -1;
75 +
76 +        _c = (struct in_addr**)_h->h_addr_list;
77 +        fd = -1;
78 +
79 +        while(*_c) {
80 +            _s.sin_family = AF_INET;
81 +            _s.sin_port = htons(port);
82 +            _s.sin_addr = *(*_c);
83 +
84 +            fd = _xcb_socket(_s.sin_family, SOCK_STREAM, 0);
85 +            if(fd >= 0) {
86 +                int on = 1;
87 +                setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &on, sizeof(on));
88 +                setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &on, sizeof(on));
89 +
90 +                if(connect(fd, (struct sockaddr*)&_s, sizeof(_s)) >= 0)
91 +                    break;
92 +                close(fd);
93 +                fd = -1;
94 +            }
95 +            ++_c;
96 +        }
97 +
98 +        return fd;
99 +    }
100 +#endif
101  }
102  
103  static int _xcb_open_unix(char *protocol, const char *file)