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 graphite
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 binutils_version = 2.24
27 source_dl = http://ftp.gnu.org/gnu/gcc/%{thisapp}/
28 source_dl += ftp://gcc.gnu.org/pub/gcc/infrastructure/
29 sources = %{thisapp}.tar.gz
34 binutils >= %{binutils_version}
50 # If graphite support is enabled, we require the devel packages for build.
51 if "%{build_graphite}" == "1"
52 requires += isl-devel >= 0.14
55 # Build libquadmath (only on x86).
58 # Build liblsan (only on x86_64).
61 # Build libtasn (only on x86_64).
67 # Build libcilkrts (only x86)
70 # A couple of configure arguments depending on the architecture and
74 make_bootstrap = profiledbootstrap
76 if "%{DISTRO_ARCH}" == "x86_64"
77 configure_options = --disable-multilib
86 if "%{DISTRO_ARCH}" == "i686"
87 configure_options = --with-arch=%{DISTRO_ARCH} --with-tune=generic
94 if "%{DISTRO_ARCH}" == "aarch64"
98 if "%{DISTRO_ARCH}" == "armv7hl"
99 make_bootstrap = bootstrap
101 configure_options += --disable-sjlj-exceptions
103 configure_options += \
104 --with-tune=cortex-a8 \
105 --with-arch=armv7-a \
107 --with-fpu=vfpv3-d16 \
108 --with-abi=aapcs-linux
113 if "%{DISTRO_ARCH}" == "armv5tel"
114 make_bootstrap = bootstrap
116 configure_options += --disable-sjlj-exceptions
117 configure_options += --with-float=soft
122 if "%{build_graphite}" == "1"
123 configure_options += \
127 # CFLAGS for hardening.
128 HARD_CFLAGS = -DENABLE_ESP -DEFAULT_PIE_SSP -DEFAULT_RELRO -DEFAULT_BIND_NOW
131 mkdir -v %{DIR_SRC}/gcc-build
133 # Remove unneeded features that will save some compile time
134 rm -rf lib{gfortran,java,objc} gcc/{fortran,java,objc,objcp}
136 # Apply a sed substitution that will suppress the installation of
137 # libiberty.a. The version of libiberty.a provided by Binutils will be used
139 sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in
142 echo "%{DISTRO_NAME} %{version}-%{release}" > gcc/DEV-PHASE
144 # Libgomp uses -Werror regardless of --disable-werror, and this will cause a
145 # build failure when -D_FORTIFY_SOURCE=2 causes build time warnings:
146 sed -e "s/-Werror//" -i libgomp/configure
148 # The fixincludes script is known to occasionally erroneously attempt to
149 # "fix" the system headers installed so far. As the headers up to this point
150 # are known to not require fixing, issue the following command to prevent
151 # the fixincludes script from running:
152 sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in
154 sed -i gcc/Makefile.in \
155 -e "s/-fno-exceptions/& -fno-asynchronous-unwind-tables/"
157 # we want to be able to control the pie patch logic via something other
158 # than ALL_CFLAGS and ALL_CXXFLAGS...
159 sed -i gcc/Makefile.in \
160 -e '/^ALL_CFLAGS/iHARD_CFLAGS = %{HARD_CFLAGS}' \
161 -e 's|^ALL_CFLAGS = |ALL_CFLAGS = $(HARD_CFLAGS) |' \
162 -e '/^ALL_CXXFLAGS/iHARD_CFLAGS = %{HARD_CFLAGS}' \
163 -e 's|^ALL_CXXFLAGS = |ALL_CXXFLAGS = $(HARD_CFLAGS) |'
165 # However, genautomata crashes with a "Bus Error" when compiled
167 sed -i gcc/Makefile.in \
168 -e 's|^build/genautomata$(build_exeext) .*|& -fno-PIC|'
170 # Default to -gdwarf-4 -fno-debug-types-section rather than -gdwarf-2
171 sed -i gcc/common.opt \
172 -e '/UInteger Var(dwarf_version)/s/Init(2)/Init(4)/' \
173 -e '/flag_debug_types_section/s/Init(1)/Init(0)/' \
174 -e '/dwarf_record_gcc_switches/s/Init(0)/Init(1)/' \
175 -e 's/\(may be either 2, 3 or 4; the default version is \)2\./\14./'
177 #./contrib/gcc_update --touch
184 cd %{DIR_SRC}/gcc-build
188 CFLAGS=$(echo ${CFLAGS} | sed -e 's/\(-Wp,\)\?-D_FORTIFY_SOURCE=[12]//g')
189 CFLAGS=$(echo ${CFLAGS} | sed -e 's/-Werror=format-security//g')
190 CFLAGS=$(echo ${CFLAGS} | sed -e 's/-m64//g;s/-m32//g;s/-m31//g')
191 CFLAGS=$(echo ${CFLAGS} | sed -e 's/-mfpmath=sse/-mfpmath=sse -msse2/g')
192 CFLAGS=$(echo ${CFLAGS} | sed -e 's/-march=i.86//g')
193 CFLAGS=$(echo ${CFLAGS} | sed -e 's/ -pipe / /g')
194 CFLAGS=$(echo "${CFLAGS}" | sed -e 's/[[:blank:]]\+/ /g')
195 CXXFLAGS=$(echo ${CFLAGS} | sed -e 's/ -Wall//g')
196 CXXFLAGS=$(echo ${CXXFLAGS} | sed -e 's/ -fexceptions / /g')
197 #CXXFLAGS=$(echo ${CXXFLAGS} | sed -e 's/ -Werror=format-security / -Wformat -Werror=format-security /g')
200 *-fasynchronous-unwind-tables*)
201 sed -i -e "s/-fno-exceptions /-fno-exceptions -fno-asynchronous-unwind-tables/" \
202 ../%{thisapp}/Makefile.in
207 CXXFLAGS="${CXXFLAGS}" \
208 XCFLAGS="${CFLAGS}" \
209 TCFLAGS="${CFLAGS}" \
210 ../%{thisapp}/configure \
211 --build=%{DISTRO_BUILDTARGET} \
214 --libexecdir=%{libdir} \
218 --enable-threads=posix \
219 --enable-__cxa_atexit \
220 --enable-clocale=gnu \
221 --enable-languages=c,c++,lto \
223 --enable-checking=release \
227 --with-bugurl=http://bugtracker.ipfire.org \
228 --disable-libunwind-exceptions \
229 --enable-gnu-unique-object \
230 --enable-linker-build-id \
231 --with-linker-hash-style=gnu \
233 --enable-initfini-array \
235 --enable-gnu-indirect-function \
238 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58012
239 # XXX disabled flags: --disable-static
241 # GCC does not support a parallel build.
242 make %{make_bootstrap} BOOT_CFLAGS="${CFLAGS}"
244 # Generate man pages.
245 perl -pi -e 's/head3/head2/' ../contrib/texi2pod.pl
246 for i in %{DIR_APP}/gcc/doc/*.texi; do
247 cp -a $i $i.orig; sed 's/ftable/table/' $i.orig > $i
249 make -C gcc generated-manpages
250 for i in %{DIR_APP}/gcc/doc/*.texi; do mv -f $i.orig $i; done
254 # cd %{DIR_SRC}/gcc-build && make -k check || true
255 # cd %{DIR_APP} && ./contrib/test_summary
259 cd %{DIR_SRC}/gcc-build
260 make install DESTDIR=%{BUILDROOT}
262 # Check if the installation path exists.
263 FULLPATH="%{BUILDROOT}%{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}"
264 [ -d "${FULLPATH}" ] || exit 1
266 mkdir -pv %{BUILDROOT}%{prefix}/lib
267 ln -sfv ../bin/cpp %{BUILDROOT}%{prefix}/lib/cpp
268 ln -sfv gcc %{BUILDROOT}/usr/bin/cc
270 # Fix libgcc_s symlinks.
271 rm -f ${FULLPATH}/libgcc_s.so %{BUILDROOT}%{libdir}/libgcc_s.so
272 case "%{DISTRO_ARCH}" in
274 cat <<EOF >${FULLPATH}/libgcc_s.so
276 Use the shared library, but some functions are only in
277 the static library, so try that secondarily. */
278 OUTPUT_FORMAT(elf32-littlearm)
279 GROUP ( %{libdir}/libgcc_s.so.1 libgcc.a )
283 ln -svf ../../../../..%{libdir}/libgcc_s.so.1 ${FULLPATH}/libgcc_s.so
286 chmod 755 %{BUILDROOT}%{libdir}/libgcc_s.so.1
288 # Remove some GNU debugger stuff.
289 rm -vf %{BUILDROOT}%{libdir}/lib*.py
291 # Install missing header file(s) on ARM.
292 case "%{DISTRO_ARCH}" in
294 cp -vf %{DIR_APP}/gcc/config/vxworks-dummy.h \
295 ${FULLPATH}/plugin/include/config/
296 cp -vf %{DIR_APP}/gcc/config/arm/arm-cores.def \
297 ${FULLPATH}/plugin/include/config/arm/
302 mv -vf %{BUILDROOT}%{libdir}/libgomp.spec ${FULLPATH}/
303 ln -svf ../../../libgomp.so.1.0.0 ${FULLPATH}/libgomp.so
304 chmod 755 %{BUILDROOT}%{libdir}/libgomp.so.1.*
307 ln -svf ../../../libstdc++.so.6.0.21 ${FULLPATH}/libstdc++.so
308 mv -vf %{BUILDROOT}%{libdir}/lib{std,sup}c++.a ${FULLPATH}
311 if [ "%{build_libquadmath}" = "1" ]; then
312 ln -svf ../../../libquadmath.so.0.0.0 ${FULLPATH}/libquadmath.so
313 chmod 755 %{BUILDROOT}%{libdir}/libquadmath.so.0.*
317 mv -vf %{BUILDROOT}%{libdir}/libitm.spec ${FULLPATH}/
318 ln -svf ../../../libitm.so.1.0.0 ${FULLPATH}/libitm.so
319 chmod 755 %{BUILDROOT}%{libdir}/libitm.so.1.*
322 if [ "%{build_liblsan}" = "1" ]; then
323 ln -svf ../../../liblsan.so.0.0.0 ${FULLPATH}/liblsan.so
324 chmod 755 %{BUILDROOT}%{libdir}/liblsan.so.*
328 if [ "%{build_libtsan}" = "1" ]; then
329 ln -svf ../../../libtsan.so.0.0.0 ${FULLPATH}/libtsan.so
330 chmod 755 %{BUILDROOT}%{libdir}/libtsan.so.*
334 if [ "%{build_libubsan}" = "1" ]; then
335 ln -svf ../../../libubsan.so.0.0.0 ${FULLPATH}/libubsan.so
336 chmod 755 %{BUILDROOT}%{libdir}/libubsan.so.*
340 if [ "%{build_libcilkrts}" = "1" ]; then
341 ln -svf ../../../libcilkrts.so.5.0.0 ${FULLPATH}/libcilkrts.so
342 chmod 755 %{BUILDROOT}%{libdir}/libcilkrts.so.5.*
347 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libgcc.a
348 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libgcc_eh.a
349 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libstdc++.a
350 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libsupc++.a
359 binutils >= %{binutils_version}
369 # We do not ship libgcc-devel anymore.
370 provides += libgcc-devel = %{thisver}
371 obsoletes += libgcc-devel < %{thisver}
373 if "%{build_cloog}" == "1"
374 requires += cloog >= %{cloog_version}
379 summary = C++ support for GCC.
381 This package adds C++ support to the GNU Compiler Collection.
382 It includes support for most of the current C++ specification,
383 including templates and exception handling.
388 libstdc++ = %{thisver}
389 libstdc++-devel = %{thisver}
394 %{libdir}/gcc/*/*/cc1plus
395 /usr/share/man/man*/*++*
400 summary = The C Preprocessor.
402 Cpp is the GNU C-Compatible Compiler Preprocessor.
403 Cpp is a macro processor which is used automatically
404 by the C compiler to transform your program before actual
405 compilation. It is called a macro processor because it allows
406 you to define macros, abbreviations for longer
409 The C preprocessor provides four separate functionalities: the
410 inclusion of header files (files of declarations that can be
411 substituted into your program); macro expansion (you can define macros,
412 and the C preprocessor will replace the macros with their definitions
413 throughout the program); conditional compilation (using special
414 preprocessing directives, you can include or exclude parts of the
415 program according to various conditions); and line control (if you use
416 a program to combine or rearrange source files into an intermediate
417 file which is then compiled, you can use line control to inform the
418 compiler about where each source line originated).
420 You should install this package if you are a C programmer and you use
423 group = Development/Languages
428 %{mandir}/man1/cpp.1*
429 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/cc1
433 requires = gcc-c++ = %{thisver}
437 summary = GCC shared support library.
439 This package contains GCC shared support library which is needed
440 e.g. for exception handling support.
444 %{libdir}/libgcc*.so.*
454 summary = GNU Standard C++ Library.
456 The libstdc++ package contains a rewritten standard compliant GCC Standard
461 %{libdir}/libstdc++*.so.*
465 package libstdc++-devel
466 summary = Header files and libraries for C++ development.
468 This is the GNU implementation of the standard C++ libraries. This
469 package includes the header files and libraries needed for C++
470 development. This includes rewritten implementation of STL.
474 libstdc++ = %{thisver}
479 %{libdir}/libstdc++*.so
483 package libstdc++-static
484 summary = Static libraries for the GNU standard C++ library
485 description = %{summary}
488 libstdc++-devel = %{thisver}
492 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libstdc++.a
493 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libsupc++.a
498 summary = GCC OpenMP v3.0 shared support library.
500 This package contains GCC shared support library which is needed
501 for OpenMP v3.0 support.
505 %{libdir}/libgomp*.so.*
509 if "%{build_libquadmath}" == "1"
511 summary = GCC __float128 shared support library.
513 This package contains GCC shared support library which is needed
514 for __float128 math support and for Fortran REAL*16 support.
518 %{libdir}/libquadmath*.so.*
522 package libquadmath-devel
523 summary = Development files for GCC __float128 support.
525 This package contains headers for building Fortran programs using
526 REAL*16 and programs using __float128 math.
531 libquadmath = %{thisver}
535 %{libdir}/libquadmath.so
536 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/include/quadmath.h
537 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/include/quadmath_weak.h
538 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libquadmath.so
544 summary = The GNU Transactional Memory library.
546 This package contains the GNU Transactional Memory library
547 which is a GCC transactional memory support runtime library.
551 %{libdir}/libitm.so.1*
556 summary = The GNU Transactional Memory support.
558 This package contains headers and support files for the
559 GNU Transactional Memory library.
569 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/include/itm.h
570 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/include/itm_weak.h
571 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libitm.so
576 summary = The GNU Atomic library
578 This package contains the GNU Atomic library which is a
579 GCC support runtime library for atomisc operations not
580 supported by hardware.
584 %{libdir}/libatomic.so.1*
589 summary = The Address Sanitizer runtime library
591 This package contains the Address Sanitizer library
592 which is used for -fsanitize=address instrumented programs.
596 %{libdir}/libasan.so.2*
600 if "%{build_libtsan}" == "1"
602 summary = The Thread Sanitizer runtime library
604 This package contains the Thread Sanitizer library
605 which is used for -fsanitize=thread instrumented programs.
609 %{libdir}/libtsan.so.0*
614 if "%{build_libubsan}" == "1"
616 summary = The Undefined Behavior Sanitizer runtime library
618 This package contains the Undefined Behavior Sanitizer library
619 which is used for -fsanitize=undefined instrumented programs.
623 %{libdir}/libubsan.so.0*
628 if "%{build_liblsan}" == "1"
630 summary = The Leak Sanitizer runtime library
632 This package contains the Leak Sanitizer library
633 which is used for -fsanitize=leak instrumented programs.
637 %{libdir}/liblsan.so.0*
642 if "%{build_libcilkrts}" == "1"
644 summary = The Cilk+ runtime library
646 This package contains the Cilk+ runtime library.
650 %{libdir}/libcilkrts.so.5*
655 package gcc-plugin-devel
656 summary = Support for compiling GCC plugins.
658 This package contains header files and other support files
659 for compiling GCC plugins. The GCC plugin ABI is currently
660 not stable, so plugins must be rebuilt any time GCC is updated.
667 libmpc-devel >= 0.8.1
671 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/plugin
675 package %{name}-debuginfo