Gentoo Archives: gentoo-commits

From: Matt Turner <mattst88@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: x11-base/xorg-server/files/, x11-base/xorg-server/
Date: Thu, 28 Feb 2019 05:47:48
Message-Id: 1551332686.4b03aab97013ea3cacb778956262dbf16e70fcdf.mattst88@gentoo
1 commit: 4b03aab97013ea3cacb778956262dbf16e70fcdf
2 Author: Matt Turner <mattst88 <AT> gentoo <DOT> org>
3 AuthorDate: Thu Feb 28 01:18:22 2019 +0000
4 Commit: Matt Turner <mattst88 <AT> gentoo <DOT> org>
5 CommitDate: Thu Feb 28 05:44:46 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4b03aab9
7
8 x11-base/xorg-server: Version bump to 1.20.4
9
10 Closes: https://bugs.gentoo.org/677752
11 Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>
12
13 x11-base/xorg-server/Manifest | 1 +
14 ...ck-the-shm-dir-at-run-time-not-build-time.patch | 174 +++++++++++++++++
15 ...1.20.4-shm-Use-memfd_create-when-possible.patch | 89 +++++++++
16 ...ndent-shm_tmpfile-to-follow-our-standards.patch | 72 +++++++
17 x11-base/xorg-server/xorg-server-1.20.4.ebuild | 217 +++++++++++++++++++++
18 5 files changed, 553 insertions(+)
19
20 diff --git a/x11-base/xorg-server/Manifest b/x11-base/xorg-server/Manifest
21 index 4dc15913393..d0d520e0f00 100644
22 --- a/x11-base/xorg-server/Manifest
23 +++ b/x11-base/xorg-server/Manifest
24 @@ -1 +1,2 @@
25 DIST xorg-server-1.20.3.tar.bz2 6205000 BLAKE2B 9fc8acf1812d0aa4800941dd1846060f91edf1e7ebc92b35e8c2028266d88d3ab3ba14e95f535e5ee41941f8e20769ee75723ba609f5653d4892f97bc5cf91c4 SHA512 ee44554f86df4297f54c5871fe7a18954eeef4338775a25f36d6577b279c4775f61128da71b86cfaeadcc080838d6749dede138d4db178866579da2056543fba
26 +DIST xorg-server-1.20.4.tar.bz2 6123780 BLAKE2B 224dda54f433315f6614cbee5bc54db91d9d9e190c06ac7f26e334b80b9d4a612ff4b2a4f10f50a6f928ecdbea40172d5578289fbf88411f006bcd473253b05d SHA512 f1c92ef6d7613e0636973d3395b48dfdad42230847ab1c8b1cea84647a968f649f9aba97bdb01c10ee8351cbe954d4e6ca4a0fc84bb8fa662d49c8ba2aee00a8
27
28 diff --git a/x11-base/xorg-server/files/xorg-server-1.20.4-shm-Pick-the-shm-dir-at-run-time-not-build-time.patch b/x11-base/xorg-server/files/xorg-server-1.20.4-shm-Pick-the-shm-dir-at-run-time-not-build-time.patch
29 new file mode 100644
30 index 00000000000..54ed62935a6
31 --- /dev/null
32 +++ b/x11-base/xorg-server/files/xorg-server-1.20.4-shm-Pick-the-shm-dir-at-run-time-not-build-time.patch
33 @@ -0,0 +1,174 @@
34 +From 19f6cb570becbc4e355807199c6e251fc7935132 Mon Sep 17 00:00:00 2001
35 +From: Eric Anholt <eric@××××××.net>
36 +Date: Wed, 19 Sep 2018 13:28:06 -0700
37 +Subject: [PATCH xserver] shm: Pick the shm dir at run time, not build time.
38 +
39 +Prodding the builder's filesystem for tmp dirs doesn't necessarily
40 +tell you anything about what the actual host's filesystem is going to
41 +look like, so we should just try the dirs at runtime.
42 +
43 +Signed-off-by: Eric Anholt <eric@××××××.net>
44 +---
45 + Xext/shm.c | 48 +++++++++++++++++++++++++----------------
46 + configure.ac | 43 ------------------------------------
47 + include/dix-config.h.in | 3 ---
48 + include/meson.build | 5 -----
49 + 4 files changed, 29 insertions(+), 70 deletions(-)
50 +
51 +diff --git a/Xext/shm.c b/Xext/shm.c
52 +index ed43b9202..2739a59e7 100644
53 +--- a/Xext/shm.c
54 ++++ b/Xext/shm.c
55 +@@ -1194,36 +1194,46 @@ ProcShmAttachFd(ClientPtr client)
56 + static int
57 + shm_tmpfile(void)
58 + {
59 +-#ifdef SHMDIR
60 ++ const char *shmdirs[] = {
61 ++ "/run/shm",
62 ++ "/var/tmp",
63 ++ "/tmp",
64 ++ };
65 + int fd;
66 +- char template[] = SHMDIR "/shmfd-XXXXXX";
67 ++
68 + #ifdef O_TMPFILE
69 +- fd = open(SHMDIR, O_TMPFILE|O_RDWR|O_CLOEXEC|O_EXCL, 0666);
70 +- if (fd >= 0) {
71 +- DebugF ("Using O_TMPFILE\n");
72 +- return fd;
73 ++ for (int i = 0; i < ARRAY_SIZE(shmdirs); i++) {
74 ++ fd = open(shmdirs[i], O_TMPFILE|O_RDWR|O_CLOEXEC|O_EXCL, 0666);
75 ++ if (fd >= 0) {
76 ++ DebugF ("Using O_TMPFILE\n");
77 ++ return fd;
78 ++ }
79 + }
80 + ErrorF ("Not using O_TMPFILE\n");
81 + #endif
82 ++
83 ++ for (int i = 0; i < ARRAY_SIZE(shmdirs); i++) {
84 ++ char template[PATH_MAX];
85 ++ snprintf(template, ARRAY_SIZE(template), "%s/shmfd-XXXXXX", shmdirs[i]);
86 + #ifdef HAVE_MKOSTEMP
87 +- fd = mkostemp(template, O_CLOEXEC);
88 ++ fd = mkostemp(template, O_CLOEXEC);
89 + #else
90 +- fd = mkstemp(template);
91 ++ fd = mkstemp(template);
92 + #endif
93 +- if (fd < 0)
94 +- return -1;
95 +- unlink(template);
96 ++ if (fd < 0)
97 ++ continue;
98 ++ unlink(template);
99 + #ifndef HAVE_MKOSTEMP
100 +- int flags = fcntl(fd, F_GETFD);
101 +- if (flags != -1) {
102 +- flags |= FD_CLOEXEC;
103 +- (void) fcntl(fd, F_SETFD, &flags);
104 +- }
105 ++ int flags = fcntl(fd, F_GETFD);
106 ++ if (flags != -1) {
107 ++ flags |= FD_CLOEXEC;
108 ++ (void) fcntl(fd, F_SETFD, &flags);
109 ++ }
110 + #endif
111 +- return fd;
112 +-#else
113 ++ return fd;
114 ++ }
115 ++
116 + return -1;
117 +-#endif
118 + }
119 +
120 + static int
121 +diff --git a/configure.ac b/configure.ac
122 +index 359b62cb5..57a233102 100644
123 +--- a/configure.ac
124 ++++ b/configure.ac
125 +@@ -1115,49 +1115,6 @@ case "$DRI2,$HAVE_DRI2PROTO" in
126 + esac
127 + AM_CONDITIONAL(DRI2, test "x$DRI2" = xyes)
128 +
129 +-dnl
130 +-dnl Locate a suitable tmp file system for creating shared memeory files
131 +-dnl
132 +-
133 +-AC_ARG_WITH(shared-memory-dir, AS_HELP_STRING([--with-shared-memory-dir=PATH], [Path to directory in a world-writable temporary directory for anonymous shared memory (default: auto)]),
134 +-[],
135 +-[with_shared_memory_dir=yes])
136 +-
137 +-shmdirs="/run/shm /var/tmp /tmp"
138 +-
139 +-case x"$with_shared_memory_dir" in
140 +-xyes)
141 +- for dir in $shmdirs; do
142 +- case x"$with_shared_memory_dir" in
143 +- xyes)
144 +- echo Checking temp dir "$dir"
145 +- if test -d "$dir"; then
146 +- with_shared_memory_dir="$dir"
147 +- fi
148 +- ;;
149 +- esac
150 +- done
151 +- ;;
152 +-x/*)
153 +- ;;
154 +-xno)
155 +- ;;
156 +-*)
157 +- AC_MSG_ERROR([Invalid directory specified for --with-shared-memory-dir: $with_shared_memory_dir])
158 +- ;;
159 +-esac
160 +-
161 +-case x"$with_shared_memory_dir" in
162 +-xyes)
163 +- AC_MSG_ERROR([No directory found for shared memory temp files.])
164 +- ;;
165 +-xno)
166 +- ;;
167 +-*)
168 +- AC_DEFINE_UNQUOTED(SHMDIR, ["$with_shared_memory_dir"], [Directory for shared memory temp files])
169 +- ;;
170 +-esac
171 +-
172 + AC_ARG_ENABLE(xtrans-send-fds, AS_HELP_STRING([--disable-xtrans-send-fds], [Use Xtrans support for fd passing (default: auto)]), [XTRANS_SEND_FDS=$enableval], [XTRANS_SEND_FDS=auto])
173 +
174 + case "x$XTRANS_SEND_FDS" in
175 +diff --git a/include/dix-config.h.in b/include/dix-config.h.in
176 +index f8df86608..3bd22b8bb 100644
177 +--- a/include/dix-config.h.in
178 ++++ b/include/dix-config.h.in
179 +@@ -452,9 +452,6 @@
180 + /* Wrap SIGBUS to catch MIT-SHM faults */
181 + #undef BUSFAULT
182 +
183 +-/* Directory for shared memory temp files */
184 +-#undef SHMDIR
185 +-
186 + /* Don't let Xdefs.h define 'pointer' */
187 + #define _XTYPEDEF_POINTER 1
188 +
189 +diff --git a/include/meson.build b/include/meson.build
190 +index 4a0c12f5a..04c41e999 100644
191 +--- a/include/meson.build
192 ++++ b/include/meson.build
193 +@@ -91,11 +91,6 @@ conf_data.set('SYSTEMD_LOGIND', build_systemd_logind)
194 + conf_data.set('NEED_DBUS', build_systemd_logind or build_hal)
195 + conf_data.set('CONFIG_WSCONS', host_machine.system() == 'openbsd')
196 +
197 +-# XXX: SHMDIR is weird in autoconf, probing the build system for
198 +-# various tmp directories. Could we replace it with C code at runtime
199 +-# that just uses whatever directory works?
200 +-conf_data.set_quoted('SHMDIR', '/tmp')
201 +-
202 + conf_data.set('HAVE_XSHMFENCE', xshmfence_dep.found())
203 + conf_data.set('WITH_LIBDRM', libdrm_dep.found())
204 + conf_data.set('GLAMOR_HAS_EGL_QUERY_DMABUF',
205 +--
206 +2.19.2
207 +
208
209 diff --git a/x11-base/xorg-server/files/xorg-server-1.20.4-shm-Use-memfd_create-when-possible.patch b/x11-base/xorg-server/files/xorg-server-1.20.4-shm-Use-memfd_create-when-possible.patch
210 new file mode 100644
211 index 00000000000..fce25944537
212 --- /dev/null
213 +++ b/x11-base/xorg-server/files/xorg-server-1.20.4-shm-Use-memfd_create-when-possible.patch
214 @@ -0,0 +1,89 @@
215 +From f6753c117ef0f83499d5e2d6dda226fec9ddf803 Mon Sep 17 00:00:00 2001
216 +From: Alexander Volkov <a.volkov@×××××××××.ru>
217 +Date: Mon, 11 Feb 2019 18:54:10 +0300
218 +Subject: [PATCH xserver] shm: Use memfd_create when possible
219 +
220 +It doesn't require shared memory dir and thus allows
221 +to avoid cases when this dir is detected incorrectly,
222 +as in https://bugreports.qt.io/browse/QTBUG-71440
223 +
224 +Signed-off-by: Alexander Volkov <a.volkov@×××××××××.ru>
225 +---
226 + Xext/shm.c | 12 ++++++++++++
227 + configure.ac | 2 +-
228 + include/dix-config.h.in | 3 +++
229 + include/meson.build | 1 +
230 + 4 files changed, 17 insertions(+), 1 deletion(-)
231 +
232 +diff --git a/Xext/shm.c b/Xext/shm.c
233 +index 2739a59e7..506fd4df1 100644
234 +--- a/Xext/shm.c
235 ++++ b/Xext/shm.c
236 +@@ -35,6 +35,9 @@ in this Software without prior written authorization from The Open Group.
237 + #include <sys/types.h>
238 + #include <sys/ipc.h>
239 + #include <sys/shm.h>
240 ++#ifdef HAVE_MEMFD_CREATE
241 ++#include <sys/mman.h>
242 ++#endif
243 + #include <unistd.h>
244 + #include <sys/stat.h>
245 + #include <fcntl.h>
246 +@@ -1201,6 +1204,15 @@ shm_tmpfile(void)
247 + };
248 + int fd;
249 +
250 ++#ifdef HAVE_MEMFD_CREATE
251 ++ fd = memfd_create("xorg", MFD_CLOEXEC|MFD_ALLOW_SEALING);
252 ++ if (fd != -1) {
253 ++ fcntl(fd, F_ADD_SEALS, F_SEAL_SHRINK);
254 ++ DebugF ("Using memfd_create\n");
255 ++ return fd;
256 ++ }
257 ++#endif
258 ++
259 + #ifdef O_TMPFILE
260 + for (int i = 0; i < ARRAY_SIZE(shmdirs); i++) {
261 + fd = open(shmdirs[i], O_TMPFILE|O_RDWR|O_CLOEXEC|O_EXCL, 0666);
262 +diff --git a/configure.ac b/configure.ac
263 +index 0ca96aeb8..79ff7fa64 100644
264 +--- a/configure.ac
265 ++++ b/configure.ac
266 +@@ -159,7 +159,7 @@ dnl Checks for library functions.
267 + AC_CHECK_FUNCS([backtrace geteuid getuid issetugid getresuid \
268 + getdtablesize getifaddrs getpeereid getpeerucred getprogname getzoneid \
269 + mmap posix_fallocate seteuid shmctl64 strncasecmp vasprintf vsnprintf \
270 +- walkcontext setitimer poll epoll_create1 mkostemp])
271 ++ walkcontext setitimer poll epoll_create1 mkostemp memfd_create])
272 + AC_CONFIG_LIBOBJ_DIR([os])
273 + AC_REPLACE_FUNCS([reallocarray strcasecmp strcasestr strlcat strlcpy strndup\
274 + timingsafe_memcmp])
275 +diff --git a/include/dix-config.h.in b/include/dix-config.h.in
276 +index 855b3d50c..9eb1a924e 100644
277 +--- a/include/dix-config.h.in
278 ++++ b/include/dix-config.h.in
279 +@@ -128,6 +128,9 @@
280 + /* Define to 1 if you have the <linux/fb.h> header file. */
281 + #undef HAVE_LINUX_FB_H
282 +
283 ++/* Define to 1 if you have the `memfd_create' function. */
284 ++#undef HAVE_MEMFD_CREATE
285 ++
286 + /* Define to 1 if you have the `mkostemp' function. */
287 + #undef HAVE_MKOSTEMP
288 +
289 +diff --git a/include/meson.build b/include/meson.build
290 +index 04c41e999..bbd5a6690 100644
291 +--- a/include/meson.build
292 ++++ b/include/meson.build
293 +@@ -141,6 +141,7 @@ conf_data.set('HAVE_GETPEEREID', cc.has_function('getpeereid'))
294 + conf_data.set('HAVE_GETPEERUCRED', cc.has_function('getpeerucred'))
295 + conf_data.set('HAVE_GETPROGNAME', cc.has_function('getprogname'))
296 + conf_data.set('HAVE_GETZONEID', cc.has_function('getzoneid'))
297 ++conf_data.set('HAVE_MEMFD_CREATE', cc.has_function('memfd_create'))
298 + conf_data.set('HAVE_MKOSTEMP', cc.has_function('mkostemp'))
299 + conf_data.set('HAVE_MMAP', cc.has_function('mmap'))
300 + conf_data.set('HAVE_POLL', cc.has_function('poll'))
301 +--
302 +2.19.2
303 +
304
305 diff --git a/x11-base/xorg-server/files/xorg-server-1.20.4-shm-reindent-shm_tmpfile-to-follow-our-standards.patch b/x11-base/xorg-server/files/xorg-server-1.20.4-shm-reindent-shm_tmpfile-to-follow-our-standards.patch
306 new file mode 100644
307 index 00000000000..1ce9e130794
308 --- /dev/null
309 +++ b/x11-base/xorg-server/files/xorg-server-1.20.4-shm-reindent-shm_tmpfile-to-follow-our-standards.patch
310 @@ -0,0 +1,72 @@
311 +From 804a9b4f57107fa2d0ed1ae0becda5bebaffe6e1 Mon Sep 17 00:00:00 2001
312 +From: Eric Anholt <eric@××××××.net>
313 +Date: Wed, 19 Sep 2018 13:20:12 -0700
314 +Subject: [PATCH xserver] shm: reindent shm_tmpfile to follow our standards.
315 +
316 +Signed-off-by: Eric Anholt <eric@××××××.net>
317 +---
318 + Xext/shm.c | 40 ++++++++++++++++++++--------------------
319 + 1 file changed, 20 insertions(+), 20 deletions(-)
320 +
321 +diff --git a/Xext/shm.c b/Xext/shm.c
322 +index 589ed0b4d..ed43b9202 100644
323 +--- a/Xext/shm.c
324 ++++ b/Xext/shm.c
325 +@@ -1195,34 +1195,34 @@ static int
326 + shm_tmpfile(void)
327 + {
328 + #ifdef SHMDIR
329 +- int fd;
330 +- char template[] = SHMDIR "/shmfd-XXXXXX";
331 ++ int fd;
332 ++ char template[] = SHMDIR "/shmfd-XXXXXX";
333 + #ifdef O_TMPFILE
334 +- fd = open(SHMDIR, O_TMPFILE|O_RDWR|O_CLOEXEC|O_EXCL, 0666);
335 +- if (fd >= 0) {
336 +- DebugF ("Using O_TMPFILE\n");
337 +- return fd;
338 +- }
339 +- ErrorF ("Not using O_TMPFILE\n");
340 ++ fd = open(SHMDIR, O_TMPFILE|O_RDWR|O_CLOEXEC|O_EXCL, 0666);
341 ++ if (fd >= 0) {
342 ++ DebugF ("Using O_TMPFILE\n");
343 ++ return fd;
344 ++ }
345 ++ ErrorF ("Not using O_TMPFILE\n");
346 + #endif
347 + #ifdef HAVE_MKOSTEMP
348 +- fd = mkostemp(template, O_CLOEXEC);
349 ++ fd = mkostemp(template, O_CLOEXEC);
350 + #else
351 +- fd = mkstemp(template);
352 ++ fd = mkstemp(template);
353 + #endif
354 +- if (fd < 0)
355 +- return -1;
356 +- unlink(template);
357 ++ if (fd < 0)
358 ++ return -1;
359 ++ unlink(template);
360 + #ifndef HAVE_MKOSTEMP
361 +- int flags = fcntl(fd, F_GETFD);
362 +- if (flags != -1) {
363 +- flags |= FD_CLOEXEC;
364 +- (void) fcntl(fd, F_SETFD, &flags);
365 +- }
366 ++ int flags = fcntl(fd, F_GETFD);
367 ++ if (flags != -1) {
368 ++ flags |= FD_CLOEXEC;
369 ++ (void) fcntl(fd, F_SETFD, &flags);
370 ++ }
371 + #endif
372 +- return fd;
373 ++ return fd;
374 + #else
375 +- return -1;
376 ++ return -1;
377 + #endif
378 + }
379 +
380 +--
381 +2.19.2
382 +
383
384 diff --git a/x11-base/xorg-server/xorg-server-1.20.4.ebuild b/x11-base/xorg-server/xorg-server-1.20.4.ebuild
385 new file mode 100644
386 index 00000000000..73fb1dab471
387 --- /dev/null
388 +++ b/x11-base/xorg-server/xorg-server-1.20.4.ebuild
389 @@ -0,0 +1,217 @@
390 +# Copyright 1999-2019 Gentoo Authors
391 +# Distributed under the terms of the GNU General Public License v2
392 +
393 +EAPI=7
394 +
395 +XORG_DOC=doc
396 +XORG_EAUTORECONF="yes"
397 +inherit xorg-3 multilib flag-o-matic
398 +EGIT_REPO_URI="https://anongit.freedesktop.org/git/xorg/xserver.git"
399 +
400 +DESCRIPTION="X.Org X servers"
401 +SLOT="0/${PV}"
402 +if [[ ${PV} != 9999* ]]; then
403 + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux"
404 +fi
405 +
406 +IUSE_SERVERS="dmx kdrive wayland xephyr xnest xorg xvfb"
407 +IUSE="${IUSE_SERVERS} debug +glamor ipv6 libressl minimal selinux +suid systemd +udev unwind xcsecurity"
408 +
409 +CDEPEND=">=app-eselect/eselect-opengl-1.3.0
410 + !libressl? ( dev-libs/openssl:0= )
411 + libressl? ( dev-libs/libressl:0= )
412 + >=x11-apps/iceauth-1.0.2
413 + >=x11-apps/rgb-1.0.3
414 + >=x11-apps/xauth-1.0.3
415 + x11-apps/xkbcomp
416 + >=x11-libs/libdrm-2.4.89
417 + >=x11-libs/libpciaccess-0.12.901
418 + >=x11-libs/libXau-1.0.4
419 + >=x11-libs/libXdmcp-1.0.2
420 + >=x11-libs/libXfont2-2.0.1
421 + >=x11-libs/libxkbfile-1.0.4
422 + >=x11-libs/libxshmfence-1.1
423 + >=x11-libs/pixman-0.27.2
424 + >=x11-libs/xtrans-1.3.5
425 + >=x11-misc/xbitmaps-1.0.1
426 + >=x11-misc/xkeyboard-config-2.4.1-r3
427 + dmx? (
428 + x11-libs/libXt
429 + >=x11-libs/libdmx-1.0.99.1
430 + >=x11-libs/libX11-1.1.5
431 + >=x11-libs/libXaw-1.0.4
432 + >=x11-libs/libXext-1.0.99.4
433 + >=x11-libs/libXfixes-5.0
434 + >=x11-libs/libXi-1.2.99.1
435 + >=x11-libs/libXmu-1.0.3
436 + x11-libs/libXrender
437 + >=x11-libs/libXres-1.0.3
438 + >=x11-libs/libXtst-1.0.99.2
439 + )
440 + glamor? (
441 + media-libs/libepoxy[X]
442 + >=media-libs/mesa-18[egl,gbm]
443 + !x11-libs/glamor
444 + )
445 + kdrive? (
446 + >=x11-libs/libXext-1.0.5
447 + x11-libs/libXv
448 + )
449 + xephyr? (
450 + x11-libs/libxcb[xkb]
451 + x11-libs/xcb-util
452 + x11-libs/xcb-util-image
453 + x11-libs/xcb-util-keysyms
454 + x11-libs/xcb-util-renderutil
455 + x11-libs/xcb-util-wm
456 + )
457 + !minimal? (
458 + >=x11-libs/libX11-1.1.5
459 + >=x11-libs/libXext-1.0.5
460 + >=media-libs/mesa-18
461 + )
462 + udev? ( virtual/libudev:= )
463 + unwind? ( sys-libs/libunwind )
464 + wayland? (
465 + >=dev-libs/wayland-1.3.0
466 + media-libs/libepoxy
467 + >=dev-libs/wayland-protocols-1.1
468 + )
469 + >=x11-apps/xinit-1.3.3-r1
470 + systemd? (
471 + sys-apps/dbus
472 + sys-apps/systemd
473 + )"
474 +
475 +DEPEND="${CDEPEND}
476 + sys-devel/flex
477 + >=x11-base/xorg-proto-2018.3
478 + dmx? (
479 + doc? (
480 + || (
481 + www-client/links
482 + www-client/lynx
483 + www-client/w3m
484 + )
485 + )
486 + )"
487 +
488 +RDEPEND="${CDEPEND}
489 + selinux? ( sec-policy/selinux-xserver )
490 + !x11-drivers/xf86-video-modesetting
491 +"
492 +
493 +PDEPEND="
494 + xorg? ( >=x11-base/xorg-drivers-$(ver_cut 1-2) )"
495 +
496 +REQUIRED_USE="!minimal? (
497 + || ( ${IUSE_SERVERS} )
498 + )
499 + minimal? ( !glamor !wayland )
500 + xephyr? ( kdrive )"
501 +
502 +UPSTREAMED_PATCHES=(
503 + "${FILESDIR}"/${P}-shm-reindent-shm_tmpfile-to-follow-our-standards.patch
504 + "${FILESDIR}"/${P}-shm-Pick-the-shm-dir-at-run-time-not-build-time.patch
505 + "${FILESDIR}"/${P}-shm-Use-memfd_create-when-possible.patch
506 +)
507 +
508 +PATCHES=(
509 + "${UPSTREAMED_PATCHES[@]}"
510 + "${FILESDIR}"/${PN}-1.12-unloadsubmodule.patch
511 + # needed for new eselect-opengl, bug #541232
512 + "${FILESDIR}"/${PN}-1.18-support-multiple-Files-sections.patch
513 +)
514 +
515 +pkg_setup() {
516 + if use wayland && ! use glamor; then
517 + ewarn "glamor is necessary for acceleration under Xwayland."
518 + ewarn "Performance may be unacceptable without it."
519 + fi
520 +
521 + # localstatedir is used for the log location; we need to override the default
522 + # from ebuild.sh
523 + # sysconfdir is used for the xorg.conf location; same applies
524 + # NOTE: fop is used for doc generating; and I have no idea if Gentoo
525 + # package it somewhere
526 + XORG_CONFIGURE_OPTIONS=(
527 + $(use_enable ipv6)
528 + $(use_enable debug)
529 + $(use_enable dmx)
530 + $(use_enable glamor)
531 + $(use_enable kdrive)
532 + $(use_enable unwind libunwind)
533 + $(use_enable wayland xwayland)
534 + $(use_enable !minimal record)
535 + $(use_enable !minimal xfree86-utils)
536 + $(use_enable !minimal dri)
537 + $(use_enable !minimal dri2)
538 + $(use_enable !minimal dri3)
539 + $(use_enable !minimal glx)
540 + $(use_enable xcsecurity)
541 + $(use_enable xephyr)
542 + $(use_enable xnest)
543 + $(use_enable xorg)
544 + $(use_enable xvfb)
545 + $(use_enable udev config-udev)
546 + $(use_with doc doxygen)
547 + $(use_with doc xmlto)
548 + $(use_with systemd systemd-daemon)
549 + $(use_enable systemd systemd-logind)
550 + $(usex suid $(use_enable systemd suid-wrapper) '--disable-suid-wrapper')
551 + $(usex suid $(use_enable !systemd install-setuid) '--disable-install-setuid')
552 + --enable-libdrm
553 + --sysconfdir="${EPREFIX}"/etc/X11
554 + --localstatedir="${EPREFIX}"/var
555 + --with-fontrootdir="${EPREFIX}"/usr/share/fonts
556 + --with-xkb-output="${EPREFIX}"/var/lib/xkb
557 + --disable-config-hal
558 + --disable-linux-acpi
559 + --without-dtrace
560 + --without-fop
561 + --with-os-vendor=Gentoo
562 + --with-sha1=libcrypto
563 + )
564 +}
565 +
566 +src_install() {
567 + default
568 +
569 + server_based_install
570 +
571 + if ! use minimal && use xorg; then
572 + # Install xorg.conf.example into docs
573 + dodoc "${S}"/hw/xfree86/xorg.conf.example
574 + fi
575 +
576 + newinitd "${FILESDIR}"/xdm-setup.initd-1 xdm-setup
577 + newinitd "${FILESDIR}"/xdm.initd-11 xdm
578 + newconfd "${FILESDIR}"/xdm.confd-4 xdm
579 +
580 + # install the @x11-module-rebuild set for Portage
581 + insinto /usr/share/portage/config/sets
582 + newins "${FILESDIR}"/xorg-sets.conf xorg.conf
583 +
584 + find "${ED}"/var -type d -empty -delete || die
585 +}
586 +
587 +pkg_postinst() {
588 + # sets up libGL and DRI2 symlinks if needed (ie, on a fresh install)
589 + eselect opengl set xorg-x11 --use-old
590 +}
591 +
592 +pkg_postrm() {
593 + # Get rid of module dir to ensure opengl-update works properly
594 + if [[ -z ${REPLACED_BY_VERSION} && -e ${EROOT}/usr/$(get_libdir)/xorg/modules ]]; then
595 + rm -rf "${EROOT}"/usr/$(get_libdir)/xorg/modules
596 + fi
597 +}
598 +
599 +server_based_install() {
600 + if ! use xorg; then
601 + rm "${ED}"/usr/share/man/man1/Xserver.1x \
602 + "${ED}"/usr/$(get_libdir)/xserver/SecurityPolicy \
603 + "${ED}"/usr/$(get_libdir)/pkgconfig/xorg-server.pc \
604 + "${ED}"/usr/share/man/man1/Xserver.1x
605 + fi
606 +}