/[gentoo-x86]/media-libs/mesa/mesa-8.0.3.ebuild
Gentoo

Contents of /media-libs/mesa/mesa-8.0.3.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations) (download)
Fri Jun 22 20:19:39 2012 UTC (2 years, 5 months ago) by ago
Branch: MAIN
Changes since 1.2: +2 -2 lines
Stable for amd64, wrt bug #419473

(Portage version: 2.1.10.65/cvs/Linux x86_64)

1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/media-libs/mesa/mesa-8.0.3.ebuild,v 1.2 2012/05/28 12:43:01 chithanh Exp $
4
5 EAPI=4
6
7 EGIT_REPO_URI="git://anongit.freedesktop.org/mesa/mesa"
8
9 if [[ ${PV} = 9999* ]]; then
10 GIT_ECLASS="git-2"
11 EXPERIMENTAL="true"
12 fi
13
14 inherit base autotools multilib flag-o-matic python toolchain-funcs ${GIT_ECLASS}
15
16 OPENGL_DIR="xorg-x11"
17
18 MY_PN="${PN/m/M}"
19 MY_P="${MY_PN}-${PV/_/-}"
20 MY_SRC_P="${MY_PN}Lib-${PV/_/-}"
21
22 FOLDER="${PV/_rc*/}"
23
24 DESCRIPTION="OpenGL-like graphic library for Linux"
25 HOMEPAGE="http://mesa3d.sourceforge.net/"
26
27 SRC_PATCHES="mirror://gentoo/${P}-gentoo-patches-02.tar.bz2"
28 if [[ $PV = 9999* ]]; then
29 SRC_URI="${SRC_PATCHES}"
30 else
31 SRC_URI="ftp://ftp.freedesktop.org/pub/mesa/${FOLDER}/${MY_SRC_P}.tar.bz2
32 ${SRC_PATCHES}"
33 fi
34
35 # Most of the code is MIT/X11.
36 # ralloc is LGPL-3
37 # GLES[2]/gl[2]{,ext,platform}.h are SGI-B-2.0
38 LICENSE="MIT LGPL-3 SGI-B-2.0"
39 SLOT="0"
40 KEYWORDS="~alpha amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~x86-freebsd ~amd64-linux ~ia64-linux ~x86-linux ~sparc-solaris ~x64-solaris ~x86-solaris"
41
42 INTEL_CARDS="i915 i965 intel"
43 RADEON_CARDS="r100 r200 r300 r600 radeon"
44 VIDEO_CARDS="${INTEL_CARDS} ${RADEON_CARDS} nouveau vmware"
45 for card in ${VIDEO_CARDS}; do
46 IUSE_VIDEO_CARDS+=" video_cards_${card}"
47 done
48
49 IUSE="${IUSE_VIDEO_CARDS}
50 bindist +classic d3d debug +egl g3dvl +gallium gbm gles1 gles2 +llvm +nptl openvg osmesa pax_kernel pic selinux shared-dricore +shared-glapi vdpau wayland xa xvmc kernel_FreeBSD"
51
52 REQUIRED_USE="
53 d3d? ( gallium )
54 g3dvl? ( gallium )
55 llvm? ( gallium )
56 openvg? ( egl gallium )
57 gbm? ( shared-glapi )
58 g3dvl? ( || ( vdpau xvmc ) )
59 vdpau? ( g3dvl )
60 xa? ( gallium )
61 xvmc? ( g3dvl )
62 video_cards_intel? ( || ( classic gallium ) )
63 video_cards_i915? ( || ( classic gallium ) )
64 video_cards_i965? ( classic )
65 video_cards_nouveau? ( || ( classic gallium ) )
66 video_cards_radeon? ( || ( classic gallium ) )
67 video_cards_r100? ( classic )
68 video_cards_r200? ( classic )
69 video_cards_r300? ( gallium )
70 video_cards_r600? ( gallium )
71 video_cards_vmware? ( gallium )
72 "
73
74 LIBDRM_DEPSTRING=">=x11-libs/libdrm-2.4.32"
75 # not a runtime dependency of this package, but dependency of packages which
76 # depend on this package, bug #342393
77 EXTERNAL_DEPEND="
78 >=x11-proto/dri2proto-2.6
79 >=x11-proto/glproto-1.4.15
80 "
81 # keep correct libdrm and dri2proto dep
82 # keep blocks in rdepend for binpkg
83 RDEPEND="${EXTERNAL_DEPEND}
84 !<x11-base/xorg-server-1.7
85 !<=x11-proto/xf86driproto-2.0.3
86 classic? ( app-admin/eselect-mesa )
87 gallium? ( app-admin/eselect-mesa )
88 >=app-admin/eselect-opengl-1.2.5
89 dev-libs/expat
90 gbm? ( sys-fs/udev )
91 >=x11-libs/libX11-1.3.99.901
92 x11-libs/libXdamage
93 x11-libs/libXext
94 x11-libs/libXxf86vm
95 >=x11-libs/libxcb-1.8
96 d3d? ( app-emulation/wine )
97 vdpau? ( >=x11-libs/libvdpau-0.4.1 )
98 wayland? ( dev-libs/wayland )
99 xvmc? ( >=x11-libs/libXvMC-1.0.6 )
100 ${LIBDRM_DEPSTRING}[video_cards_nouveau?,video_cards_vmware?]
101 video_cards_nouveau? ( <x11-libs/libdrm-2.4.34 )
102 "
103 for card in ${INTEL_CARDS}; do
104 RDEPEND="${RDEPEND}
105 video_cards_${card}? ( ${LIBDRM_DEPSTRING}[video_cards_intel] )
106 "
107 done
108
109 for card in ${RADEON_CARDS}; do
110 RDEPEND="${RDEPEND}
111 video_cards_${card}? ( ${LIBDRM_DEPSTRING}[video_cards_radeon] )
112 "
113 done
114
115 DEPEND="${RDEPEND}
116 llvm? ( >=sys-devel/llvm-2.9 )
117 =dev-lang/python-2*
118 dev-libs/libxml2[python]
119 virtual/pkgconfig
120 sys-devel/bison
121 sys-devel/flex
122 x11-misc/makedepend
123 >=x11-proto/xextproto-7.0.99.1
124 x11-proto/xf86driproto
125 x11-proto/xf86vidmodeproto
126 "
127
128 S="${WORKDIR}/${MY_P}"
129
130 # It is slow without texrels, if someone wants slow
131 # mesa without texrels +pic use is worth the shot
132 QA_EXECSTACK="usr/lib*/opengl/xorg-x11/lib/libGL.so*"
133 QA_WX_LOAD="usr/lib*/opengl/xorg-x11/lib/libGL.so*"
134
135 # Think about: ggi, fbcon, no-X configs
136
137 pkg_setup() {
138 # workaround toc-issue wrt #386545
139 use ppc64 && append-flags -mminimal-toc
140 }
141
142 src_unpack() {
143 default
144 [[ $PV = 9999* ]] && git-2_src_unpack
145 }
146
147 src_prepare() {
148 # apply patches
149 if [[ ${PV} != 9999* && -n ${SRC_PATCHES} ]]; then
150 EPATCH_FORCE="yes" \
151 EPATCH_SOURCE="${WORKDIR}/patches" \
152 EPATCH_SUFFIX="patch" \
153 epatch
154 fi
155
156 # relax the requirement that r300 must have llvm, bug 380303
157 epatch "${FILESDIR}"/${PN}-8.0-dont-require-llvm-for-r300.patch
158
159 # fix for hardened pax_kernel, bug 240956
160 [[ ${PV} != 9999* ]] && epatch "${FILESDIR}"/glx_ro_text_segm.patch
161
162 # Solaris needs some recent POSIX stuff in our case
163 if [[ ${CHOST} == *-solaris* ]] ; then
164 sed -i -e "s/-DSVR4/-D_POSIX_C_SOURCE=200112L/" configure.ac || die
165 fi
166
167 # Tests fail against python-3, bug #407887
168 sed -i 's|/usr/bin/env python|/usr/bin/env python2|' src/glsl/tests/compare_ir || die
169
170 base_src_prepare
171
172 eautoreconf
173 }
174
175 src_configure() {
176 local myconf
177
178 if use classic; then
179 # Configurable DRI drivers
180 driver_enable swrast
181
182 # Intel code
183 driver_enable video_cards_i915 i915
184 driver_enable video_cards_i965 i965
185 if ! use video_cards_i915 && \
186 ! use video_cards_i965; then
187 driver_enable video_cards_intel i915 i965
188 fi
189
190 # Nouveau code
191 driver_enable video_cards_nouveau nouveau
192
193 # ATI code
194 driver_enable video_cards_r100 radeon
195 driver_enable video_cards_r200 r200
196 if ! use video_cards_r100 && \
197 ! use video_cards_r200; then
198 driver_enable video_cards_radeon radeon r200
199 fi
200 fi
201
202 if use egl; then
203 myconf+="
204 --with-egl-platforms=x11$(use wayland && echo ",wayland")$(use gbm && echo ",drm")
205 $(use_enable gallium gallium-egl)
206 "
207 fi
208
209 if use gallium; then
210 myconf+="
211 $(use_enable d3d d3d1x)
212 $(use_enable g3dvl gallium-g3dvl)
213 $(use_enable llvm gallium-llvm)
214 $(use_enable openvg)
215 $(use_enable vdpau)
216 $(use_enable xa)
217 $(use_enable xvmc)
218 "
219 gallium_enable swrast
220 gallium_enable video_cards_vmware svga
221 gallium_enable video_cards_nouveau nouveau
222 gallium_enable video_cards_i915 i915
223 if ! use video_cards_i915; then
224 gallium_enable video_cards_intel i915
225 fi
226
227 gallium_enable video_cards_r300 r300
228 gallium_enable video_cards_r600 r600
229 if ! use video_cards_r300 && \
230 ! use video_cards_r600; then
231 gallium_enable video_cards_radeon r300 r600
232 fi
233 fi
234
235 # x86 hardened pax_kernel needs glx-rts, bug 240956
236 if use pax_kernel; then
237 myconf+="
238 $(use_enable x86 glx-rts)
239 "
240 fi
241
242 econf \
243 --enable-dri \
244 --enable-glx \
245 $(use_enable !bindist texture-float) \
246 $(use_enable debug) \
247 $(use_enable egl) \
248 $(use_enable gbm) \
249 $(use_enable gles1) \
250 $(use_enable gles2) \
251 $(use_enable nptl glx-tls) \
252 $(use_enable osmesa) \
253 $(use_enable !pic asm) \
254 $(use_enable shared-dricore) \
255 $(use_enable shared-glapi) \
256 --with-dri-drivers=${DRI_DRIVERS} \
257 --with-gallium-drivers=${GALLIUM_DRIVERS} \
258 ${myconf}
259 }
260
261 src_install() {
262 base_src_install
263
264 if use !bindist; then
265 dodoc docs/patents.txt
266 fi
267
268 # Save the glsl-compiler for later use
269 if ! tc-is-cross-compiler; then
270 dobin "${S}"/src/glsl/glsl_compiler
271 fi
272
273 # Install config file for eselect mesa
274 insinto /usr/share/mesa
275 newins "${FILESDIR}/eselect-mesa.conf.8.0.1" eselect-mesa.conf
276
277 # Move libGL and others from /usr/lib to /usr/lib/opengl/blah/lib
278 # because user can eselect desired GL provider.
279 ebegin "Moving libGL and friends for dynamic switching"
280 dodir /usr/$(get_libdir)/opengl/${OPENGL_DIR}/{lib,extensions,include}
281 local x
282 for x in "${ED}"/usr/$(get_libdir)/lib{EGL,GL*,OpenVG}.{la,a,so*}; do
283 if [ -f ${x} -o -L ${x} ]; then
284 mv -f "${x}" "${ED}"/usr/$(get_libdir)/opengl/${OPENGL_DIR}/lib \
285 || die "Failed to move ${x}"
286 fi
287 done
288 for x in "${ED}"/usr/include/GL/{gl.h,glx.h,glext.h,glxext.h}; do
289 if [ -f ${x} -o -L ${x} ]; then
290 mv -f "${x}" "${ED}"/usr/$(get_libdir)/opengl/${OPENGL_DIR}/include \
291 || die "Failed to move ${x}"
292 fi
293 done
294 eend $?
295
296 if use classic || use gallium; then
297 ebegin "Moving DRI/Gallium drivers for dynamic switching"
298 local gallium_drivers=( i915_dri.so i965_dri.so r300_dri.so r600_dri.so swrast_dri.so )
299 keepdir /usr/$(get_libdir)/dri
300 dodir /usr/$(get_libdir)/mesa
301 for x in ${gallium_drivers[@]}; do
302 if [ -f "${S}/$(get_libdir)/gallium/${x}" ]; then
303 mv -f "${ED}/usr/$(get_libdir)/dri/${x}" "${ED}/usr/$(get_libdir)/dri/${x/_dri.so/g_dri.so}" \
304 || die "Failed to move ${x}"
305 insinto "/usr/$(get_libdir)/dri/"
306 if [ -f "${S}/$(get_libdir)/${x}" ]; then
307 insopts -m0755
308 doins "${S}/$(get_libdir)/${x}"
309 fi
310 fi
311 done
312 for x in "${ED}"/usr/$(get_libdir)/dri/*.so; do
313 if [ -f ${x} -o -L ${x} ]; then
314 mv -f "${x}" "${x/dri/mesa}" \
315 || die "Failed to move ${x}"
316 fi
317 done
318 pushd "${ED}"/usr/$(get_libdir)/dri || die "pushd failed"
319 ln -s ../mesa/*.so . || die "Creating symlink failed"
320 # remove symlinks to drivers known to eselect
321 for x in ${gallium_drivers[@]}; do
322 if [ -f ${x} -o -L ${x} ]; then
323 rm "${x}" || die "Failed to remove ${x}"
324 fi
325 done
326 popd
327 eend $?
328 fi
329 }
330
331 pkg_postinst() {
332 # Switch to the xorg implementation.
333 echo
334 eselect opengl set --use-old ${OPENGL_DIR}
335
336 # switch to xorg-x11 and back if necessary, bug #374647 comment 11
337 OLD_IMPLEM="$(eselect opengl show)"
338 if [[ ${OPENGL_DIR}x != ${OLD_IMPLEM}x ]]; then
339 eselect opengl set ${OPENGL_DIR}
340 eselect opengl set ${OLD_IMPLEM}
341 fi
342
343 # Select classic/gallium drivers
344 if use classic || use gallium; then
345 eselect mesa set --auto
346 fi
347
348 # warn about patent encumbered texture-float
349 if use !bindist; then
350 elog "USE=\"bindist\" was not set. Potentially patent encumbered code was"
351 elog "enabled. Please see patents.txt for an explanation."
352 fi
353
354 local using_radeon r_flag
355 for r_flag in ${RADEON_CARDS}; do
356 if use video_cards_${r_flag}; then
357 using_radeon=1
358 break
359 fi
360 done
361
362 if [[ ${using_radeon} = 1 ]] && ! has_version media-libs/libtxc_dxtn; then
363 elog "Note that in order to have full S3TC support, it is necessary to install"
364 elog "media-libs/libtxc_dxtn as well. This may be necessary to get nice"
365 elog "textures in some apps, and some others even require this to run."
366 fi
367 }
368
369 # $1 - VIDEO_CARDS flag
370 # other args - names of DRI drivers to enable
371 # TODO: avoid code duplication for a more elegant implementation
372 driver_enable() {
373 case $# in
374 # for enabling unconditionally
375 1)
376 DRI_DRIVERS+=",$1"
377 ;;
378 *)
379 if use $1; then
380 shift
381 for i in $@; do
382 DRI_DRIVERS+=",${i}"
383 done
384 fi
385 ;;
386 esac
387 }
388
389 gallium_enable() {
390 case $# in
391 # for enabling unconditionally
392 1)
393 GALLIUM_DRIVERS+=",$1"
394 ;;
395 *)
396 if use $1; then
397 shift
398 for i in $@; do
399 GALLIUM_DRIVERS+=",${i}"
400 done
401 fi
402 ;;
403 esac
404 }

  ViewVC Help
Powered by ViewVC 1.1.20