Gentoo Archives: gentoo-commits

From: Michael Palimaka <kensington@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-misc/tigervnc/, net-misc/tigervnc/files/
Date: Thu, 02 Mar 2017 11:12:45
Message-Id: 1488453147.5d6997c802d49ff00baf4b191b9e1b9e7f06660f.kensington@gentoo
1 commit: 5d6997c802d49ff00baf4b191b9e1b9e7f06660f
2 Author: Bruno Henc <hencb <AT> protonmail <DOT> ch>
3 AuthorDate: Sun Feb 19 22:11:55 2017 +0000
4 Commit: Michael Palimaka <kensington <AT> gentoo <DOT> org>
5 CommitDate: Thu Mar 2 11:12:27 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5d6997c8
7
8 net-misc/tigervnc: add xorg-server-1.19 support
9
10 The latest release of tigervnc (1.7.1) doesn't
11 support xorg-server-1.19. Backporting a patch
12 and commit from the main trunk allows one to
13 build tigervnc-1.7.1 with the server use flag
14 for xorg-server-1.19.
15
16 The ebuild is tested to be building and performing
17 correctly with LXDE and GNOME on a localhost.
18 However, I recommend backporting other changes as
19 well to fix possible issues with xorg-server-1.19.
20
21 Since TigerVNC releases aren't as frequent,
22 backporting might be worth the effort.
23
24 Gentoo-bug: 603424
25
26 net-misc/tigervnc/Manifest | 1 +
27 .../files/tigervnc-1.7.1-xserver119-compat.patch | 446 +++++++++++++++++++++
28 net-misc/tigervnc/files/xserver119.patch | 95 +++++
29 net-misc/tigervnc/tigervnc-1.7.1-r1.ebuild | 188 +++++++++
30 4 files changed, 730 insertions(+)
31
32 diff --git a/net-misc/tigervnc/Manifest b/net-misc/tigervnc/Manifest
33 index f6a0feedd6c..06e4ed53d1f 100644
34 --- a/net-misc/tigervnc/Manifest
35 +++ b/net-misc/tigervnc/Manifest
36 @@ -2,3 +2,4 @@ DIST tigervnc-1.4.2-patches-0.1.tar.bz2 7361 SHA256 21c77708d303192108ffeef02acc
37 DIST tigervnc-1.7.1.tar.gz 1406032 SHA256 3c021ec0bee4611020c0bcbab995b0ef2f6f1a46127a52b368827f3275527ccc SHA512 babdc362b28d7af80c7efbb3a1aadf158d7f29621afe36d785748af45e515e2718cf1011359db7b39c218770b3f3ee2767e08abc58091f018c08ba9739a3e68d WHIRLPOOL 178d6b3fb7569cfb2de5dd144031b441b02a865574928d20f1589fd6f933b9276477292182cde56e948ab75d2fc0bea4d79f71bcddb33f6057970a7caa08b2cc
38 DIST tigervnc.png 4958 SHA256 e0828aeb92ccaaf93e690e9ee5e17803de1cb140d3ca79fb756fe08ebbc4492e SHA512 97f9a42e9b9f50f1c91de3b7d7991aa8965240fe4958d6da4e9f72f9baa4510ad615765f7c59d6e0a90c9d4b5fe53ad1547c766f2da45e4a6b6e29b03ced2b8b WHIRLPOOL bbf01f6702724bc4329d053bd3fbf856103371abce20f6f74aa3c2e5eed0eebcdcccd287788b1efbb8de3008cb484a8da5ccd1bd667727e4b0861f3bb550529c
39 DIST xorg-server-1.18.4.tar.bz2 6009508 SHA256 278459b2c31d61a15655d95a72fb79930c480a6bb8cf9226e48a07df8b1d31c8 SHA512 2055948caa1437547ea823a70d8b24584b65338bb9f1bbf75e3ad7fd60ec9684378facaffa05b7ce496d904213cd192085a43ba889a1476d5fbc813b7e41b56b WHIRLPOOL f9ba5ffb49e6ac7ca20d64d27712a0a8f10c6560256a20e9f944d6438dc5f5eebe53daf6af110084da67a622e92874969047518e72ff181de0d64d83030d629f
40 +DIST xorg-server-1.19.1.tar.bz2 6041792 SHA256 79ae2cf39d3f6c4a91201d8dad549d1d774b3420073c5a70d390040aa965a7fb SHA512 37d413fdd96ce6b15ae20ca5028331498586044cfc7a6ab0acb99201b04063c69bcd06867f2dc33237b244ce2870a1c5a4be3cbe4560f2461894f46f8d5dbdd7 WHIRLPOOL 9fab4118e866e11a7742ba63d7f681490d43718a329416fb742e268fdf56f348bc9f1f2b5229fbaac98ce78f41fc1e9e5aa7587ee120fcccaba752ff4bac1555
41
42 diff --git a/net-misc/tigervnc/files/tigervnc-1.7.1-xserver119-compat.patch b/net-misc/tigervnc/files/tigervnc-1.7.1-xserver119-compat.patch
43 new file mode 100644
44 index 00000000000..192344257a5
45 --- /dev/null
46 +++ b/net-misc/tigervnc/files/tigervnc-1.7.1-xserver119-compat.patch
47 @@ -0,0 +1,446 @@
48 +From 3fed95eda27dfbeee6535f987f5d14a66f64749b Mon Sep 17 00:00:00 2001
49 +From: Hans de Goede <hdegoede@××××××.com>
50 +Date: Wed, 5 Oct 2016 11:15:27 +0200
51 +Subject: [PATCH] Add xorg-xserver 1.19 support
52 +
53 +---
54 + unix/xserver/hw/vnc/XserverDesktop.cc | 183 ++++++++++++++++++++++++++++++++++
55 + unix/xserver/hw/vnc/XserverDesktop.h | 7 ++
56 + unix/xserver/hw/vnc/vncBlockHandler.c | 19 ++++
57 + unix/xserver/hw/vnc/vncExtInit.cc | 13 +++
58 + unix/xserver/hw/vnc/vncExtInit.h | 5 +
59 + unix/xserver/hw/vnc/vncHooks.c | 21 +++-
60 + unix/xserver/hw/vnc/xorg-version.h | 4 +-
61 + unix/xserver119.patch | 95 ++++++++++++++++++
62 + 8 files changed, 343 insertions(+), 4 deletions(-)
63 + create mode 100644 unix/xserver119.patch
64 +
65 +diff --git a/unix/xserver/hw/vnc/XserverDesktop.cc b/unix/xserver/hw/vnc/XserverDesktop.cc
66 +index 4f82a54..8cc0b0b 100644
67 +--- a/unix/xserver/hw/vnc/XserverDesktop.cc
68 ++++ b/unix/xserver/hw/vnc/XserverDesktop.cc
69 +@@ -90,6 +90,30 @@ class FileHTTPServer : public rfb::HTTPServer {
70 + XserverDesktop* desktop;
71 + };
72 +
73 ++#if XORG >= 119
74 ++extern "C" {
75 ++/*
76 ++ * xserver NotifyFd callbacks. Note we also expect write notifies to work,
77 ++ * which only works with xserver >= 1.19.
78 ++ */
79 ++#include "os.h"
80 ++
81 ++static void HandleListenFd(int fd, int xevents, void *data)
82 ++{
83 ++ XserverDesktop *desktop = (XserverDesktop *)data;
84 ++
85 ++ desktop->handleListenFd(fd);
86 ++}
87 ++
88 ++static void HandleSocketFd(int fd, int xevents, void *data)
89 ++{
90 ++ XserverDesktop *desktop = (XserverDesktop *)data;
91 ++
92 ++ desktop->handleSocketFd(fd, xevents);
93 ++}
94 ++
95 ++}
96 ++#endif
97 +
98 + XserverDesktop::XserverDesktop(int screenIndex_,
99 + std::list<network::TcpListener*> listeners_,
100 +@@ -111,15 +135,35 @@ XserverDesktop::XserverDesktop(int screenIndex_,
101 +
102 + if (!httpListeners.empty ())
103 + httpServer = new FileHTTPServer(this);
104 ++
105 ++#if XORG >= 119
106 ++ for (std::list<TcpListener*>::iterator i = listeners.begin();
107 ++ i != listeners.end();
108 ++ i++) {
109 ++ SetNotifyFd((*i)->getFd(), HandleListenFd, X_NOTIFY_READ, this);
110 ++ }
111 ++
112 ++ for (std::list<TcpListener*>::iterator i = httpListeners.begin();
113 ++ i != httpListeners.end();
114 ++ i++) {
115 ++ SetNotifyFd((*i)->getFd(), HandleListenFd, X_NOTIFY_READ, this);
116 ++ }
117 ++#endif
118 + }
119 +
120 + XserverDesktop::~XserverDesktop()
121 + {
122 + while (!listeners.empty()) {
123 ++#if XORG >= 119
124 ++ RemoveNotifyFd(listeners.back()->getFd());
125 ++#endif
126 + delete listeners.back();
127 + listeners.pop_back();
128 + }
129 + while (!httpListeners.empty()) {
130 ++#if XORG >= 119
131 ++ RemoveNotifyFd(listeners.back()->getFd());
132 ++#endif
133 + delete httpListeners.back();
134 + httpListeners.pop_back();
135 + }
136 +@@ -389,6 +433,140 @@ void XserverDesktop::add_copied(const rfb::Region &dest, const rfb::Point &delta
137 + }
138 + }
139 +
140 ++#if XORG >= 119
141 ++void XserverDesktop::handleListenFd(int fd)
142 ++{
143 ++ std::list<TcpListener*>::iterator i;
144 ++ SocketServer *fd_server = NULL;
145 ++ bool is_http = false;
146 ++
147 ++ for (i = listeners.begin(); i != listeners.end(); i++) {
148 ++ if ((*i)->getFd() == fd) {
149 ++ fd_server = server;
150 ++ break;
151 ++ }
152 ++ }
153 ++ if (httpServer && !fd_server) {
154 ++ for (i = httpListeners.begin(); i != httpListeners.end(); i++) {
155 ++ if ((*i)->getFd() == fd) {
156 ++ fd_server = httpServer;
157 ++ is_http = true;
158 ++ break;
159 ++ }
160 ++ }
161 ++ }
162 ++ if (!fd_server) {
163 ++ vlog.error("XserverDesktop::handleListenFd: Error cannot find fd");
164 ++ return;
165 ++ }
166 ++
167 ++ Socket* sock = (*i)->accept();
168 ++ sock->outStream().setBlocking(false);
169 ++ vlog.debug("new %sclient, sock %d", is_http ? "http " : "", sock->getFd());
170 ++ fd_server->addSocket(sock);
171 ++ SetNotifyFd(sock->getFd(), HandleSocketFd, X_NOTIFY_READ, this);
172 ++}
173 ++
174 ++void XserverDesktop::handleSocketFd(int fd, int xevents)
175 ++{
176 ++ std::list<Socket*> sockets;
177 ++ std::list<Socket*>::iterator i;
178 ++ SocketServer *fd_server = NULL;
179 ++ bool is_http = false;
180 ++
181 ++ server->getSockets(&sockets);
182 ++ for (i = sockets.begin(); i != sockets.end(); i++) {
183 ++ if ((*i)->getFd() == fd) {
184 ++ fd_server = server;
185 ++ break;
186 ++ }
187 ++ }
188 ++ if (httpServer && !fd_server) {
189 ++ httpServer->getSockets(&sockets);
190 ++ for (i = sockets.begin(); i != sockets.end(); i++) {
191 ++ if ((*i)->getFd() == fd) {
192 ++ fd_server = httpServer;
193 ++ is_http = true;
194 ++ break;
195 ++ }
196 ++ }
197 ++ }
198 ++ if (!fd_server) {
199 ++ vlog.error("XserverDesktop::handleSocketFd: Error cannot find fd");
200 ++ return;
201 ++ }
202 ++
203 ++ if (xevents & X_NOTIFY_READ)
204 ++ fd_server->processSocketReadEvent(*i);
205 ++
206 ++ if (xevents & X_NOTIFY_WRITE)
207 ++ fd_server->processSocketWriteEvent(*i);
208 ++
209 ++ if ((*i)->isShutdown()) {
210 ++ vlog.debug("%sclient gone, sock %d", is_http ? "http " : "", fd);
211 ++ RemoveNotifyFd(fd);
212 ++ fd_server->removeSocket(*i);
213 ++ if (!is_http)
214 ++ vncClientGone(fd);
215 ++ delete (*i);
216 ++ }
217 ++}
218 ++
219 ++void XserverDesktop::blockHandler(int* timeout)
220 ++{
221 ++ // We don't have a good callback for when we can init input devices[1],
222 ++ // so we abuse the fact that this routine will be called first thing
223 ++ // once the dix is done initialising.
224 ++ // [1] Technically Xvnc has InitInput(), but libvnc.so has nothing.
225 ++ vncInitInputDevice();
226 ++
227 ++ try {
228 ++ std::list<Socket*> sockets;
229 ++ std::list<Socket*>::iterator i;
230 ++ server->getSockets(&sockets);
231 ++ for (i = sockets.begin(); i != sockets.end(); i++) {
232 ++ int fd = (*i)->getFd();
233 ++ if ((*i)->isShutdown()) {
234 ++ vlog.debug("client gone, sock %d",fd);
235 ++ server->removeSocket(*i);
236 ++ vncClientGone(fd);
237 ++ delete (*i);
238 ++ } else {
239 ++ /* Update existing NotifyFD to listen for write (or not) */
240 ++ if ((*i)->outStream().bufferUsage() > 0)
241 ++ SetNotifyFd(fd, HandleSocketFd, X_NOTIFY_READ | X_NOTIFY_WRITE, this);
242 ++ else
243 ++ SetNotifyFd(fd, HandleSocketFd, X_NOTIFY_READ, this);
244 ++ }
245 ++ }
246 ++ if (httpServer) {
247 ++ httpServer->getSockets(&sockets);
248 ++ for (i = sockets.begin(); i != sockets.end(); i++) {
249 ++ int fd = (*i)->getFd();
250 ++ if ((*i)->isShutdown()) {
251 ++ vlog.debug("http client gone, sock %d",fd);
252 ++ httpServer->removeSocket(*i);
253 ++ delete (*i);
254 ++ } else {
255 ++ /* Update existing NotifyFD to listen for write (or not) */
256 ++ if ((*i)->outStream().bufferUsage() > 0)
257 ++ SetNotifyFd(fd, HandleSocketFd, X_NOTIFY_READ | X_NOTIFY_WRITE, this);
258 ++ else
259 ++ SetNotifyFd(fd, HandleSocketFd, X_NOTIFY_READ, this);
260 ++ }
261 ++ }
262 ++ }
263 ++
264 ++ int nextTimeout = server->checkTimeouts();
265 ++ if (nextTimeout > 0 && (*timeout == -1 || nextTimeout < *timeout))
266 ++ *timeout = nextTimeout;
267 ++ } catch (rdr::Exception& e) {
268 ++ vlog.error("XserverDesktop::blockHandler: %s",e.str());
269 ++ }
270 ++}
271 ++
272 ++#else
273 ++
274 + void XserverDesktop::readBlockHandler(fd_set* fds, struct timeval ** timeout)
275 + {
276 + // We don't have a good callback for when we can init input devices[1],
277 +@@ -603,10 +781,15 @@ void XserverDesktop::writeWakeupHandler(fd_set* fds, int nfds)
278 + }
279 + }
280 +
281 ++#endif
282 ++
283 + void XserverDesktop::addClient(Socket* sock, bool reverse)
284 + {
285 + vlog.debug("new client, sock %d reverse %d",sock->getFd(),reverse);
286 + server->addSocket(sock, reverse);
287 ++#if XORG >= 119
288 ++ SetNotifyFd(sock->getFd(), HandleSocketFd, X_NOTIFY_READ, this);
289 ++#endif
290 + }
291 +
292 + void XserverDesktop::disconnectClients()
293 +diff --git a/unix/xserver/hw/vnc/XserverDesktop.h b/unix/xserver/hw/vnc/XserverDesktop.h
294 +index c069028..9e77627 100644
295 +--- a/unix/xserver/hw/vnc/XserverDesktop.h
296 ++++ b/unix/xserver/hw/vnc/XserverDesktop.h
297 +@@ -38,6 +38,7 @@
298 + #include <rfb/VNCServerST.h>
299 + #include <rdr/SubstitutingInStream.h>
300 + #include "Input.h"
301 ++#include "xorg-version.h"
302 +
303 + namespace rfb {
304 + class VNCServerST;
305 +@@ -69,10 +70,16 @@ class XserverDesktop : public rfb::SDesktop, public rfb::FullFramePixelBuffer,
306 + const unsigned char *rgbaData);
307 + void add_changed(const rfb::Region &region);
308 + void add_copied(const rfb::Region &dest, const rfb::Point &delta);
309 ++#if XORG >= 119
310 ++ void handleListenFd(int fd);
311 ++ void handleSocketFd(int fd, int xevents);
312 ++ void blockHandler(int* timeout);
313 ++#else
314 + void readBlockHandler(fd_set* fds, struct timeval ** timeout);
315 + void readWakeupHandler(fd_set* fds, int nfds);
316 + void writeBlockHandler(fd_set* fds, struct timeval ** timeout);
317 + void writeWakeupHandler(fd_set* fds, int nfds);
318 ++#endif
319 + void addClient(network::Socket* sock, bool reverse);
320 + void disconnectClients();
321 +
322 +diff --git a/unix/xserver/hw/vnc/vncBlockHandler.c b/unix/xserver/hw/vnc/vncBlockHandler.c
323 +index 4e44478..baebc3d 100644
324 +--- a/unix/xserver/hw/vnc/vncBlockHandler.c
325 ++++ b/unix/xserver/hw/vnc/vncBlockHandler.c
326 +@@ -30,6 +30,23 @@
327 +
328 + #include "vncExtInit.h"
329 + #include "vncBlockHandler.h"
330 ++#include "xorg-version.h"
331 ++
332 ++#if XORG >= 119
333 ++
334 ++static void vncBlockHandler(void* data, void* timeout)
335 ++{
336 ++ vncCallBlockHandlers(timeout);
337 ++}
338 ++
339 ++void vncRegisterBlockHandlers(void)
340 ++{
341 ++ if (!RegisterBlockAndWakeupHandlers(vncBlockHandler,
342 ++ (ServerWakeupHandlerProcPtr)NoopDDA, 0))
343 ++ FatalError("RegisterBlockAndWakeupHandlers() failed\n");
344 ++}
345 ++
346 ++#else
347 +
348 + static void vncBlockHandler(void * data, OSTimePtr t, void * readmask);
349 + static void vncWakeupHandler(void * data, int nfds, void * readmask);
350 +@@ -144,3 +161,5 @@ static void vncWriteWakeupHandlerFallback(void)
351 +
352 + vncWriteWakeupHandler(ret, &fallbackFds);
353 + }
354 ++
355 ++#endif
356 +diff --git a/unix/xserver/hw/vnc/vncExtInit.cc b/unix/xserver/hw/vnc/vncExtInit.cc
357 +index dea3cb8..9d70e44 100644
358 +--- a/unix/xserver/hw/vnc/vncExtInit.cc
359 ++++ b/unix/xserver/hw/vnc/vncExtInit.cc
360 +@@ -249,6 +249,17 @@ int vncExtensionIsActive(int scrIdx)
361 + return (desktop[scrIdx] != NULL);
362 + }
363 +
364 ++#if XORG >= 119
365 ++
366 ++void vncCallBlockHandlers(int* timeout)
367 ++{
368 ++ for (int scr = 0; scr < vncGetScreenCount(); scr++)
369 ++ if (desktop[scr])
370 ++ desktop[scr]->blockHandler(timeout);
371 ++}
372 ++
373 ++#else
374 ++
375 + void vncCallReadBlockHandlers(fd_set * fds, struct timeval ** timeout)
376 + {
377 + for (int scr = 0; scr < vncGetScreenCount(); scr++)
378 +@@ -277,6 +288,8 @@ void vncCallWriteWakeupHandlers(fd_set * fds, int nfds)
379 + desktop[scr]->writeWakeupHandler(fds, nfds);
380 + }
381 +
382 ++#endif
383 ++
384 + int vncGetAvoidShiftNumLock(void)
385 + {
386 + return (bool)avoidShiftNumLock;
387 +diff --git a/unix/xserver/hw/vnc/vncExtInit.h b/unix/xserver/hw/vnc/vncExtInit.h
388 +index 9785d11..3164528 100644
389 +--- a/unix/xserver/hw/vnc/vncExtInit.h
390 ++++ b/unix/xserver/hw/vnc/vncExtInit.h
391 +@@ -22,6 +22,7 @@
392 + #include <stdint.h>
393 + #include <stddef.h>
394 + #include <sys/select.h>
395 ++#include "xorg-version.h"
396 +
397 + // Only from C++
398 + #ifdef __cplusplus
399 +@@ -50,10 +51,14 @@ extern int vncInetdSock;
400 + void vncExtensionInit(void);
401 + int vncExtensionIsActive(int scrIdx);
402 +
403 ++#if XORG >= 119
404 ++void vncCallBlockHandlers(int* timeout);
405 ++#else
406 + void vncCallReadBlockHandlers(fd_set * fds, struct timeval ** timeout);
407 + void vncCallReadWakeupHandlers(fd_set * fds, int nfds);
408 + void vncCallWriteBlockHandlers(fd_set * fds, struct timeval ** timeout);
409 + void vncCallWriteWakeupHandlers(fd_set * fds, int nfds);
410 ++#endif
411 +
412 + int vncGetAvoidShiftNumLock(void);
413 +
414 +diff --git a/unix/xserver/hw/vnc/vncHooks.c b/unix/xserver/hw/vnc/vncHooks.c
415 +index 22ea9ea..29f3f8b 100644
416 +--- a/unix/xserver/hw/vnc/vncHooks.c
417 ++++ b/unix/xserver/hw/vnc/vncHooks.c
418 +@@ -128,9 +128,11 @@ static Bool vncHooksDisplayCursor(DeviceIntPtr pDev,
419 + #if XORG <= 112
420 + static void vncHooksBlockHandler(int i, pointer blockData, pointer pTimeout,
421 + pointer pReadmask);
422 +-#else
423 ++#elif XORG <= 118
424 + static void vncHooksBlockHandler(ScreenPtr pScreen, void * pTimeout,
425 + void * pReadmask);
426 ++#else
427 ++static void vncHooksBlockHandler(ScreenPtr pScreen, void * pTimeout);
428 + #endif
429 + #ifdef RENDER
430 + static void vncHooksComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask,
431 +@@ -716,9 +718,11 @@ static Bool vncHooksDisplayCursor(DeviceIntPtr pDev,
432 + #if XORG <= 112
433 + static void vncHooksBlockHandler(int i, pointer blockData, pointer pTimeout,
434 + pointer pReadmask)
435 +-#else
436 ++#elif XORG <= 118
437 + static void vncHooksBlockHandler(ScreenPtr pScreen_, void * pTimeout,
438 + void * pReadmask)
439 ++#else
440 ++static void vncHooksBlockHandler(ScreenPtr pScreen_, void * pTimeout)
441 + #endif
442 + {
443 + #if XORG <= 112
444 +@@ -731,8 +735,10 @@ static void vncHooksBlockHandler(ScreenPtr pScreen_, void * pTimeout,
445 +
446 + #if XORG <= 112
447 + (*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask);
448 +-#else
449 ++#elif XORG <= 118
450 + (*pScreen->BlockHandler) (pScreen, pTimeout, pReadmask);
451 ++#else
452 ++ (*pScreen->BlockHandler) (pScreen, pTimeout);
453 + #endif
454 +
455 + vncHooksScreen->ignoreHooks--;
456 +@@ -1033,12 +1039,21 @@ static void vncHooksCopyClip(GCPtr dst, GCPtr src) {
457 +
458 + // Unwrap and rewrap helpers
459 +
460 ++#if XORG >= 116
461 ++#define GC_OP_PROLOGUE(pGC, name)\
462 ++ vncHooksGCPtr pGCPriv = vncHooksGCPrivate(pGC);\
463 ++ const GCFuncs *oldFuncs = pGC->funcs;\
464 ++ pGC->funcs = pGCPriv->wrappedFuncs;\
465 ++ pGC->ops = pGCPriv->wrappedOps; \
466 ++ DBGPRINT((stderr,"vncHooks" #name " called\n"))
467 ++#else
468 + #define GC_OP_PROLOGUE(pGC, name)\
469 + vncHooksGCPtr pGCPriv = vncHooksGCPrivate(pGC);\
470 + GCFuncs *oldFuncs = pGC->funcs;\
471 + pGC->funcs = pGCPriv->wrappedFuncs;\
472 + pGC->ops = pGCPriv->wrappedOps; \
473 + DBGPRINT((stderr,"vncHooks" #name " called\n"))
474 ++#endif
475 +
476 + #define GC_OP_EPILOGUE(pGC)\
477 + pGCPriv->wrappedOps = pGC->ops;\
478 +diff --git a/unix/xserver/hw/vnc/xorg-version.h b/unix/xserver/hw/vnc/xorg-version.h
479 +index 60610cb..9d1c0eb 100644
480 +--- a/unix/xserver/hw/vnc/xorg-version.h
481 ++++ b/unix/xserver/hw/vnc/xorg-version.h
482 +@@ -50,8 +50,10 @@
483 + #define XORG 117
484 + #elif XORG_VERSION_CURRENT < ((1 * 10000000) + (18 * 100000) + (99 * 1000))
485 + #define XORG 118
486 ++#elif XORG_VERSION_CURRENT < ((1 * 10000000) + (19 * 100000) + (99 * 1000))
487 ++#define XORG 119
488 + #else
489 +-#error "X.Org newer than 1.18 is not supported"
490 ++#error "X.Org newer than 1.19 is not supported"
491 + #endif
492 +
493 + #endif
494
495 diff --git a/net-misc/tigervnc/files/xserver119.patch b/net-misc/tigervnc/files/xserver119.patch
496 new file mode 100644
497 index 00000000000..614f104a4d4
498 --- /dev/null
499 +++ b/net-misc/tigervnc/files/xserver119.patch
500 @@ -0,0 +1,95 @@
501 +diff -up xserver/configure.ac.xserver116-rebased xserver/configure.ac
502 +--- xserver/configure.ac.xserver116-rebased 2016-09-29 13:14:45.595441590 +0200
503 ++++ xserver/configure.ac 2016-09-29 13:14:45.631442006 +0200
504 +@@ -74,6 +74,7 @@ dnl forcing an entire recompile.x
505 + AC_CONFIG_HEADERS(include/version-config.h)
506 +
507 + AM_PROG_AS
508 ++AC_PROG_CXX
509 + AC_PROG_LN_S
510 + LT_PREREQ([2.2])
511 + LT_INIT([disable-static win32-dll])
512 +@@ -1863,6 +1864,10 @@ if test "x$XVFB" = xyes; then
513 + AC_SUBST([XVFB_SYS_LIBS])
514 + fi
515 +
516 ++dnl Xvnc DDX
517 ++AC_SUBST([XVNC_CPPFLAGS], ["-DHAVE_DIX_CONFIG_H $XSERVER_CFLAGS"])
518 ++AC_SUBST([XVNC_LIBS], ["$FB_LIB $FIXES_LIB $XEXT_LIB $CONFIG_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $DRI3_LIB $PRESENT_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $MAIN_LIB"])
519 ++AC_SUBST([XVNC_SYS_LIBS], ["$GLX_SYS_LIBS"])
520 +
521 + dnl Xnest DDX
522 +
523 +@@ -1898,6 +1903,8 @@ if test "x$XORG" = xauto; then
524 + fi
525 + AC_MSG_RESULT([$XORG])
526 +
527 ++AC_DEFINE_UNQUOTED(XORG_VERSION_CURRENT, [$VENDOR_RELEASE], [Current Xorg version])
528 ++
529 + if test "x$XORG" = xyes; then
530 + XORG_DDXINCS='-I$(top_srcdir)/hw/xfree86 -I$(top_srcdir)/hw/xfree86/include -I$(top_srcdir)/hw/xfree86/common'
531 + XORG_OSINCS='-I$(top_srcdir)/hw/xfree86/os-support -I$(top_srcdir)/hw/xfree86/os-support/bus -I$(top_srcdir)/os'
532 +@@ -2116,7 +2123,6 @@ if test "x$XORG" = xyes; then
533 + AC_DEFINE(XORG_SERVER, 1, [Building Xorg server])
534 + AC_DEFINE(XORGSERVER, 1, [Building Xorg server])
535 + AC_DEFINE(XFree86Server, 1, [Building XFree86 server])
536 +- AC_DEFINE_UNQUOTED(XORG_VERSION_CURRENT, [$VENDOR_RELEASE], [Current Xorg version])
537 + AC_DEFINE(NEED_XF86_TYPES, 1, [Need XFree86 typedefs])
538 + AC_DEFINE(NEED_XF86_PROTOTYPES, 1, [Need XFree86 helper functions])
539 + AC_DEFINE(__XSERVERNAME__, "Xorg", [Name of X server])
540 +@@ -2691,6 +2697,7 @@ hw/dmx/Makefile
541 + hw/dmx/man/Makefile
542 + hw/vfb/Makefile
543 + hw/vfb/man/Makefile
544 ++hw/vnc/Makefile
545 + hw/xnest/Makefile
546 + hw/xnest/man/Makefile
547 + hw/xwin/Makefile
548 +diff -up xserver/hw/Makefile.am.xserver116-rebased xserver/hw/Makefile.am
549 +--- xserver/hw/Makefile.am.xserver116-rebased 2016-09-29 13:14:45.601441659 +0200
550 ++++ xserver/hw/Makefile.am 2016-09-29 13:14:45.631442006 +0200
551 +@@ -38,7 +38,8 @@ SUBDIRS = \
552 + $(DMX_SUBDIRS) \
553 + $(KDRIVE_SUBDIRS) \
554 + $(XQUARTZ_SUBDIRS) \
555 +- $(XWAYLAND_SUBDIRS)
556 ++ $(XWAYLAND_SUBDIRS) \
557 ++ vnc
558 +
559 + DIST_SUBDIRS = dmx xfree86 vfb xnest xwin xquartz kdrive xwayland
560 +
561 +diff -up xserver/mi/miinitext.c.xserver116-rebased xserver/mi/miinitext.c
562 +--- xserver/mi/miinitext.c.xserver116-rebased 2016-09-29 13:14:45.618441855 +0200
563 ++++ xserver/mi/miinitext.c 2016-09-29 13:14:45.631442006 +0200
564 +@@ -114,6 +114,10 @@ SOFTWARE.
565 + #include "micmap.h"
566 + #include "globals.h"
567 +
568 ++#ifdef TIGERVNC
569 ++extern void vncExtensionInit(INITARGS);
570 ++#endif
571 ++
572 + /* The following is only a small first step towards run-time
573 + * configurable extensions.
574 + */
575 +@@ -238,6 +242,9 @@ EnableDisableExtensionError(const char *
576 +
577 + /* List of built-in (statically linked) extensions */
578 + static const ExtensionModule staticExtensions[] = {
579 ++#ifdef TIGERVNC
580 ++ {vncExtensionInit, "VNC-EXTENSION", NULL},
581 ++#endif
582 + {GEExtensionInit, "Generic Event Extension", &noGEExtension},
583 + {ShapeExtensionInit, "SHAPE", NULL},
584 + #ifdef MITSHM
585 +--- xserver/include/os.h~ 2016-10-03 09:07:29.000000000 +0200
586 ++++ xserver/include/os.h 2016-10-03 14:13:00.013654506 +0200
587 +@@ -621,7 +621,7 @@
588 + extern _X_EXPORT void
589 + LogClose(enum ExitCode error);
590 + extern _X_EXPORT Bool
591 +-LogSetParameter(LogParameter param, int value);
592 ++LogSetParameter(enum _LogParameter param, int value);
593 + extern _X_EXPORT void
594 + LogVWrite(int verb, const char *f, va_list args)
595 + _X_ATTRIBUTE_PRINTF(2, 0);
596
597 diff --git a/net-misc/tigervnc/tigervnc-1.7.1-r1.ebuild b/net-misc/tigervnc/tigervnc-1.7.1-r1.ebuild
598 new file mode 100644
599 index 00000000000..164dbb1670f
600 --- /dev/null
601 +++ b/net-misc/tigervnc/tigervnc-1.7.1-r1.ebuild
602 @@ -0,0 +1,188 @@
603 +# Copyright 1999-2017 Gentoo Foundation
604 +# Distributed under the terms of the GNU General Public License v2
605 +
606 +EAPI="6"
607 +
608 +CMAKE_IN_SOURCE_BUILD=1
609 +
610 +inherit autotools cmake-utils eutils flag-o-matic java-pkg-opt-2 systemd
611 +
612 +XSERVER_VERSION="1.19.1"
613 +
614 +DESCRIPTION="Remote desktop viewer display system"
615 +HOMEPAGE="http://www.tigervnc.org"
616 +SRC_URI="https://github.com/TigerVNC/tigervnc/archive/v${PV}.tar.gz -> ${P}.tar.gz
617 + https://dev.gentoo.org/~armin76/dist/tigervnc-1.4.2-patches-0.1.tar.bz2
618 + mirror://gentoo/${PN}.png
619 + server? ( ftp://ftp.freedesktop.org/pub/xorg/individual/xserver/xorg-server-${XSERVER_VERSION}.tar.bz2 )"
620 +
621 +LICENSE="GPL-2"
622 +SLOT="0"
623 +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sh ~sparc ~x86"
624 +IUSE="+drm gnutls java +opengl pam server +xorgmodule"
625 +
626 +CDEPEND="virtual/jpeg:0
627 + sys-libs/zlib
628 + >=x11-libs/libXtst-1.0.99.2
629 + >=x11-libs/fltk-1.3.1
630 + gnutls? ( net-libs/gnutls:= )
631 + pam? ( virtual/pam )
632 + server? (
633 + dev-lang/perl
634 + >=x11-libs/libXi-1.2.99.1
635 + >=x11-libs/libXfont-1.4.2
636 + >=x11-libs/libxkbfile-1.0.4
637 + x11-libs/libXrender
638 + >=x11-libs/pixman-0.27.2
639 + >=x11-apps/xauth-1.0.3
640 + x11-apps/xsetroot
641 + >=x11-misc/xkeyboard-config-2.4.1-r3
642 + opengl? ( >=app-eselect/eselect-opengl-1.3.1-r1 )
643 + xorgmodule? ( =x11-base/xorg-server-${XSERVER_VERSION%.*}* )
644 + drm? ( x11-libs/libdrm )
645 + )"
646 +
647 +RDEPEND="${CDEPEND}
648 + java? ( >=virtual/jre-1.5:* )
649 + !net-misc/vnc
650 + !net-misc/tightvnc
651 + !net-misc/xf4vnc"
652 +
653 +DEPEND="${CDEPEND}
654 + amd64? ( dev-lang/nasm )
655 + x86? ( dev-lang/nasm )
656 + >=x11-proto/inputproto-2.2.99.1
657 + >=x11-proto/xextproto-7.2.99.901
658 + >=x11-proto/xproto-7.0.26
659 + java? ( >=virtual/jdk-1.5 )
660 + server? (
661 + virtual/pkgconfig
662 + media-fonts/font-util
663 + x11-misc/util-macros
664 + >=x11-proto/bigreqsproto-1.1.0
665 + >=x11-proto/compositeproto-0.4
666 + >=x11-proto/damageproto-1.1
667 + >=x11-proto/fixesproto-5.0
668 + >=x11-proto/fontsproto-2.1.3
669 + >=x11-proto/glproto-1.4.17
670 + >=x11-proto/randrproto-1.4.0
671 + >=x11-proto/renderproto-0.11
672 + >=x11-proto/resourceproto-1.2.0
673 + >=x11-proto/scrnsaverproto-1.1
674 + >=x11-proto/videoproto-2.2.2
675 + >=x11-proto/xcmiscproto-1.2.0
676 + >=x11-proto/xineramaproto-1.1.3
677 + >=x11-libs/xtrans-1.3.3
678 + >=x11-proto/dri2proto-2.8
679 + opengl? ( >=media-libs/mesa-10.3.4-r1 )
680 + )"
681 +
682 +PATCHES=(
683 + "${WORKDIR}"/patches/010_libvnc-os.patch
684 + "${WORKDIR}"/patches/030_manpages.patch
685 + "${WORKDIR}"/patches/055_xstartup.patch
686 +)
687 +
688 +src_prepare() {
689 + if use server ; then
690 + cp -r "${WORKDIR}"/xorg-server-${XSERVER_VERSION}/. unix/xserver || die
691 + fi
692 +
693 + default
694 +
695 + if use server; then
696 + eapply "${FILESDIR}/${PN}-1.7.1-xserver119-compat.patch"
697 + cd unix/xserver || die
698 + eapply "${FILESDIR}/xserver119.patch"
699 + eautoreconf
700 + fi
701 +}
702 +
703 +src_configure() {
704 + use arm || use hppa && append-flags "-fPIC"
705 +
706 + local mycmakeargs=(
707 + -DENABLE_GNUTLS=$(usex gnutls)
708 + -DENABLE_PAM=$(usex pam)
709 + -DBUILD_JAVA=$(usex java)
710 + )
711 +
712 + cmake-utils_src_configure
713 +
714 + if use server; then
715 + cd unix/xserver || die
716 + econf \
717 + $(use_enable opengl glx) \
718 + $(use_enable drm libdrm) \
719 + --disable-config-hal \
720 + --disable-config-udev \
721 + --disable-devel-docs \
722 + --disable-dmx \
723 + --disable-dri \
724 + --disable-dri3 \
725 + --disable-glamor \
726 + --disable-kdrive \
727 + --disable-libunwind \
728 + --disable-linux-acpi \
729 + --disable-record \
730 + --disable-selective-werror \
731 + --disable-silent-rules \
732 + --disable-static \
733 + --disable-tslib \
734 + --disable-unit-tests \
735 + --disable-xephyr \
736 + --disable-xinerama \
737 + --disable-xnest \
738 + --disable-xorg \
739 + --disable-xvfb \
740 + --disable-xwin \
741 + --disable-xwayland \
742 + --enable-dri2 \
743 + --with-pic \
744 + --without-dtrace \
745 + --disable-present \
746 + --disable-unit-tests
747 + fi
748 +}
749 +
750 +src_compile() {
751 + cmake-utils_src_compile
752 +
753 + if use server; then
754 + # deps of the vnc module and the module itself
755 + local d subdirs=(
756 + fb xfixes Xext dbe $(usex opengl glx "") randr render damageext miext Xi xkb
757 + composite dix mi os hw/vnc
758 + )
759 + for d in "${subdirs[@]}"; do
760 + emake -C unix/xserver/"${d}"
761 + done
762 + fi
763 +}
764 +
765 +src_install() {
766 + cmake-utils_src_install
767 +
768 + newicon "${DISTDIR}"/tigervnc.png vncviewer.png
769 + make_desktop_entry vncviewer vncviewer vncviewer Network
770 +
771 + if use server ; then
772 + emake -C unix/xserver/hw/vnc DESTDIR="${D}" install
773 + if ! use xorgmodule; then
774 + rm -r "${ED%/}"/usr/$(get_libdir)/xorg || die
775 + else
776 + rm "${ED%/}"/usr/$(get_libdir)/xorg/modules/extensions/libvnc.la || die
777 + fi
778 +
779 + newconfd "${FILESDIR}"/${PN}.confd ${PN}
780 + newinitd "${FILESDIR}"/${PN}.initd ${PN}
781 + systemd_douserunit contrib/systemd/user/vncserver@.service
782 + else
783 + local f
784 + cd "${ED}" || die
785 + for f in vncserver vncpasswd x0vncserver vncconfig; do
786 + rm usr/bin/$f || die
787 + rm usr/share/man/man1/$f.1 || die
788 + done
789 + fi
790 +}