gcc/gcc.spec

changeset 320
d8a8300afdc8
child 321
bbed90117468
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gcc/gcc.spec	Thu Mar 24 19:00:55 2011 +0100
     1.3 @@ -0,0 +1,346 @@
     1.4 +##
     1.5 +##  gcc.spec -- OpenPKG RPM Package Specification
     1.6 +##  Copyright (c) 2000-2010 OpenPKG Foundation e.V. <http://openpkg.net/>
     1.7 +##
     1.8 +##  Permission to use, copy, modify, and distribute this software for
     1.9 +##  any purpose with or without fee is hereby granted, provided that
    1.10 +##  the above copyright notice and this permission notice appear in all
    1.11 +##  copies.
    1.12 +##
    1.13 +##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    1.14 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    1.15 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    1.16 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
    1.17 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    1.18 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    1.19 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
    1.20 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    1.21 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    1.22 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
    1.23 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    1.24 +##  SUCH DAMAGE.
    1.25 +##
    1.26 +
    1.27 +#   package version
    1.28 +%define       V_full         4.5.2
    1.29 +%define       V_comp         %nil
    1.30 +
    1.31 +#   package information
    1.32 +Name:         gcc
    1.33 +Summary:      GNU Compiler Collection
    1.34 +URL:          http://gcc.gnu.org/
    1.35 +Vendor:       Free Software Foundation
    1.36 +Packager:     OpenPKG Foundation e.V.
    1.37 +Distribution: OpenPKG Community
    1.38 +Class:        CORE
    1.39 +Group:        Compiler
    1.40 +License:      GPL
    1.41 +Version:      %{V_full}
    1.42 +Release:      20101221
    1.43 +
    1.44 +#   package options
    1.45 +%option       with_binutils  yes
    1.46 +%option       with_cxx       yes
    1.47 +%option       with_objc      no
    1.48 +%option       with_java      no
    1.49 +%option       with_fortran   no
    1.50 +%option       with_optimize  yes
    1.51 +%option       with_profile   no
    1.52 +%option       with_threads   yes
    1.53 +%option       with_multilib  no
    1.54 +
    1.55 +#   list of sources
    1.56 +Source0:      ftp://gcc.gnu.org/pub/gcc/releases/gcc-%{V_full}/gcc-core-%{V_full}.tar.bz2
    1.57 +Source1:      ftp://gcc.gnu.org/pub/gcc/releases/gcc-%{V_full}/gcc-g++-%{V_full}.tar.bz2
    1.58 +Source2:      ftp://gcc.gnu.org/pub/gcc/releases/gcc-%{V_full}/gcc-objc-%{V_full}.tar.bz2
    1.59 +Source3:      ftp://gcc.gnu.org/pub/gcc/releases/gcc-%{V_full}/gcc-java-%{V_full}.tar.bz2
    1.60 +Source4:      ftp://gcc.gnu.org/pub/gcc/releases/gcc-%{V_full}/gcc-fortran-%{V_full}.tar.bz2
    1.61 +Patch0:       gcc.patch
    1.62 +
    1.63 +#   build information
    1.64 +BuildPreReq:  OpenPKG, openpkg >= 20100101, make
    1.65 +PreReq:       OpenPKG, openpkg >= 20100101
    1.66 +%if "%{with_binutils}" == "yes"
    1.67 +BuildPreReq:  binutils >= 2.14
    1.68 +PreReq:       binutils >= 2.14
    1.69 +%endif
    1.70 +BuildPreReq:  mpc, mpfr, gmp
    1.71 +PreReq:       mpc, mpfr, gmp
    1.72 +%if "%{with_cxx}" == "yes"
    1.73 +BuildPreReq:  libiconv
    1.74 +PreReq:       libiconv
    1.75 +%endif
    1.76 +%if "%{with_java}" == "yes"
    1.77 +BuildPreReq:  zlib
    1.78 +PreReq:       zlib
    1.79 +%endif
    1.80 +
    1.81 +%description
    1.82 +    The GNU Compiler Collection (GCC) provides standard conforming and
    1.83 +    highly portable compilers for the ISO C, ISO C++, Objective-C,
    1.84 +    Fortran and Java languages.
    1.85 +
    1.86 +%track
    1.87 +    prog gcc = {
    1.88 +        version   = %{V_full}
    1.89 +        url       = ftp://gcc.gnu.org/pub/gcc/releases/
    1.90 +        regex     = gcc-(4\.\d+\.\d+)
    1.91 +        url       = ftp://gcc.gnu.org/pub/gcc/releases/gcc-__NEWVER__/
    1.92 +        regex     = gcc-core-(\d+\.\d+\.\d+)\.tar\.bz2
    1.93 +    }
    1.94 +
    1.95 +%prep
    1.96 +    %setup -q
    1.97 +%if "%{with_cxx}" == "yes"
    1.98 +    %setup -q -T -D -b 1
    1.99 +%endif
   1.100 +%if "%{with_objc}" == "yes"
   1.101 +    %setup -q -T -D -b 2
   1.102 +%endif
   1.103 +%if "%{with_java}" == "yes"
   1.104 +    %setup -q -T -D -b 3
   1.105 +%endif
   1.106 +%if "%{with_fortran}" == "yes"
   1.107 +    %setup -q -T -D -b 4
   1.108 +%endif
   1.109 +    %patch -p0
   1.110 +    %{l_shtool} subst -v -s \
   1.111 +        -e 's;PREFIX_INCLUDE_DIR;PREFIX_INCLUDE_DIR_DISABLED;g' \
   1.112 +        gcc/configure
   1.113 +    if [ ".%{V_comp}" != . ]; then
   1.114 +        %{l_shtool} subst -v -s \
   1.115 +            -e 's;(libdir)/gcc/;(libdir)/gcc%{V_comp}/;' \
   1.116 +            `find . -name Makefile.in -type f -print`
   1.117 +    fi
   1.118 +    case "%{l_platform -t}" in
   1.119 +        amd64*-linux* )
   1.120 +            %{l_shtool} subst \
   1.121 +                -e 's/GLIBCXX_IS_NATIVE=false/GLIBCXX_IS_NATIVE=true/g' \
   1.122 +                -e 's/test x.gcc_no_link = xyes/false/g' \
   1.123 +                libstdc++-v3/configure
   1.124 +            ;;
   1.125 +    esac
   1.126 +    %{l_shtool} subst \
   1.127 +        -e 's;<iconv\.h>;"%{l_prefix}/include/iconv.h";' \
   1.128 +        libstdc++-v3/include/ext/codecvt_specializations.h
   1.129 +
   1.130 +%build
   1.131 +    #   create build sub-directory
   1.132 +    %{l_shtool} mkdir -p obj
   1.133 +    cd obj
   1.134 +
   1.135 +    #   determine ld(1) and as(1) usage
   1.136 +    l_with_gnu_ld_as=""
   1.137 +    LD=%{l_tool_locate ld ld}
   1.138 +    AS=%{l_tool_locate as as}
   1.139 +    echo $LD | grep '^/' >/dev/null && l_with_gnu_ld_as="${l_with_gnu_ld_as} --with-ld=$LD"
   1.140 +    echo $AS | grep '^/' >/dev/null && l_with_gnu_ld_as="${l_with_gnu_ld_as} --with-as=$AS"
   1.141 +    $LD --version </dev/null 2>/dev/null | grep "^GNU ld "        >/dev/null && l_with_gnu_ld_as="${l_with_gnu_ld_as} --with-gnu-ld"
   1.142 +    $AS --version </dev/null 2>/dev/null | grep "^GNU assembler " >/dev/null && l_with_gnu_ld_as="${l_with_gnu_ld_as} --with-gnu-as"
   1.143 +    unset LD
   1.144 +    unset AS
   1.145 +
   1.146 +    #   determine threads usage
   1.147 +%if "%{with_threads}" == "yes"
   1.148 +    l_enable_threads="posix"
   1.149 +%else
   1.150 +    l_enable_threads="single"
   1.151 +%endif
   1.152 +
   1.153 +    #   determine language usage
   1.154 +    l_enable_languages="c"
   1.155 +%if "%{with_cxx}" == "yes"
   1.156 +    l_enable_languages="${l_enable_languages},c++"
   1.157 +%endif
   1.158 +%if "%{with_objc}" == "yes"
   1.159 +    l_enable_languages="${l_enable_languages},objc"
   1.160 +%endif
   1.161 +%if "%{with_java}" == "yes"
   1.162 +    l_enable_languages="${l_enable_languages},java"
   1.163 +%endif
   1.164 +%if "%{with_fortran}" == "yes"
   1.165 +    l_enable_languages="${l_enable_languages},f95"
   1.166 +%endif
   1.167 +
   1.168 +    #   disable GNU iconv usage
   1.169 +    ( echo "am_cv_func_iconv=no"
   1.170 +      echo "am_cv_lib_iconv=no"
   1.171 +    ) >config.cache
   1.172 +
   1.173 +    #   configure the package
   1.174 +    CC="%{l_cc}" \
   1.175 +    CFLAGS="%{l_cflags}" \
   1.176 +%if "%{with_java}" == "yes" || "%{with_fortran}" == "yes" || "%{with_cxx}" == "yes"
   1.177 +    CPPFLAGS="%{l_cppflags}" \
   1.178 +    LDFLAGS="%{l_ldflags}" \
   1.179 +%endif
   1.180 +    CONFIG_SHELL="%{l_bash}" \
   1.181 +    ../configure \
   1.182 +        --with-bugurl="http://openpkg.org/" \
   1.183 +        --with-pkgversion="%{l_openpkg_release -F "OpenPKG-%%t"}" \
   1.184 +        --cache-file=./config.cache \
   1.185 +        --srcdir=`pwd`/.. \
   1.186 +        --prefix=%{l_prefix} \
   1.187 +        --exec-prefix=%{l_prefix} \
   1.188 +        --mandir=%{l_prefix}/man \
   1.189 +        --infodir=%{l_prefix}/info \
   1.190 +        --includedir=%{l_prefix}/include/gcc%{V_comp} \
   1.191 +        --libexecdir=%{l_prefix}/libexec/gcc%{V_comp} \
   1.192 +        --with-gxx-include-dir=%{l_prefix}/include/g++%{V_comp} \
   1.193 +        --with-local-prefix=%{l_prefix}/lib/gcc%{V_comp} \
   1.194 +        --enable-languages="${l_enable_languages}" \
   1.195 +        --enable-threads="${l_enable_threads}" \
   1.196 +        --disable-maintainer-mode \
   1.197 +        --disable-shared \
   1.198 +        --disable-nls \
   1.199 +%if "%{with_java}" == "yes"
   1.200 +        --with-system-zlib \
   1.201 +%endif
   1.202 +%if "%{with_multilib}" == "yes"
   1.203 +        --enable-multilib \
   1.204 +%else
   1.205 +        --disable-multilib \
   1.206 +%endif
   1.207 +%if "%{with_cxx}" == "yes"
   1.208 +        --with-libiconv-prefix=%{l_prefix} \
   1.209 +%endif
   1.210 +        --with-gmp=%{l_prefix} \
   1.211 +        --with-mpfr=%{l_prefix} \
   1.212 +        --with-mpc=%{l_prefix} \
   1.213 +        ${l_with_gnu_ld_as}
   1.214 +
   1.215 +    #   determine build flags
   1.216 +    l_ccisgcc=no
   1.217 +    if [ ".`(%{l_cc} -v; %{l_cc} --version) </dev/null 2>&1 | grep -i 'gcc'`" != . ]; then
   1.218 +        l_ccisgcc=yes
   1.219 +    fi
   1.220 +    l_cflags=""
   1.221 +    l_cxxflags=""
   1.222 +    l_boot_cflags=""
   1.223 +    l_libcflags="-g"
   1.224 +    l_libcxxflags="-g"
   1.225 +    #   at least GNU as from GNU binutils supports -pipe always
   1.226 +    AS="%{l_tool_locate as as}"
   1.227 +    "$AS" --version </dev/null 2>/dev/null | grep "^GNU assembler " >/dev/null && {
   1.228 +        l_boot_cflags="$l_boot_cflags -pipe"
   1.229 +        l_libcxxflags="$l_libcxxflags -pipe"
   1.230 +    }
   1.231 +%if "%{with_optimize}" == "yes"
   1.232 +    #   conservatively optimize the generated program code
   1.233 +    #   (also _tune_ for particular CPUs, but _without_ requiring these CPUs!)
   1.234 +    l_cflags="$l_cflags -O"
   1.235 +    l_boot_cflags="$l_boot_cflags -O2 -fomit-frame-pointer"
   1.236 +    case "%{l_platform -t}" in
   1.237 +        *i?86-*     ) l_boot_cflags="$l_boot_cflags -mtune=pentium3" ;;
   1.238 +        *sun4[uv]-* ) l_boot_cflags="$l_boot_cflags -mtune=v9"       ;;
   1.239 +    esac
   1.240 +    l_libcxxflags="$l_libcxxflags -O2 -fno-implicit-templates"
   1.241 +%else
   1.242 +    #   else do no optimizations at all to reduce problems to minimum in advance
   1.243 +    l_boot_cflags="$l_boot_cflags -O0"
   1.244 +    l_libcxxflags="$l_libcxxflags -O0"
   1.245 +%endif
   1.246 +    maketarget="bootstrap2-lean"
   1.247 +%if "%{with_profile}" == "yes"
   1.248 +    #   GCC >= 3.4 supports a "profiledbootstrap" target to build an
   1.249 +    #   optimized version of itself through profiling. Because this
   1.250 +    #   requires a (bootstrapping) C compiler with 64-bit arithmetic,
   1.251 +    #   the whole approach is currently supported only if already
   1.252 +    #   building with GCC as the bootstrapping C compiler.
   1.253 +    if [ ".$l_ccisgcc" = .yes ]; then
   1.254 +        maketarget="profiledbootstrap"
   1.255 +    fi
   1.256 +%endif
   1.257 +    case "%{l_platform -t}" in
   1.258 +        amd64-*          ) l_cflags="$l_cflags -fPIC"; l_cxxflags="$l_cxxflags -fPIC" ;;
   1.259 +        ia64-*           ) l_cflags="$l_cflags -fPIC"; l_cxxflags="$l_cxxflags -fPIC" ;;
   1.260 +        sparc64-freebsd* ) l_cflags="$l_cflags -fPIC"; l_cxxflags="$l_cxxflags -fPIC" ;;
   1.261 +    esac
   1.262 +%if "%{with_java}" == "yes" || "%{with_fortran}" == "yes" || "%{with_cxx}" == "yes"
   1.263 +    l_cflags="$l_cflags %{l_cppflags}"
   1.264 +    l_cxxflags="$l_cxxflags %{l_cppflags}"
   1.265 +    l_libcflags="$l_libcflags %{l_cppflags}"
   1.266 +    l_libcxxflags="$l_libcxxflags %{l_cppflags}"
   1.267 +%endif
   1.268 +
   1.269 +    #   build the package
   1.270 +    MAKE="%{l_make} %{l_mflags}" \
   1.271 +    %{l_make} %{l_mflags} \
   1.272 +        MAKE="%{l_make} %{l_mflags}" \
   1.273 +        BOOT_CFLAGS="${l_boot_cflags}" \
   1.274 +        CFLAGS="${l_cflags}" \
   1.275 +        CXXFLAGS="${l_cxxflags}" \
   1.276 +        LIBCFLAGS="${l_libcflags}" \
   1.277 +        LIBCXXFLAGS="${l_libcxxflags}" \
   1.278 +        $maketarget
   1.279 +
   1.280 +%install
   1.281 +
   1.282 +    #   fetch GNU platform triple
   1.283 +    triple=`./config.guess`
   1.284 +
   1.285 +    #   perform the standard installation procedure
   1.286 +    ( cd obj
   1.287 +      %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
   1.288 +    ) || exit $?
   1.289 +
   1.290 +    #   cleanup installation tree
   1.291 +    mv $RPM_BUILD_ROOT%{l_prefix}/lib/{lib*.a,*.spec} \
   1.292 +       $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_comp}/${triple}/[0-9]*/ \
   1.293 +       >/dev/null 2>&1 || true
   1.294 +    mv $RPM_BUILD_ROOT%{l_prefix}/lib64/{lib*.a,*.spec} \
   1.295 +       $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_comp}/${triple}/[0-9]*/ \
   1.296 +       >/dev/null 2>&1 || true
   1.297 +    dirs=""
   1.298 +    for multilib in `$RPM_BUILD_ROOT%{l_prefix}/bin/gcc --print-multi-lib`; do
   1.299 +        subdir=`echo "$multilib" | sed -e 's/;.*$//'`
   1.300 +        [ ".$subdir" = .. ] && continue
   1.301 +        mv $RPM_BUILD_ROOT%{l_prefix}/lib/$subdir/lib*.a \
   1.302 +           $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_comp}/${triple}/[0-9]*/$subdir/ \
   1.303 +           >/dev/null 2>&1 || true
   1.304 +        mv $RPM_BUILD_ROOT%{l_prefix}/lib64/$subdir/lib*.a \
   1.305 +           $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_comp}/${triple}/[0-9]*/$subdir/ \
   1.306 +           >/dev/null 2>&1 || true
   1.307 +        dirs="$dirs $subdir"
   1.308 +    done
   1.309 +    for subdir in $dirs; do
   1.310 +        rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib/$subdir >/dev/null 2>&1 || true
   1.311 +    done
   1.312 +    mv $RPM_BUILD_ROOT%{l_prefix}/${triple}/include/* \
   1.313 +       $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_comp}/${triple}/[0-9]*/include/ \
   1.314 +           >/dev/null 2>&1 || true
   1.315 +
   1.316 +    #   strip installation tree
   1.317 +    rm -rf $RPM_BUILD_ROOT%{l_prefix}/${triple}
   1.318 +    rm -f  $RPM_BUILD_ROOT%{l_prefix}/info/dir
   1.319 +    rm -rf $RPM_BUILD_ROOT%{l_prefix}/man/man7   >/dev/null 2>&1 || true
   1.320 +    rm -f  $RPM_BUILD_ROOT%{l_prefix}/lib/*.la   >/dev/null 2>&1 || true
   1.321 +    rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib64      >/dev/null 2>&1 || true
   1.322 +    rm -f  $RPM_BUILD_ROOT%{l_prefix}/bin/*-gcc* >/dev/null 2>&1 || true
   1.323 +%if "%{with_cxx}" == "yes"
   1.324 +    rm -f  $RPM_BUILD_ROOT%{l_prefix}/bin/*-c++  >/dev/null 2>&1 || true
   1.325 +    rm -f  $RPM_BUILD_ROOT%{l_prefix}/bin/*-g++  >/dev/null 2>&1 || true
   1.326 +%endif
   1.327 +    strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
   1.328 +    for prog in cc1 cc1plus collect2 cpp; do
   1.329 +        strip $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_comp}/${triple}/[0-9]*/${prog} \
   1.330 +            >/dev/null 2>&1 || true
   1.331 +    done
   1.332 +
   1.333 +    #   bump up installation tree
   1.334 +    ln $RPM_BUILD_ROOT%{l_prefix}/bin/gcc \
   1.335 +       $RPM_BUILD_ROOT%{l_prefix}/bin/cc
   1.336 +    ln $RPM_BUILD_ROOT%{l_prefix}/man/man1/gcc.1 \
   1.337 +       $RPM_BUILD_ROOT%{l_prefix}/man/man1/cc.1
   1.338 +%if "%{with_cxx}" == "yes"
   1.339 +    ln $RPM_BUILD_ROOT%{l_prefix}/man/man1/g++.1 \
   1.340 +       $RPM_BUILD_ROOT%{l_prefix}/man/man1/c++.1
   1.341 +%endif
   1.342 +
   1.343 +    #   determine installation file list
   1.344 +    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
   1.345 +
   1.346 +%files -f files
   1.347 +
   1.348 +%clean
   1.349 +

mercurial