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

Contents of /media-libs/mesa/mesa-8.1_rc1_pre20120724.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations) (download)
Tue Jul 24 22:25:36 2012 UTC (9 months, 3 weeks ago) by chithanh
Branch: MAIN
New snapshot.

(Portage version: 2.2.0_alpha115/cvs/Linux x86_64)

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

  ViewVC Help
Powered by ViewVC 1.1.13