1 |
commit: 5c0caeaae7e3e7be707d561b847fa52603fd5253 |
2 |
Author: callmetango <callmetango <AT> users <DOT> noreply <DOT> github <DOT> com> |
3 |
AuthorDate: Sat Aug 25 11:52:07 2018 +0000 |
4 |
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Oct 29 11:48:16 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/musl.git/commit/?id=5c0caeaa |
7 |
|
8 |
media-libs/mesa: increased stacksize to prevent segfaults |
9 |
|
10 |
* increased stacksize to prevent segfaults as suggested by https://github.com/alpinelinux/aports/pull/4847 |
11 |
|
12 |
.../mesa/files/mesa-18-musl-larger-stacksize.patch | 52 ++ |
13 |
media-libs/mesa/mesa-18.1.6-r1.ebuild | 547 +++++++++++++++++++++ |
14 |
2 files changed, 599 insertions(+) |
15 |
|
16 |
diff --git a/media-libs/mesa/files/mesa-18-musl-larger-stacksize.patch b/media-libs/mesa/files/mesa-18-musl-larger-stacksize.patch |
17 |
new file mode 100644 |
18 |
index 0000000..cfc3bc5 |
19 |
--- /dev/null |
20 |
+++ b/media-libs/mesa/files/mesa-18-musl-larger-stacksize.patch |
21 |
@@ -0,0 +1,52 @@ |
22 |
+# [main/mesa: use larger stack size for new threads #4847](https://github.com/alpinelinux/aports/pull/4847) |
23 |
+ |
24 |
+[prspkt (prspkt) · GitHub](https://github.com/prspkt) commented |
25 |
+2018-07-25T12:34:00Z |
26 |
+ |
27 |
+Since the introduction of the mesa 18.1.* series, applications that use OpenGL |
28 |
+have been consistently segfaulting. I can locally reproduce using |
29 |
+`community/mpv` for video playback. This has also been discovered |
30 |
+[here](https://github.com/gentoo/musl/issues/136) and the |
31 |
+[patch](https://github.com/void-linux/void-packages/blob/18838a6cd6b00b1d309d6cc712b7d54660597221/srcpkgs/libGL/patches/musl-stacksize.patch) |
32 |
+was imported after following a discussion |
33 |
+[here](https://github.com/void-linux/void-packages/issues/933). |
34 |
+ |
35 |
+Increasing the stacksise consistently fixes the issue. |
36 |
+ |
37 |
+## References |
38 |
+ |
39 |
+[Segfaults with mesa-18.1.0_rc* · Issue #136 · gentoo/musl · GitHub](https://github.com/gentoo/musl/issues/136) |
40 |
+[RetroArch segfaults after recent update of various gfx libraries: mesa-ati-dri, libGL, etc. · Issue #933 · void-linux/void-packages · GitHub](https://github.com/void-linux/void-packages/issues/933) |
41 |
+ |
42 |
+--- a/include/c11/threads_posix.h |
43 |
++++ b/include/c11/threads_posix.h |
44 |
+@@ -281,15 +281,29 @@ static inline int |
45 |
+ thrd_create(thrd_t *thr, thrd_start_t func, void *arg) |
46 |
+ { |
47 |
+ struct impl_thrd_param *pack; |
48 |
++#ifdef __GLIBC__ |
49 |
++ pthread_attr_t *attrp = NULL; |
50 |
++#else |
51 |
++ pthread_attr_t attr = { 0 }; |
52 |
++ pthread_attr_init(&attr); |
53 |
++ pthread_attr_setstacksize(&attr, 8388608); |
54 |
++ pthread_attr_t *attrp = &attr; |
55 |
++#endif |
56 |
+ assert(thr != NULL); |
57 |
+ pack = (struct impl_thrd_param *)malloc(sizeof(struct impl_thrd_param)); |
58 |
+ if (!pack) return thrd_nomem; |
59 |
+ pack->func = func; |
60 |
+ pack->arg = arg; |
61 |
+- if (pthread_create(thr, NULL, impl_thrd_routine, pack) != 0) { |
62 |
++ if (pthread_create(thr, attrp, impl_thrd_routine, pack) != 0) { |
63 |
++#ifndef __GLIBC__ |
64 |
++ pthread_attr_destroy(&attr); |
65 |
++#endif |
66 |
+ free(pack); |
67 |
+ return thrd_error; |
68 |
+ } |
69 |
++#ifndef __GLIBC__ |
70 |
++ pthread_attr_destroy(&attr); |
71 |
++#endif |
72 |
+ return thrd_success; |
73 |
+ } |
74 |
|
75 |
diff --git a/media-libs/mesa/mesa-18.1.6-r1.ebuild b/media-libs/mesa/mesa-18.1.6-r1.ebuild |
76 |
new file mode 100644 |
77 |
index 0000000..134fcaf |
78 |
--- /dev/null |
79 |
+++ b/media-libs/mesa/mesa-18.1.6-r1.ebuild |
80 |
@@ -0,0 +1,547 @@ |
81 |
+# Copyright 1999-2018 Gentoo Foundation |
82 |
+# Distributed under the terms of the GNU General Public License v2 |
83 |
+ |
84 |
+EAPI=6 |
85 |
+ |
86 |
+EGIT_REPO_URI="https://gitlab.freedesktop.org/mesa/mesa.git" |
87 |
+ |
88 |
+if [[ ${PV} = 9999 ]]; then |
89 |
+ GIT_ECLASS="git-r3" |
90 |
+ EXPERIMENTAL="true" |
91 |
+fi |
92 |
+ |
93 |
+PYTHON_COMPAT=( python2_7 ) |
94 |
+ |
95 |
+inherit autotools llvm multilib-minimal python-any-r1 pax-utils ${GIT_ECLASS} |
96 |
+ |
97 |
+OPENGL_DIR="xorg-x11" |
98 |
+ |
99 |
+MY_P="${P/_/-}" |
100 |
+ |
101 |
+DESCRIPTION="OpenGL-like graphic library for Linux" |
102 |
+HOMEPAGE="https://www.mesa3d.org/ https://mesa.freedesktop.org/" |
103 |
+ |
104 |
+if [[ $PV == 9999 ]]; then |
105 |
+ SRC_URI="" |
106 |
+else |
107 |
+ SRC_URI="https://mesa.freedesktop.org/archive/${MY_P}.tar.xz" |
108 |
+ KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~x86" |
109 |
+fi |
110 |
+ |
111 |
+LICENSE="MIT" |
112 |
+SLOT="0" |
113 |
+RESTRICT="!bindist? ( bindist )" |
114 |
+ |
115 |
+RADEON_CARDS="r100 r200 r300 r600 radeon radeonsi" |
116 |
+VIDEO_CARDS="${RADEON_CARDS} freedreno i915 i965 imx intel nouveau vc4 virgl vivante vmware" |
117 |
+for card in ${VIDEO_CARDS}; do |
118 |
+ IUSE_VIDEO_CARDS+=" video_cards_${card}" |
119 |
+done |
120 |
+ |
121 |
+IUSE="${IUSE_VIDEO_CARDS} |
122 |
+ bindist +classic d3d9 debug +dri3 +egl +gallium +gbm gles1 gles2 unwind |
123 |
+ +llvm +nptl opencl osmesa pax_kernel openmax pic selinux vaapi valgrind |
124 |
+ vdpau vulkan wayland xvmc xa" |
125 |
+ |
126 |
+REQUIRED_USE=" |
127 |
+ d3d9? ( dri3 gallium ) |
128 |
+ llvm? ( gallium ) |
129 |
+ opencl? ( gallium llvm || ( video_cards_r600 video_cards_radeonsi ) ) |
130 |
+ openmax? ( gallium ) |
131 |
+ gles1? ( egl ) |
132 |
+ gles2? ( egl ) |
133 |
+ vaapi? ( gallium ) |
134 |
+ vdpau? ( gallium ) |
135 |
+ vulkan? ( || ( video_cards_i965 video_cards_radeonsi ) |
136 |
+ video_cards_radeonsi? ( llvm ) ) |
137 |
+ wayland? ( egl gbm ) |
138 |
+ xa? ( gallium ) |
139 |
+ video_cards_freedreno? ( gallium ) |
140 |
+ video_cards_intel? ( classic ) |
141 |
+ video_cards_i915? ( || ( classic gallium ) ) |
142 |
+ video_cards_i965? ( classic ) |
143 |
+ video_cards_imx? ( gallium video_cards_vivante ) |
144 |
+ video_cards_nouveau? ( || ( classic gallium ) ) |
145 |
+ video_cards_radeon? ( || ( classic gallium ) |
146 |
+ gallium? ( x86? ( llvm ) amd64? ( llvm ) ) ) |
147 |
+ video_cards_r100? ( classic ) |
148 |
+ video_cards_r200? ( classic ) |
149 |
+ video_cards_r300? ( gallium x86? ( llvm ) amd64? ( llvm ) ) |
150 |
+ video_cards_r600? ( gallium ) |
151 |
+ video_cards_radeonsi? ( gallium llvm ) |
152 |
+ video_cards_vc4? ( gallium ) |
153 |
+ video_cards_virgl? ( gallium ) |
154 |
+ video_cards_vivante? ( gallium gbm ) |
155 |
+ video_cards_vmware? ( gallium ) |
156 |
+" |
157 |
+ |
158 |
+LIBDRM_DEPSTRING=">=x11-libs/libdrm-2.4.91" |
159 |
+RDEPEND=" |
160 |
+ !app-eselect/eselect-mesa |
161 |
+ >=app-eselect/eselect-opengl-1.3.0 |
162 |
+ >=dev-libs/expat-2.1.0-r3:=[${MULTILIB_USEDEP}] |
163 |
+ >=sys-libs/zlib-1.2.8[${MULTILIB_USEDEP}] |
164 |
+ >=x11-libs/libX11-1.6.2:=[${MULTILIB_USEDEP}] |
165 |
+ >=x11-libs/libxshmfence-1.1:=[${MULTILIB_USEDEP}] |
166 |
+ >=x11-libs/libXdamage-1.1.4-r1:=[${MULTILIB_USEDEP}] |
167 |
+ >=x11-libs/libXext-1.3.2:=[${MULTILIB_USEDEP}] |
168 |
+ >=x11-libs/libXxf86vm-1.1.3:=[${MULTILIB_USEDEP}] |
169 |
+ >=x11-libs/libxcb-1.13:=[${MULTILIB_USEDEP}] |
170 |
+ x11-libs/libXfixes:=[${MULTILIB_USEDEP}] |
171 |
+ unwind? ( sys-libs/libunwind[${MULTILIB_USEDEP}] ) |
172 |
+ llvm? ( |
173 |
+ video_cards_radeonsi? ( |
174 |
+ virtual/libelf:0=[${MULTILIB_USEDEP}] |
175 |
+ ) |
176 |
+ video_cards_r600? ( |
177 |
+ virtual/libelf:0=[${MULTILIB_USEDEP}] |
178 |
+ ) |
179 |
+ video_cards_radeon? ( |
180 |
+ virtual/libelf:0=[${MULTILIB_USEDEP}] |
181 |
+ ) |
182 |
+ ) |
183 |
+ opencl? ( |
184 |
+ app-eselect/eselect-opencl |
185 |
+ dev-libs/libclc |
186 |
+ virtual/libelf:0=[${MULTILIB_USEDEP}] |
187 |
+ ) |
188 |
+ openmax? ( |
189 |
+ >=media-libs/libomxil-bellagio-0.9.3:=[${MULTILIB_USEDEP}] |
190 |
+ x11-misc/xdg-utils |
191 |
+ ) |
192 |
+ vaapi? ( |
193 |
+ >=x11-libs/libva-1.7.3:=[${MULTILIB_USEDEP}] |
194 |
+ video_cards_nouveau? ( !<=x11-libs/libva-vdpau-driver-0.7.4-r3 ) |
195 |
+ ) |
196 |
+ vdpau? ( >=x11-libs/libvdpau-1.1:=[${MULTILIB_USEDEP}] ) |
197 |
+ wayland? ( |
198 |
+ >=dev-libs/wayland-1.15.0:=[${MULTILIB_USEDEP}] |
199 |
+ >=dev-libs/wayland-protocols-1.8 |
200 |
+ ) |
201 |
+ xvmc? ( >=x11-libs/libXvMC-1.0.8:=[${MULTILIB_USEDEP}] ) |
202 |
+ ${LIBDRM_DEPSTRING}[video_cards_freedreno?,video_cards_nouveau?,video_cards_vc4?,video_cards_vivante?,video_cards_vmware?,${MULTILIB_USEDEP}] |
203 |
+ |
204 |
+ video_cards_intel? ( |
205 |
+ !video_cards_i965? ( ${LIBDRM_DEPSTRING}[video_cards_intel] ) |
206 |
+ ) |
207 |
+ video_cards_i915? ( ${LIBDRM_DEPSTRING}[video_cards_intel] ) |
208 |
+" |
209 |
+for card in ${RADEON_CARDS}; do |
210 |
+ RDEPEND="${RDEPEND} |
211 |
+ video_cards_${card}? ( ${LIBDRM_DEPSTRING}[video_cards_radeon] ) |
212 |
+ " |
213 |
+done |
214 |
+RDEPEND="${RDEPEND} |
215 |
+ video_cards_radeonsi? ( ${LIBDRM_DEPSTRING}[video_cards_amdgpu] ) |
216 |
+" |
217 |
+ |
218 |
+# Please keep the LLVM dependency block separate. Since LLVM is slotted, |
219 |
+# we need to *really* make sure we're not pulling one than more slot |
220 |
+# simultaneously. |
221 |
+# |
222 |
+# How to use it: |
223 |
+# 1. List all the working slots (with min versions) in ||, newest first. |
224 |
+# 2. Update the := to specify *max* version, e.g. < 7. |
225 |
+# 3. Specify LLVM_MAX_SLOT, e.g. 6. |
226 |
+LLVM_MAX_SLOT="6" |
227 |
+LLVM_DEPSTR=" |
228 |
+ || ( |
229 |
+ sys-devel/llvm:7[${MULTILIB_USEDEP}] |
230 |
+ sys-devel/llvm:6[${MULTILIB_USEDEP}] |
231 |
+ sys-devel/llvm:5[${MULTILIB_USEDEP}] |
232 |
+ sys-devel/llvm:4[${MULTILIB_USEDEP}] |
233 |
+ >=sys-devel/llvm-3.9.0:0[${MULTILIB_USEDEP}] |
234 |
+ ) |
235 |
+ sys-devel/llvm:=[${MULTILIB_USEDEP}] |
236 |
+" |
237 |
+LLVM_DEPSTR_AMDGPU=${LLVM_DEPSTR//]/,llvm_targets_AMDGPU(-)]} |
238 |
+CLANG_DEPSTR=${LLVM_DEPSTR//llvm/clang} |
239 |
+CLANG_DEPSTR_AMDGPU=${CLANG_DEPSTR//]/,llvm_targets_AMDGPU(-)]} |
240 |
+RDEPEND="${RDEPEND} |
241 |
+ llvm? ( |
242 |
+ opencl? ( |
243 |
+ video_cards_r600? ( |
244 |
+ ${CLANG_DEPSTR_AMDGPU} |
245 |
+ ) |
246 |
+ !video_cards_r600? ( |
247 |
+ video_cards_radeonsi? ( |
248 |
+ ${CLANG_DEPSTR_AMDGPU} |
249 |
+ ) |
250 |
+ ) |
251 |
+ !video_cards_r600? ( |
252 |
+ !video_cards_radeonsi? ( |
253 |
+ video_cards_radeon? ( |
254 |
+ ${CLANG_DEPSTR_AMDGPU} |
255 |
+ ) |
256 |
+ ) |
257 |
+ ) |
258 |
+ !video_cards_r600? ( |
259 |
+ !video_cards_radeon? ( |
260 |
+ !video_cards_radeonsi? ( |
261 |
+ ${CLANG_DEPSTR} |
262 |
+ ) |
263 |
+ ) |
264 |
+ ) |
265 |
+ ) |
266 |
+ !opencl? ( |
267 |
+ video_cards_r600? ( |
268 |
+ ${LLVM_DEPSTR_AMDGPU} |
269 |
+ ) |
270 |
+ !video_cards_r600? ( |
271 |
+ video_cards_radeonsi? ( |
272 |
+ ${LLVM_DEPSTR_AMDGPU} |
273 |
+ ) |
274 |
+ ) |
275 |
+ !video_cards_r600? ( |
276 |
+ !video_cards_radeonsi? ( |
277 |
+ video_cards_radeon? ( |
278 |
+ ${LLVM_DEPSTR_AMDGPU} |
279 |
+ ) |
280 |
+ ) |
281 |
+ ) |
282 |
+ !video_cards_r600? ( |
283 |
+ !video_cards_radeon? ( |
284 |
+ !video_cards_radeonsi? ( |
285 |
+ ${LLVM_DEPSTR} |
286 |
+ ) |
287 |
+ ) |
288 |
+ ) |
289 |
+ ) |
290 |
+ ) |
291 |
+" |
292 |
+unset {LLVM,CLANG}_DEPSTR{,_AMDGPU} |
293 |
+ |
294 |
+DEPEND="${RDEPEND} |
295 |
+ ${PYTHON_DEPS} |
296 |
+ opencl? ( |
297 |
+ >=sys-devel/gcc-4.6 |
298 |
+ ) |
299 |
+ sys-devel/gettext |
300 |
+ virtual/pkgconfig |
301 |
+ valgrind? ( dev-util/valgrind ) |
302 |
+ x11-base/xorg-proto |
303 |
+ vulkan? ( |
304 |
+ $(python_gen_any_dep ">=dev-python/mako-0.7.3[\${PYTHON_USEDEP}]") |
305 |
+ ) |
306 |
+" |
307 |
+[[ ${PV} == 9999 ]] && DEPEND+=" |
308 |
+ sys-devel/bison |
309 |
+ sys-devel/flex |
310 |
+ $(python_gen_any_dep ">=dev-python/mako-0.7.3[\${PYTHON_USEDEP}]") |
311 |
+" |
312 |
+ |
313 |
+S="${WORKDIR}/${MY_P}" |
314 |
+EGIT_CHECKOUT_DIR=${S} |
315 |
+ |
316 |
+QA_WX_LOAD=" |
317 |
+x86? ( |
318 |
+ !pic? ( |
319 |
+ usr/lib*/libglapi.so.0.0.0 |
320 |
+ usr/lib*/libGLESv1_CM.so.1.1.0 |
321 |
+ usr/lib*/libGLESv2.so.2.0.0 |
322 |
+ usr/lib*/libGL.so.1.2.0 |
323 |
+ usr/lib*/libOSMesa.so.8.0.0 |
324 |
+ ) |
325 |
+)" |
326 |
+ |
327 |
+llvm_check_deps() { |
328 |
+ local flags=${MULTILIB_USEDEP} |
329 |
+ if use video_cards_r600 || use video_cards_radeon || use video_cards_radeonsi |
330 |
+ then |
331 |
+ flags+=",llvm_targets_AMDGPU(-)" |
332 |
+ fi |
333 |
+ |
334 |
+ if use opencl; then |
335 |
+ has_version "sys-devel/clang[${flags}]" || return 1 |
336 |
+ fi |
337 |
+ has_version "sys-devel/llvm[${flags}]" |
338 |
+} |
339 |
+ |
340 |
+pkg_setup() { |
341 |
+ # warning message for bug 459306 |
342 |
+ if use llvm && has_version sys-devel/llvm[!debug=]; then |
343 |
+ ewarn "Mismatch between debug USE flags in media-libs/mesa and sys-devel/llvm" |
344 |
+ ewarn "detected! This can cause problems. For details, see bug 459306." |
345 |
+ fi |
346 |
+ |
347 |
+ if use llvm; then |
348 |
+ llvm_pkg_setup |
349 |
+ fi |
350 |
+ python-any-r1_pkg_setup |
351 |
+} |
352 |
+ |
353 |
+src_prepare() { |
354 |
+ eapply "${FILESDIR}"/${PN}-17-execinfo.patch |
355 |
+ eapply "${FILESDIR}"/${PN}-17-musl-string_h.patch |
356 |
+ eapply "${FILESDIR}"/${PN}-17-musl-invocation_name.patch |
357 |
+ eapply "${FILESDIR}"/${PN}-18-musl-pthread.patch |
358 |
+ eapply "${FILESDIR}"/${PN}-18-intel-missing-time_t.patch |
359 |
+ eapply "${FILESDIR}"/${PN}-18-musl-amdgpu-include-pthread.patch |
360 |
+ eapply "${FILESDIR}"/${PN}-18-musl-larger-stacksize.patch |
361 |
+ eapply_user |
362 |
+ eautoreconf |
363 |
+} |
364 |
+ |
365 |
+multilib_src_configure() { |
366 |
+ local myconf |
367 |
+ |
368 |
+ if use classic; then |
369 |
+ # Configurable DRI drivers |
370 |
+ driver_enable swrast |
371 |
+ |
372 |
+ # Intel code |
373 |
+ driver_enable video_cards_i915 i915 |
374 |
+ driver_enable video_cards_i965 i965 |
375 |
+ if ! use video_cards_i915 && \ |
376 |
+ ! use video_cards_i965; then |
377 |
+ driver_enable video_cards_intel i915 i965 |
378 |
+ fi |
379 |
+ |
380 |
+ # Nouveau code |
381 |
+ driver_enable video_cards_nouveau nouveau |
382 |
+ |
383 |
+ # ATI code |
384 |
+ driver_enable video_cards_r100 radeon |
385 |
+ driver_enable video_cards_r200 r200 |
386 |
+ if ! use video_cards_r100 && \ |
387 |
+ ! use video_cards_r200; then |
388 |
+ driver_enable video_cards_radeon radeon r200 |
389 |
+ fi |
390 |
+ fi |
391 |
+ |
392 |
+ if use egl; then |
393 |
+ myconf+=" --with-platforms=x11,surfaceless$(use wayland && echo ",wayland")$(use gbm && echo ",drm")" |
394 |
+ fi |
395 |
+ |
396 |
+ if use gallium; then |
397 |
+ myconf+=" |
398 |
+ $(use_enable d3d9 nine) |
399 |
+ $(use_enable llvm) |
400 |
+ $(use_enable openmax omx-bellagio) |
401 |
+ $(use_enable vaapi va) |
402 |
+ $(use_enable vdpau) |
403 |
+ $(use_enable xa) |
404 |
+ $(use_enable xvmc) |
405 |
+ " |
406 |
+ use vaapi && myconf+=" --with-va-libdir=/usr/$(get_libdir)/va/drivers" |
407 |
+ |
408 |
+ gallium_enable swrast |
409 |
+ gallium_enable video_cards_vc4 vc4 |
410 |
+ gallium_enable video_cards_vivante etnaviv |
411 |
+ gallium_enable video_cards_vmware svga |
412 |
+ gallium_enable video_cards_nouveau nouveau |
413 |
+ gallium_enable video_cards_i915 i915 |
414 |
+ gallium_enable video_cards_imx imx |
415 |
+ if ! use video_cards_i915 && \ |
416 |
+ ! use video_cards_i965; then |
417 |
+ gallium_enable video_cards_intel i915 |
418 |
+ fi |
419 |
+ |
420 |
+ gallium_enable video_cards_r300 r300 |
421 |
+ gallium_enable video_cards_r600 r600 |
422 |
+ gallium_enable video_cards_radeonsi radeonsi |
423 |
+ if ! use video_cards_r300 && \ |
424 |
+ ! use video_cards_r600; then |
425 |
+ gallium_enable video_cards_radeon r300 r600 |
426 |
+ fi |
427 |
+ |
428 |
+ gallium_enable video_cards_freedreno freedreno |
429 |
+ # opencl stuff |
430 |
+ if use opencl; then |
431 |
+ myconf+=" |
432 |
+ $(use_enable opencl) |
433 |
+ --with-clang-libdir="${EPREFIX}/usr/lib" |
434 |
+ " |
435 |
+ fi |
436 |
+ |
437 |
+ gallium_enable video_cards_virgl virgl |
438 |
+ fi |
439 |
+ |
440 |
+ if use vulkan; then |
441 |
+ vulkan_enable video_cards_i965 intel |
442 |
+ vulkan_enable video_cards_radeonsi radeon |
443 |
+ fi |
444 |
+ |
445 |
+ # x86 hardened pax_kernel needs glx-rts, bug 240956 |
446 |
+ if [[ ${ABI} == x86 ]]; then |
447 |
+ myconf+=" $(use_enable pax_kernel glx-read-only-text)" |
448 |
+ fi |
449 |
+ |
450 |
+ # on abi_x86_32 hardened we need to have asm disable |
451 |
+ if [[ ${ABI} == x86* ]] && use pic; then |
452 |
+ myconf+=" --disable-asm" |
453 |
+ fi |
454 |
+ |
455 |
+ if use gallium; then |
456 |
+ myconf+=" $(use_enable osmesa gallium-osmesa)" |
457 |
+ else |
458 |
+ myconf+=" $(use_enable osmesa)" |
459 |
+ fi |
460 |
+ |
461 |
+ # build fails with BSD indent, bug #428112 |
462 |
+ use userland_GNU || export INDENT=cat |
463 |
+ |
464 |
+ ECONF_SOURCE="${S}" \ |
465 |
+ econf \ |
466 |
+ --enable-dri \ |
467 |
+ --enable-glx \ |
468 |
+ --enable-shared-glapi \ |
469 |
+ $(use_enable !bindist texture-float) \ |
470 |
+ $(use_enable d3d9 nine) \ |
471 |
+ $(use_enable debug) \ |
472 |
+ $(use_enable dri3) \ |
473 |
+ $(use_enable egl) \ |
474 |
+ $(use_enable gbm) \ |
475 |
+ $(use_enable gles1) \ |
476 |
+ $(use_enable gles2) \ |
477 |
+ $(use_enable nptl glx-tls) \ |
478 |
+ $(use_enable unwind libunwind) \ |
479 |
+ --enable-valgrind=$(usex valgrind auto no) \ |
480 |
+ --enable-llvm-shared-libs \ |
481 |
+ --disable-opencl-icd \ |
482 |
+ --with-dri-drivers=${DRI_DRIVERS} \ |
483 |
+ --with-gallium-drivers=${GALLIUM_DRIVERS} \ |
484 |
+ --with-vulkan-drivers=${VULKAN_DRIVERS} \ |
485 |
+ PYTHON2="${PYTHON}" \ |
486 |
+ ${myconf} |
487 |
+} |
488 |
+ |
489 |
+multilib_src_install() { |
490 |
+ emake install DESTDIR="${D}" |
491 |
+ |
492 |
+ if use wayland; then |
493 |
+ # These files are now provided by >=dev-libs/wayland-1.15.0 |
494 |
+ rm "${ED}/usr/$(get_libdir)/libwayland-egl.so" || die |
495 |
+ rm "${ED}/usr/$(get_libdir)/libwayland-egl.so.1" || die |
496 |
+ rm "${ED}/usr/$(get_libdir)/libwayland-egl.so.1.0.0" || die |
497 |
+ rm "${ED}/usr/$(get_libdir)/pkgconfig/wayland-egl.pc" || die |
498 |
+ fi |
499 |
+ |
500 |
+ if use opencl; then |
501 |
+ ebegin "Moving Gallium/Clover OpenCL implementation for dynamic switching" |
502 |
+ local cl_dir="/usr/$(get_libdir)/OpenCL/vendors/mesa" |
503 |
+ dodir ${cl_dir}/{lib,include} |
504 |
+ if [ -f "${ED}/usr/$(get_libdir)/libOpenCL.so" ]; then |
505 |
+ mv -f "${ED}"/usr/$(get_libdir)/libOpenCL.so* \ |
506 |
+ "${ED}"${cl_dir} |
507 |
+ fi |
508 |
+ if [ -f "${ED}/usr/include/CL/opencl.h" ]; then |
509 |
+ mv -f "${ED}"/usr/include/CL \ |
510 |
+ "${ED}"${cl_dir}/include |
511 |
+ fi |
512 |
+ eend $? |
513 |
+ fi |
514 |
+ |
515 |
+ if use openmax; then |
516 |
+ echo "XDG_DATA_DIRS=\"${EPREFIX}/usr/share/mesa/xdg\"" > "${T}/99mesaxdgomx" |
517 |
+ doenvd "${T}"/99mesaxdgomx |
518 |
+ keepdir /usr/share/mesa/xdg |
519 |
+ fi |
520 |
+} |
521 |
+ |
522 |
+multilib_src_install_all() { |
523 |
+ find "${ED}" -name '*.la' -delete |
524 |
+ einstalldocs |
525 |
+ |
526 |
+ if use !bindist; then |
527 |
+ dodoc docs/patents.txt |
528 |
+ fi |
529 |
+} |
530 |
+ |
531 |
+multilib_src_test() { |
532 |
+ if use llvm; then |
533 |
+ 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' |
534 |
+ pushd src/gallium/drivers/llvmpipe >/dev/null || die |
535 |
+ emake ${llvm_tests} |
536 |
+ pax-mark m ${llvm_tests} |
537 |
+ popd >/dev/null || die |
538 |
+ fi |
539 |
+ emake check |
540 |
+} |
541 |
+ |
542 |
+pkg_postinst() { |
543 |
+ # Switch to the xorg implementation. |
544 |
+ echo |
545 |
+ eselect opengl set --use-old ${OPENGL_DIR} |
546 |
+ |
547 |
+ # Switch to mesa opencl |
548 |
+ if use opencl; then |
549 |
+ eselect opencl set --use-old ${PN} |
550 |
+ fi |
551 |
+ |
552 |
+ # run omxregister-bellagio to make the OpenMAX drivers known system-wide |
553 |
+ if use openmax; then |
554 |
+ ebegin "Registering OpenMAX drivers" |
555 |
+ BELLAGIO_SEARCH_PATH="${EPREFIX}/usr/$(get_libdir)/libomxil-bellagio0" \ |
556 |
+ OMX_BELLAGIO_REGISTRY=${EPREFIX}/usr/share/mesa/xdg/.omxregister \ |
557 |
+ omxregister-bellagio |
558 |
+ eend $? |
559 |
+ fi |
560 |
+ |
561 |
+ # warn about patent encumbered texture-float |
562 |
+ if use !bindist; then |
563 |
+ elog "USE=\"bindist\" was not set. Potentially patent encumbered code was" |
564 |
+ elog "enabled. Please see /usr/share/doc/${P}/patents.txt.bz2 for an" |
565 |
+ elog "explanation." |
566 |
+ fi |
567 |
+} |
568 |
+ |
569 |
+pkg_prerm() { |
570 |
+ if use openmax; then |
571 |
+ rm "${EPREFIX}"/usr/share/mesa/xdg/.omxregister |
572 |
+ fi |
573 |
+} |
574 |
+ |
575 |
+# $1 - VIDEO_CARDS flag |
576 |
+# other args - names of DRI drivers to enable |
577 |
+# TODO: avoid code duplication for a more elegant implementation |
578 |
+driver_enable() { |
579 |
+ case $# in |
580 |
+ # for enabling unconditionally |
581 |
+ 1) |
582 |
+ DRI_DRIVERS+=",$1" |
583 |
+ ;; |
584 |
+ *) |
585 |
+ if use $1; then |
586 |
+ shift |
587 |
+ for i in $@; do |
588 |
+ DRI_DRIVERS+=",${i}" |
589 |
+ done |
590 |
+ fi |
591 |
+ ;; |
592 |
+ esac |
593 |
+} |
594 |
+ |
595 |
+gallium_enable() { |
596 |
+ case $# in |
597 |
+ # for enabling unconditionally |
598 |
+ 1) |
599 |
+ GALLIUM_DRIVERS+=",$1" |
600 |
+ ;; |
601 |
+ *) |
602 |
+ if use $1; then |
603 |
+ shift |
604 |
+ for i in $@; do |
605 |
+ GALLIUM_DRIVERS+=",${i}" |
606 |
+ done |
607 |
+ fi |
608 |
+ ;; |
609 |
+ esac |
610 |
+} |
611 |
+ |
612 |
+vulkan_enable() { |
613 |
+ case $# in |
614 |
+ # for enabling unconditionally |
615 |
+ 1) |
616 |
+ VULKAN_DRIVERS+=",$1" |
617 |
+ ;; |
618 |
+ *) |
619 |
+ if use $1; then |
620 |
+ shift |
621 |
+ for i in $@; do |
622 |
+ VULKAN_DRIVERS+=",${i}" |
623 |
+ done |
624 |
+ fi |
625 |
+ ;; |
626 |
+ esac |
627 |
+} |