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 $
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
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/"
24 #SRC_PATCHES="mirror://gentoo/${P}-gentoo-patches-01.tar.bz2"
25 if [[ $PV = 9999* ]]; then
26 SRC_URI="${SRC_PATCHES}"
28 SRC_URI="ftp://ftp.freedesktop.org/pub/mesa/${PV}/${MY_SRC_P}.tar.bz2
34 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sh ~sparc ~x86 ~x86-fbsd"
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}"
41 IUSE="${IUSE_VIDEO_CARDS}
42 debug +gallium motif +nptl pic selinux +xcb kernel_FreeBSD"
44 # keep correct libdrm and dri2proto dep
45 # keep blocks in rdepend for binpkg
47 !<x11-base/xorg-server-1.7
48 !<=x11-proto/xf86driproto-2.0.3
49 >=app-admin/eselect-opengl-1.1.1-r2
51 >=x11-libs/libdrm-2.4.19
59 motif? ( x11-libs/openmotif )
64 >=x11-proto/dri2proto-2.2
65 >=x11-proto/glproto-1.4.11
67 >=x11-proto/xextproto-7.0.99.1
68 x11-proto/xf86driproto
69 x11-proto/xf86vidmodeproto
72 S="${WORKDIR}/${MY_P}"
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*"
79 # Think about: ggi, svga, fbcon, no-X configs
82 # gcc 4.2 has buggy ivopts
83 if [[ $(gcc-version) = "4.2" ]]; then
84 append-flags -fno-ivopts
87 # recommended by upstream
88 append-flags -ffast-math
92 [[ $PV = 9999* ]] && git_src_unpack || unpack ${A}
97 if [[ ${PV} != 9999* && -n ${SRC_PATCHES} ]]; then
99 EPATCH_SOURCE="${WORKDIR}/patches" \
100 EPATCH_SUFFIX="patch" \
103 # FreeBSD 6.* doesn't have posix_memalign().
104 [[ ${CHOST} == *-freebsd6.* ]] && \
105 sed -i -e "s/-DHAVE_POSIX_MEMALIGN//" configure.ac
107 epatch "${FILESDIR}/unfuck-mesa-78.patch"
115 # Configurable DRI drivers
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
129 myconf="${myconf} $(use_enable gallium)"
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."
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"
146 myconf="${myconf} --disable-gallium-radeon"
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."
155 # --with-driver=dri|xlib|osmesa || do we need osmesa?
157 --disable-option-checking \
161 $(use_enable debug) \
162 $(use_enable motif glw) \
163 $(use_enable motif) \
164 $(use_enable nptl glx-tls) \
166 $(use_enable !pic asm) \
167 --with-dri-drivers=${DRI_DRIVERS} \
172 emake DESTDIR="${D}" install || die "Installation failed"
174 # Remove redundant headers
176 rm -f "${D}"/usr/include/GL/glut*.h || die "Removing glut include failed."
178 rm -f "${D}"/usr/include/GL/{glew,glxew,wglew}.h \
179 || die "Removing glew includes failed."
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}
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}"
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}"
202 # Switch to the xorg implementation.
204 eselect opengl set --use-old ${OPENGL_DIR}
207 # $1 - VIDEO_CARDS flag
208 # other args - names of DRI drivers to enable
211 # for enabling unconditionally