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 $
7 EGIT_REPO_URI="git://anongit.freedesktop.org/mesa/mesa"
9 if [[ ${PV} = 9999* ]]; then
14 inherit autotools multilib flag-o-matic ${GIT_ECLASS} portability versionator
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/"
25 #SRC_PATCHES="mirror://gentoo/${P}-gentoo-patches-01.tar.bz2"
26 if [[ $PV = 9999* ]]; then
27 SRC_URI="${SRC_PATCHES}"
29 SRC_URI="ftp://ftp.freedesktop.org/pub/mesa/${MAJOR_MINOR}/RC/${MY_SRC_P}.tar.bz2
35 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sh ~sparc ~x86 ~x86-fbsd"
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}"
42 IUSE="${IUSE_VIDEO_CARDS}
43 debug +gallium motif +nptl pic selinux +xcb kernel_FreeBSD"
45 # keep correct libdrm and dri2proto dep
46 # keep blocks in rdepend for binpkg
48 !<x11-base/xorg-server-1.7
49 !<=x11-proto/xf86driproto-2.0.3
50 >=app-admin/eselect-opengl-1.1.1-r2
52 >=x11-libs/libdrm-2.4.17
60 motif? ( x11-libs/openmotif )
65 >=x11-proto/dri2proto-1.99.3
66 >=x11-proto/glproto-1.4.8
68 >=x11-proto/xextproto-7.0.99.1
69 x11-proto/xf86driproto
70 x11-proto/xf86vidmodeproto
73 S="${WORKDIR}/${MY_P}"
75 # Think about: ggi, svga, fbcon, no-X configs
78 # gcc 4.2 has buggy ivopts
79 if [[ $(gcc-version) = "4.2" ]]; then
80 append-flags -fno-ivopts
83 # recommended by upstream
84 append-flags -ffast-math
88 [[ $PV = 9999* ]] && git_src_unpack || unpack ${A}
93 if [[ ${PV} != 9999* && -n ${SRC_PATCHES} ]]; then
95 EPATCH_SOURCE="${WORKDIR}/patches" \
96 EPATCH_SUFFIX="patch" \
99 # FreeBSD 6.* doesn't have posix_memalign().
100 [[ ${CHOST} == *-freebsd6.* ]] && \
101 sed -i -e "s/-DHAVE_POSIX_MEMALIGN//" configure.ac
103 epatch "${FILESDIR}/0001-i965-Fix-the-response-len-of-masked-sampler-messages.patch"
111 # Configurable DRI drivers
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
126 myconf="${myconf} $(use_enable gallium)"
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."
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"
144 myconf="${myconf} --disable-gallium-radeon"
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."
153 # --with-driver=dri|xlib|osmesa || do we need osmesa?
155 --disable-option-checking \
159 $(use_enable debug) \
160 $(use_enable motif glw) \
161 $(use_enable motif) \
162 $(use_enable nptl glx-tls) \
164 $(use_enable !pic asm) \
165 --with-dri-drivers=${DRI_DRIVERS} \
171 emake DESTDIR="${D}" install || die "Installation failed"
173 # Remove redundant headers
175 rm -f "${D}"/usr/include/GL/glut*.h || die "Removing glut include failed."
177 rm -f "${D}"/usr/include/GL/{glew,glxew,wglew}.h \
178 || die "Removing glew includes failed."
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}
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}"
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}"
201 # Switch to the xorg implementation.
203 eselect opengl set --use-old ${OPENGL_DIR}
206 # $1 - VIDEO_CARDS flag
207 # other args - names of DRI drivers to enable
210 # for enabling unconditionally