mesa/mesa.spec

Tue, 29 Mar 2011 20:04:34 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 29 Mar 2011 20:04:34 +0200
changeset 334
4a34d7a82eab
parent 51
64165e101f08
child 616
1cbb05665045
permissions
-rw-r--r--

Rework package yet again, correcting and introducing new buildconf logic:
Conditionally disable bootstrap stage comparison correctly, correct
english grammar, better find system as(1) and ld(1), indotruce detailed
optimization option messages, more completely guess cpu types, allow
profiled bootstrapping without a preinstalled GCC because many other
compilers have long since implemented 64-bit arithmetic, instruct make
to build sequentially (not in sparallel) when building a profiled
bootstrap as GCC online documents recommend, and generally improve
comment blocks.

The single most important correction in this changeset relates to the
GCC changed optimization policy since at least GCC 4.5, in which -march
is always passed and not always correctly guessed. In the case of this
package, allowing GCC to guess the architecture leads to wild build
errors at various subcomponents (zlib, libgcc, libiberty...) and
bootstrap stages. It seems quite platform specific, and the safest
approach to correcting this seems to be explicitly always specifying the
-march argument when bootstrapping GCC. Because the best choice 'native'
is not available when bootstrapping using a foreign (non GCC) compiler,
a guess is made according to rpmmacros l_platform in that case.

It is questionable as to whether these recent optimization changes
on the part of GCC or this package are compatible with each other,
or if either are complete or correct at all. At least applying these
corrections allows this package to build again in most cases test.

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

mercurial