1 ###############################################################################
2 # IPFire.org - An Open Source Firewall Solution #
3 # Copyright (C) - IPFire Development Team <info@ipfire.org> #
4 ###############################################################################
6 # Configure build to compile with cloog and ppl.
13 maintainer = Michael Tremer <michael.tremer@ipfire.org>
14 groups = Development/Compilers
15 url = http://gcc.gnu.org/
16 license = GPLv3+ and GPLv2+ with exceptions
17 summary = Various compilers (C, C++, Objective-C, Java, ...).
20 The gcc package contains the GNU Compiler Collection. \
21 You'll need this package in order to compile C code.
24 # This is the at least required version of binutils.
25 required_binutils_version = 2.21.51.0.8-1
27 source_dl = http://ftp.gnu.org/gnu/gcc/%{thisapp}/
28 sources = %{thisapp}.tar.gz
33 binutils>=%{required_binutils_version}
49 # If cloog support is enabled, we require the devel packages for build.
50 if "%{build_cloog_ppl}" == "1"
51 requires += cloog-ppl-devel >= 0.15.11-2
52 requires += ppl-devel >= 1.0
55 # Build libquadmath (only on x86).
58 # A couple of configure arguments depending on the architecture and
62 make_bootstrap = profiledbootstrap
64 if "%{DISTRO_ARCH}" == "x86_64"
65 configure_options = --disable-multilib
70 if "%{DISTRO_ARCH}" == "i686"
71 configure_options = --with-arch=%{DISTRO_ARCH} --with-tune=generic
76 if "%{DISTRO_ARCH}" == "armv5tel"
77 make_bootstrap = bootstrap
79 configure_options += --disable-sjlj-exceptions
80 configure_options += --with-float=soft
83 if "%{DISTRO_ARCH}" == "armv7hl"
84 make_bootstrap = bootstrap
86 configure_options += --disable-sjlj-exceptions
88 configure_options += \
89 --with-cpu=cortex-a8 \
90 --with-tune=cortex-a8 \
93 --with-fpu=vfpv3-d16 \
94 --with-abi=aapcs-linux
97 if "%{build_cloog_ppl}" == "1"
98 configure_options += --with-cloog --with-ppl \
99 --disable-ppl-version-check
102 # CFLAGS for hardening.
103 HARD_CFLAGS = -DEFAULT_PIE -DEFAULT_SSP -DEFAULT_PIE_SSP -DEFAULT_ESP_SPP \
104 -DENABLE_ESP_SSP -DEFAULT_RELRO -DEFAULT_BIND_NOW
107 mkdir -v %{DIR_SRC}/gcc-build
109 # Remove unneeded features that will save some compile time
110 rm -rf lib{gfortran,java,objc} gcc/{fortran,java,objc,objcp}
112 # Apply a sed substitution that will suppress the installation of
113 # libiberty.a. The version of libiberty.a provided by Binutils will be used
115 sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in
118 echo "%{DISTRO_NAME} %{version}-%{release}" > gcc/DEV-PHASE
120 # Libgomp uses -Werror regardless of --disable-werror, and this will cause a
121 # build failure when -D_FORTIFY_SOURCE=2 causes build time warnings:
122 sed -e "s/-Werror//" -i libgomp/configure
124 # The fixincludes script is known to occasionally erroneously attempt to
125 # "fix" the system headers installed so far. As the headers up to this point
126 # are known to not require fixing, issue the following command to prevent
127 # the fixincludes script from running:
128 sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in
130 sed -i gcc/Makefile.in \
131 -e "s/-fno-exceptions/& -fno-asynchronous-unwind-tables/"
133 # we want to be able to control the pie patch logic via something other
134 # than ALL_CFLAGS and ALL_CXXFLAGS...
135 sed -i gcc/Makefile.in \
136 -e '/^ALL_CFLAGS/iHARD_CFLAGS = ' \
137 -e 's|^ALL_CFLAGS = |ALL_CFLAGS = $(HARD_CFLAGS) |' \
138 -e '/^ALL_CXXFLAGS/iHARD_CFLAGS = ' \
139 -e 's|^ALL_CXXFLAGS = |ALL_CXXFLAGS = $(HARD_CFLAGS) |'
141 # Enable the GCC hardening by default.
142 sed -i gcc/Makefile.in \
143 -e "s|^HARD_CFLAGS = |HARD_CFLAGS = %{HARD_CFLAGS} |"
145 # Compile the compiler with -fPIC as well.
146 # However, genautomata crashes with a "Bus Error" when compiled
148 sed -i gcc/Makefile.in \
149 -e "s|^ESP_NOPIE_CFLAGS = .*|ESP_NOPIE_CFLAGS =|" \
150 -e 's|^build/genautomata$(build_exeext) .*|& -fno-PIC|'
152 # Default to -gdwarf-4 -fno-debug-types-section rather than -gdwarf-2
153 sed -i gcc/common.opt \
154 -e '/UInteger Var(dwarf_version)/s/Init(2)/Init(4)/' \
155 -e '/flag_debug_types_section/s/Init(1)/Init(0)/' \
156 -e '/dwarf_record_gcc_switches/s/Init(0)/Init(1)/' \
157 -e 's/\(may be either 2, 3 or 4; the default version is \)2\./\14./'
159 ./contrib/gcc_update --touch
163 cd %{DIR_SRC}/gcc-build
167 CFLAGS=$(echo ${CFLAGS} | sed -e 's/\(-Wp,\)\?-D_FORTIFY_SOURCE=[12]//g')
168 CFLAGS=$(echo ${CFLAGS} | sed -e 's/-m64//g;s/-m32//g;s/-m31//g')
169 CFLAGS=$(echo ${CFLAGS} | sed -e 's/-march=i.86//g')
170 CFLAGS=$(echo ${CFLAGS} | sed -e 's/ -pipe / /g')
171 CFLAGS=$(echo "${CFLAGS}" | sed -e 's/[[:blank:]]\+/ /g')
172 CXXFLAGS=$(echo ${CFLAGS} | sed -e 's/ -Wall//g')
175 CXXFLAGS="${CXXFLAGS}" \
176 XCFLAGS="${CFLAGS}" \
177 TCFLAGS="${CFLAGS}" \
178 ../%{thisapp}/configure \
179 --build=%{DISTRO_BUILDTARGET} \
182 --libexecdir=%{libdir} \
183 --mandir=/usr/share/man \
186 --enable-threads=posix \
187 --enable-__cxa_atexit \
188 --enable-clocale=gnu \
189 --enable-languages=c,c++,lto \
191 --enable-checking=release \
192 --disable-build-with-cxx \
193 --disable-build-poststage1-with-cxx \
198 --with-bugurl=http://bugtracker.ipfire.org \
199 --disable-libunwind-exceptions \
200 --enable-gnu-unique-object \
201 --enable-linker-build-id \
202 --with-linker-hash-style=gnu \
205 # GCC does not support a parallel build.
206 make %{make_bootstrap} BOOT_CFLAGS="${CFLAGS}"
208 # Generate man pages.
209 perl -pi -e 's/head3/head2/' ../contrib/texi2pod.pl
210 for i in %{DIR_APP}/gcc/doc/*.texi; do
211 cp -a $i $i.orig; sed 's/ftable/table/' $i.orig > $i
213 make -C gcc generated-manpages
214 for i in %{DIR_APP}/gcc/doc/*.texi; do mv -f $i.orig $i; done
218 # cd %{DIR_SRC}/gcc-build && make check
219 # cd %{DIR_APP} && ./contrib/test_summary
223 cd %{DIR_SRC}/gcc-build
224 make install DESTDIR=%{BUILDROOT}
226 # Check if the installation path exists.
227 FULLPATH="%{BUILDROOT}%{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}"
228 [ -d "${FULLPATH}" ] || exit 1
230 mkdir -pv %{BUILDROOT}%{prefix}/lib
231 ln -sfv ../bin/cpp %{BUILDROOT}%{prefix}/lib/cpp
232 ln -sfv gcc %{BUILDROOT}/usr/bin/cc
234 # Fix libgcc_s symlinks.
235 rm -f ${FULLPATH}/libgcc_s.so %{BUILDROOT}%{libdir}/libgcc_s.so
236 case "%{DISTRO_ARCH}" in
238 cat <<EOF >${FULLPATH}/libgcc_s.so
240 Use the shared library, but some functions are only in
241 the static library, so try that secondarily. */
242 OUTPUT_FORMAT(elf32-littlearm)
243 GROUP ( %{libdir}/libgcc_s.so.1 libgcc.a )
247 ln -svf ../../../../..%{libdir}/libgcc_s.so.1 ${FULLPATH}/libgcc_s.so
250 chmod 755 %{BUILDROOT}%{libdir}/libgcc_s.so.1
252 # Remove some GNU debugger stuff.
253 rm -vf %{BUILDROOT}%{libdir}/lib*.py
255 # Install missing header file(s) on ARM.
256 case "%{DISTRO_ARCH}" in
258 cp -vf %{DIR_APP}/gcc/config/vxworks-dummy.h \
259 ${FULLPATH}/plugin/include/config/
260 cp -vf %{DIR_APP}/gcc/config/arm/arm-cores.def \
261 ${FULLPATH}/plugin/include/config/arm/
266 mv -vf %{BUILDROOT}%{libdir}/libgomp.spec ${FULLPATH}/
267 ln -svf ../../../libgomp.so.1.0.0 ${FULLPATH}/libgomp.so
268 chmod 755 %{BUILDROOT}%{libdir}/libgomp.so.1.*
271 ln -svf ../../../libstdc++.so.6.0.17 ${FULLPATH}/libstdc++.so
274 ln -svf ../../../libmudflap.so.0.0.0 ${FULLPATH}/libmudflap.so
275 ln -svf ../../../libmudflapth.so.0.0.0 ${FULLPATH}/libmudflapth.so
276 chmod 755 %{BUILDROOT}%{libdir}/libmudflap{,th}.so.0.*
279 if [ "%{build_libquadmath}" = "1" ]; then
280 ln -svf ../../../libquadmath.so.0.0.0 ${FULLPATH}/libquadmath.so
281 chmod 755 %{BUILDROOT}%{libdir}/libquadmath.so.0.*
285 mv -vf %{BUILDROOT}%{libdir}/libitm.spec ${FULLPATH}/
286 ln -svf ../../../libitm.so.1.0.0 ${FULLPATH}/libitm.so
287 chmod 755 %{BUILDROOT}%{libdir}/libitm.so.1.*
291 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libgcc.a
292 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libgcc_eh.a
301 binutils >= %{required_binutils_version}
311 # We do not ship libgcc-devel anymore.
312 provides += libgcc-devel = %{thisver}
313 obsoletes += libgcc-devel < %{thisver}
315 if "%{build_cloog_ppl}" == "1"
316 requires += cloog-ppl >= 0.15
321 summary = C++ support for GCC.
323 This package adds C++ support to the GNU Compiler Collection.
324 It includes support for most of the current C++ specification,
325 including templates and exception handling.
330 libstdc++ = %{thisver}
331 libstdc++-devel = %{thisver}
336 %{libdir}/gcc/*/*/cc1plus
337 /usr/share/man/man*/*++*
342 summary = The C Preprocessor.
344 Cpp is the GNU C-Compatible Compiler Preprocessor.
345 Cpp is a macro processor which is used automatically
346 by the C compiler to transform your program before actual
347 compilation. It is called a macro processor because it allows
348 you to define macros, abbreviations for longer
351 The C preprocessor provides four separate functionalities: the
352 inclusion of header files (files of declarations that can be
353 substituted into your program); macro expansion (you can define macros,
354 and the C preprocessor will replace the macros with their definitions
355 throughout the program); conditional compilation (using special
356 preprocessing directives, you can include or exclude parts of the
357 program according to various conditions); and line control (if you use
358 a program to combine or rearrange source files into an intermediate
359 file which is then compiled, you can use line control to inform the
360 compiler about where each source line originated).
362 You should install this package if you are a C programmer and you use
365 group = Development/Languages
370 %{mandir}/man1/cpp.1*
371 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/cc1
375 requires = gcc-c++ = %{thisver}
379 summary = GCC shared support library.
381 This package contains GCC shared support library which is needed
382 e.g. for exception handling support.
386 %{libdir}/libgcc*.so.*
391 summary = GNU Standard C++ Library.
393 The libstdc++ package contains a rewritten standard compliant GCC Standard
398 %{libdir}/libstdc++*.so.*
402 package libstdc++-devel
403 summary = Header files and libraries for C++ development.
405 This is the GNU implementation of the standard C++ libraries. This
406 package includes the header files and libraries needed for C++
407 development. This includes rewritten implementation of STL.
411 libstdc++ = %{thisver}
416 %{libdir}/libstdc++*.so
421 summary = GCC OpenMP v3.0 shared support library.
423 This package contains GCC shared support library which is needed
424 for OpenMP v3.0 support.
428 %{libdir}/libgomp*.so.*
433 summary = GCC mudflap shared support library.
435 This package contains GCC shared support library which is needed
440 %{libdir}/libmudflap*.so.*
444 package libmudflap-devel
445 summary = Development files for GCC mudflap support.
447 This package contains headers for building mudflap-instrumented programs.
449 To instrument a non-threaded program, add -fmudflap
450 option to GCC and when linking add -lmudflap, for threaded programs
451 also add -fmudflapth and -lmudflapth.
455 libmudflap = %{thisver}
459 %{libdir}/libmudflap.so
460 %{libdir}/libmudflapth.so
461 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/include/mf-runtime.h
462 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libmudflap.so
463 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libmudflapth.so
467 if "%{build_libquadmath}" == "1"
469 summary = GCC __float128 shared support library.
471 This package contains GCC shared support library which is needed
472 for __float128 math support and for Fortran REAL*16 support.
476 %{libdir}/libquadmath*.so.*
480 package libquadmath-devel
481 summary = Development files for GCC __float128 support.
483 This package contains headers for building Fortran programs using
484 REAL*16 and programs using __float128 math.
489 libquadmath = %{thisver}
493 %{libdir}/libquadmath.so
494 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/include/quadmath.h
495 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/include/quadmath_weak.h
496 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libquadmath.so
502 summary = The GNU Transactional Memory library.
504 This package contains the GNU Transactional Memory library
505 which is a GCC transactional memory support runtime library.
509 %{libdir}/libitm.so.1*
514 summary = The GNU Transactional Memory support.
516 This package contains headers and support files for the
517 GNU Transactional Memory library.
527 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/include/itm.h
528 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/include/itm_weak.h
529 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libitm.so
533 package gcc-plugin-devel
534 summary = Support for compiling GCC plugins.
536 This package contains header files and other support files
537 for compiling GCC plugins. The GCC plugin ABI is currently
538 not stable, so plugins must be rebuilt any time GCC is updated.
545 libmpc-devel >= 0.8.1
549 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/plugin
553 package %{name}-debuginfo