gcc/gcc.spec

Thu, 22 Mar 2012 20:53:42 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Mar 2012 20:53:42 +0100
changeset 407
633675dc493c
parent 406
cd6aad0e0d4e
child 468
695288b7c41a
permissions
-rw-r--r--

Add spawn header fixincludes logic and update to new vendor version.

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@407 25 %define V_full 4.6.3
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@406 39 Release: 20120208
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@335 52 # fix intermodule dependencies implicitly
michael@335 53 %if "%{with_java}" == "yes"
michael@335 54 %define with_cxx yes
michael@335 55 %define with_threads yes
michael@335 56 %endif
michael@335 57
michael@320 58 # list of sources
michael@320 59 Source0: ftp://gcc.gnu.org/pub/gcc/releases/gcc-%{V_full}/gcc-core-%{V_full}.tar.bz2
michael@320 60 Source1: ftp://gcc.gnu.org/pub/gcc/releases/gcc-%{V_full}/gcc-g++-%{V_full}.tar.bz2
michael@320 61 Source2: ftp://gcc.gnu.org/pub/gcc/releases/gcc-%{V_full}/gcc-objc-%{V_full}.tar.bz2
michael@320 62 Source3: ftp://gcc.gnu.org/pub/gcc/releases/gcc-%{V_full}/gcc-java-%{V_full}.tar.bz2
michael@320 63 Source4: ftp://gcc.gnu.org/pub/gcc/releases/gcc-%{V_full}/gcc-fortran-%{V_full}.tar.bz2
michael@320 64 Patch0: gcc.patch
michael@407 65 Patch1: gcc.patch.spawn
michael@320 66
michael@320 67 # build information
michael@321 68 Prefix: %{l_prefix}
michael@321 69 BuildRoot: %{l_buildroot}
michael@332 70 BuildPreReq: OpenPKG, openpkg >= 20060823, make
michael@322 71 PreReq: OpenPKG, openpkg >= 20060823
michael@332 72 BuildPreReq: mpc, mpfr, gmp
michael@332 73 PreReq: mpc, mpfr, gmp
michael@320 74 %if "%{with_binutils}" == "yes"
michael@320 75 BuildPreReq: binutils >= 2.14
michael@320 76 PreReq: binutils >= 2.14
michael@320 77 %endif
michael@320 78 %if "%{with_cxx}" == "yes"
michael@320 79 BuildPreReq: libiconv
michael@320 80 PreReq: libiconv
michael@320 81 %endif
michael@320 82 %if "%{with_java}" == "yes"
michael@335 83 BuildPreReq: zlib, infozip
michael@320 84 PreReq: zlib
michael@320 85 %endif
michael@321 86 AutoReq: no
michael@321 87 AutoReqProv: no
michael@320 88
michael@320 89 %description
michael@320 90 The GNU Compiler Collection (GCC) provides standard conforming and
michael@320 91 highly portable compilers for the ISO C, ISO C++, Objective-C,
michael@320 92 Fortran and Java languages.
michael@320 93
michael@320 94 %track
michael@320 95 prog gcc = {
michael@320 96 version = %{V_full}
michael@320 97 url = ftp://gcc.gnu.org/pub/gcc/releases/
michael@320 98 regex = gcc-(4\.\d+\.\d+)
michael@320 99 url = ftp://gcc.gnu.org/pub/gcc/releases/gcc-__NEWVER__/
michael@320 100 regex = gcc-core-(\d+\.\d+\.\d+)\.tar\.bz2
michael@320 101 }
michael@320 102
michael@320 103 %prep
michael@320 104 %setup -q
michael@320 105 %if "%{with_cxx}" == "yes"
michael@320 106 %setup -q -T -D -b 1
michael@320 107 %endif
michael@320 108 %if "%{with_objc}" == "yes"
michael@320 109 %setup -q -T -D -b 2
michael@320 110 %endif
michael@320 111 %if "%{with_java}" == "yes"
michael@320 112 %setup -q -T -D -b 3
michael@320 113 %endif
michael@320 114 %if "%{with_fortran}" == "yes"
michael@320 115 %setup -q -T -D -b 4
michael@320 116 %endif
michael@320 117 %patch -p0
michael@407 118 %patch -p0 -P 1
michael@332 119 %{l_shtool} subst \
michael@332 120 -e 's;\(instname="\$dir/\$name"\)i;\1;' \
michael@332 121 ltmain.sh
michael@320 122 %{l_shtool} subst -v -s \
michael@328 123 -e 's;\(gmplibs="-lmpc\) \(-lmpfr -lgmp\);\1 -lm \2;' \
michael@328 124 configure
michael@328 125 %{l_shtool} subst -v -s \
michael@335 126 -e 's;\(LDEXP_LIB=\)"$LIBS";\1"$LDFLAGS";' \
michael@320 127 -e 's;PREFIX_INCLUDE_DIR;PREFIX_INCLUDE_DIR_DISABLED;g' \
michael@320 128 gcc/configure
michael@332 129 %{l_shtool} subst \
michael@332 130 -e 's;[ \t]*-W[a-zA-Z0-9_\-][a-zA-Z0-9_\-]*,*;;g' \
michael@332 131 lto-plugin/Makefile.in
michael@332 132 %{l_shtool} subst \
michael@332 133 -e 's;-rpath *[^ \t][^ \t]*;;g' \
michael@332 134 -e 's;--tag=disable-static;--tag=disable-shared;g' \
michael@332 135 -e 's;\.\./libiberty/libiberty\.a;-L../libiberty -liberty;g' \
michael@332 136 -e 's;\.\./libiberty/pic/libiberty\.a;-L../libiberty/pic -liberty;g' \
michael@332 137 lto-plugin/Makefile.in
michael@337 138 %if "%{with_cxx}" == "yes"
michael@337 139 %{l_shtool} subst \
michael@337 140 -e 's;\(pythondir *= *\$(datadir)\)/gcc-\$(gcc_version);\1/gcc;' \
michael@337 141 libstdc++-v3/python/Makefile.in
michael@337 142 %endif
michael@337 143 %if "%{with_java}" == "yes"
michael@337 144 %{l_shtool} subst \
michael@337 145 -e 's;\(default_python_dir\) *=.*;\1=/share/gcc/python/libjava;' \
michael@337 146 libjava/configure
michael@337 147 %{l_shtool} subst \
michael@337 148 -e 's;JAR *= *@JAR@;JAR = $(here)/scripts/jar;' \
michael@337 149 libjava/Makefile.in
michael@337 150 %endif
michael@320 151 if [ ".%{V_comp}" != . ]; then
michael@320 152 %{l_shtool} subst -v -s \
michael@320 153 -e 's;(libdir)/gcc/;(libdir)/gcc%{V_comp}/;' \
michael@337 154 -e 's;(libexecdir)/gcc/;(libexecdir)/gcc%{V_comp}/;' \
michael@320 155 `find . -name Makefile.in -type f -print`
michael@320 156 fi
michael@334 157 %{l_shtool} subst \
michael@334 158 -e 's;^\(do-compare\) *\(=.*\);#\1-shouldnt-be-defined-here \2;' \
michael@334 159 config/*.mk
michael@320 160 case "%{l_platform -t}" in
michael@334 161 amd64-linux* )
michael@320 162 %{l_shtool} subst \
michael@320 163 -e 's/GLIBCXX_IS_NATIVE=false/GLIBCXX_IS_NATIVE=true/g' \
michael@320 164 -e 's/test x.gcc_no_link = xyes/false/g' \
michael@320 165 libstdc++-v3/configure
michael@320 166 ;;
michael@320 167 esac
michael@320 168 %{l_shtool} subst \
michael@320 169 -e 's;<iconv\.h>;"%{l_prefix}/include/iconv.h";' \
michael@320 170 libstdc++-v3/include/ext/codecvt_specializations.h
michael@337 171 %{l_shtool} subst \
michael@337 172 -e 's;.*with_arch_32=\${with_arch_32:-pentium4}.*;;' \
michael@337 173 -e 's;with_arch_32=\${with_arch_32:-pentiumpro};arch_without_sse2=yes;' \
michael@337 174 gcc/config.gcc
michael@406 175 #-e 's;\(with_arch_32=\${with_arch_32:-\)pentium4};\1pentium3};' \
michael@406 176
michael@406 177 %if "%{with_cxx}" == "yes"
michael@406 178 # sad hack to correct split gettext in libc and libintl each
michael@406 179 # providing locale-intl.cc disparate libintl.h with externs,
michael@406 180 # see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11074
michael@406 181 [ -f %{l_prefix}/include/libintl.h -a -f /usr/include/libintl.h ] && \
michael@406 182 cp /usr/include/libintl.h libstdc++-v3/libsupc++/ || \
michael@406 183 [ -f /usr/include/libintl.h ] || \
michael@406 184 ( echo "A system native gettext installation is not detected. Because GCC"
michael@406 185 echo "C++ components require gettext problems may arise. These problems"
michael@406 186 echo "can appear at build time causing the build to stop with errors"
michael@406 187 echo "containing the words NLS, intl, or locale, or at run time should"
michael@406 188 echo "undefined external symbols libintl_* in libstdc++.a interfere with"
michael@406 189 echo "building other C++ sources."
michael@406 190 echo ""
michael@406 191 echo "To solve such problems, contact the GCC package maintainer and inform"
michael@406 192 echo "of the location of libintl.h header on the system in question."
michael@406 193 ) | %{l_rpmtool} msg -b -t warn
michael@406 194 %endif
michael@320 195
michael@320 196 %build
michael@334 197 # create build subdirectory
michael@337 198 %{l_shtool} mkdir -p objbld
michael@337 199 cd objbld
michael@320 200
michael@334 201 # locate ld(1) and as(1) accordingly
michael@328 202 %if "%{with_binutils}" == "yes"
michael@334 203 # allow OpenPKG binutils
michael@328 204 LD=%{l_tool_locate ld ld}
michael@328 205 AS=%{l_tool_locate as as}
michael@322 206 %else
michael@334 207 # ignore OpenPKG binutils
michael@334 208 LD=`PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/ccs/bin:/opt/bin:/opt/sbin:/usr/local/bin:/usr/local/sbin which ld`
michael@334 209 AS=`PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/ccs/bin:/opt/bin:/opt/sbin:/usr/local/bin:/usr/local/sbin which as`
michael@322 210 %endif
michael@320 211 l_with_gnu_ld_as=""
michael@322 212 echo $LD | grep '^/' >/dev/null && l_with_gnu_ld_as="--with-ld=$LD"
michael@320 213 echo $AS | grep '^/' >/dev/null && l_with_gnu_ld_as="${l_with_gnu_ld_as} --with-as=$AS"
michael@337 214 $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" || l_with_gnu_ld_as="${l_with_gnu_ld_as} --without-gnu-ld"
michael@337 215 $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" || l_with_gnu_ld_as="${l_with_gnu_ld_as} --without-gnu-as"
michael@320 216
michael@334 217 # determine threads use
michael@320 218 %if "%{with_threads}" == "yes"
michael@320 219 l_enable_threads="posix"
michael@320 220 %else
michael@320 221 l_enable_threads="single"
michael@320 222 %endif
michael@320 223
michael@334 224 # determine language use
michael@320 225 l_enable_languages="c"
michael@320 226 %if "%{with_cxx}" == "yes"
michael@320 227 l_enable_languages="${l_enable_languages},c++"
michael@320 228 %endif
michael@320 229 %if "%{with_objc}" == "yes"
michael@320 230 l_enable_languages="${l_enable_languages},objc"
michael@320 231 %endif
michael@320 232 %if "%{with_java}" == "yes"
michael@320 233 l_enable_languages="${l_enable_languages},java"
michael@320 234 %endif
michael@320 235 %if "%{with_fortran}" == "yes"
michael@320 236 l_enable_languages="${l_enable_languages},f95"
michael@320 237 %endif
michael@320 238
michael@334 239 # disable GNU iconv use
michael@320 240 ( echo "am_cv_func_iconv=no"
michael@320 241 echo "am_cv_lib_iconv=no"
michael@320 242 ) >config.cache
michael@334 243 # platforms failing 'compare' make target (see prep as well)
michael@332 244 case "%{l_platform -t}" in
michael@334 245 *i?86-sunos* ) echo "gcc_cv_prog_cmp_skip=true" >>config.cache ;;
michael@334 246 *amd64-linux* ) echo "gcc_cv_prog_cmp_skip=true" >>config.cache ;;
michael@332 247 esac
michael@332 248
michael@320 249 # configure the package
michael@322 250 LD="$LD" \
michael@322 251 AS="$AS" \
michael@320 252 CC="%{l_cc}" \
michael@320 253 CFLAGS="%{l_cflags}" \
michael@335 254 %if "%{with_cxx}" == "yes"
michael@320 255 CPPFLAGS="%{l_cppflags}" \
michael@320 256 LDFLAGS="%{l_ldflags}" \
michael@320 257 %endif
michael@320 258 CONFIG_SHELL="%{l_bash}" \
michael@332 259 GREP="%{l_bash}" \
michael@320 260 ../configure \
michael@406 261 --cache-file=./config.cache \
michael@320 262 --with-bugurl="http://openpkg.org/" \
michael@320 263 --with-pkgversion="%{l_openpkg_release -F "OpenPKG-%%t"}" \
michael@320 264 --srcdir=`pwd`/.. \
michael@320 265 --prefix=%{l_prefix} \
michael@320 266 --exec-prefix=%{l_prefix} \
michael@320 267 --mandir=%{l_prefix}/man \
michael@320 268 --infodir=%{l_prefix}/info \
michael@320 269 --includedir=%{l_prefix}/include/gcc%{V_comp} \
michael@320 270 --with-gxx-include-dir=%{l_prefix}/include/g++%{V_comp} \
michael@320 271 --enable-languages="${l_enable_languages}" \
michael@320 272 --enable-threads="${l_enable_threads}" \
michael@320 273 --disable-maintainer-mode \
michael@320 274 --disable-shared \
michael@320 275 --disable-nls \
michael@320 276 %if "%{with_java}" == "yes"
michael@320 277 --with-system-zlib \
michael@320 278 %endif
michael@320 279 %if "%{with_multilib}" == "yes"
michael@320 280 --enable-multilib \
michael@320 281 %else
michael@320 282 --disable-multilib \
michael@320 283 %endif
michael@320 284 %if "%{with_cxx}" == "yes"
michael@320 285 --with-libiconv-prefix=%{l_prefix} \
michael@320 286 %endif
michael@320 287 --with-gmp=%{l_prefix} \
michael@320 288 --with-mpfr=%{l_prefix} \
michael@320 289 --with-mpc=%{l_prefix} \
michael@320 290 ${l_with_gnu_ld_as}
michael@320 291
michael@320 292 # determine build flags
michael@320 293 l_ccisgcc=no
michael@320 294 if [ ".`(%{l_cc} -v; %{l_cc} --version) </dev/null 2>&1 | grep -i 'gcc'`" != . ]; then
michael@320 295 l_ccisgcc=yes
michael@320 296 fi
michael@320 297 l_cflags=""
michael@320 298 l_cxxflags=""
michael@320 299 l_boot_cflags=""
michael@320 300 l_libcflags="-g"
michael@320 301 l_libcxxflags="-g"
michael@320 302 # at least GNU as from GNU binutils supports -pipe always
michael@332 303 "$AS" --version </dev/null 2>/dev/null | grep "^GNU assembler" >/dev/null && {
michael@320 304 l_boot_cflags="$l_boot_cflags -pipe"
michael@320 305 l_libcxxflags="$l_libcxxflags -pipe"
michael@320 306 }
michael@320 307 %if "%{with_optimize}" == "yes"
michael@334 308 # GCC authors are not keeping up with optimized portability expectations
michael@334 309 ( echo "As GCC advances its optimization logic becomes increasingly complex (and"
michael@334 310 echo "buggy?) Since at least GCC 4.5, problems have been reported using arguments"
michael@334 311 echo "-O, -mtune, or -march implicitly or explicitly during different bootstrap"
michael@334 312 echo "stages as well as stage comparison and even the final installation."
michael@334 313 echo ""
michael@334 314 echo "Pay attention when building on one computer and installing on another as"
michael@334 315 echo "problems may be platform specific. If in doubt, disable optimization."
michael@334 316 ) | %{l_rpmtool} msg -b -t warn
michael@337 317 if [ ".$l_ccisgcc" != .yes ]; then
michael@334 318 # CPU native detection only works with GCC (see driver-i386.c)
michael@334 319 ( echo "Platform specific optimization is enabled, but detection of appropriate"
michael@334 320 echo "native architecture is only possible when bootstrapping GCC using a pre-"
michael@337 321 echo "installed GCC. The current build is using a different compiler, so such"
michael@337 322 echo "optimization is generically built while deferring native architecture"
michael@337 323 echo "detection to the final GCC binary."
michael@334 324 echo ""
michael@337 325 echo "To achieve native architecture detection while bootstrapping please"
michael@337 326 echo "install GCC first and then build GCC a second time."
michael@334 327 ) | %{l_rpmtool} msg -b -t notice
michael@332 328 fi
michael@337 329 # tuning without specifying '-march' is portable and in theory
michael@337 330 # allows the resulting GCC binaries to execute on other hosts!
michael@332 331 case "%{l_platform -t}" in
michael@337 332 *sun4[uv]-* ) l_boot_cflags="$l_boot_cflags -mtune=v9" ;;
michael@337 333 *sun*-* ) l_boot_cflags="$l_boot_cflags -mtune=v8" ;;
michael@337 334 *i?86-* | *amd64-* | *ia64-* ) l_boot_cflags="$l_boot_cflags -mtune=native" ;;
michael@337 335 * ) l_boot_cflags="$l_boot_cflags -mtune=generic" ;;
michael@332 336 esac
michael@332 337 l_cflags="$l_cflags -O"
michael@332 338 l_boot_cflags="$l_boot_cflags -O3 -fomit-frame-pointer"
michael@332 339 l_libcxxflags="$l_libcxxflags -O3 -fno-implicit-templates"
michael@332 340 %else
michael@334 341 # don't optimize at all to avoid problems
michael@320 342 l_boot_cflags="$l_boot_cflags -O0"
michael@320 343 l_libcxxflags="$l_libcxxflags -O0"
michael@320 344 %endif
michael@334 345 %if "%{with_profile}" == "yes"
michael@335 346 # generate profile feedback
michael@334 347 maketarget="profiledbootstrap"
michael@334 348 loc_makeflags="%{l_mflags}"
michael@335 349
michael@335 350 # warn about exceptional build duration for profile feedback
michael@335 351 ( echo "Building profile feedback on some hosts can take many days to complete!"
michael@335 352 echo "Now continuing to build a profiled bootstrap with parallel make logic"
michael@335 353 echo "disabled according to profiling requirements..."
michael@335 354 ) | %{l_rpmtool} msg -b -t warn
michael@335 355
michael@335 356 # warn about profiled bootstrap requirement of 64-bit arithmetic
michael@334 357 if [ ".$l_ccisgcc" != .yes ]; then
michael@335 358 ( echo "A preinstalled GCC was not detected although one is recommended for"
michael@335 359 echo "building a profiled bootstrap. Buildtime or runtime errors can occur if"
michael@335 360 echo "the compiler used to build profile feedback doesn't support 64-bit math."
michael@334 361 echo ""
michael@334 362 echo "If in doubt, stop now and start the build again with profiling disabled."
michael@334 363 ) | %{l_rpmtool} msg -b -t warn
michael@334 364 fi
michael@334 365 %else
michael@335 366 # build in three stages
michael@332 367 maketarget="bootstrap"
michael@334 368 loc_makeflags="%{l_mflags -O}"
michael@320 369 %endif
michael@320 370 case "%{l_platform -t}" in
michael@332 371 *64-* ) l_cflags="$l_cflags -fPIC"; l_cxxflags="$l_cxxflags -fPIC" ;;
michael@320 372 esac
michael@335 373 %if "%{with_cxx}" == "yes"
michael@320 374 l_cflags="$l_cflags %{l_cppflags}"
michael@320 375 l_cxxflags="$l_cxxflags %{l_cppflags}"
michael@320 376 l_libcflags="$l_libcflags %{l_cppflags}"
michael@320 377 l_libcxxflags="$l_libcxxflags %{l_cppflags}"
michael@320 378 %endif
michael@320 379
michael@320 380 # build the package
michael@334 381 MAKE="%{l_make} ${loc_makeflags}" \
michael@334 382 %{l_make} ${loc_makeflags} \
michael@332 383 GREP="grep" \
michael@334 384 MAKE="%{l_make} ${loc_makeflags}" \
michael@320 385 BOOT_CFLAGS="${l_boot_cflags}" \
michael@320 386 CFLAGS="${l_cflags}" \
michael@320 387 CXXFLAGS="${l_cxxflags}" \
michael@335 388 %if "%{with_cxx}" == "yes"
michael@335 389 CPPFLAGS="%{l_cppflags}" \
michael@335 390 LDFLAGS="%{l_ldflags}" \
michael@335 391 BOOT_LDFLAGS="%{l_ldflags}" \
michael@335 392 %endif
michael@320 393 LIBCFLAGS="${l_libcflags}" \
michael@320 394 LIBCXXFLAGS="${l_libcxxflags}" \
michael@320 395 $maketarget
michael@320 396
michael@320 397 %install
michael@321 398 rm -rf $RPM_BUILD_ROOT
michael@320 399
michael@320 400 # fetch GNU platform triple
michael@320 401 triple=`./config.guess`
michael@320 402
michael@337 403 # perform standard installation procedure
michael@337 404 ( cd objbld
michael@320 405 %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
michael@320 406 ) || exit $?
michael@320 407
michael@320 408 # cleanup installation tree
michael@320 409 mv $RPM_BUILD_ROOT%{l_prefix}/lib/{lib*.a,*.spec} \
michael@320 410 $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_comp}/${triple}/[0-9]*/ \
michael@320 411 >/dev/null 2>&1 || true
michael@320 412 mv $RPM_BUILD_ROOT%{l_prefix}/lib64/{lib*.a,*.spec} \
michael@320 413 $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_comp}/${triple}/[0-9]*/ \
michael@320 414 >/dev/null 2>&1 || true
michael@320 415 dirs=""
michael@320 416 for multilib in `$RPM_BUILD_ROOT%{l_prefix}/bin/gcc --print-multi-lib`; do
michael@320 417 subdir=`echo "$multilib" | sed -e 's/;.*$//'`
michael@320 418 [ ".$subdir" = .. ] && continue
michael@320 419 mv $RPM_BUILD_ROOT%{l_prefix}/lib/$subdir/lib*.a \
michael@320 420 $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_comp}/${triple}/[0-9]*/$subdir/ \
michael@320 421 >/dev/null 2>&1 || true
michael@320 422 mv $RPM_BUILD_ROOT%{l_prefix}/lib64/$subdir/lib*.a \
michael@320 423 $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_comp}/${triple}/[0-9]*/$subdir/ \
michael@320 424 >/dev/null 2>&1 || true
michael@320 425 dirs="$dirs $subdir"
michael@320 426 done
michael@320 427 for subdir in $dirs; do
michael@320 428 rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib/$subdir >/dev/null 2>&1 || true
michael@320 429 done
michael@320 430 mv $RPM_BUILD_ROOT%{l_prefix}/${triple}/include/* \
michael@320 431 $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_comp}/${triple}/[0-9]*/include/ \
michael@320 432 >/dev/null 2>&1 || true
michael@320 433
michael@332 434 # correct hardcoded paths
michael@332 435 %{l_shtool} subst \
michael@337 436 -e "s;\(dependency_libs\) *=.*;\1='-L%{l_prefix}/lib\ -L%{l_prefix}/lib/gcc%{V_comp}/${triple}/%{V_full}\ -liberty';" \
michael@337 437 $RPM_BUILD_ROOT%{l_prefix}/libexec/gcc%{V_comp}/${triple}/[0-9]*/liblto_plugin.la
michael@332 438
michael@320 439 # strip installation tree
michael@320 440 rm -rf $RPM_BUILD_ROOT%{l_prefix}/${triple}
michael@320 441 rm -f $RPM_BUILD_ROOT%{l_prefix}/info/dir
michael@320 442 rm -rf $RPM_BUILD_ROOT%{l_prefix}/man/man7 >/dev/null 2>&1 || true
michael@320 443 rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/*.la >/dev/null 2>&1 || true
michael@320 444 rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib64 >/dev/null 2>&1 || true
michael@320 445 rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-gcc* >/dev/null 2>&1 || true
michael@320 446 %if "%{with_cxx}" == "yes"
michael@320 447 rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-c++ >/dev/null 2>&1 || true
michael@320 448 rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-g++ >/dev/null 2>&1 || true
michael@320 449 %endif
michael@320 450 strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
michael@320 451 for prog in cc1 cc1plus collect2 cpp; do
michael@320 452 strip $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_comp}/${triple}/[0-9]*/${prog} \
michael@320 453 >/dev/null 2>&1 || true
michael@320 454 done
michael@320 455
michael@320 456 # bump up installation tree
michael@320 457 ln $RPM_BUILD_ROOT%{l_prefix}/bin/gcc \
michael@320 458 $RPM_BUILD_ROOT%{l_prefix}/bin/cc
michael@320 459 ln $RPM_BUILD_ROOT%{l_prefix}/man/man1/gcc.1 \
michael@320 460 $RPM_BUILD_ROOT%{l_prefix}/man/man1/cc.1
michael@320 461 %if "%{with_cxx}" == "yes"
michael@320 462 ln $RPM_BUILD_ROOT%{l_prefix}/man/man1/g++.1 \
michael@320 463 $RPM_BUILD_ROOT%{l_prefix}/man/man1/c++.1
michael@320 464 %endif
michael@320 465
michael@320 466 # determine installation file list
michael@320 467 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
michael@320 468
michael@320 469 %files -f files
michael@320 470
michael@320 471 %clean
michael@321 472 rm -rf $RPM_BUILD_ROOT
michael@320 473

mercurial