Gentoo Archives: gentoo-commits

From: "Anthony G. Basile" <blueness@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/musl:master commit in: media-libs/mesa/files/, media-libs/mesa/
Date: Fri, 05 Oct 2018 00:12:51
Message-Id: 1538698356.dd04544dfaa4439e9e7b9e430a7d1f3012695c12.blueness@gentoo
1 commit: dd04544dfaa4439e9e7b9e430a7d1f3012695c12
2 Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
3 AuthorDate: Fri Oct 5 00:12:36 2018 +0000
4 Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
5 CommitDate: Fri Oct 5 00:12:36 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/musl.git/commit/?id=dd04544d
7
8 media-libs/mesa: add version 18.2.1
9
10 Signed-off-by: Anthony G. Basile <blueness <AT> gentoo.org>
11 Package-Manager: Portage-2.3.49, Repoman-2.3.10
12
13 media-libs/mesa/Manifest | 1 +
14 .../mesa/files/mesa-18-musl-invocation_name.patch | 12 +
15 media-libs/mesa/mesa-18.2.1.ebuild | 558 +++++++++++++++++++++
16 3 files changed, 571 insertions(+)
17
18 diff --git a/media-libs/mesa/Manifest b/media-libs/mesa/Manifest
19 index 267d401..8fedaa2 100644
20 --- a/media-libs/mesa/Manifest
21 +++ b/media-libs/mesa/Manifest
22 @@ -1,2 +1,3 @@
23 DIST mesa-18.1.6.tar.xz 11142884 BLAKE2B fdd156fe7debf5223285dfa238070a2bd7d8ec684dec168afab78b9d2d38d53c10d939aaa64f34c2910e542dce3869adfca6383fca6a854c6dd03287a044b0e3 SHA512 2966210800215f5ced2720691063a8519b51ebeab9fb1e99bde4b1bd7ccc719d6395a1c29f25c88efe62d1592cf14ceafc163aca349490b1f8cee81070d46fcc
24 DIST mesa-18.1.9.tar.xz 11146188 BLAKE2B 753f0fa3780502d56927f9b0e6124b4728cb5aa3600de78585487fb8e178c6987a72b79fb56e6c310757d157f9f85f12b73a6889bd361b51b62fb1dc1c20eecd SHA512 22db2950d25a3d9393e7c622c783bd177c21695569c8a95683bf77e92318e1db85672a134d4bea30c1f49a24e52bc3a2c1a0ac15deafb3a8fcbfb6de6a18adc2
25 +DIST mesa-18.2.1.tar.xz 11374476 BLAKE2B f0f3b766d68550f8c395a1b1d1ffc7a9e532c22ee6b91d698db33a270c152e03ab656d4219301bc2e0e95ba6f0583017c4361add928ad8ab26378a1ec6958f36 SHA512 d249bdf79aad36db9a8d291b3a1a100d283893ac741f58f85ae7e5c90ca25c37f80a5fa6fc57945ffeb0b67b788e7ea146543ec790b22f144578fc4c1525b84d
26
27 diff --git a/media-libs/mesa/files/mesa-18-musl-invocation_name.patch b/media-libs/mesa/files/mesa-18-musl-invocation_name.patch
28 new file mode 100644
29 index 0000000..f591d47
30 --- /dev/null
31 +++ b/media-libs/mesa/files/mesa-18-musl-invocation_name.patch
32 @@ -0,0 +1,12 @@
33 +diff -Naur mesa-18.2.1.orig/src/gallium/winsys/virgl/vtest/virgl_vtest_socket.c mesa-18.2.1/src/gallium/winsys/virgl/vtest/virgl_vtest_socket.c
34 +--- mesa-18.2.1.orig/src/gallium/winsys/virgl/vtest/virgl_vtest_socket.c 2018-09-21 06:57:00.000000000 -0400
35 ++++ mesa-18.2.1/src/gallium/winsys/virgl/vtest/virgl_vtest_socket.c 2018-10-04 20:06:47.074806047 -0400
36 +@@ -84,7 +84,7 @@
37 + ret = os_get_process_name(cmdline, 63);
38 + if (ret == FALSE)
39 + strcpy(cmdline, nstr);
40 +-#if defined(__GLIBC__) || defined(__CYGWIN__)
41 ++#if defined(__linux__) || defined(__CYGWIN__)
42 + if (!strcmp(cmdline, "shader_runner")) {
43 + const char *name;
44 + /* hack to get better testname */
45
46 diff --git a/media-libs/mesa/mesa-18.2.1.ebuild b/media-libs/mesa/mesa-18.2.1.ebuild
47 new file mode 100644
48 index 0000000..e128919
49 --- /dev/null
50 +++ b/media-libs/mesa/mesa-18.2.1.ebuild
51 @@ -0,0 +1,558 @@
52 +# Copyright 1999-2018 Gentoo Foundation
53 +# Distributed under the terms of the GNU General Public License v2
54 +
55 +EAPI=6
56 +
57 +PYTHON_COMPAT=( python2_7 )
58 +
59 +inherit llvm meson multilib-minimal pax-utils python-any-r1
60 +
61 +OPENGL_DIR="xorg-x11"
62 +
63 +MY_P="${P/_/-}"
64 +
65 +DESCRIPTION="OpenGL-like graphic library for Linux"
66 +HOMEPAGE="https://www.mesa3d.org/ https://mesa.freedesktop.org/"
67 +
68 +if [[ ${PV} == 9999 ]]; then
69 + EGIT_REPO_URI="https://gitlab.freedesktop.org/mesa/mesa.git"
70 + EXPERIMENTAL="true"
71 + inherit git-r3
72 +else
73 + SRC_URI="https://mesa.freedesktop.org/archive/${MY_P}.tar.xz"
74 + KEYWORDS="~amd64 ~arm ~arm64 ~mips ~ppc ~x86"
75 +fi
76 +
77 +LICENSE="MIT"
78 +SLOT="0"
79 +RESTRICT="
80 + !test? ( test )
81 +"
82 +
83 +RADEON_CARDS="r100 r200 r300 r600 radeon radeonsi"
84 +VIDEO_CARDS="${RADEON_CARDS} freedreno i915 i965 imx intel nouveau vc4 virgl vivante vmware"
85 +for card in ${VIDEO_CARDS}; do
86 + IUSE_VIDEO_CARDS+=" video_cards_${card}"
87 +done
88 +
89 +IUSE="${IUSE_VIDEO_CARDS}
90 + +classic d3d9 debug +dri3 +egl +gallium +gbm gles1 gles2 +llvm lm_sensors
91 + opencl osmesa pax_kernel pic selinux test unwind vaapi valgrind vdpau
92 + vulkan wayland xa xvmc"
93 +
94 +REQUIRED_USE="
95 + d3d9? ( dri3 )
96 + gles1? ( egl )
97 + gles2? ( egl )
98 + vulkan? ( dri3
99 + || ( video_cards_i965 video_cards_radeonsi )
100 + video_cards_radeonsi? ( llvm ) )
101 + wayland? ( egl gbm )
102 + video_cards_freedreno? ( gallium )
103 + video_cards_intel? ( classic )
104 + video_cards_i915? ( || ( classic gallium ) )
105 + video_cards_i965? ( classic )
106 + video_cards_imx? ( gallium video_cards_vivante )
107 + video_cards_nouveau? ( || ( classic gallium ) )
108 + video_cards_radeon? ( || ( classic gallium )
109 + gallium? ( x86? ( llvm ) amd64? ( llvm ) ) )
110 + video_cards_r100? ( classic )
111 + video_cards_r200? ( classic )
112 + video_cards_r300? ( gallium x86? ( llvm ) amd64? ( llvm ) )
113 + video_cards_r600? ( gallium )
114 + video_cards_radeonsi? ( gallium llvm )
115 + video_cards_vc4? ( gallium )
116 + video_cards_virgl? ( gallium )
117 + video_cards_vivante? ( gallium gbm )
118 + video_cards_vmware? ( gallium )
119 +"
120 +
121 +LIBDRM_DEPSTRING=">=x11-libs/libdrm-2.4.93"
122 +RDEPEND="
123 + !app-eselect/eselect-mesa
124 + >=app-eselect/eselect-opengl-1.3.0
125 + >=dev-libs/expat-2.1.0-r3:=[${MULTILIB_USEDEP}]
126 + >=sys-libs/zlib-1.2.8[${MULTILIB_USEDEP}]
127 + >=x11-libs/libX11-1.6.2:=[${MULTILIB_USEDEP}]
128 + >=x11-libs/libxshmfence-1.1:=[${MULTILIB_USEDEP}]
129 + >=x11-libs/libXdamage-1.1.4-r1:=[${MULTILIB_USEDEP}]
130 + >=x11-libs/libXext-1.3.2:=[${MULTILIB_USEDEP}]
131 + >=x11-libs/libXxf86vm-1.1.3:=[${MULTILIB_USEDEP}]
132 + >=x11-libs/libxcb-1.13:=[${MULTILIB_USEDEP}]
133 + x11-libs/libXfixes:=[${MULTILIB_USEDEP}]
134 + gallium? (
135 + unwind? ( sys-libs/libunwind[${MULTILIB_USEDEP}] )
136 + llvm? (
137 + video_cards_radeonsi? (
138 + virtual/libelf:0=[${MULTILIB_USEDEP}]
139 + )
140 + video_cards_r600? (
141 + virtual/libelf:0=[${MULTILIB_USEDEP}]
142 + )
143 + video_cards_radeon? (
144 + virtual/libelf:0=[${MULTILIB_USEDEP}]
145 + )
146 + )
147 + lm_sensors? ( sys-apps/lm_sensors:=[${MULTILIB_USEDEP}] )
148 + opencl? (
149 + app-eselect/eselect-opencl
150 + dev-libs/libclc
151 + virtual/libelf:0=[${MULTILIB_USEDEP}]
152 + )
153 + vaapi? (
154 + >=x11-libs/libva-1.7.3:=[${MULTILIB_USEDEP}]
155 + video_cards_nouveau? ( !<=x11-libs/libva-vdpau-driver-0.7.4-r3 )
156 + )
157 + vdpau? ( >=x11-libs/libvdpau-1.1:=[${MULTILIB_USEDEP}] )
158 + xvmc? ( >=x11-libs/libXvMC-1.0.8:=[${MULTILIB_USEDEP}] )
159 + )
160 + wayland? (
161 + >=dev-libs/wayland-1.15.0:=[${MULTILIB_USEDEP}]
162 + >=dev-libs/wayland-protocols-1.8
163 + )
164 + ${LIBDRM_DEPSTRING}[video_cards_freedreno?,video_cards_nouveau?,video_cards_vc4?,video_cards_vivante?,video_cards_vmware?,${MULTILIB_USEDEP}]
165 +
166 + video_cards_intel? (
167 + !video_cards_i965? ( ${LIBDRM_DEPSTRING}[video_cards_intel] )
168 + )
169 + video_cards_i915? ( ${LIBDRM_DEPSTRING}[video_cards_intel] )
170 +"
171 +for card in ${RADEON_CARDS}; do
172 + RDEPEND="${RDEPEND}
173 + video_cards_${card}? ( ${LIBDRM_DEPSTRING}[video_cards_radeon] )
174 + "
175 +done
176 +RDEPEND="${RDEPEND}
177 + video_cards_radeonsi? ( ${LIBDRM_DEPSTRING}[video_cards_amdgpu] )
178 +"
179 +
180 +# Please keep the LLVM dependency block separate. Since LLVM is slotted,
181 +# we need to *really* make sure we're not pulling one than more slot
182 +# simultaneously.
183 +#
184 +# How to use it:
185 +# 1. List all the working slots (with min versions) in ||, newest first.
186 +# 2. Update the := to specify *max* version, e.g. < 7.
187 +# 3. Specify LLVM_MAX_SLOT, e.g. 6.
188 +LLVM_MAX_SLOT="7"
189 +LLVM_DEPSTR="
190 + || (
191 + sys-devel/llvm:7[${MULTILIB_USEDEP}]
192 + sys-devel/llvm:6[${MULTILIB_USEDEP}]
193 + sys-devel/llvm:5[${MULTILIB_USEDEP}]
194 + sys-devel/llvm:4[${MULTILIB_USEDEP}]
195 + >=sys-devel/llvm-3.9.0:0[${MULTILIB_USEDEP}]
196 + )
197 + sys-devel/llvm:=[${MULTILIB_USEDEP}]
198 +"
199 +LLVM_DEPSTR_AMDGPU=${LLVM_DEPSTR//]/,llvm_targets_AMDGPU(-)]}
200 +CLANG_DEPSTR=${LLVM_DEPSTR//llvm/clang}
201 +CLANG_DEPSTR_AMDGPU=${CLANG_DEPSTR//]/,llvm_targets_AMDGPU(-)]}
202 +RDEPEND="${RDEPEND}
203 + llvm? (
204 + opencl? (
205 + video_cards_r600? (
206 + ${CLANG_DEPSTR_AMDGPU}
207 + )
208 + !video_cards_r600? (
209 + video_cards_radeonsi? (
210 + ${CLANG_DEPSTR_AMDGPU}
211 + )
212 + )
213 + !video_cards_r600? (
214 + !video_cards_radeonsi? (
215 + video_cards_radeon? (
216 + ${CLANG_DEPSTR_AMDGPU}
217 + )
218 + )
219 + )
220 + !video_cards_r600? (
221 + !video_cards_radeon? (
222 + !video_cards_radeonsi? (
223 + ${CLANG_DEPSTR}
224 + )
225 + )
226 + )
227 + )
228 + !opencl? (
229 + video_cards_r600? (
230 + ${LLVM_DEPSTR_AMDGPU}
231 + )
232 + !video_cards_r600? (
233 + video_cards_radeonsi? (
234 + ${LLVM_DEPSTR_AMDGPU}
235 + )
236 + )
237 + !video_cards_r600? (
238 + !video_cards_radeonsi? (
239 + video_cards_radeon? (
240 + ${LLVM_DEPSTR_AMDGPU}
241 + )
242 + )
243 + )
244 + !video_cards_r600? (
245 + !video_cards_radeon? (
246 + !video_cards_radeonsi? (
247 + ${LLVM_DEPSTR}
248 + )
249 + )
250 + )
251 + )
252 + )
253 +"
254 +unset {LLVM,CLANG}_DEPSTR{,_AMDGPU}
255 +
256 +DEPEND="${RDEPEND}
257 + ${PYTHON_DEPS}
258 + opencl? (
259 + >=sys-devel/gcc-4.6
260 + )
261 + sys-devel/bison
262 + sys-devel/flex
263 + sys-devel/gettext
264 + virtual/pkgconfig
265 + valgrind? ( dev-util/valgrind )
266 + x11-base/xorg-proto
267 + x11-libs/libXrandr[${MULTILIB_USEDEP}]
268 + $(python_gen_any_dep ">=dev-python/mako-0.8.0[\${PYTHON_USEDEP}]")
269 +"
270 +
271 +S="${WORKDIR}/${MY_P}"
272 +EGIT_CHECKOUT_DIR=${S}
273 +
274 +QA_WX_LOAD="
275 +x86? (
276 + !pic? (
277 + usr/lib*/libglapi.so.0.0.0
278 + usr/lib*/libGLESv1_CM.so.1.0.0
279 + usr/lib*/libGLESv2.so.2.0.0
280 + usr/lib*/libGL.so.1.2.0
281 + usr/lib*/libOSMesa.so.8.0.0
282 + )
283 +)"
284 +
285 +llvm_check_deps() {
286 + local flags=${MULTILIB_USEDEP}
287 + if use video_cards_r600 || use video_cards_radeon || use video_cards_radeonsi
288 + then
289 + flags+=",llvm_targets_AMDGPU(-)"
290 + fi
291 +
292 + if use opencl; then
293 + has_version "sys-devel/clang[${flags}]" || return 1
294 + fi
295 + has_version "sys-devel/llvm[${flags}]"
296 +}
297 +
298 +pkg_pretend() {
299 + if use d3d9; then
300 + if ! use video_cards_r300 &&
301 + ! use video_cards_r600 &&
302 + ! use video_cards_radeonsi &&
303 + ! use video_cards_nouveau &&
304 + ! use video_cards_vmware; then
305 + ewarn "Ignoring USE=d3d9 since VIDEO_CARDS does not contain r300, r600, radeonsi, nouveau, or vmware"
306 + fi
307 + fi
308 +
309 + if use opencl; then
310 + if ! use video_cards_r600 &&
311 + ! use video_cards_radeonsi; then
312 + ewarn "Ignoring USE=opencl since VIDEO_CARDS does not contain r600 or radeonsi"
313 + fi
314 + fi
315 +
316 + if use vaapi; then
317 + if ! use video_cards_r600 &&
318 + ! use video_cards_radeonsi &&
319 + ! use video_cards_nouveau; then
320 + ewarn "Ignoring USE=vaapi since VIDEO_CARDS does not contain r600, radeonsi, or nouveau"
321 + fi
322 + fi
323 +
324 + if use vdpau; then
325 + if ! use video_cards_r300 &&
326 + ! use video_cards_r600 &&
327 + ! use video_cards_radeonsi &&
328 + ! use video_cards_nouveau; then
329 + ewarn "Ignoring USE=vdpau since VIDEO_CARDS does not contain r300, r600, radeonsi, or nouveau"
330 + fi
331 + fi
332 +
333 + if use xa; then
334 + if ! use video_cards_freedreno &&
335 + ! use video_cards_nouveau &&
336 + ! use video_cards_vmware; then
337 + ewarn "Ignoring USE=xa since VIDEO_CARDS does not contain freedreno, nouveau, or vmware"
338 + fi
339 + fi
340 +
341 + if use xvmc; then
342 + if ! use video_cards_r600 &&
343 + ! use video_cards_nouveau; then
344 + ewarn "Ignoring USE=xvmc since VIDEO_CARDS does not contain r600 or nouveau"
345 + fi
346 + fi
347 +
348 + if ! use gallium; then
349 + use d3d9 && ewarn "Ignoring USE=d3d9 since USE does not contain gallium"
350 + use lm_sensors && ewarn "Ignoring USE=lm_sensors since USE does not contain gallium"
351 + use llvm && ewarn "Ignoring USE=llvm since USE does not contain gallium"
352 + use opencl && ewarn "Ignoring USE=opencl since USE does not contain gallium"
353 + use vaapi && ewarn "Ignoring USE=vaapi since USE does not contain gallium"
354 + use vdpau && ewarn "Ignoring USE=vdpau since USE does not contain gallium"
355 + use unwind && ewarn "Ignoring USE=unwind since USE does not contain gallium"
356 + use xa && ewarn "Ignoring USE=xa since USE does not contain gallium"
357 + use xvmc && ewarn "Ignoring USE=xvmc since USE does not contain gallium"
358 + fi
359 +
360 + if ! use llvm; then
361 + use opencl && ewarn "Ignoring USE=opencl since USE does not contain llvm"
362 + fi
363 +}
364 +
365 +pkg_setup() {
366 + # warning message for bug 459306
367 + if use llvm && has_version sys-devel/llvm[!debug=]; then
368 + ewarn "Mismatch between debug USE flags in media-libs/mesa and sys-devel/llvm"
369 + ewarn "detected! This can cause problems. For details, see bug 459306."
370 + fi
371 +
372 + if use llvm; then
373 + llvm_pkg_setup
374 + fi
375 + python-any-r1_pkg_setup
376 +}
377 +
378 +src_prepare() {
379 + eapply "${FILESDIR}"/${PN}-17-execinfo.patch
380 + eapply "${FILESDIR}"/${PN}-17-musl-string_h.patch
381 + eapply "${FILESDIR}"/${PN}-18-musl-invocation_name.patch
382 + eapply "${FILESDIR}"/${PN}-18-musl-pthread.patch
383 + #eapply "${FILESDIR}"/${PN}-18-intel-missing-time_t.patch
384 + eapply "${FILESDIR}"/${PN}-18-musl-amdgpu-include-pthread.patch
385 + eapply_user
386 +}
387 +
388 +multilib_src_configure() {
389 + local emesonargs=()
390 +
391 + if use classic; then
392 + # Intel code
393 + dri_driver_enable video_cards_i915 i915
394 + dri_driver_enable video_cards_i965 i965
395 + if ! use video_cards_i915 && \
396 + ! use video_cards_i965; then
397 + dri_driver_enable video_cards_intel i915 i965
398 + fi
399 +
400 + # Nouveau code
401 + dri_driver_enable video_cards_nouveau nouveau
402 +
403 + # ATI code
404 + dri_driver_enable video_cards_r100 r100
405 + dri_driver_enable video_cards_r200 r200
406 + if ! use video_cards_r100 && \
407 + ! use video_cards_r200; then
408 + dri_driver_enable video_cards_radeon r100 r200
409 + fi
410 + fi
411 +
412 + emesonargs+=( -Dplatforms=x11,surfaceless$(use wayland && echo ",wayland")$(use gbm && echo ",drm") )
413 +
414 + if use gallium; then
415 + emesonargs+=(
416 + $(meson_use llvm)
417 + $(meson_use lm_sensors lmsensors)
418 + $(meson_use unwind libunwind)
419 + )
420 +
421 + if use video_cards_r300 ||
422 + use video_cards_r600 ||
423 + use video_cards_radeonsi ||
424 + use video_cards_nouveau ||
425 + use video_cards_vmware; then
426 + emesonargs+=($(meson_use d3d9 gallium-nine))
427 + else
428 + emesonargs+=(-Dgallium-nine=false)
429 + fi
430 +
431 + if use video_cards_r600 ||
432 + use video_cards_radeonsi ||
433 + use video_cards_nouveau; then
434 + emesonargs+=($(meson_use vaapi gallium-va))
435 + use vaapi && emesonargs+=( -Dva-libs-path=/usr/$(get_libdir)/va/drivers )
436 + else
437 + emesonargs+=(-Dgallium-va=false)
438 + fi
439 +
440 + if use video_cards_r300 ||
441 + use video_cards_r600 ||
442 + use video_cards_radeonsi ||
443 + use video_cards_nouveau; then
444 + emesonargs+=($(meson_use vdpau gallium-vdpau))
445 + else
446 + emesonargs+=(-Dgallium-vdpau=false)
447 + fi
448 +
449 + if use video_cards_freedreno ||
450 + use video_cards_nouveau ||
451 + use video_cards_vmware; then
452 + emesonargs+=($(meson_use xa gallium-xa))
453 + else
454 + emesonargs+=(-Dgallium-xa=false)
455 + fi
456 +
457 + if use video_cards_r600 ||
458 + use video_cards_nouveau; then
459 + emesonargs+=($(meson_use xvmc gallium-xvmc))
460 + else
461 + emesonargs+=(-Dgallium-xvmc=false)
462 + fi
463 +
464 + gallium_enable video_cards_vc4 vc4
465 + gallium_enable video_cards_vivante etnaviv
466 + gallium_enable video_cards_vmware svga
467 + gallium_enable video_cards_nouveau nouveau
468 + gallium_enable video_cards_imx imx
469 +
470 + # Only one i915 driver (classic vs gallium). Default to classic.
471 + if ! use classic; then
472 + gallium_enable video_cards_i915 i915
473 + if ! use video_cards_i915 && \
474 + ! use video_cards_i965; then
475 + gallium_enable video_cards_intel i915
476 + fi
477 + fi
478 +
479 + gallium_enable video_cards_r300 r300
480 + gallium_enable video_cards_r600 r600
481 + gallium_enable video_cards_radeonsi radeonsi
482 + if ! use video_cards_r300 && \
483 + ! use video_cards_r600; then
484 + gallium_enable video_cards_radeon r300 r600
485 + fi
486 +
487 + gallium_enable video_cards_freedreno freedreno
488 + # opencl stuff
489 + if use opencl; then
490 + emesonargs+=(
491 + -Dgallium-opencl="$(usex opencl standalone disabled)"
492 + )
493 + fi
494 +
495 + gallium_enable video_cards_virgl virgl
496 + fi
497 +
498 + if use vulkan; then
499 + vulkan_enable video_cards_i965 intel
500 + vulkan_enable video_cards_radeonsi amd
501 + fi
502 +
503 + # x86 hardened pax_kernel needs glx-rts, bug 240956
504 + if [[ ${ABI} == x86 ]]; then
505 + emesonargs+=( $(meson_use pax_kernel glx-read-only-text) )
506 + fi
507 +
508 + # on abi_x86_32 hardened we need to have asm disable
509 + if [[ ${ABI} == x86* ]] && use pic; then
510 + emesonargs+=( -Dasm=false )
511 + fi
512 +
513 + if use gallium; then
514 + gallium_enable -- swrast
515 + emesonargs+=( -Dosmesa=$(usex osmesa gallium none) )
516 + else
517 + dri_driver_enable -- swrast
518 + emesonargs+=( -Dosmesa=$(usex osmesa classic none) )
519 + fi
520 +
521 + driver_list() {
522 + local drivers="$(sort -u <<< "${1// /$'\n'}")"
523 + echo "${drivers//$'\n'/,}"
524 + }
525 +
526 + emesonargs+=(
527 + $(meson_use test build-tests)
528 + -Dglx=dri
529 + -Dshared-glapi=true
530 + $(meson_use dri3)
531 + $(meson_use egl)
532 + $(meson_use gbm)
533 + $(meson_use gles1)
534 + $(meson_use gles2)
535 + $(meson_use selinux)
536 + -Dvalgrind=$(usex valgrind auto false)
537 + -Ddri-drivers=$(driver_list "${DRI_DRIVERS[*]}")
538 + -Dgallium-drivers=$(driver_list "${GALLIUM_DRIVERS[*]}")
539 + -Dvulkan-drivers=$(driver_list "${VULKAN_DRIVERS[*]}")
540 + --buildtype $(usex debug debug plain)
541 + -Db_ndebug=$(usex debug false true)
542 + )
543 + meson_src_configure
544 +}
545 +
546 +multilib_src_compile() {
547 + meson_src_compile
548 +}
549 +
550 +multilib_src_install() {
551 + meson_src_install
552 +
553 + if use opencl; then
554 + ebegin "Moving Gallium/Clover OpenCL implementation for dynamic switching"
555 + local cl_dir="/usr/$(get_libdir)/OpenCL/vendors/mesa"
556 + dodir ${cl_dir}/{lib,include}
557 + if [ -f "${ED}/usr/$(get_libdir)/libOpenCL.so" ]; then
558 + mv -f "${ED}"/usr/$(get_libdir)/libOpenCL.so* \
559 + "${ED}"${cl_dir}
560 + fi
561 + if [ -f "${ED}/usr/include/CL/opencl.h" ]; then
562 + mv -f "${ED}"/usr/include/CL \
563 + "${ED}"${cl_dir}/include
564 + fi
565 + eend $?
566 + fi
567 +}
568 +
569 +multilib_src_install_all() {
570 + einstalldocs
571 +}
572 +
573 +multilib_src_test() {
574 + meson_src_test
575 +}
576 +
577 +pkg_postinst() {
578 + # Switch to the xorg implementation.
579 + echo
580 + eselect opengl set --use-old ${OPENGL_DIR}
581 +
582 + # Switch to mesa opencl
583 + if use opencl; then
584 + eselect opencl set --use-old ${PN}
585 + fi
586 +}
587 +
588 +# $1 - VIDEO_CARDS flag (check skipped for "--")
589 +# other args - names of DRI drivers to enable
590 +dri_driver_enable() {
591 + if [[ $1 == -- ]] || use $1; then
592 + shift
593 + DRI_DRIVERS+=("$@")
594 + fi
595 +}
596 +
597 +gallium_enable() {
598 + if [[ $1 == -- ]] || use $1; then
599 + shift
600 + GALLIUM_DRIVERS+=("$@")
601 + fi
602 +}
603 +
604 +vulkan_enable() {
605 + if [[ $1 == -- ]] || use $1; then
606 + shift
607 + VULKAN_DRIVERS+=("$@")
608 + fi
609 +}