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