Thu, 08 Jan 2009 22:06:06 +0100
Remove usage of SUN_LEN thereby increasing portability.
1 ##
2 ## mesa.spec -- OpenPKG RPM Package Specification
3 ## Copyright (c) 2000-2008 OpenPKG Foundation e.V. <http://openpkg.net/>
4 ##
5 ## Permission to use, copy, modify, and distribute this software for
6 ## any purpose with or without fee is hereby granted, provided that
7 ## the above copyright notice and this permission notice appear in all
8 ## copies.
9 ##
10 ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
11 ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
12 ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
13 ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
14 ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
15 ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
16 ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
17 ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
18 ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
19 ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
20 ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
21 ## SUCH DAMAGE.
22 ##
24 # package information
25 Name: mesa
26 Summary: OpenGL Toolkit
27 URL: http://www.mesa3d.org/
28 Vendor: Brian Paul
29 Packager: OpenPKG Foundation e.V.
30 Distribution: OpenPKG Community
31 Class: EVAL
32 Group: XWindow
33 License: LGPL
34 Version: 7.2
35 Release: 20090106
37 # package options
38 %option with_demos no
40 # list of sources
41 Source0: http://osdn.dl.sourceforge.net/sourceforge/mesa3d/MesaLib-%{version}.tar.bz2
42 Source1: http://osdn.dl.sourceforge.net/sourceforge/mesa3d/MesaGLUT-%{version}.tar.bz2
43 Source2: http://osdn.dl.sourceforge.net/sourceforge/mesa3d/MesaDemos-%{version}.tar.bz2
44 Patch0: mesa.patch
46 # build information
47 Prefix: %{l_prefix}
48 BuildRoot: %{l_buildroot}
49 BuildPreReq: OpenPKG, openpkg >= 20040130
50 PreReq: OpenPKG, openpkg >= 20040130
51 BuildPreReq: X11, gcc, make, autoconf, binutils
52 PreReq: X11
53 AutoReq: no
54 AutoReqProv: no
56 %description
57 Mesa is a full-featured 3D graphics rendering library providing the
58 official OpenGL 2.0 and OpenGL 2.1 APIs. A variety of device drivers
59 allow Mesa to be used in many different environments ranging from
60 software emulation to complete hardware acceleration for modern
61 GPUs.
63 %track
64 prog mesa:MesaLib = {
65 version = %{version}
66 url = http://prdownloads.sourceforge.net/mesa3d/
67 regex = MesaLib-(7\.\d+(?:\.\d+)?)\.tar\.bz2
68 }
69 prog mesa:MesaGLUT = {
70 version = %{version}
71 url = http://prdownloads.sourceforge.net/mesa3d/
72 regex = MesaGLUT-(7\.\d+(?:\.\d+)?)\.tar\.bz2
73 }
74 prog mesa:MesaDemos = {
75 version = %{version}
76 url = http://prdownloads.sourceforge.net/mesa3d/
77 regex = MesaDemos-(7\.\d+(?:\.\d+)?)\.tar\.bz2
78 }
80 %prep
81 # announce exceptional build requirements
82 ( echo "This package has exceptional storage requirements:"
83 echo " mesa-%{version}-root (500 Mo)"
84 echo " Mesa-%{version} (3,5 Go)"
85 echo " mesa-%{version}-<date>.<arch>-<os>-<tag>.rpm (200 Mo)"
86 ) | %{l_rpmtool} msg -b -t notice
88 %setup -q -n Mesa-%{version}
89 %setup -q -n Mesa-%{version} -T -D -b 1
90 %patch -p0
91 %if "%{with_demos}" == "yes"
92 %setup -q -n Mesa-%{version} -T -D -b 2
93 %endif
94 %{l_shtool} subst \
95 -e "s;@l_x11bindir@;`%{l_rc} --query x11_bindir`;g" \
96 configs/default
97 %{l_shtool} subst \
98 -e "s;^\(CC\ \ *=\).*;\1 %{l_cc};" \
99 -e "s;^\(CXX\ \ *=\).*;\1 %{l_cxx};" \
100 -e "s;^\(CFLAGS\ \ *=\)\(.*\);\1 %{l_cflags -O}\2;" \
101 -e "s;^\(CXXFLAGS\ \ *=\)\(.*\);\1 %{l_cxxflags -O}\2;" \
102 -e "s;^\(CPPFLAGS\ \ *=\)\(.*\);\1 %{l_cppflags}\2;" \
103 -e "s;^\(LDFLAGS\ \ *=\)\(.*\);\1 %{l_ldflags}\2;" \
104 configs/*
105 %{l_shtool} subst \
106 -e 's;^\(EXTRA_LIB_PATH\ *=.*\);\1 -L$(X11LIB_DIR);' \
107 configs/*
108 %{l_shtool} subst \
109 -e "s;\.\./images/;%{l_prefix}/lib/mesa/images/;" \
110 `find . -name '*.c' -o -name '*.cxx'`
112 %build
113 case "%{l_platform -t}" in
114 *-freebsd* ) plat="freebsd" ;;
115 *-netbsd* ) plat="netbsd" ;;
116 i?86*-linux* ) plat="linux-x86-static" ;;
117 *-linux* ) plat="linux-static" ;;
118 i?86*-sunos* ) plat="solaris-x86-gcc" ;;
119 *-sunos* ) plat="sunos5-gcc" ;;
120 * ) echo "platform %{l_platform -t} not supported" 2>&1; exit 1; ;;
121 esac
123 # begin building broken mesa build logic
124 ( cd configs && rm -f current && ln -s $plat current )
125 ( cd src
126 CC="%{l_cc}" \
127 CXX="%{l_cxx}" \
128 CFLAGS="%{l_cflags -O}" \
129 CXXFLAGS="%{l_cxxflags -O}" \
130 CPPFLAGS="%{l_cppflags}" \
131 LDFLAGS="%{l_ldflags}" \
132 X11LIB_DIR="`%{l_rc} --query x11_libdir`" \
133 %{l_make} %{l_mflags -O} \
134 SHELL="%{l_bash}"
135 ) || exit $?
137 # correct broken mesa archive logic
138 %{l_shtool} mkdir -f -p -m 755 temphack
139 ( cd temphack
140 %{l_prefix}/bin/ar -x ../src/mesa/libglapi.a
141 %{l_prefix}/bin/ar -x ../src/mesa/libmesa.a
142 %{l_prefix}/bin/ar -d ../lib/libGL.a libglapi.a libmesa.a
143 %{l_prefix}/bin/ar -ru ../lib/libGL.a *.o
144 ) || exit $?
146 %if "%{with_demos}" == "yes"
147 # continue building with corrected mesa library
148 ( cd progs
149 CC="%{l_cc}" \
150 CXX="%{l_cxx}" \
151 CFLAGS="%{l_cflags -O}" \
152 CXXFLAGS="%{l_cxxflags -O}" \
153 CPPFLAGS="%{l_cppflags}" \
154 LDFLAGS="%{l_ldflags}" \
155 X11LIB_DIR="`%{l_rc} --query x11_libdir`" \
156 %{l_make} %{l_mflags -O} \
157 SHELL="%{l_bash}"
158 ) || exit $?
159 %endif
161 %install
162 rm -rf $RPM_BUILD_ROOT
163 %{l_shtool} mkdir -f -p -m 755 \
164 $RPM_BUILD_ROOT%{l_prefix}/lib \
165 $RPM_BUILD_ROOT%{l_prefix}/include/GL
166 %{l_shtool} install -c -m 644 \
167 lib/* $RPM_BUILD_ROOT%{l_prefix}/lib/
168 %{l_shtool} install -c -m 644 \
169 include/GL/*.h $RPM_BUILD_ROOT%{l_prefix}/include/GL/
170 %if "%{with_demos}" == "yes"
171 %{l_shtool} mkdir -f -p -m 755 \
172 $RPM_BUILD_ROOT%{l_prefix}/lib/mesa/demos \
173 $RPM_BUILD_ROOT%{l_prefix}/lib/mesa/images
174 %{l_shtool} install -s -c -m 755 \
175 `find progs/demos/ -type f -prune -perm 755 -print` \
176 `find progs/redbook/ -type f -prune -perm 755 -print` \
177 `find progs/samples/ -type f -prune -perm 755 -print` \
178 `find progs/xdemos/ -type f -prune -perm 755 -print` \
179 $RPM_BUILD_ROOT%{l_prefix}/lib/mesa/demos/
180 %{l_shtool} install -c -m 644 \
181 progs/images/* $RPM_BUILD_ROOT%{l_prefix}/lib/mesa/images/
182 %endif
183 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
185 %files -f files
187 %clean
188 rm -rf $RPM_BUILD_ROOT