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}
375 summary = C++ support for GCC.
377 This package adds C++ support to the GNU Compiler Collection.
378 It includes support for most of the current C++ specification,
379 including templates and exception handling.
384 libstdc++ = %{thisver}
385 libstdc++-devel = %{thisver}
390 %{libdir}/gcc/*/*/cc1plus
391 /usr/share/man/man*/*++*
396 summary = The C Preprocessor.
398 Cpp is the GNU C-Compatible Compiler Preprocessor.
399 Cpp is a macro processor which is used automatically
400 by the C compiler to transform your program before actual
401 compilation. It is called a macro processor because it allows
402 you to define macros, abbreviations for longer
405 The C preprocessor provides four separate functionalities: the
406 inclusion of header files (files of declarations that can be
407 substituted into your program); macro expansion (you can define macros,
408 and the C preprocessor will replace the macros with their definitions
409 throughout the program); conditional compilation (using special
410 preprocessing directives, you can include or exclude parts of the
411 program according to various conditions); and line control (if you use
412 a program to combine or rearrange source files into an intermediate
413 file which is then compiled, you can use line control to inform the
414 compiler about where each source line originated).
416 You should install this package if you are a C programmer and you use
419 group = Development/Languages
424 %{mandir}/man1/cpp.1*
425 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/cc1
429 requires = gcc-c++ = %{thisver}
433 summary = GCC shared support library.
435 This package contains GCC shared support library which is needed
436 e.g. for exception handling support.
440 %{libdir}/libgcc*.so.*
450 summary = GNU Standard C++ Library.
452 The libstdc++ package contains a rewritten standard compliant GCC Standard
457 %{libdir}/libstdc++*.so.*
461 package libstdc++-devel
462 summary = Header files and libraries for C++ development.
464 This is the GNU implementation of the standard C++ libraries. This
465 package includes the header files and libraries needed for C++
466 development. This includes rewritten implementation of STL.
470 libstdc++ = %{thisver}
475 %{libdir}/libstdc++*.so
479 package libstdc++-static
480 summary = Static libraries for the GNU standard C++ library
481 description = %{summary}
484 libstdc++-devel = %{thisver}
488 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libstdc++.a
489 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libsupc++.a
494 summary = GCC OpenMP v3.0 shared support library.
496 This package contains GCC shared support library which is needed
497 for OpenMP v3.0 support.
501 %{libdir}/libgomp*.so.*
505 if "%{build_libquadmath}" == "1"
507 summary = GCC __float128 shared support library.
509 This package contains GCC shared support library which is needed
510 for __float128 math support and for Fortran REAL*16 support.
514 %{libdir}/libquadmath*.so.*
518 package libquadmath-devel
519 summary = Development files for GCC __float128 support.
521 This package contains headers for building Fortran programs using
522 REAL*16 and programs using __float128 math.
527 libquadmath = %{thisver}
531 %{libdir}/libquadmath.so
532 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/include/quadmath.h
533 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/include/quadmath_weak.h
534 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libquadmath.so
540 summary = The GNU Transactional Memory library.
542 This package contains the GNU Transactional Memory library
543 which is a GCC transactional memory support runtime library.
547 %{libdir}/libitm.so.1*
552 summary = The GNU Transactional Memory support.
554 This package contains headers and support files for the
555 GNU Transactional Memory library.
565 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/include/itm.h
566 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/include/itm_weak.h
567 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libitm.so
572 summary = The GNU Atomic library
574 This package contains the GNU Atomic library which is a
575 GCC support runtime library for atomisc operations not
576 supported by hardware.
580 %{libdir}/libatomic.so.1*
585 summary = The Address Sanitizer runtime library
587 This package contains the Address Sanitizer library
588 which is used for -fsanitize=address instrumented programs.
592 %{libdir}/libasan.so.2*
596 if "%{build_libtsan}" == "1"
598 summary = The Thread Sanitizer runtime library
600 This package contains the Thread Sanitizer library
601 which is used for -fsanitize=thread instrumented programs.
605 %{libdir}/libtsan.so.0*
610 if "%{build_libubsan}" == "1"
612 summary = The Undefined Behavior Sanitizer runtime library
614 This package contains the Undefined Behavior Sanitizer library
615 which is used for -fsanitize=undefined instrumented programs.
619 %{libdir}/libubsan.so.0*
624 if "%{build_liblsan}" == "1"
626 summary = The Leak Sanitizer runtime library
628 This package contains the Leak Sanitizer library
629 which is used for -fsanitize=leak instrumented programs.
633 %{libdir}/liblsan.so.0*
638 if "%{build_libcilkrts}" == "1"
640 summary = The Cilk+ runtime library
642 This package contains the Cilk+ runtime library.
646 %{libdir}/libcilkrts.so.5*
651 package gcc-plugin-devel
652 summary = Support for compiling GCC plugins.
654 This package contains header files and other support files
655 for compiling GCC plugins. The GCC plugin ABI is currently
656 not stable, so plugins must be rebuilt any time GCC is updated.
663 libmpc-devel >= 0.8.1
667 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/plugin
671 package %{name}-debuginfo