michael@34: ##
michael@34: ## mesa.spec -- OpenPKG RPM Package Specification
michael@34: ## Copyright (c) 2000-2008 OpenPKG Foundation e.V.
michael@34: ##
michael@34: ## Permission to use, copy, modify, and distribute this software for
michael@34: ## any purpose with or without fee is hereby granted, provided that
michael@34: ## the above copyright notice and this permission notice appear in all
michael@34: ## copies.
michael@34: ##
michael@34: ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
michael@34: ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
michael@34: ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
michael@34: ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
michael@34: ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
michael@34: ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
michael@34: ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
michael@34: ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
michael@34: ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
michael@34: ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
michael@34: ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
michael@34: ## SUCH DAMAGE.
michael@34: ##
michael@34:
michael@34: # package information
michael@34: Name: mesa
michael@34: Summary: OpenGL Toolkit
michael@34: URL: http://www.mesa3d.org/
michael@34: Vendor: Brian Paul
michael@34: Packager: OpenPKG Foundation e.V.
michael@34: Distribution: OpenPKG Community
michael@34: Class: EVAL
michael@34: Group: XWindow
michael@34: License: LGPL
michael@34: Version: 7.2
michael@35: Release: 20090106
michael@34:
michael@34: # package options
michael@34: %option with_demos no
michael@34:
michael@34: # list of sources
michael@34: Source0: http://osdn.dl.sourceforge.net/sourceforge/mesa3d/MesaLib-%{version}.tar.bz2
michael@34: Source1: http://osdn.dl.sourceforge.net/sourceforge/mesa3d/MesaGLUT-%{version}.tar.bz2
michael@34: Source2: http://osdn.dl.sourceforge.net/sourceforge/mesa3d/MesaDemos-%{version}.tar.bz2
michael@34: Patch0: mesa.patch
michael@34:
michael@34: # build information
michael@34: Prefix: %{l_prefix}
michael@34: BuildRoot: %{l_buildroot}
michael@34: BuildPreReq: OpenPKG, openpkg >= 20040130
michael@34: PreReq: OpenPKG, openpkg >= 20040130
michael@34: BuildPreReq: X11, gcc, make, autoconf, binutils
michael@34: PreReq: X11
michael@34: AutoReq: no
michael@34: AutoReqProv: no
michael@34:
michael@34: %description
michael@34: Mesa is a full-featured 3D graphics rendering library providing the
michael@34: official OpenGL 2.0 and OpenGL 2.1 APIs. A variety of device drivers
michael@34: allow Mesa to be used in many different environments ranging from
michael@34: software emulation to complete hardware acceleration for modern
michael@34: GPUs.
michael@34:
michael@34: %track
michael@34: prog mesa:MesaLib = {
michael@34: version = %{version}
michael@34: url = http://prdownloads.sourceforge.net/mesa3d/
michael@34: regex = MesaLib-(7\.\d+(?:\.\d+)?)\.tar\.bz2
michael@34: }
michael@34: prog mesa:MesaGLUT = {
michael@34: version = %{version}
michael@34: url = http://prdownloads.sourceforge.net/mesa3d/
michael@34: regex = MesaGLUT-(7\.\d+(?:\.\d+)?)\.tar\.bz2
michael@34: }
michael@34: prog mesa:MesaDemos = {
michael@34: version = %{version}
michael@34: url = http://prdownloads.sourceforge.net/mesa3d/
michael@34: regex = MesaDemos-(7\.\d+(?:\.\d+)?)\.tar\.bz2
michael@34: }
michael@34:
michael@34: %prep
michael@34: # announce exceptional build requirements
michael@34: ( echo "This package has exceptional storage requirements:"
michael@34: echo " mesa-%{version}-root (500 Mo)"
michael@34: echo " Mesa-%{version} (3,5 Go)"
michael@34: echo " mesa-%{version}-.--.rpm (200 Mo)"
michael@34: ) | %{l_rpmtool} msg -b -t notice
michael@34:
michael@34: %setup -q -n Mesa-%{version}
michael@34: %setup -q -n Mesa-%{version} -T -D -b 1
michael@34: %patch -p0
michael@34: %if "%{with_demos}" == "yes"
michael@34: %setup -q -n Mesa-%{version} -T -D -b 2
michael@34: %endif
michael@34: %{l_shtool} subst \
michael@34: -e "s;@l_x11bindir@;`%{l_rc} --query x11_bindir`;g" \
michael@34: configs/default
michael@34: %{l_shtool} subst \
michael@34: -e "s;^\(CC\ \ *=\).*;\1 %{l_cc};" \
michael@34: -e "s;^\(CXX\ \ *=\).*;\1 %{l_cxx};" \
michael@34: -e "s;^\(CFLAGS\ \ *=\)\(.*\);\1 %{l_cflags -O}\2;" \
michael@34: -e "s;^\(CXXFLAGS\ \ *=\)\(.*\);\1 %{l_cxxflags -O}\2;" \
michael@34: -e "s;^\(CPPFLAGS\ \ *=\)\(.*\);\1 %{l_cppflags}\2;" \
michael@34: -e "s;^\(LDFLAGS\ \ *=\)\(.*\);\1 %{l_ldflags}\2;" \
michael@34: configs/*
michael@34: %{l_shtool} subst \
michael@34: -e 's;^\(EXTRA_LIB_PATH\ *=.*\);\1 -L$(X11LIB_DIR);' \
michael@34: configs/*
michael@34: %{l_shtool} subst \
michael@34: -e "s;\.\./images/;%{l_prefix}/lib/mesa/images/;" \
michael@35: `find . -name '*.c' -o -name '*.cxx'`
michael@34:
michael@34: %build
michael@34: case "%{l_platform -t}" in
michael@34: *-freebsd* ) plat="freebsd" ;;
michael@34: *-netbsd* ) plat="netbsd" ;;
michael@34: i?86*-linux* ) plat="linux-x86-static" ;;
michael@34: *-linux* ) plat="linux-static" ;;
michael@34: i?86*-sunos* ) plat="solaris-x86-gcc" ;;
michael@34: *-sunos* ) plat="sunos5-gcc" ;;
michael@34: * ) echo "platform %{l_platform -t} not supported" 2>&1; exit 1; ;;
michael@34: esac
michael@34:
michael@34: # begin building broken mesa build logic
michael@34: ( cd configs && rm -f current && ln -s $plat current )
michael@34: ( cd src
michael@34: CC="%{l_cc}" \
michael@34: CXX="%{l_cxx}" \
michael@34: CFLAGS="%{l_cflags -O}" \
michael@34: CXXFLAGS="%{l_cxxflags -O}" \
michael@34: CPPFLAGS="%{l_cppflags}" \
michael@34: LDFLAGS="%{l_ldflags}" \
michael@34: X11LIB_DIR="`%{l_rc} --query x11_libdir`" \
michael@34: %{l_make} %{l_mflags -O} \
michael@34: SHELL="%{l_bash}"
michael@34: ) || exit $?
michael@34:
michael@34: # correct broken mesa archive logic
michael@34: %{l_shtool} mkdir -f -p -m 755 temphack
michael@34: ( cd temphack
michael@34: %{l_prefix}/bin/ar -x ../src/mesa/libglapi.a
michael@34: %{l_prefix}/bin/ar -x ../src/mesa/libmesa.a
michael@34: %{l_prefix}/bin/ar -d ../lib/libGL.a libglapi.a libmesa.a
michael@34: %{l_prefix}/bin/ar -ru ../lib/libGL.a *.o
michael@34: ) || exit $?
michael@34:
michael@34: %if "%{with_demos}" == "yes"
michael@34: # continue building with corrected mesa library
michael@34: ( cd progs
michael@34: CC="%{l_cc}" \
michael@34: CXX="%{l_cxx}" \
michael@34: CFLAGS="%{l_cflags -O}" \
michael@34: CXXFLAGS="%{l_cxxflags -O}" \
michael@34: CPPFLAGS="%{l_cppflags}" \
michael@34: LDFLAGS="%{l_ldflags}" \
michael@34: X11LIB_DIR="`%{l_rc} --query x11_libdir`" \
michael@34: %{l_make} %{l_mflags -O} \
michael@34: SHELL="%{l_bash}"
michael@34: ) || exit $?
michael@34: %endif
michael@34:
michael@34: %install
michael@34: rm -rf $RPM_BUILD_ROOT
michael@34: %{l_shtool} mkdir -f -p -m 755 \
michael@34: $RPM_BUILD_ROOT%{l_prefix}/lib \
michael@34: $RPM_BUILD_ROOT%{l_prefix}/include/GL
michael@34: %{l_shtool} install -c -m 644 \
michael@34: lib/* $RPM_BUILD_ROOT%{l_prefix}/lib/
michael@34: %{l_shtool} install -c -m 644 \
michael@34: include/GL/*.h $RPM_BUILD_ROOT%{l_prefix}/include/GL/
michael@34: %if "%{with_demos}" == "yes"
michael@34: %{l_shtool} mkdir -f -p -m 755 \
michael@34: $RPM_BUILD_ROOT%{l_prefix}/lib/mesa/demos \
michael@34: $RPM_BUILD_ROOT%{l_prefix}/lib/mesa/images
michael@34: %{l_shtool} install -s -c -m 755 \
michael@34: `find progs/demos/ -type f -prune -perm 755 -print` \
michael@34: `find progs/redbook/ -type f -prune -perm 755 -print` \
michael@34: `find progs/samples/ -type f -prune -perm 755 -print` \
michael@34: `find progs/xdemos/ -type f -prune -perm 755 -print` \
michael@34: $RPM_BUILD_ROOT%{l_prefix}/lib/mesa/demos/
michael@34: %{l_shtool} install -c -m 644 \
michael@34: progs/images/* $RPM_BUILD_ROOT%{l_prefix}/lib/mesa/images/
michael@34: %endif
michael@34: %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
michael@34:
michael@34: %files -f files
michael@34:
michael@34: %clean
michael@34: rm -rf $RPM_BUILD_ROOT
michael@34: