Gentoo Archives: gentoo-commits

From: Aric Belsito <lluixhi@×××××.com>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/musl:master commit in: media-libs/mesa/
Date: Sun, 29 Apr 2018 17:19:32
Message-Id: 1525022321.8cec66558211d69740b0e275279c6c03e29b5437.lluixhi@gentoo
1 commit: 8cec66558211d69740b0e275279c6c03e29b5437
2 Author: Aric Belsito <lluixhi <AT> gmail <DOT> com>
3 AuthorDate: Sun Apr 29 17:18:41 2018 +0000
4 Commit: Aric Belsito <lluixhi <AT> gmail <DOT> com>
5 CommitDate: Sun Apr 29 17:18:41 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/musl.git/commit/?id=8cec6655
7
8 media-libs/mesa: version bump to 18.0.2/18.1.0_rc2
9
10 media-libs/mesa/Manifest | 2 +
11 media-libs/mesa/mesa-18.0.2.ebuild | 589 ++++++++++++++++++++++++++++++++
12 media-libs/mesa/mesa-18.1.0_rc2.ebuild | 591 +++++++++++++++++++++++++++++++++
13 3 files changed, 1182 insertions(+)
14
15 diff --git a/media-libs/mesa/Manifest b/media-libs/mesa/Manifest
16 index aea4540..d8673e6 100644
17 --- a/media-libs/mesa/Manifest
18 +++ b/media-libs/mesa/Manifest
19 @@ -4,4 +4,6 @@ DIST mesa-17.3.8.tar.xz 10660896 BLAKE2B 432deefad4b0a42914efc24c558d5c766443f55
20 DIST mesa-17.3.9.tar.xz 10660456 BLAKE2B 54f4a75f9040e50e9eea8f5c52a276578379d25d2a01ac4767ab12bee85fe5dae1492d5bb1df06b6e8c6b0fe960bbd5ea38691c75d08a6b4302c64377ce58e54 SHA512 83deffbc6b9823b8e93cccf57d7952106f3d55fea881e3924f9f9586f0e9347a6e3a1a36cc19c24af819f2fde3af9496652a6ff56132511a5618d5774404f63f
21 DIST mesa-18.0.0.tar.xz 11056544 BLAKE2B 467c100bcbc0a60e3868e718331192255fd16394c21b08c128a054e066740cd071e0b272aba011873fe239821f53442e9a07ae860d94b425275bd68c3db3b7fc SHA512 1494bb09357896a2505b3dcfec772268e28c765804f21e144948a314f1d79d99ff9f21062ef5860eb5a5a568b305a9c954585924a7ac8890fe1ebd8df3bcc396
22 DIST mesa-18.0.1.tar.xz 10945308 BLAKE2B 03dad0961aafeb954a50f1db305288682e6b0dc58631b66de2f331dc95756b881bf7f73b5e2fa4ec04640054c27aab236acdf6b89bd7cd89ca1dbe9134a6a2d0 SHA512 b0d610904b6f179a27b42aee5f479339e341926915cdc6adb08ac999a4a12539abc3776577e86af83e10381d9703ef1bca70bab81b43daf2c000622c9c3612d2
23 +DIST mesa-18.0.2.tar.xz 10949364 BLAKE2B 8b0557db70f61ac39df96e923383e41008f483ae2f89b3723e94e644cb2ced81a7996d61009acaebaf7813843742a24351a573c80f1173615e6c0302552cf621 SHA512 77d24d01c4c22596d28421aeb74932ff232730a4f556ae1a2e8777ece2876e4e352679575385c065505df4a2a83d2c1cf30db92dcf88038417e36a2768332d7e
24 DIST mesa-18.1.0-rc1.tar.xz 11118324 BLAKE2B e5a89c8469b6716463c9efb0e7059022bc986da83d55a020156a3466cb44c283828bacb340ef4dceda9e14a82f737b6809f742b49a8b38d7e871ff1864e8bb3e SHA512 5b179b4ece6fd0e04ef00744d975607b6678c4c333c47fdd7442768ac15b375c7faeb8472b0dba19c0b8755067effd6243803ce17739a50c17efc8e69e6ae401
25 +DIST mesa-18.1.0-rc2.tar.xz 11117872 BLAKE2B a95096ed573031eed17b880f725d68af062e0f7d9513d391d83c51e996fa238add93e05ae98ad4ed77d731f7521736b73566687be798029293d88f8b4b75db1c SHA512 43ddb27c436ab6ad08c4f5f764855e0681c10995e5279146c01e03e6e8af98dd23d96a20d3ac50107a6ca89cc3dd094bc472ddd70d290d0357cef3059ae34cfc
26
27 diff --git a/media-libs/mesa/mesa-18.0.2.ebuild b/media-libs/mesa/mesa-18.0.2.ebuild
28 new file mode 100644
29 index 0000000..6841281
30 --- /dev/null
31 +++ b/media-libs/mesa/mesa-18.0.2.ebuild
32 @@ -0,0 +1,589 @@
33 +# Copyright 1999-2018 Gentoo Foundation
34 +# Distributed under the terms of the GNU General Public License v2
35 +
36 +EAPI=6
37 +
38 +EGIT_REPO_URI="https://anongit.freedesktop.org/git/mesa/mesa.git"
39 +
40 +if [[ ${PV} = 9999 ]]; then
41 + GIT_ECLASS="git-r3"
42 + EXPERIMENTAL="true"
43 +fi
44 +
45 +PYTHON_COMPAT=( python2_7 )
46 +
47 +inherit autotools llvm multilib-minimal python-any-r1 pax-utils ${GIT_ECLASS}
48 +
49 +OPENGL_DIR="xorg-x11"
50 +
51 +MY_P="${P/_/-}"
52 +
53 +DESCRIPTION="OpenGL-like graphic library for Linux"
54 +HOMEPAGE="https://www.mesa3d.org/ https://mesa.freedesktop.org/"
55 +
56 +if [[ $PV == 9999 ]]; then
57 + SRC_URI=""
58 +else
59 + SRC_URI="https://mesa.freedesktop.org/archive/${MY_P}.tar.xz"
60 + KEYWORDS="~amd64 ~arm ~ia64 ~mips ~ppc ~sh ~sparc ~x86"
61 +fi
62 +
63 +LICENSE="MIT"
64 +SLOT="0"
65 +RESTRICT="!bindist? ( bindist )"
66 +
67 +RADEON_CARDS="r100 r200 r300 r600 radeon radeonsi"
68 +VIDEO_CARDS="${RADEON_CARDS} freedreno i915 i965 imx intel nouveau vc4 virgl vivante vmware"
69 +for card in ${VIDEO_CARDS}; do
70 + IUSE_VIDEO_CARDS+=" video_cards_${card}"
71 +done
72 +
73 +IUSE="${IUSE_VIDEO_CARDS}
74 + bindist +classic d3d9 debug +dri3 +egl +gallium +gbm gles1 gles2 unwind
75 + +llvm +nptl opencl osmesa pax_kernel openmax pic selinux vaapi valgrind
76 + vdpau vulkan wayland xvmc xa"
77 +
78 +REQUIRED_USE="
79 + d3d9? ( dri3 gallium )
80 + llvm? ( gallium )
81 + opencl? ( gallium llvm )
82 + openmax? ( gallium )
83 + gles1? ( egl )
84 + gles2? ( egl )
85 + vaapi? ( gallium )
86 + vdpau? ( gallium )
87 + vulkan? ( || ( video_cards_i965 video_cards_radeonsi )
88 + video_cards_radeonsi? ( llvm ) )
89 + wayland? ( egl gbm )
90 + xa? ( gallium )
91 + video_cards_freedreno? ( gallium )
92 + video_cards_intel? ( classic )
93 + video_cards_i915? ( || ( classic gallium ) )
94 + video_cards_i965? ( classic )
95 + video_cards_imx? ( gallium video_cards_vivante )
96 + video_cards_nouveau? ( || ( classic gallium ) )
97 + video_cards_radeon? ( || ( classic gallium )
98 + gallium? ( x86? ( llvm ) amd64? ( llvm ) ) )
99 + video_cards_r100? ( classic )
100 + video_cards_r200? ( classic )
101 + video_cards_r300? ( gallium x86? ( llvm ) amd64? ( llvm ) )
102 + video_cards_r600? ( gallium )
103 + video_cards_radeonsi? ( gallium llvm )
104 + video_cards_vc4? ( gallium )
105 + video_cards_virgl? ( gallium )
106 + video_cards_vivante? ( gallium gbm )
107 + video_cards_vmware? ( gallium )
108 +"
109 +
110 +LIBDRM_DEPSTRING=">=x11-libs/libdrm-2.4.89"
111 +# keep correct libdrm and dri2proto dep
112 +# keep blocks in rdepend for binpkg
113 +RDEPEND="
114 + !<x11-base/xorg-server-1.7
115 + !<=x11-proto/xf86driproto-2.0.3
116 + classic? ( app-eselect/eselect-mesa )
117 + gallium? ( app-eselect/eselect-mesa )
118 + >=app-eselect/eselect-opengl-1.3.0
119 + >=dev-libs/expat-2.1.0-r3:=[${MULTILIB_USEDEP}]
120 + >=sys-libs/zlib-1.2.8[${MULTILIB_USEDEP}]
121 + >=x11-libs/libX11-1.6.2:=[${MULTILIB_USEDEP}]
122 + >=x11-libs/libxshmfence-1.1:=[${MULTILIB_USEDEP}]
123 + >=x11-libs/libXdamage-1.1.4-r1:=[${MULTILIB_USEDEP}]
124 + >=x11-libs/libXext-1.3.2:=[${MULTILIB_USEDEP}]
125 + >=x11-libs/libXxf86vm-1.1.3:=[${MULTILIB_USEDEP}]
126 + >=x11-libs/libxcb-1.9.3:=[${MULTILIB_USEDEP}]
127 + x11-libs/libXfixes:=[${MULTILIB_USEDEP}]
128 + unwind? ( sys-libs/libunwind[${MULTILIB_USEDEP}] )
129 + llvm? (
130 + video_cards_radeonsi? (
131 + virtual/libelf:0=[${MULTILIB_USEDEP}]
132 + )
133 + video_cards_r600? (
134 + virtual/libelf:0=[${MULTILIB_USEDEP}]
135 + )
136 + video_cards_radeon? (
137 + virtual/libelf:0=[${MULTILIB_USEDEP}]
138 + )
139 + )
140 + opencl? (
141 + app-eselect/eselect-opencl
142 + dev-libs/libclc
143 + virtual/libelf:0=[${MULTILIB_USEDEP}]
144 + )
145 + openmax? (
146 + >=media-libs/libomxil-bellagio-0.9.3:=[${MULTILIB_USEDEP}]
147 + x11-misc/xdg-utils
148 + )
149 + vaapi? (
150 + >=x11-libs/libva-1.7.3:=[${MULTILIB_USEDEP}]
151 + video_cards_nouveau? ( !<=x11-libs/libva-vdpau-driver-0.7.4-r3 )
152 + )
153 + vdpau? ( >=x11-libs/libvdpau-1.1:=[${MULTILIB_USEDEP}] )
154 + wayland? (
155 + >=dev-libs/wayland-1.11.0:=[${MULTILIB_USEDEP}]
156 + >=dev-libs/wayland-protocols-1.8
157 + )
158 + xvmc? ( >=x11-libs/libXvMC-1.0.8:=[${MULTILIB_USEDEP}] )
159 + ${LIBDRM_DEPSTRING}[video_cards_freedreno?,video_cards_nouveau?,video_cards_vc4?,video_cards_vivante?,video_cards_vmware?,${MULTILIB_USEDEP}]
160 +
161 + video_cards_intel? (
162 + !video_cards_i965? ( ${LIBDRM_DEPSTRING}[video_cards_intel] )
163 + )
164 + video_cards_i915? ( ${LIBDRM_DEPSTRING}[video_cards_intel] )
165 +"
166 +for card in ${RADEON_CARDS}; do
167 + RDEPEND="${RDEPEND}
168 + video_cards_${card}? ( ${LIBDRM_DEPSTRING}[video_cards_radeon] )
169 + "
170 +done
171 +RDEPEND="${RDEPEND}
172 + video_cards_radeonsi? ( ${LIBDRM_DEPSTRING}[video_cards_amdgpu] )
173 +"
174 +
175 +# Please keep the LLVM dependency block separate. Since LLVM is slotted,
176 +# we need to *really* make sure we're not pulling one than more slot
177 +# simultaneously.
178 +#
179 +# How to use it:
180 +# 1. List all the working slots (with min versions) in ||, newest first.
181 +# 2. Update the := to specify *max* version, e.g. < 7.
182 +# 3. Specify LLVM_MAX_SLOT, e.g. 6.
183 +LLVM_DEPSTR="
184 + || (
185 + sys-devel/llvm:6[${MULTILIB_USEDEP}]
186 + sys-devel/llvm:5[${MULTILIB_USEDEP}]
187 + sys-devel/llvm:4[${MULTILIB_USEDEP}]
188 + >=sys-devel/llvm-3.9.0:0[${MULTILIB_USEDEP}]
189 + )
190 + sys-devel/llvm:=[${MULTILIB_USEDEP}]
191 +"
192 +LLVM_DEPSTR_AMDGPU=${LLVM_DEPSTR//]/,llvm_targets_AMDGPU(-)]}
193 +CLANG_DEPSTR=${LLVM_DEPSTR//llvm/clang}
194 +CLANG_DEPSTR_AMDGPU=${CLANG_DEPSTR//]/,llvm_targets_AMDGPU(-)]}
195 +RDEPEND="${RDEPEND}
196 + llvm? (
197 + opencl? (
198 + video_cards_r600? (
199 + ${CLANG_DEPSTR_AMDGPU}
200 + )
201 + !video_cards_r600? (
202 + video_cards_radeonsi? (
203 + ${CLANG_DEPSTR_AMDGPU}
204 + )
205 + )
206 + !video_cards_r600? (
207 + !video_cards_radeonsi? (
208 + video_cards_radeon? (
209 + ${CLANG_DEPSTR_AMDGPU}
210 + )
211 + )
212 + )
213 + !video_cards_r600? (
214 + !video_cards_radeon? (
215 + !video_cards_radeonsi? (
216 + ${CLANG_DEPSTR}
217 + )
218 + )
219 + )
220 + )
221 + !opencl? (
222 + video_cards_r600? (
223 + ${LLVM_DEPSTR_AMDGPU}
224 + )
225 + !video_cards_r600? (
226 + video_cards_radeonsi? (
227 + ${LLVM_DEPSTR_AMDGPU}
228 + )
229 + )
230 + !video_cards_r600? (
231 + !video_cards_radeonsi? (
232 + video_cards_radeon? (
233 + ${LLVM_DEPSTR_AMDGPU}
234 + )
235 + )
236 + )
237 + !video_cards_r600? (
238 + !video_cards_radeon? (
239 + !video_cards_radeonsi? (
240 + ${LLVM_DEPSTR}
241 + )
242 + )
243 + )
244 + )
245 + )
246 +"
247 +unset {LLVM,CLANG}_DEPSTR{,_AMDGPU}
248 +
249 +DEPEND="${RDEPEND}
250 + ${PYTHON_DEPS}
251 + opencl? (
252 + >=sys-devel/gcc-4.6
253 + )
254 + sys-devel/gettext
255 + virtual/pkgconfig
256 + valgrind? ( dev-util/valgrind )
257 + >=x11-proto/dri2proto-2.8-r1:=[${MULTILIB_USEDEP}]
258 + dri3? (
259 + >=x11-proto/dri3proto-1.0:=[${MULTILIB_USEDEP}]
260 + >=x11-proto/presentproto-1.0:=[${MULTILIB_USEDEP}]
261 + )
262 + >=x11-proto/glproto-1.4.17-r1:=[${MULTILIB_USEDEP}]
263 + >=x11-proto/xextproto-7.2.1-r1:=[${MULTILIB_USEDEP}]
264 + >=x11-proto/xf86driproto-2.1.1-r1:=[${MULTILIB_USEDEP}]
265 + >=x11-proto/xf86vidmodeproto-2.3.1-r1:=[${MULTILIB_USEDEP}]
266 + vulkan? (
267 + $(python_gen_any_dep ">=dev-python/mako-0.7.3[\${PYTHON_USEDEP}]")
268 + )
269 +"
270 +[[ ${PV} == 9999 ]] && DEPEND+="
271 + sys-devel/bison
272 + sys-devel/flex
273 + $(python_gen_any_dep ">=dev-python/mako-0.7.3[\${PYTHON_USEDEP}]")
274 +"
275 +
276 +S="${WORKDIR}/${MY_P}"
277 +EGIT_CHECKOUT_DIR=${S}
278 +
279 +QA_WX_LOAD="
280 +x86? (
281 + !pic? (
282 + usr/lib*/libglapi.so.0.0.0
283 + usr/lib*/libGLESv1_CM.so.1.1.0
284 + usr/lib*/libGLESv2.so.2.0.0
285 + usr/lib*/libGL.so.1.2.0
286 + usr/lib*/libOSMesa.so.8.0.0
287 + )
288 +)"
289 +
290 +llvm_check_deps() {
291 + local flags=${MULTILIB_USEDEP}
292 + if use video_cards_r600 || use video_cards_radeon || use video_cards_radeonsi
293 + then
294 + flags+=",llvm_targets_AMDGPU(-)"
295 + fi
296 +
297 + if use opencl; then
298 + has_version "sys-devel/clang[${flags}]" || return 1
299 + fi
300 + has_version "sys-devel/llvm[${flags}]"
301 +}
302 +
303 +pkg_setup() {
304 + # warning message for bug 459306
305 + if use llvm && has_version sys-devel/llvm[!debug=]; then
306 + ewarn "Mismatch between debug USE flags in media-libs/mesa and sys-devel/llvm"
307 + ewarn "detected! This can cause problems. For details, see bug 459306."
308 + fi
309 +
310 + if use llvm; then
311 + llvm_pkg_setup
312 + fi
313 + python-any-r1_pkg_setup
314 +}
315 +
316 +src_prepare() {
317 + eapply "${FILESDIR}"/${PN}-17-execinfo.patch
318 + eapply "${FILESDIR}"/${PN}-17-musl-string_h.patch
319 + eapply "${FILESDIR}"/${PN}-17-musl-invocation_name.patch
320 + eapply "${FILESDIR}"/${PN}-18-musl-pthread.patch
321 +
322 + eautoreconf
323 +
324 + eapply_user
325 +}
326 +
327 +multilib_src_configure() {
328 + local myconf
329 +
330 + if use classic; then
331 + # Configurable DRI drivers
332 + driver_enable swrast
333 +
334 + # Intel code
335 + driver_enable video_cards_i915 i915
336 + driver_enable video_cards_i965 i965
337 + if ! use video_cards_i915 && \
338 + ! use video_cards_i965; then
339 + driver_enable video_cards_intel i915 i965
340 + fi
341 +
342 + # Nouveau code
343 + driver_enable video_cards_nouveau nouveau
344 +
345 + # ATI code
346 + driver_enable video_cards_r100 radeon
347 + driver_enable video_cards_r200 r200
348 + if ! use video_cards_r100 && \
349 + ! use video_cards_r200; then
350 + driver_enable video_cards_radeon radeon r200
351 + fi
352 + fi
353 +
354 + if use egl; then
355 + myconf+=" --with-platforms=x11,surfaceless$(use wayland && echo ",wayland")$(use gbm && echo ",drm")"
356 + fi
357 +
358 + if use gallium; then
359 + myconf+="
360 + $(use_enable d3d9 nine)
361 + $(use_enable llvm)
362 + $(use_enable openmax omx-bellagio)
363 + $(use_enable vaapi va)
364 + $(use_enable vdpau)
365 + $(use_enable xa)
366 + $(use_enable xvmc)
367 + "
368 + use vaapi && myconf+=" --with-va-libdir=/usr/$(get_libdir)/va/drivers"
369 +
370 + gallium_enable swrast
371 + gallium_enable video_cards_vc4 vc4
372 + gallium_enable video_cards_vivante etnaviv
373 + gallium_enable video_cards_vmware svga
374 + gallium_enable video_cards_nouveau nouveau
375 + gallium_enable video_cards_i915 i915
376 + gallium_enable video_cards_imx imx
377 + if ! use video_cards_i915 && \
378 + ! use video_cards_i965; then
379 + gallium_enable video_cards_intel i915
380 + fi
381 +
382 + gallium_enable video_cards_r300 r300
383 + gallium_enable video_cards_r600 r600
384 + gallium_enable video_cards_radeonsi radeonsi
385 + if ! use video_cards_r300 && \
386 + ! use video_cards_r600; then
387 + gallium_enable video_cards_radeon r300 r600
388 + fi
389 +
390 + gallium_enable video_cards_freedreno freedreno
391 + # opencl stuff
392 + if use opencl; then
393 + myconf+="
394 + $(use_enable opencl)
395 + --with-clang-libdir="${EPREFIX}/usr/lib"
396 + "
397 + fi
398 +
399 + gallium_enable video_cards_virgl virgl
400 + fi
401 +
402 + if use vulkan; then
403 + vulkan_enable video_cards_i965 intel
404 + vulkan_enable video_cards_radeonsi radeon
405 + fi
406 +
407 + # x86 hardened pax_kernel needs glx-rts, bug 240956
408 + if [[ ${ABI} == x86 ]]; then
409 + myconf+=" $(use_enable pax_kernel glx-read-only-text)"
410 + fi
411 +
412 + # on abi_x86_32 hardened we need to have asm disable
413 + if [[ ${ABI} == x86* ]] && use pic; then
414 + myconf+=" --disable-asm"
415 + fi
416 +
417 + if use gallium; then
418 + myconf+=" $(use_enable osmesa gallium-osmesa)"
419 + else
420 + myconf+=" $(use_enable osmesa)"
421 + fi
422 +
423 + # build fails with BSD indent, bug #428112
424 + use userland_GNU || export INDENT=cat
425 +
426 + ECONF_SOURCE="${S}" \
427 + econf \
428 + --enable-dri \
429 + --enable-glx \
430 + --enable-shared-glapi \
431 + $(use_enable !bindist texture-float) \
432 + $(use_enable d3d9 nine) \
433 + $(use_enable debug) \
434 + $(use_enable dri3) \
435 + $(use_enable egl) \
436 + $(use_enable gbm) \
437 + $(use_enable gles1) \
438 + $(use_enable gles2) \
439 + $(use_enable nptl glx-tls) \
440 + $(use_enable unwind libunwind) \
441 + --enable-valgrind=$(usex valgrind auto no) \
442 + --enable-llvm-shared-libs \
443 + --disable-opencl-icd \
444 + --with-dri-drivers=${DRI_DRIVERS} \
445 + --with-gallium-drivers=${GALLIUM_DRIVERS} \
446 + --with-vulkan-drivers=${VULKAN_DRIVERS} \
447 + PYTHON2="${PYTHON}" \
448 + ${myconf}
449 +}
450 +
451 +multilib_src_install() {
452 + emake install DESTDIR="${D}"
453 +
454 + if use classic || use gallium; then
455 + ebegin "Moving DRI/Gallium drivers for dynamic switching"
456 + local gallium_drivers=( i915_dri.so i965_dri.so r300_dri.so r600_dri.so swrast_dri.so )
457 + keepdir /usr/$(get_libdir)/dri
458 + dodir /usr/$(get_libdir)/mesa
459 + for x in ${gallium_drivers[@]}; do
460 + if [ -f "$(get_libdir)/gallium/${x}" ]; then
461 + mv -f "${ED}/usr/$(get_libdir)/dri/${x}" "${ED}/usr/$(get_libdir)/dri/${x/_dri.so/g_dri.so}" \
462 + || die "Failed to move ${x}"
463 + fi
464 + done
465 + if use classic; then
466 + emake -C "${BUILD_DIR}/src/mesa/drivers/dri" DESTDIR="${D}" install
467 + fi
468 + for x in "${ED}"/usr/$(get_libdir)/dri/*.so; do
469 + if [ -f ${x} -o -L ${x} ]; then
470 + mv -f "${x}" "${x/dri/mesa}" \
471 + || die "Failed to move ${x}"
472 + fi
473 + done
474 + pushd "${ED}"/usr/$(get_libdir)/dri || die "pushd failed"
475 + ln -s ../mesa/*.so . || die "Creating symlink failed"
476 + # remove symlinks to drivers known to eselect
477 + for x in ${gallium_drivers[@]}; do
478 + if [ -f ${x} -o -L ${x} ]; then
479 + rm "${x}" || die "Failed to remove ${x}"
480 + fi
481 + done
482 + popd
483 + eend $?
484 + fi
485 + if use opencl; then
486 + ebegin "Moving Gallium/Clover OpenCL implementation for dynamic switching"
487 + local cl_dir="/usr/$(get_libdir)/OpenCL/vendors/mesa"
488 + dodir ${cl_dir}/{lib,include}
489 + if [ -f "${ED}/usr/$(get_libdir)/libOpenCL.so" ]; then
490 + mv -f "${ED}"/usr/$(get_libdir)/libOpenCL.so* \
491 + "${ED}"${cl_dir}
492 + fi
493 + if [ -f "${ED}/usr/include/CL/opencl.h" ]; then
494 + mv -f "${ED}"/usr/include/CL \
495 + "${ED}"${cl_dir}/include
496 + fi
497 + eend $?
498 + fi
499 +
500 + if use openmax; then
501 + echo "XDG_DATA_DIRS=\"${EPREFIX}/usr/share/mesa/xdg\"" > "${T}/99mesaxdgomx"
502 + doenvd "${T}"/99mesaxdgomx
503 + keepdir /usr/share/mesa/xdg
504 + fi
505 +}
506 +
507 +multilib_src_install_all() {
508 + find "${ED}" -name '*.la' -delete
509 + einstalldocs
510 +
511 + if use !bindist; then
512 + dodoc docs/patents.txt
513 + fi
514 +
515 + # Install config file for eselect mesa
516 + insinto /usr/share/mesa
517 + newins "${FILESDIR}/eselect-mesa.conf.9.2" eselect-mesa.conf
518 +}
519 +
520 +multilib_src_test() {
521 + if use llvm; then
522 + local llvm_tests='lp_test_arit lp_test_arit lp_test_blend lp_test_blend lp_test_conv lp_test_conv lp_test_format lp_test_format lp_test_printf lp_test_printf'
523 + pushd src/gallium/drivers/llvmpipe >/dev/null || die
524 + emake ${llvm_tests}
525 + pax-mark m ${llvm_tests}
526 + popd >/dev/null || die
527 + fi
528 + emake check
529 +}
530 +
531 +pkg_postinst() {
532 + # Switch to the xorg implementation.
533 + echo
534 + eselect opengl set --use-old ${OPENGL_DIR}
535 +
536 + # Select classic/gallium drivers
537 + if use classic || use gallium; then
538 + eselect mesa set --auto
539 + fi
540 +
541 + # Switch to mesa opencl
542 + if use opencl; then
543 + eselect opencl set --use-old ${PN}
544 + fi
545 +
546 + # run omxregister-bellagio to make the OpenMAX drivers known system-wide
547 + if use openmax; then
548 + ebegin "Registering OpenMAX drivers"
549 + BELLAGIO_SEARCH_PATH="${EPREFIX}/usr/$(get_libdir)/libomxil-bellagio0" \
550 + OMX_BELLAGIO_REGISTRY=${EPREFIX}/usr/share/mesa/xdg/.omxregister \
551 + omxregister-bellagio
552 + eend $?
553 + fi
554 +
555 + # warn about patent encumbered texture-float
556 + if use !bindist; then
557 + elog "USE=\"bindist\" was not set. Potentially patent encumbered code was"
558 + elog "enabled. Please see /usr/share/doc/${P}/patents.txt.bz2 for an"
559 + elog "explanation."
560 + fi
561 +}
562 +
563 +pkg_prerm() {
564 + if use openmax; then
565 + rm "${EPREFIX}"/usr/share/mesa/xdg/.omxregister
566 + fi
567 +}
568 +
569 +# $1 - VIDEO_CARDS flag
570 +# other args - names of DRI drivers to enable
571 +# TODO: avoid code duplication for a more elegant implementation
572 +driver_enable() {
573 + case $# in
574 + # for enabling unconditionally
575 + 1)
576 + DRI_DRIVERS+=",$1"
577 + ;;
578 + *)
579 + if use $1; then
580 + shift
581 + for i in $@; do
582 + DRI_DRIVERS+=",${i}"
583 + done
584 + fi
585 + ;;
586 + esac
587 +}
588 +
589 +gallium_enable() {
590 + case $# in
591 + # for enabling unconditionally
592 + 1)
593 + GALLIUM_DRIVERS+=",$1"
594 + ;;
595 + *)
596 + if use $1; then
597 + shift
598 + for i in $@; do
599 + GALLIUM_DRIVERS+=",${i}"
600 + done
601 + fi
602 + ;;
603 + esac
604 +}
605 +
606 +vulkan_enable() {
607 + case $# in
608 + # for enabling unconditionally
609 + 1)
610 + VULKAN_DRIVERS+=",$1"
611 + ;;
612 + *)
613 + if use $1; then
614 + shift
615 + for i in $@; do
616 + VULKAN_DRIVERS+=",${i}"
617 + done
618 + fi
619 + ;;
620 + esac
621 +}
622
623 diff --git a/media-libs/mesa/mesa-18.1.0_rc2.ebuild b/media-libs/mesa/mesa-18.1.0_rc2.ebuild
624 new file mode 100644
625 index 0000000..9d597ac
626 --- /dev/null
627 +++ b/media-libs/mesa/mesa-18.1.0_rc2.ebuild
628 @@ -0,0 +1,591 @@
629 +# Copyright 1999-2018 Gentoo Foundation
630 +# Distributed under the terms of the GNU General Public License v2
631 +
632 +EAPI=6
633 +
634 +EGIT_REPO_URI="https://anongit.freedesktop.org/git/mesa/mesa.git"
635 +
636 +if [[ ${PV} = 9999 ]]; then
637 + GIT_ECLASS="git-r3"
638 + EXPERIMENTAL="true"
639 +fi
640 +
641 +PYTHON_COMPAT=( python2_7 )
642 +
643 +inherit autotools llvm multilib-minimal python-any-r1 pax-utils ${GIT_ECLASS}
644 +
645 +OPENGL_DIR="xorg-x11"
646 +
647 +MY_P="${P/_/-}"
648 +
649 +DESCRIPTION="OpenGL-like graphic library for Linux"
650 +HOMEPAGE="https://www.mesa3d.org/ https://mesa.freedesktop.org/"
651 +
652 +if [[ $PV == 9999 ]]; then
653 + SRC_URI=""
654 +else
655 + SRC_URI="https://mesa.freedesktop.org/archive/${MY_P}.tar.xz"
656 + KEYWORDS="~amd64 ~arm ~ia64 ~mips ~ppc ~sh ~sparc ~x86"
657 +fi
658 +
659 +LICENSE="MIT"
660 +SLOT="0"
661 +RESTRICT="!bindist? ( bindist )"
662 +
663 +RADEON_CARDS="r100 r200 r300 r600 radeon radeonsi"
664 +VIDEO_CARDS="${RADEON_CARDS} freedreno i915 i965 imx intel nouveau vc4 virgl vivante vmware"
665 +for card in ${VIDEO_CARDS}; do
666 + IUSE_VIDEO_CARDS+=" video_cards_${card}"
667 +done
668 +
669 +IUSE="${IUSE_VIDEO_CARDS}
670 + bindist +classic d3d9 debug +dri3 +egl +gallium +gbm gles1 gles2 unwind
671 + +llvm +nptl opencl osmesa pax_kernel openmax pic selinux vaapi valgrind
672 + vdpau vulkan wayland xvmc xa"
673 +
674 +REQUIRED_USE="
675 + d3d9? ( dri3 gallium )
676 + llvm? ( gallium )
677 + opencl? ( gallium llvm )
678 + openmax? ( gallium )
679 + gles1? ( egl )
680 + gles2? ( egl )
681 + vaapi? ( gallium )
682 + vdpau? ( gallium )
683 + vulkan? ( || ( video_cards_i965 video_cards_radeonsi )
684 + video_cards_radeonsi? ( llvm ) )
685 + wayland? ( egl gbm )
686 + xa? ( gallium )
687 + video_cards_freedreno? ( gallium )
688 + video_cards_intel? ( classic )
689 + video_cards_i915? ( || ( classic gallium ) )
690 + video_cards_i965? ( classic )
691 + video_cards_imx? ( gallium video_cards_vivante )
692 + video_cards_nouveau? ( || ( classic gallium ) )
693 + video_cards_radeon? ( || ( classic gallium )
694 + gallium? ( x86? ( llvm ) amd64? ( llvm ) ) )
695 + video_cards_r100? ( classic )
696 + video_cards_r200? ( classic )
697 + video_cards_r300? ( gallium x86? ( llvm ) amd64? ( llvm ) )
698 + video_cards_r600? ( gallium )
699 + video_cards_radeonsi? ( gallium llvm )
700 + video_cards_vc4? ( gallium )
701 + video_cards_virgl? ( gallium )
702 + video_cards_vivante? ( gallium gbm )
703 + video_cards_vmware? ( gallium )
704 +"
705 +
706 +LIBDRM_DEPSTRING=">=x11-libs/libdrm-2.4.91"
707 +# keep correct libdrm and dri2proto dep
708 +# keep blocks in rdepend for binpkg
709 +RDEPEND="
710 + !<x11-base/xorg-server-1.7
711 + !<=x11-proto/xf86driproto-2.0.3
712 + classic? ( app-eselect/eselect-mesa )
713 + gallium? ( app-eselect/eselect-mesa )
714 + >=app-eselect/eselect-opengl-1.3.0
715 + >=dev-libs/expat-2.1.0-r3:=[${MULTILIB_USEDEP}]
716 + >=sys-libs/zlib-1.2.8[${MULTILIB_USEDEP}]
717 + >=x11-libs/libX11-1.6.2:=[${MULTILIB_USEDEP}]
718 + >=x11-libs/libxshmfence-1.1:=[${MULTILIB_USEDEP}]
719 + >=x11-libs/libXdamage-1.1.4-r1:=[${MULTILIB_USEDEP}]
720 + >=x11-libs/libXext-1.3.2:=[${MULTILIB_USEDEP}]
721 + >=x11-libs/libXxf86vm-1.1.3:=[${MULTILIB_USEDEP}]
722 + >=x11-libs/libxcb-1.13:=[${MULTILIB_USEDEP}]
723 + x11-libs/libXfixes:=[${MULTILIB_USEDEP}]
724 + unwind? ( sys-libs/libunwind[${MULTILIB_USEDEP}] )
725 + llvm? (
726 + video_cards_radeonsi? (
727 + virtual/libelf:0=[${MULTILIB_USEDEP}]
728 + )
729 + video_cards_r600? (
730 + virtual/libelf:0=[${MULTILIB_USEDEP}]
731 + )
732 + video_cards_radeon? (
733 + virtual/libelf:0=[${MULTILIB_USEDEP}]
734 + )
735 + )
736 + opencl? (
737 + app-eselect/eselect-opencl
738 + dev-libs/libclc
739 + virtual/libelf:0=[${MULTILIB_USEDEP}]
740 + )
741 + openmax? (
742 + >=media-libs/libomxil-bellagio-0.9.3:=[${MULTILIB_USEDEP}]
743 + x11-misc/xdg-utils
744 + )
745 + vaapi? (
746 + >=x11-libs/libva-1.7.3:=[${MULTILIB_USEDEP}]
747 + video_cards_nouveau? ( !<=x11-libs/libva-vdpau-driver-0.7.4-r3 )
748 + )
749 + vdpau? ( >=x11-libs/libvdpau-1.1:=[${MULTILIB_USEDEP}] )
750 + wayland? (
751 + >=dev-libs/wayland-1.11.0:=[${MULTILIB_USEDEP}]
752 + >=dev-libs/wayland-protocols-1.8
753 + )
754 + xvmc? ( >=x11-libs/libXvMC-1.0.8:=[${MULTILIB_USEDEP}] )
755 + ${LIBDRM_DEPSTRING}[video_cards_freedreno?,video_cards_nouveau?,video_cards_vc4?,video_cards_vivante?,video_cards_vmware?,${MULTILIB_USEDEP}]
756 +
757 + video_cards_intel? (
758 + !video_cards_i965? ( ${LIBDRM_DEPSTRING}[video_cards_intel] )
759 + )
760 + video_cards_i915? ( ${LIBDRM_DEPSTRING}[video_cards_intel] )
761 +"
762 +for card in ${RADEON_CARDS}; do
763 + RDEPEND="${RDEPEND}
764 + video_cards_${card}? ( ${LIBDRM_DEPSTRING}[video_cards_radeon] )
765 + "
766 +done
767 +RDEPEND="${RDEPEND}
768 + video_cards_radeonsi? ( ${LIBDRM_DEPSTRING}[video_cards_amdgpu] )
769 +"
770 +
771 +# Please keep the LLVM dependency block separate. Since LLVM is slotted,
772 +# we need to *really* make sure we're not pulling one than more slot
773 +# simultaneously.
774 +#
775 +# How to use it:
776 +# 1. List all the working slots (with min versions) in ||, newest first.
777 +# 2. Update the := to specify *max* version, e.g. < 7.
778 +# 3. Specify LLVM_MAX_SLOT, e.g. 6.
779 +LLVM_DEPSTR="
780 + || (
781 + sys-devel/llvm:7[${MULTILIB_USEDEP}]
782 + sys-devel/llvm:6[${MULTILIB_USEDEP}]
783 + sys-devel/llvm:5[${MULTILIB_USEDEP}]
784 + sys-devel/llvm:4[${MULTILIB_USEDEP}]
785 + >=sys-devel/llvm-3.9.0:0[${MULTILIB_USEDEP}]
786 + )
787 + sys-devel/llvm:=[${MULTILIB_USEDEP}]
788 +"
789 +LLVM_DEPSTR_AMDGPU=${LLVM_DEPSTR//]/,llvm_targets_AMDGPU(-)]}
790 +CLANG_DEPSTR=${LLVM_DEPSTR//llvm/clang}
791 +CLANG_DEPSTR_AMDGPU=${CLANG_DEPSTR//]/,llvm_targets_AMDGPU(-)]}
792 +RDEPEND="${RDEPEND}
793 + llvm? (
794 + opencl? (
795 + video_cards_r600? (
796 + ${CLANG_DEPSTR_AMDGPU}
797 + )
798 + !video_cards_r600? (
799 + video_cards_radeonsi? (
800 + ${CLANG_DEPSTR_AMDGPU}
801 + )
802 + )
803 + !video_cards_r600? (
804 + !video_cards_radeonsi? (
805 + video_cards_radeon? (
806 + ${CLANG_DEPSTR_AMDGPU}
807 + )
808 + )
809 + )
810 + !video_cards_r600? (
811 + !video_cards_radeon? (
812 + !video_cards_radeonsi? (
813 + ${CLANG_DEPSTR}
814 + )
815 + )
816 + )
817 + )
818 + !opencl? (
819 + video_cards_r600? (
820 + ${LLVM_DEPSTR_AMDGPU}
821 + )
822 + !video_cards_r600? (
823 + video_cards_radeonsi? (
824 + ${LLVM_DEPSTR_AMDGPU}
825 + )
826 + )
827 + !video_cards_r600? (
828 + !video_cards_radeonsi? (
829 + video_cards_radeon? (
830 + ${LLVM_DEPSTR_AMDGPU}
831 + )
832 + )
833 + )
834 + !video_cards_r600? (
835 + !video_cards_radeon? (
836 + !video_cards_radeonsi? (
837 + ${LLVM_DEPSTR}
838 + )
839 + )
840 + )
841 + )
842 + )
843 +"
844 +unset {LLVM,CLANG}_DEPSTR{,_AMDGPU}
845 +
846 +DEPEND="${RDEPEND}
847 + ${PYTHON_DEPS}
848 + opencl? (
849 + >=sys-devel/gcc-4.6
850 + )
851 + sys-devel/gettext
852 + virtual/pkgconfig
853 + valgrind? ( dev-util/valgrind )
854 + >=x11-proto/dri2proto-2.8-r1:=[${MULTILIB_USEDEP}]
855 + dri3? (
856 + >=x11-proto/dri3proto-1.0:=[${MULTILIB_USEDEP}]
857 + >=x11-proto/presentproto-1.0:=[${MULTILIB_USEDEP}]
858 + )
859 + >=x11-proto/glproto-1.4.17-r1:=[${MULTILIB_USEDEP}]
860 + >=x11-proto/xextproto-7.2.1-r1:=[${MULTILIB_USEDEP}]
861 + >=x11-proto/xf86driproto-2.1.1-r1:=[${MULTILIB_USEDEP}]
862 + >=x11-proto/xf86vidmodeproto-2.3.1-r1:=[${MULTILIB_USEDEP}]
863 + vulkan? (
864 + $(python_gen_any_dep ">=dev-python/mako-0.7.3[\${PYTHON_USEDEP}]")
865 + )
866 +"
867 +[[ ${PV} == 9999 ]] && DEPEND+="
868 + sys-devel/bison
869 + sys-devel/flex
870 + $(python_gen_any_dep ">=dev-python/mako-0.7.3[\${PYTHON_USEDEP}]")
871 +"
872 +
873 +S="${WORKDIR}/${MY_P}"
874 +EGIT_CHECKOUT_DIR=${S}
875 +
876 +QA_WX_LOAD="
877 +x86? (
878 + !pic? (
879 + usr/lib*/libglapi.so.0.0.0
880 + usr/lib*/libGLESv1_CM.so.1.1.0
881 + usr/lib*/libGLESv2.so.2.0.0
882 + usr/lib*/libGL.so.1.2.0
883 + usr/lib*/libOSMesa.so.8.0.0
884 + )
885 +)"
886 +
887 +llvm_check_deps() {
888 + local flags=${MULTILIB_USEDEP}
889 + if use video_cards_r600 || use video_cards_radeon || use video_cards_radeonsi
890 + then
891 + flags+=",llvm_targets_AMDGPU(-)"
892 + fi
893 +
894 + if use opencl; then
895 + has_version "sys-devel/clang[${flags}]" || return 1
896 + fi
897 + has_version "sys-devel/llvm[${flags}]"
898 +}
899 +
900 +pkg_setup() {
901 + # warning message for bug 459306
902 + if use llvm && has_version sys-devel/llvm[!debug=]; then
903 + ewarn "Mismatch between debug USE flags in media-libs/mesa and sys-devel/llvm"
904 + ewarn "detected! This can cause problems. For details, see bug 459306."
905 + fi
906 +
907 + if use llvm; then
908 + llvm_pkg_setup
909 + fi
910 + python-any-r1_pkg_setup
911 +}
912 +
913 +src_prepare() {
914 + eapply "${FILESDIR}"/${PN}-17-execinfo.patch
915 + eapply "${FILESDIR}"/${PN}-17-musl-string_h.patch
916 + eapply "${FILESDIR}"/${PN}-17-musl-invocation_name.patch
917 + eapply "${FILESDIR}"/${PN}-18-musl-pthread.patch
918 + eapply "${FILESDIR}"/${PN}-18-intel-missing-time_t.patch
919 +
920 + eautoreconf
921 +
922 + eapply_user
923 +}
924 +
925 +multilib_src_configure() {
926 + local myconf
927 +
928 + if use classic; then
929 + # Configurable DRI drivers
930 + driver_enable swrast
931 +
932 + # Intel code
933 + driver_enable video_cards_i915 i915
934 + driver_enable video_cards_i965 i965
935 + if ! use video_cards_i915 && \
936 + ! use video_cards_i965; then
937 + driver_enable video_cards_intel i915 i965
938 + fi
939 +
940 + # Nouveau code
941 + driver_enable video_cards_nouveau nouveau
942 +
943 + # ATI code
944 + driver_enable video_cards_r100 radeon
945 + driver_enable video_cards_r200 r200
946 + if ! use video_cards_r100 && \
947 + ! use video_cards_r200; then
948 + driver_enable video_cards_radeon radeon r200
949 + fi
950 + fi
951 +
952 + if use egl; then
953 + myconf+=" --with-platforms=x11,surfaceless$(use wayland && echo ",wayland")$(use gbm && echo ",drm")"
954 + fi
955 +
956 + if use gallium; then
957 + myconf+="
958 + $(use_enable d3d9 nine)
959 + $(use_enable llvm)
960 + $(use_enable openmax omx-bellagio)
961 + $(use_enable vaapi va)
962 + $(use_enable vdpau)
963 + $(use_enable xa)
964 + $(use_enable xvmc)
965 + "
966 + use vaapi && myconf+=" --with-va-libdir=/usr/$(get_libdir)/va/drivers"
967 +
968 + gallium_enable swrast
969 + gallium_enable video_cards_vc4 vc4
970 + gallium_enable video_cards_vivante etnaviv
971 + gallium_enable video_cards_vmware svga
972 + gallium_enable video_cards_nouveau nouveau
973 + gallium_enable video_cards_i915 i915
974 + gallium_enable video_cards_imx imx
975 + if ! use video_cards_i915 && \
976 + ! use video_cards_i965; then
977 + gallium_enable video_cards_intel i915
978 + fi
979 +
980 + gallium_enable video_cards_r300 r300
981 + gallium_enable video_cards_r600 r600
982 + gallium_enable video_cards_radeonsi radeonsi
983 + if ! use video_cards_r300 && \
984 + ! use video_cards_r600; then
985 + gallium_enable video_cards_radeon r300 r600
986 + fi
987 +
988 + gallium_enable video_cards_freedreno freedreno
989 + # opencl stuff
990 + if use opencl; then
991 + myconf+="
992 + $(use_enable opencl)
993 + --with-clang-libdir="${EPREFIX}/usr/lib"
994 + "
995 + fi
996 +
997 + gallium_enable video_cards_virgl virgl
998 + fi
999 +
1000 + if use vulkan; then
1001 + vulkan_enable video_cards_i965 intel
1002 + vulkan_enable video_cards_radeonsi radeon
1003 + fi
1004 +
1005 + # x86 hardened pax_kernel needs glx-rts, bug 240956
1006 + if [[ ${ABI} == x86 ]]; then
1007 + myconf+=" $(use_enable pax_kernel glx-read-only-text)"
1008 + fi
1009 +
1010 + # on abi_x86_32 hardened we need to have asm disable
1011 + if [[ ${ABI} == x86* ]] && use pic; then
1012 + myconf+=" --disable-asm"
1013 + fi
1014 +
1015 + if use gallium; then
1016 + myconf+=" $(use_enable osmesa gallium-osmesa)"
1017 + else
1018 + myconf+=" $(use_enable osmesa)"
1019 + fi
1020 +
1021 + # build fails with BSD indent, bug #428112
1022 + use userland_GNU || export INDENT=cat
1023 +
1024 + ECONF_SOURCE="${S}" \
1025 + econf \
1026 + --enable-dri \
1027 + --enable-glx \
1028 + --enable-shared-glapi \
1029 + $(use_enable !bindist texture-float) \
1030 + $(use_enable d3d9 nine) \
1031 + $(use_enable debug) \
1032 + $(use_enable dri3) \
1033 + $(use_enable egl) \
1034 + $(use_enable gbm) \
1035 + $(use_enable gles1) \
1036 + $(use_enable gles2) \
1037 + $(use_enable nptl glx-tls) \
1038 + $(use_enable unwind libunwind) \
1039 + --enable-valgrind=$(usex valgrind auto no) \
1040 + --enable-llvm-shared-libs \
1041 + --disable-opencl-icd \
1042 + --with-dri-drivers=${DRI_DRIVERS} \
1043 + --with-gallium-drivers=${GALLIUM_DRIVERS} \
1044 + --with-vulkan-drivers=${VULKAN_DRIVERS} \
1045 + PYTHON2="${PYTHON}" \
1046 + ${myconf}
1047 +}
1048 +
1049 +multilib_src_install() {
1050 + emake install DESTDIR="${D}"
1051 +
1052 + if use classic || use gallium; then
1053 + ebegin "Moving DRI/Gallium drivers for dynamic switching"
1054 + local gallium_drivers=( i915_dri.so i965_dri.so r300_dri.so r600_dri.so swrast_dri.so )
1055 + keepdir /usr/$(get_libdir)/dri
1056 + dodir /usr/$(get_libdir)/mesa
1057 + for x in ${gallium_drivers[@]}; do
1058 + if [ -f "$(get_libdir)/gallium/${x}" ]; then
1059 + mv -f "${ED}/usr/$(get_libdir)/dri/${x}" "${ED}/usr/$(get_libdir)/dri/${x/_dri.so/g_dri.so}" \
1060 + || die "Failed to move ${x}"
1061 + fi
1062 + done
1063 + if use classic; then
1064 + emake -C "${BUILD_DIR}/src/mesa/drivers/dri" DESTDIR="${D}" install
1065 + fi
1066 + for x in "${ED}"/usr/$(get_libdir)/dri/*.so; do
1067 + if [ -f ${x} -o -L ${x} ]; then
1068 + mv -f "${x}" "${x/dri/mesa}" \
1069 + || die "Failed to move ${x}"
1070 + fi
1071 + done
1072 + pushd "${ED}"/usr/$(get_libdir)/dri || die "pushd failed"
1073 + ln -s ../mesa/*.so . || die "Creating symlink failed"
1074 + # remove symlinks to drivers known to eselect
1075 + for x in ${gallium_drivers[@]}; do
1076 + if [ -f ${x} -o -L ${x} ]; then
1077 + rm "${x}" || die "Failed to remove ${x}"
1078 + fi
1079 + done
1080 + popd
1081 + eend $?
1082 + fi
1083 + if use opencl; then
1084 + ebegin "Moving Gallium/Clover OpenCL implementation for dynamic switching"
1085 + local cl_dir="/usr/$(get_libdir)/OpenCL/vendors/mesa"
1086 + dodir ${cl_dir}/{lib,include}
1087 + if [ -f "${ED}/usr/$(get_libdir)/libOpenCL.so" ]; then
1088 + mv -f "${ED}"/usr/$(get_libdir)/libOpenCL.so* \
1089 + "${ED}"${cl_dir}
1090 + fi
1091 + if [ -f "${ED}/usr/include/CL/opencl.h" ]; then
1092 + mv -f "${ED}"/usr/include/CL \
1093 + "${ED}"${cl_dir}/include
1094 + fi
1095 + eend $?
1096 + fi
1097 +
1098 + if use openmax; then
1099 + echo "XDG_DATA_DIRS=\"${EPREFIX}/usr/share/mesa/xdg\"" > "${T}/99mesaxdgomx"
1100 + doenvd "${T}"/99mesaxdgomx
1101 + keepdir /usr/share/mesa/xdg
1102 + fi
1103 +}
1104 +
1105 +multilib_src_install_all() {
1106 + find "${ED}" -name '*.la' -delete
1107 + einstalldocs
1108 +
1109 + if use !bindist; then
1110 + dodoc docs/patents.txt
1111 + fi
1112 +
1113 + # Install config file for eselect mesa
1114 + insinto /usr/share/mesa
1115 + newins "${FILESDIR}/eselect-mesa.conf.9.2" eselect-mesa.conf
1116 +}
1117 +
1118 +multilib_src_test() {
1119 + if use llvm; then
1120 + local llvm_tests='lp_test_arit lp_test_arit lp_test_blend lp_test_blend lp_test_conv lp_test_conv lp_test_format lp_test_format lp_test_printf lp_test_printf'
1121 + pushd src/gallium/drivers/llvmpipe >/dev/null || die
1122 + emake ${llvm_tests}
1123 + pax-mark m ${llvm_tests}
1124 + popd >/dev/null || die
1125 + fi
1126 + emake check
1127 +}
1128 +
1129 +pkg_postinst() {
1130 + # Switch to the xorg implementation.
1131 + echo
1132 + eselect opengl set --use-old ${OPENGL_DIR}
1133 +
1134 + # Select classic/gallium drivers
1135 + if use classic || use gallium; then
1136 + eselect mesa set --auto
1137 + fi
1138 +
1139 + # Switch to mesa opencl
1140 + if use opencl; then
1141 + eselect opencl set --use-old ${PN}
1142 + fi
1143 +
1144 + # run omxregister-bellagio to make the OpenMAX drivers known system-wide
1145 + if use openmax; then
1146 + ebegin "Registering OpenMAX drivers"
1147 + BELLAGIO_SEARCH_PATH="${EPREFIX}/usr/$(get_libdir)/libomxil-bellagio0" \
1148 + OMX_BELLAGIO_REGISTRY=${EPREFIX}/usr/share/mesa/xdg/.omxregister \
1149 + omxregister-bellagio
1150 + eend $?
1151 + fi
1152 +
1153 + # warn about patent encumbered texture-float
1154 + if use !bindist; then
1155 + elog "USE=\"bindist\" was not set. Potentially patent encumbered code was"
1156 + elog "enabled. Please see /usr/share/doc/${P}/patents.txt.bz2 for an"
1157 + elog "explanation."
1158 + fi
1159 +}
1160 +
1161 +pkg_prerm() {
1162 + if use openmax; then
1163 + rm "${EPREFIX}"/usr/share/mesa/xdg/.omxregister
1164 + fi
1165 +}
1166 +
1167 +# $1 - VIDEO_CARDS flag
1168 +# other args - names of DRI drivers to enable
1169 +# TODO: avoid code duplication for a more elegant implementation
1170 +driver_enable() {
1171 + case $# in
1172 + # for enabling unconditionally
1173 + 1)
1174 + DRI_DRIVERS+=",$1"
1175 + ;;
1176 + *)
1177 + if use $1; then
1178 + shift
1179 + for i in $@; do
1180 + DRI_DRIVERS+=",${i}"
1181 + done
1182 + fi
1183 + ;;
1184 + esac
1185 +}
1186 +
1187 +gallium_enable() {
1188 + case $# in
1189 + # for enabling unconditionally
1190 + 1)
1191 + GALLIUM_DRIVERS+=",$1"
1192 + ;;
1193 + *)
1194 + if use $1; then
1195 + shift
1196 + for i in $@; do
1197 + GALLIUM_DRIVERS+=",${i}"
1198 + done
1199 + fi
1200 + ;;
1201 + esac
1202 +}
1203 +
1204 +vulkan_enable() {
1205 + case $# in
1206 + # for enabling unconditionally
1207 + 1)
1208 + VULKAN_DRIVERS+=",$1"
1209 + ;;
1210 + *)
1211 + if use $1; then
1212 + shift
1213 + for i in $@; do
1214 + VULKAN_DRIVERS+=",${i}"
1215 + done
1216 + fi
1217 + ;;
1218 + esac
1219 +}