]> git.draconx.ca Git - gentoo-draconx.git/blob - media-libs/mesa/mesa-7.7.1_rc2.ebuild
xf86-video-intel: Bump to 2.11.0 with revert fixing Xv corruption.
[gentoo-draconx.git] / media-libs / mesa / mesa-7.7.1_rc2.ebuild
1 # Copyright 1999-2010 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/media-libs/mesa/mesa-7.7.1_rc2.ebuild,v 1.1 2010/03/23 11:20:10 scarabeus Exp $
4
5 EAPI="2"
6
7 EGIT_REPO_URI="git://anongit.freedesktop.org/mesa/mesa"
8
9 if [[ ${PV} = 9999* ]]; then
10         GIT_ECLASS="git"
11         EXPERIMENTAL="true"
12 fi
13
14 inherit autotools multilib flag-o-matic ${GIT_ECLASS} portability versionator
15
16 OPENGL_DIR="xorg-x11"
17
18 MY_PN="${PN/m/M}"
19 MY_P="${MY_PN}-${PV/_/-}"
20 MAJOR_MINOR=$(get_version_component_range 1-2)
21 MY_SRC_P="${MY_PN}Lib-${PV/_/-}"
22 DESCRIPTION="OpenGL-like graphic library for Linux"
23 HOMEPAGE="http://mesa3d.sourceforge.net/"
24
25 #SRC_PATCHES="mirror://gentoo/${P}-gentoo-patches-01.tar.bz2"
26 if [[ $PV = 9999* ]]; then
27         SRC_URI="${SRC_PATCHES}"
28 else
29         SRC_URI="ftp://ftp.freedesktop.org/pub/mesa/${MAJOR_MINOR}/RC/${MY_SRC_P}.tar.bz2
30                 ${SRC_PATCHES}"
31 fi
32
33 LICENSE="LGPL-2"
34 SLOT="0"
35 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sh ~sparc ~x86 ~x86-fbsd"
36
37 VIDEO_CARDS="intel mach64 mga none nouveau r128 radeon radeonhd savage sis sunffb svga tdfx via"
38 for card in ${VIDEO_CARDS}; do
39         IUSE_VIDEO_CARDS+=" video_cards_${card}"
40 done
41
42 IUSE="${IUSE_VIDEO_CARDS}
43         debug +gallium motif +nptl pic selinux +xcb kernel_FreeBSD"
44
45 # keep correct libdrm and dri2proto dep
46 # keep blocks in rdepend for binpkg
47 RDEPEND="
48         !<x11-base/xorg-server-1.7
49         !<=x11-proto/xf86driproto-2.0.3
50         >=app-admin/eselect-opengl-1.1.1-r2
51         dev-libs/expat
52         >=x11-libs/libdrm-2.4.17
53         x11-libs/libICE
54         x11-libs/libX11[xcb?]
55         x11-libs/libXdamage
56         x11-libs/libXext
57         x11-libs/libXi
58         x11-libs/libXmu
59         x11-libs/libXxf86vm
60         motif? ( x11-libs/openmotif )
61 "
62 DEPEND="${RDEPEND}
63         dev-util/pkgconfig
64         x11-misc/makedepend
65         >=x11-proto/dri2proto-1.99.3
66         >=x11-proto/glproto-1.4.8
67         x11-proto/inputproto
68         >=x11-proto/xextproto-7.0.99.1
69         x11-proto/xf86driproto
70         x11-proto/xf86vidmodeproto
71 "
72
73 S="${WORKDIR}/${MY_P}"
74
75 # Think about: ggi, svga, fbcon, no-X configs
76
77 pkg_setup() {
78         # gcc 4.2 has buggy ivopts
79         if [[ $(gcc-version) = "4.2" ]]; then
80                 append-flags -fno-ivopts
81         fi
82
83         # recommended by upstream
84         append-flags -ffast-math
85 }
86
87 src_unpack() {
88         [[ $PV = 9999* ]] && git_src_unpack || unpack ${A}
89 }
90
91 src_prepare() {
92         # apply patches
93         if [[ ${PV} != 9999* && -n ${SRC_PATCHES} ]]; then
94                 EPATCH_FORCE="yes" \
95                 EPATCH_SOURCE="${WORKDIR}/patches" \
96                 EPATCH_SUFFIX="patch" \
97                 epatch
98         fi
99         # FreeBSD 6.* doesn't have posix_memalign().
100         [[ ${CHOST} == *-freebsd6.* ]] && \
101                 sed -i -e "s/-DHAVE_POSIX_MEMALIGN//" configure.ac
102
103         epatch "${FILESDIR}/0001-i965-Fix-the-response-len-of-masked-sampler-messages.patch"
104
105         eautoreconf
106 }
107
108 src_configure() {
109         local myconf r600
110
111         # Configurable DRI drivers
112         driver_enable swrast
113         driver_enable video_cards_intel i810 i915 i965
114         driver_enable video_cards_mach64 mach64
115         driver_enable video_cards_mga mga
116         driver_enable video_cards_r128 r128
117         # ATI has two implementations as video_cards
118         driver_enable video_cards_radeon radeon r200 r300 r600
119         driver_enable video_cards_radeonhd r300 r600
120         driver_enable video_cards_savage savage
121         driver_enable video_cards_sis sis
122         driver_enable video_cards_sunffb ffb
123         driver_enable video_cards_tdfx tdfx
124         driver_enable video_cards_via unichrome
125
126         myconf="${myconf} $(use_enable gallium)"
127         if use gallium; then
128                 elog "You have enabled gallium infrastructure."
129                 elog "This infrastructure currently support these drivers:"
130                 elog "    Intel: driver not really functional, thus disabled."
131                 elog "    Nouveau: only available implementation. Experimental Quality."
132                 elog "    Radeon: implementation up to the r500. Testing Quality."
133                 elog "    Svga: VMWare Virtual GPU driver. Hic sunt leones."
134                 echo
135                 myconf="${myconf}
136                         --disable-gallium-intel
137                         --with-state-trackers=glx,dri,egl
138                         $(use_enable video_cards_svga gallium-svga)
139                         $(use_enable video_cards_nouveau gallium-nouveau)"
140                         #$(use_enable video_cards_intel gallium-intel)"
141                 if use video_cards_radeon || use video_cards_radeonhd; then
142                         myconf="${myconf} --enable-gallium-radeon"
143                 else
144                         myconf="${myconf} --disable-gallium-radeon"
145                 fi
146         else
147                 if use video_cards_nouveau || use video_cards_svga; then
148                         elog "SVGA and nouveau drivers are available only via gallium interface."
149                         elog "Enable gallium useflag if you insist to use them."
150                 fi
151         fi
152
153         # --with-driver=dri|xlib|osmesa || do we need osmesa?
154         econf \
155                 --disable-option-checking \
156                 --with-driver=dri \
157                 --disable-glut \
158                 --without-demos \
159                 $(use_enable debug) \
160                 $(use_enable motif glw) \
161                 $(use_enable motif) \
162                 $(use_enable nptl glx-tls) \
163                 $(use_enable xcb) \
164                 $(use_enable !pic asm) \
165                 --with-dri-drivers=${DRI_DRIVERS} \
166                 ${myconf}
167 }
168
169 src_install() {
170         dodir /usr
171         emake DESTDIR="${D}" install || die "Installation failed"
172
173         # Remove redundant headers
174         # GLUT thing
175         rm -f "${D}"/usr/include/GL/glut*.h || die "Removing glut include failed."
176         # Glew includes
177         rm -f "${D}"/usr/include/GL/{glew,glxew,wglew}.h \
178                 || die "Removing glew includes failed."
179
180         # Move libGL and others from /usr/lib to /usr/lib/opengl/blah/lib
181         # because user can eselect desired GL provider.
182         ebegin "Moving libGL and friends for dynamic switching"
183                 dodir /usr/$(get_libdir)/opengl/${OPENGL_DIR}/{lib,extensions,include}
184                 local x
185                 for x in "${D}"/usr/$(get_libdir)/libGL.{la,a,so*}; do
186                         if [ -f ${x} -o -L ${x} ]; then
187                                 mv -f ${x} "${D}"/usr/$(get_libdir)/opengl/${OPENGL_DIR}/lib \
188                                         || die "Failed to move ${x}"
189                         fi
190                 done
191                 for x in "${D}"/usr/include/GL/{gl.h,glx.h,glext.h,glxext.h}; do
192                         if [ -f ${x} -o -L ${x} ]; then
193                                 mv -f ${x} "${D}"/usr/$(get_libdir)/opengl/${OPENGL_DIR}/include \
194                                         || die "Failed to move ${x}"
195                         fi
196                 done
197         eend $?
198 }
199
200 pkg_postinst() {
201         # Switch to the xorg implementation.
202         echo
203         eselect opengl set --use-old ${OPENGL_DIR}
204 }
205
206 # $1 - VIDEO_CARDS flag
207 # other args - names of DRI drivers to enable
208 driver_enable() {
209         case $# in
210                 # for enabling unconditionally
211                 1)
212                         DRI_DRIVERS+=",$1"
213                         ;;
214                 *)
215                         if use $1; then
216                                 shift
217                                 for i in $@; do
218                                         DRI_DRIVERS+=",${i}"
219                                 done
220                         fi
221                         ;;
222         esac
223 }