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.

     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:  make, gcc, gcc::with_cxx = yes, autoconf, binutils
    52 BuildPreReq:  X11
    53 PreReq:       X11
    54 AutoReq:      no
    55 AutoReqProv:  no
    57 %description
    58     Mesa is a full-featured 3D graphics rendering library providing the
    59     official OpenGL 2.0 and OpenGL 2.1 APIs. A variety of device drivers
    60     allow Mesa to be used in many different environments ranging from
    61     software emulation to complete hardware acceleration for modern
    62     GPUs.
    64 %track
    65     prog mesa:MesaLib = {
    66         version   = %{version}
    67         url       = http://prdownloads.sourceforge.net/mesa3d/
    68         regex     = MesaLib-(7\.\d+(?:\.\d+)?)\.tar\.bz2
    69     }
    70     prog mesa:MesaGLUT = {
    71         version   = %{version}
    72         url       = http://prdownloads.sourceforge.net/mesa3d/
    73         regex     = MesaGLUT-(7\.\d+(?:\.\d+)?)\.tar\.bz2
    74     }
    75     prog mesa:MesaDemos = {
    76         version   = %{version}
    77         url       = http://prdownloads.sourceforge.net/mesa3d/
    78         regex     = MesaDemos-(7\.\d+(?:\.\d+)?)\.tar\.bz2
    79     }
    81 %prep
    82     #   announce exceptional build requirements
    83     ( echo "This package has exceptional storage requirements:"
    84       echo "  mesa-%{version}-root (500 Mo)"
    85       echo "  Mesa-%{version} (3,5 Go)"
    86       echo "  mesa-%{version}-<date>.<arch>-<os>-<tag>.rpm (200 Mo)"
    87     ) | %{l_rpmtool} msg -b -t notice
    89     %setup -q -n Mesa-%{version}
    90     %setup -q -n Mesa-%{version} -T -D -b 1
    91     %patch -p0
    92 %if "%{with_demos}" == "yes"
    93     %setup -q -n Mesa-%{version} -T -D -b 2
    94 %endif
    95     %{l_shtool} subst \
    96         -e "s;@l_x11bindir@;`%{l_rc} --query x11_bindir`;g" \
    97         configs/default
    98     %{l_shtool} subst \
    99         -e "s;^\(CC\ \ *=\).*;\1 %{l_cc};" \
   100         -e "s;^\(CXX\ \ *=\).*;\1 %{l_cxx};" \
   101         -e "s;^\(CFLAGS\ \ *=\)\(.*\);\1 %{l_cflags -O}\2;" \
   102         -e "s;^\(CXXFLAGS\ \ *=\)\(.*\);\1 %{l_cxxflags -O}\2;" \
   103         -e "s;^\(CPPFLAGS\ \ *=\)\(.*\);\1 %{l_cppflags}\2;" \
   104         -e "s;^\(LDFLAGS\ \ *=\)\(.*\);\1 %{l_ldflags}\2;" \
   105         configs/*
   106     %{l_shtool} subst \
   107         -e 's;^\(EXTRA_LIB_PATH\ *=.*\);\1 -L$(X11LIB_DIR);' \
   108         configs/*
   109     %{l_shtool} subst \
   110         -e "s;\.\./images/;%{l_prefix}/lib/mesa/images/;" \
   111         `find . -name '*.c' -o -name '*.cxx'`
   112     %{l_shtool} subst \
   113         -e 's;\(APP_LIB_DEPS *=.*-l\$(GL_LIB)\);\1 -lstdc++;' \
   114         configs/*
   116 %build
   117     case "%{l_platform -t}" in
   118         *-freebsd*   ) plat="freebsd"          ;;
   119         *-netbsd*    ) plat="netbsd"           ;;
   120         i?86*-linux* ) plat="linux-x86-static" ;;
   121         *-linux*     ) plat="linux-static"     ;;
   122         i?86*-sunos* ) plat="solaris-x86-gcc"  ;;
   123         *-sunos*     ) plat="sunos5-gcc"       ;;
   124         * ) echo "platform %{l_platform -t} not supported" 2>&1; exit 1; ;;
   125     esac
   127     #   begin building broken mesa build logic
   128     ( cd configs && rm -f current && ln -s $plat current )
   129     ( cd src
   130       CC="%{l_cc}" \
   131       CXX="%{l_cxx}" \
   132       CFLAGS="%{l_cflags -O}" \
   133       CXXFLAGS="%{l_cxxflags -O}" \
   134       CPPFLAGS="%{l_cppflags}" \
   135       LDFLAGS="%{l_ldflags}" \
   136       X11LIB_DIR="`%{l_rc} --query x11_libdir`" \
   137       %{l_make} %{l_mflags -O} \
   138           SHELL="%{l_bash}"
   139     ) || exit $?
   141     #   correct broken mesa archive logic
   142     %{l_shtool} mkdir -f -p -m 755 temphack
   143     ( cd temphack
   144       %{l_prefix}/bin/ar -x ../src/mesa/libglapi.a
   145       %{l_prefix}/bin/ar -x ../src/mesa/libmesa.a
   146       %{l_prefix}/bin/ar -d ../lib/libGL.a libglapi.a libmesa.a
   147       %{l_prefix}/bin/ar -ru ../lib/libGL.a *.o
   148     ) || exit $?
   150 %if "%{with_demos}" == "yes"
   151     #   continue building with corrected mesa library
   152     ( cd progs
   153       CC="%{l_cc}" \
   154       CXX="%{l_cxx}" \
   155       CFLAGS="%{l_cflags -O}" \
   156       CXXFLAGS="%{l_cxxflags -O}" \
   157       CPPFLAGS="%{l_cppflags}" \
   158       LDFLAGS="%{l_ldflags}" \
   159       X11LIB_DIR="`%{l_rc} --query x11_libdir`" \
   160       %{l_make} %{l_mflags -O} \
   161           SHELL="%{l_bash}"
   162     ) || exit $?
   163 %endif
   165 %install
   166     rm -rf $RPM_BUILD_ROOT
   167     %{l_shtool} mkdir -f -p -m 755 \
   168         $RPM_BUILD_ROOT%{l_prefix}/lib \
   169         $RPM_BUILD_ROOT%{l_prefix}/include/GL
   170     %{l_shtool} install -c -m 644 \
   171         lib/* $RPM_BUILD_ROOT%{l_prefix}/lib/
   172     %{l_shtool} install -c -m 644 \
   173         include/GL/*.h $RPM_BUILD_ROOT%{l_prefix}/include/GL/
   174 %if "%{with_demos}" == "yes"
   175     %{l_shtool} mkdir -f -p -m 755 \
   176         $RPM_BUILD_ROOT%{l_prefix}/lib/mesa/demos \
   177         $RPM_BUILD_ROOT%{l_prefix}/lib/mesa/images
   178     %{l_shtool} install -s -c -m 755 \
   179         `find progs/demos/ -type f -prune -perm 755 -print` \
   180         `find progs/redbook/ -type f -prune -perm 755 -print` \
   181         `find progs/samples/ -type f -prune -perm 755 -print` \
   182         `find progs/xdemos/ -type f -prune -perm 755 -print` \
   183         $RPM_BUILD_ROOT%{l_prefix}/lib/mesa/demos/
   184     %{l_shtool} install -c -m 644 \
   185         progs/images/* $RPM_BUILD_ROOT%{l_prefix}/lib/mesa/images/
   186 %endif
   187     %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
   189 %files -f files
   191 %clean
   192     rm -rf $RPM_BUILD_ROOT

mercurial