gcc/gcc.spec

Thu, 24 Mar 2011 19:00:55 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 24 Mar 2011 19:00:55 +0100
changeset 320
d8a8300afdc8
child 321
bbed90117468
permissions
-rw-r--r--

Import package vendor original specs for necessary manipulations.

michael@320 1 ##
michael@320 2 ## gcc.spec -- OpenPKG RPM Package Specification
michael@320 3 ## Copyright (c) 2000-2010 OpenPKG Foundation e.V. <http://openpkg.net/>
michael@320 4 ##
michael@320 5 ## Permission to use, copy, modify, and distribute this software for
michael@320 6 ## any purpose with or without fee is hereby granted, provided that
michael@320 7 ## the above copyright notice and this permission notice appear in all
michael@320 8 ## copies.
michael@320 9 ##
michael@320 10 ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
michael@320 11 ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
michael@320 12 ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
michael@320 13 ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
michael@320 14 ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
michael@320 15 ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
michael@320 16 ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
michael@320 17 ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
michael@320 18 ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
michael@320 19 ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
michael@320 20 ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
michael@320 21 ## SUCH DAMAGE.
michael@320 22 ##
michael@320 23
michael@320 24 # package version
michael@320 25 %define V_full 4.5.2
michael@320 26 %define V_comp %nil
michael@320 27
michael@320 28 # package information
michael@320 29 Name: gcc
michael@320 30 Summary: GNU Compiler Collection
michael@320 31 URL: http://gcc.gnu.org/
michael@320 32 Vendor: Free Software Foundation
michael@320 33 Packager: OpenPKG Foundation e.V.
michael@320 34 Distribution: OpenPKG Community
michael@320 35 Class: CORE
michael@320 36 Group: Compiler
michael@320 37 License: GPL
michael@320 38 Version: %{V_full}
michael@320 39 Release: 20101221
michael@320 40
michael@320 41 # package options
michael@320 42 %option with_binutils yes
michael@320 43 %option with_cxx yes
michael@320 44 %option with_objc no
michael@320 45 %option with_java no
michael@320 46 %option with_fortran no
michael@320 47 %option with_optimize yes
michael@320 48 %option with_profile no
michael@320 49 %option with_threads yes
michael@320 50 %option with_multilib no
michael@320 51
michael@320 52 # list of sources
michael@320 53 Source0: ftp://gcc.gnu.org/pub/gcc/releases/gcc-%{V_full}/gcc-core-%{V_full}.tar.bz2
michael@320 54 Source1: ftp://gcc.gnu.org/pub/gcc/releases/gcc-%{V_full}/gcc-g++-%{V_full}.tar.bz2
michael@320 55 Source2: ftp://gcc.gnu.org/pub/gcc/releases/gcc-%{V_full}/gcc-objc-%{V_full}.tar.bz2
michael@320 56 Source3: ftp://gcc.gnu.org/pub/gcc/releases/gcc-%{V_full}/gcc-java-%{V_full}.tar.bz2
michael@320 57 Source4: ftp://gcc.gnu.org/pub/gcc/releases/gcc-%{V_full}/gcc-fortran-%{V_full}.tar.bz2
michael@320 58 Patch0: gcc.patch
michael@320 59
michael@320 60 # build information
michael@320 61 BuildPreReq: OpenPKG, openpkg >= 20100101, make
michael@320 62 PreReq: OpenPKG, openpkg >= 20100101
michael@320 63 %if "%{with_binutils}" == "yes"
michael@320 64 BuildPreReq: binutils >= 2.14
michael@320 65 PreReq: binutils >= 2.14
michael@320 66 %endif
michael@320 67 BuildPreReq: mpc, mpfr, gmp
michael@320 68 PreReq: mpc, mpfr, gmp
michael@320 69 %if "%{with_cxx}" == "yes"
michael@320 70 BuildPreReq: libiconv
michael@320 71 PreReq: libiconv
michael@320 72 %endif
michael@320 73 %if "%{with_java}" == "yes"
michael@320 74 BuildPreReq: zlib
michael@320 75 PreReq: zlib
michael@320 76 %endif
michael@320 77
michael@320 78 %description
michael@320 79 The GNU Compiler Collection (GCC) provides standard conforming and
michael@320 80 highly portable compilers for the ISO C, ISO C++, Objective-C,
michael@320 81 Fortran and Java languages.
michael@320 82
michael@320 83 %track
michael@320 84 prog gcc = {
michael@320 85 version = %{V_full}
michael@320 86 url = ftp://gcc.gnu.org/pub/gcc/releases/
michael@320 87 regex = gcc-(4\.\d+\.\d+)
michael@320 88 url = ftp://gcc.gnu.org/pub/gcc/releases/gcc-__NEWVER__/
michael@320 89 regex = gcc-core-(\d+\.\d+\.\d+)\.tar\.bz2
michael@320 90 }
michael@320 91
michael@320 92 %prep
michael@320 93 %setup -q
michael@320 94 %if "%{with_cxx}" == "yes"
michael@320 95 %setup -q -T -D -b 1
michael@320 96 %endif
michael@320 97 %if "%{with_objc}" == "yes"
michael@320 98 %setup -q -T -D -b 2
michael@320 99 %endif
michael@320 100 %if "%{with_java}" == "yes"
michael@320 101 %setup -q -T -D -b 3
michael@320 102 %endif
michael@320 103 %if "%{with_fortran}" == "yes"
michael@320 104 %setup -q -T -D -b 4
michael@320 105 %endif
michael@320 106 %patch -p0
michael@320 107 %{l_shtool} subst -v -s \
michael@320 108 -e 's;PREFIX_INCLUDE_DIR;PREFIX_INCLUDE_DIR_DISABLED;g' \
michael@320 109 gcc/configure
michael@320 110 if [ ".%{V_comp}" != . ]; then
michael@320 111 %{l_shtool} subst -v -s \
michael@320 112 -e 's;(libdir)/gcc/;(libdir)/gcc%{V_comp}/;' \
michael@320 113 `find . -name Makefile.in -type f -print`
michael@320 114 fi
michael@320 115 case "%{l_platform -t}" in
michael@320 116 amd64*-linux* )
michael@320 117 %{l_shtool} subst \
michael@320 118 -e 's/GLIBCXX_IS_NATIVE=false/GLIBCXX_IS_NATIVE=true/g' \
michael@320 119 -e 's/test x.gcc_no_link = xyes/false/g' \
michael@320 120 libstdc++-v3/configure
michael@320 121 ;;
michael@320 122 esac
michael@320 123 %{l_shtool} subst \
michael@320 124 -e 's;<iconv\.h>;"%{l_prefix}/include/iconv.h";' \
michael@320 125 libstdc++-v3/include/ext/codecvt_specializations.h
michael@320 126
michael@320 127 %build
michael@320 128 # create build sub-directory
michael@320 129 %{l_shtool} mkdir -p obj
michael@320 130 cd obj
michael@320 131
michael@320 132 # determine ld(1) and as(1) usage
michael@320 133 l_with_gnu_ld_as=""
michael@320 134 LD=%{l_tool_locate ld ld}
michael@320 135 AS=%{l_tool_locate as as}
michael@320 136 echo $LD | grep '^/' >/dev/null && l_with_gnu_ld_as="${l_with_gnu_ld_as} --with-ld=$LD"
michael@320 137 echo $AS | grep '^/' >/dev/null && l_with_gnu_ld_as="${l_with_gnu_ld_as} --with-as=$AS"
michael@320 138 $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"
michael@320 139 $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"
michael@320 140 unset LD
michael@320 141 unset AS
michael@320 142
michael@320 143 # determine threads usage
michael@320 144 %if "%{with_threads}" == "yes"
michael@320 145 l_enable_threads="posix"
michael@320 146 %else
michael@320 147 l_enable_threads="single"
michael@320 148 %endif
michael@320 149
michael@320 150 # determine language usage
michael@320 151 l_enable_languages="c"
michael@320 152 %if "%{with_cxx}" == "yes"
michael@320 153 l_enable_languages="${l_enable_languages},c++"
michael@320 154 %endif
michael@320 155 %if "%{with_objc}" == "yes"
michael@320 156 l_enable_languages="${l_enable_languages},objc"
michael@320 157 %endif
michael@320 158 %if "%{with_java}" == "yes"
michael@320 159 l_enable_languages="${l_enable_languages},java"
michael@320 160 %endif
michael@320 161 %if "%{with_fortran}" == "yes"
michael@320 162 l_enable_languages="${l_enable_languages},f95"
michael@320 163 %endif
michael@320 164
michael@320 165 # disable GNU iconv usage
michael@320 166 ( echo "am_cv_func_iconv=no"
michael@320 167 echo "am_cv_lib_iconv=no"
michael@320 168 ) >config.cache
michael@320 169
michael@320 170 # configure the package
michael@320 171 CC="%{l_cc}" \
michael@320 172 CFLAGS="%{l_cflags}" \
michael@320 173 %if "%{with_java}" == "yes" || "%{with_fortran}" == "yes" || "%{with_cxx}" == "yes"
michael@320 174 CPPFLAGS="%{l_cppflags}" \
michael@320 175 LDFLAGS="%{l_ldflags}" \
michael@320 176 %endif
michael@320 177 CONFIG_SHELL="%{l_bash}" \
michael@320 178 ../configure \
michael@320 179 --with-bugurl="http://openpkg.org/" \
michael@320 180 --with-pkgversion="%{l_openpkg_release -F "OpenPKG-%%t"}" \
michael@320 181 --cache-file=./config.cache \
michael@320 182 --srcdir=`pwd`/.. \
michael@320 183 --prefix=%{l_prefix} \
michael@320 184 --exec-prefix=%{l_prefix} \
michael@320 185 --mandir=%{l_prefix}/man \
michael@320 186 --infodir=%{l_prefix}/info \
michael@320 187 --includedir=%{l_prefix}/include/gcc%{V_comp} \
michael@320 188 --libexecdir=%{l_prefix}/libexec/gcc%{V_comp} \
michael@320 189 --with-gxx-include-dir=%{l_prefix}/include/g++%{V_comp} \
michael@320 190 --with-local-prefix=%{l_prefix}/lib/gcc%{V_comp} \
michael@320 191 --enable-languages="${l_enable_languages}" \
michael@320 192 --enable-threads="${l_enable_threads}" \
michael@320 193 --disable-maintainer-mode \
michael@320 194 --disable-shared \
michael@320 195 --disable-nls \
michael@320 196 %if "%{with_java}" == "yes"
michael@320 197 --with-system-zlib \
michael@320 198 %endif
michael@320 199 %if "%{with_multilib}" == "yes"
michael@320 200 --enable-multilib \
michael@320 201 %else
michael@320 202 --disable-multilib \
michael@320 203 %endif
michael@320 204 %if "%{with_cxx}" == "yes"
michael@320 205 --with-libiconv-prefix=%{l_prefix} \
michael@320 206 %endif
michael@320 207 --with-gmp=%{l_prefix} \
michael@320 208 --with-mpfr=%{l_prefix} \
michael@320 209 --with-mpc=%{l_prefix} \
michael@320 210 ${l_with_gnu_ld_as}
michael@320 211
michael@320 212 # determine build flags
michael@320 213 l_ccisgcc=no
michael@320 214 if [ ".`(%{l_cc} -v; %{l_cc} --version) </dev/null 2>&1 | grep -i 'gcc'`" != . ]; then
michael@320 215 l_ccisgcc=yes
michael@320 216 fi
michael@320 217 l_cflags=""
michael@320 218 l_cxxflags=""
michael@320 219 l_boot_cflags=""
michael@320 220 l_libcflags="-g"
michael@320 221 l_libcxxflags="-g"
michael@320 222 # at least GNU as from GNU binutils supports -pipe always
michael@320 223 AS="%{l_tool_locate as as}"
michael@320 224 "$AS" --version </dev/null 2>/dev/null | grep "^GNU assembler " >/dev/null && {
michael@320 225 l_boot_cflags="$l_boot_cflags -pipe"
michael@320 226 l_libcxxflags="$l_libcxxflags -pipe"
michael@320 227 }
michael@320 228 %if "%{with_optimize}" == "yes"
michael@320 229 # conservatively optimize the generated program code
michael@320 230 # (also _tune_ for particular CPUs, but _without_ requiring these CPUs!)
michael@320 231 l_cflags="$l_cflags -O"
michael@320 232 l_boot_cflags="$l_boot_cflags -O2 -fomit-frame-pointer"
michael@320 233 case "%{l_platform -t}" in
michael@320 234 *i?86-* ) l_boot_cflags="$l_boot_cflags -mtune=pentium3" ;;
michael@320 235 *sun4[uv]-* ) l_boot_cflags="$l_boot_cflags -mtune=v9" ;;
michael@320 236 esac
michael@320 237 l_libcxxflags="$l_libcxxflags -O2 -fno-implicit-templates"
michael@320 238 %else
michael@320 239 # else do no optimizations at all to reduce problems to minimum in advance
michael@320 240 l_boot_cflags="$l_boot_cflags -O0"
michael@320 241 l_libcxxflags="$l_libcxxflags -O0"
michael@320 242 %endif
michael@320 243 maketarget="bootstrap2-lean"
michael@320 244 %if "%{with_profile}" == "yes"
michael@320 245 # GCC >= 3.4 supports a "profiledbootstrap" target to build an
michael@320 246 # optimized version of itself through profiling. Because this
michael@320 247 # requires a (bootstrapping) C compiler with 64-bit arithmetic,
michael@320 248 # the whole approach is currently supported only if already
michael@320 249 # building with GCC as the bootstrapping C compiler.
michael@320 250 if [ ".$l_ccisgcc" = .yes ]; then
michael@320 251 maketarget="profiledbootstrap"
michael@320 252 fi
michael@320 253 %endif
michael@320 254 case "%{l_platform -t}" in
michael@320 255 amd64-* ) l_cflags="$l_cflags -fPIC"; l_cxxflags="$l_cxxflags -fPIC" ;;
michael@320 256 ia64-* ) l_cflags="$l_cflags -fPIC"; l_cxxflags="$l_cxxflags -fPIC" ;;
michael@320 257 sparc64-freebsd* ) l_cflags="$l_cflags -fPIC"; l_cxxflags="$l_cxxflags -fPIC" ;;
michael@320 258 esac
michael@320 259 %if "%{with_java}" == "yes" || "%{with_fortran}" == "yes" || "%{with_cxx}" == "yes"
michael@320 260 l_cflags="$l_cflags %{l_cppflags}"
michael@320 261 l_cxxflags="$l_cxxflags %{l_cppflags}"
michael@320 262 l_libcflags="$l_libcflags %{l_cppflags}"
michael@320 263 l_libcxxflags="$l_libcxxflags %{l_cppflags}"
michael@320 264 %endif
michael@320 265
michael@320 266 # build the package
michael@320 267 MAKE="%{l_make} %{l_mflags}" \
michael@320 268 %{l_make} %{l_mflags} \
michael@320 269 MAKE="%{l_make} %{l_mflags}" \
michael@320 270 BOOT_CFLAGS="${l_boot_cflags}" \
michael@320 271 CFLAGS="${l_cflags}" \
michael@320 272 CXXFLAGS="${l_cxxflags}" \
michael@320 273 LIBCFLAGS="${l_libcflags}" \
michael@320 274 LIBCXXFLAGS="${l_libcxxflags}" \
michael@320 275 $maketarget
michael@320 276
michael@320 277 %install
michael@320 278
michael@320 279 # fetch GNU platform triple
michael@320 280 triple=`./config.guess`
michael@320 281
michael@320 282 # perform the standard installation procedure
michael@320 283 ( cd obj
michael@320 284 %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
michael@320 285 ) || exit $?
michael@320 286
michael@320 287 # cleanup installation tree
michael@320 288 mv $RPM_BUILD_ROOT%{l_prefix}/lib/{lib*.a,*.spec} \
michael@320 289 $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_comp}/${triple}/[0-9]*/ \
michael@320 290 >/dev/null 2>&1 || true
michael@320 291 mv $RPM_BUILD_ROOT%{l_prefix}/lib64/{lib*.a,*.spec} \
michael@320 292 $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_comp}/${triple}/[0-9]*/ \
michael@320 293 >/dev/null 2>&1 || true
michael@320 294 dirs=""
michael@320 295 for multilib in `$RPM_BUILD_ROOT%{l_prefix}/bin/gcc --print-multi-lib`; do
michael@320 296 subdir=`echo "$multilib" | sed -e 's/;.*$//'`
michael@320 297 [ ".$subdir" = .. ] && continue
michael@320 298 mv $RPM_BUILD_ROOT%{l_prefix}/lib/$subdir/lib*.a \
michael@320 299 $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_comp}/${triple}/[0-9]*/$subdir/ \
michael@320 300 >/dev/null 2>&1 || true
michael@320 301 mv $RPM_BUILD_ROOT%{l_prefix}/lib64/$subdir/lib*.a \
michael@320 302 $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_comp}/${triple}/[0-9]*/$subdir/ \
michael@320 303 >/dev/null 2>&1 || true
michael@320 304 dirs="$dirs $subdir"
michael@320 305 done
michael@320 306 for subdir in $dirs; do
michael@320 307 rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib/$subdir >/dev/null 2>&1 || true
michael@320 308 done
michael@320 309 mv $RPM_BUILD_ROOT%{l_prefix}/${triple}/include/* \
michael@320 310 $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_comp}/${triple}/[0-9]*/include/ \
michael@320 311 >/dev/null 2>&1 || true
michael@320 312
michael@320 313 # strip installation tree
michael@320 314 rm -rf $RPM_BUILD_ROOT%{l_prefix}/${triple}
michael@320 315 rm -f $RPM_BUILD_ROOT%{l_prefix}/info/dir
michael@320 316 rm -rf $RPM_BUILD_ROOT%{l_prefix}/man/man7 >/dev/null 2>&1 || true
michael@320 317 rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/*.la >/dev/null 2>&1 || true
michael@320 318 rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib64 >/dev/null 2>&1 || true
michael@320 319 rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-gcc* >/dev/null 2>&1 || true
michael@320 320 %if "%{with_cxx}" == "yes"
michael@320 321 rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-c++ >/dev/null 2>&1 || true
michael@320 322 rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-g++ >/dev/null 2>&1 || true
michael@320 323 %endif
michael@320 324 strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
michael@320 325 for prog in cc1 cc1plus collect2 cpp; do
michael@320 326 strip $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_comp}/${triple}/[0-9]*/${prog} \
michael@320 327 >/dev/null 2>&1 || true
michael@320 328 done
michael@320 329
michael@320 330 # bump up installation tree
michael@320 331 ln $RPM_BUILD_ROOT%{l_prefix}/bin/gcc \
michael@320 332 $RPM_BUILD_ROOT%{l_prefix}/bin/cc
michael@320 333 ln $RPM_BUILD_ROOT%{l_prefix}/man/man1/gcc.1 \
michael@320 334 $RPM_BUILD_ROOT%{l_prefix}/man/man1/cc.1
michael@320 335 %if "%{with_cxx}" == "yes"
michael@320 336 ln $RPM_BUILD_ROOT%{l_prefix}/man/man1/g++.1 \
michael@320 337 $RPM_BUILD_ROOT%{l_prefix}/man/man1/c++.1
michael@320 338 %endif
michael@320 339
michael@320 340 # determine installation file list
michael@320 341 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
michael@320 342
michael@320 343 %files -f files
michael@320 344
michael@320 345 %clean
michael@320 346

mercurial