# $Id: mesa-7.8.1-r1.smage2 5292 2010-04-20 19:02:07Z niro $ PNAME="mesa" PVER="7.8.1" PBUILD="r1" PCATEGORIE="media-libs" STATE="unstable" DESCRIPTION="Mesa3D OpenGL graphics library." HOMEPAGE="http://mesa3d.sourceforge.net/" DEPEND=">= dev-libs/expat-2 >= x11-libs/libX11-1 >= x11-libs/libXext-1 >= x11-libs/libXxf86vm-1 >= x11-libs/libXi-1 >= x11-libs/libXmu-1 >= x11-libs/libdrm-2.4 >= x11-libs/libICE-1 >= x11-base/opengl-update-magellan-2.2.9 >= x11-libs/libxcb-1 >= x11-libs/libXfixes-4 >= x11-libs/libXdamage-1" SDEPEND=">= dev-util/pkgconfig-0.23 >= x11-misc/makedepend-1 >= x11-proto/xf86vidmodeproto-2.3 >= x11-libs/libXxf86vm-1.1 >= x11-proto/glproto-1.4.9 >= x11-proto/inputproto-1 >= x11-proto/xextproto-7 >= x11-proto/xf86driproto-2 >= x11-proto/dri2proto-2.0 >= x11-proto/xcb-proto-1 >= x11-proto/xproto-7 >= x11-proto/fixesproto-4 >= x11-proto/damageproto-1" PROVIDE="virtual/opengl" # must be set before the include of multilib! EMUL_LINUX_32=true sminclude xorg mtools multilib mcore # must be set *after* the include of xorg! SRCFILE="MesaLib-${PVER/_/-}.tar.gz" SRCDIR="${BUILDDIR}/Mesa-${PVER/_/-}" SRC_URI=( ftp://ftp.freedesktop.org/pub/mesa/${PVER}/${SRCFILE} sourceforge://mesa3d/${SRCFILE} mirror://${PNAME}/${SRCFILE} mirror://${PNAME}/libGLU.la mirror://${PNAME}/libGL.la ) UP2DATE="updatecmd_sourceforge mesa3d MesaLib" src_prepare() { munpack ${SRCFILE} || die # no debug code in the drives (gentoo) all-abis 'find src/mesa/drivers/dri -name *.[hc] -exec egrep -l "\#define\W+DO_DEBUG\W+1" {} \; | xargs sed -i -re "s/\#define\W+DO_DEBUG\W+1/\#define DO_DEBUG 0/" ;' # get rid of glut includes all-abis rm -f include/GL/glut*h || die } src_compile() { # gallium is highly experimental, disabled atm! mconfigure \ --with-driver=dri \ --with-dri-driverdir=/usr/'$(mlibdir)'/dri \ --disable-debug \ --disable-glut \ --disable-ttm-api \ --without-demos \ --enable-glx-tls \ --enable-asm \ --enable-xcb \ --enable-glw \ --disable-gallium \ || die # only build software renderer on multilib arches if [[ ${ARCH} = x86_64 ]] then only-m32 "echo 'DRI_DIRS =' >> configs/autoconf" || die fi mmake || die } src_install() { # needed directories minstalldir /etc/env.d || die mmake DESTDIR=${BINDIR} install || die # missing gl headers minstallfile src/glw/GLwDrawA.h /usr/include/GL || die # remove private headers rm -f ${BINDIR}/usr/include/GL/GLw*P.h || die for abi in ${MULTILIB_ABIS} do [[ ${abi} = m32 ]] && ABI_LIBDIR="lib" [[ ${abi} = m64 ]] && ABI_LIBDIR="lib64" cd ${SRCDIR}-${abi} # fix opengl-symlinks # first remove invalid symlinks find ${BINDIR}/usr/$(mlibdir) -name libGL\.* -type l | xargs rm -f # now create required opengl-symlinks mlink libGL.so.1.2 /usr/$(mlibdir)/libGL.so || die mlink libGL.so.1.2 /usr/$(mlibdir)/libGL.so.1 || die # now setup dynamic opengl minstalldir /usr/$(mlibdir)/opengl/xorg/lib || die minstalldir /usr/$(mlibdir)/opengl/xorg/extensions || die minstalldir /usr/$(mlibdir)/opengl/xorg/include || die local x for x in ${BINDIR}/usr/$(mlibdir)/libGL.so* \ ${BINDIR}/usr/$(mlibdir)/libGL.la \ ${BINDIR}/usr/$(mlibdir)/libGL.a do if [ -f ${x} -o -L ${x} ] then # libGL.a cause problems with tuxracer, etc mv -f ${x} ${BINDIR}/usr/$(mlibdir)/opengl/xorg/lib || die "${x}" fi done for x in ${BINDIR}/usr/include/GL/{gl.h,glx.h,glext.h,glxext.h} do if [ -f ${x} -o -L ${x} ] then mv -f ${x} ${BINDIR}/usr/$(mlibdir)/opengl/xorg/include || die "${x}" fi done # satisfy libtool minstallfile -s libGLU.la /usr/$(mlibdir) || die minstallfile -s libGL.la /usr/$(mlibdir)/opengl/xorg/lib || die # fix libdir on 64bit arches if [[ $(mlibdir) != lib ]] then sed -i "s:/usr/lib:/usr/$(mlibdir):g" ${BINDIR}/usr/$(mlibdir)/libGLU.la || die sed -i "s:/usr/lib:/usr/$(mlibdir):g" ${BINDIR}/usr/$(mlibdir)/opengl/xorg/lib/libGL.la || die fi # create the two-number versioned libs (.so.#.#), since only .so.# and # .so.#.#.# were made local x for x in ${BINDIR}/usr/$(mlibdir)/libGLU.so.*.*.* \ ${BINDIR}/usr/$(mlibdir)/libGLw.so.*.*.* do local lib_name_dot3="$(basename $(ls ${x}))" local lib_name_dot2="${lib_name_dot3%.*}" local lib_name_dot1="${lib_name_dot2%.*}" local lib_name_dot0="${lib_name_dot1%.*}" mlink ${lib_name_dot3} /usr/$(mlibdir)/${lib_name_dot2} || die "${x}" mlink ${lib_name_dot3} /usr/$(mlibdir)/${lib_name_dot1} || die "${x}" mlink ${lib_name_dot3} /usr/$(mlibdir)/${lib_name_dot0} || die "${x}" done # export LIBGL_DRIVER_PATH location. # we are using '/usr/lib/dri' as hardcoded location. # but nvidia and ati are using '/usr/$(mlibdir)/xorg/modules/dri' # LIBGL_DRIVER_PATH overwrites the hardcoded location and # if nvidia or ati driver are installed # the dri modules will never be found by libGL # use "LIBGL_DEBUG=verbose glxinfo" to check this issue echo "LIBGL_DRIVERS_PATH=/usr/$(mlibdir)/dri" > ${BINDIR}/etc/env.d/09mesa-${abi} || die done } postinstall() { ${MROOT}/usr/sbin/opengl-update --use-old xorg }