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 libmpx (only on x86_64)
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
93 if "%{DISTRO_ARCH}" == "aarch64"
97 if "%{DISTRO_ARCH}" == "armv7hl"
98 make_bootstrap = bootstrap
100 configure_options += --disable-sjlj-exceptions
102 configure_options += \
103 --with-tune=cortex-a8 \
104 --with-arch=armv7-a \
106 --with-fpu=vfpv3-d16 \
107 --with-abi=aapcs-linux
112 if "%{DISTRO_ARCH}" == "armv5tel"
113 make_bootstrap = bootstrap
115 configure_options += --disable-sjlj-exceptions
116 configure_options += --with-float=soft
121 if "%{build_graphite}" == "1"
122 configure_options += \
127 mkdir -v %{DIR_SRC}/gcc-build
129 # Remove unneeded features that will save some compile time
130 rm -rf lib{gfortran,java,objc} gcc/{fortran,java,objc,objcp}
132 # Apply a sed substitution that will suppress the installation of
133 # libiberty.a. The version of libiberty.a provided by Binutils will be used
135 sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in
138 echo "%{DISTRO_NAME} %{version}-%{release}" > gcc/DEV-PHASE
140 # Libgomp uses -Werror regardless of --disable-werror, and this will cause a
141 # build failure when -D_FORTIFY_SOURCE=2 causes build time warnings:
142 sed -e "s/-Werror//" -i libgomp/configure
144 # The fixincludes script is known to occasionally erroneously attempt to
145 # "fix" the system headers installed so far. As the headers up to this point
146 # are known to not require fixing, issue the following command to prevent
147 # the fixincludes script from running:
148 sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in
150 sed -i gcc/Makefile.in \
151 -e "s/-fno-exceptions/& -fno-asynchronous-unwind-tables/"
153 #./contrib/gcc_update --touch
160 cd %{DIR_SRC}/gcc-build
164 CFLAGS=$(echo ${CFLAGS} | sed -e 's/\(-Wp,\)\?-D_FORTIFY_SOURCE=[12]//g')
165 CFLAGS=$(echo ${CFLAGS} | sed -e 's/-Werror=format-security//g')
166 CFLAGS=$(echo ${CFLAGS} | sed -e 's/-m64//g;s/-m32//g;s/-m31//g')
167 CFLAGS=$(echo ${CFLAGS} | sed -e 's/-mfpmath=sse/-mfpmath=sse -msse2/g')
168 CFLAGS=$(echo ${CFLAGS} | sed -e 's/-march=i.86//g')
169 CFLAGS=$(echo ${CFLAGS} | sed -e 's/ -pipe / /g')
170 CFLAGS=$(echo "${CFLAGS}" | sed -e 's/[[:blank:]]\+/ /g')
171 CXXFLAGS=$(echo ${CFLAGS} | sed -e 's/ -Wall//g')
172 CXXFLAGS=$(echo ${CXXFLAGS} | sed -e 's/ -fexceptions / /g')
173 #CXXFLAGS=$(echo ${CXXFLAGS} | sed -e 's/ -Werror=format-security / -Wformat -Werror=format-security /g')
176 *-fasynchronous-unwind-tables*)
177 sed -i -e "s/-fno-exceptions /-fno-exceptions -fno-asynchronous-unwind-tables/" \
178 ../%{thisapp}/Makefile.in
183 CXXFLAGS="${CXXFLAGS}" \
184 XCFLAGS="${CFLAGS}" \
185 TCFLAGS="${CFLAGS}" \
186 ../%{thisapp}/configure \
187 --build=%{DISTRO_BUILDTARGET} \
190 --libexecdir=%{libdir} \
192 --with-boot-ldflags="%{LDFLAGS}" \
195 --enable-threads=posix \
196 --enable-__cxa_atexit \
197 --enable-clocale=gnu \
198 --enable-languages=c,c++,lto \
200 --enable-checking=release \
201 --enable-default-pie \
205 --with-bugurl=http://bugtracker.ipfire.org \
206 --disable-libunwind-exceptions \
207 --enable-gnu-unique-object \
208 --enable-linker-build-id \
209 --with-linker-hash-style=gnu \
211 --enable-initfini-array \
213 --enable-gnu-indirect-function \
216 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58012
217 # XXX disabled flags: --disable-static
219 # GCC does not support a parallel build.
220 make %{make_bootstrap} BOOT_CFLAGS="${CFLAGS}"
222 # Generate man pages.
223 perl -pi -e 's/head3/head2/' ../contrib/texi2pod.pl
224 for i in %{DIR_APP}/gcc/doc/*.texi; do
225 cp -a $i $i.orig; sed 's/ftable/table/' $i.orig > $i
227 make -C gcc generated-manpages
228 for i in %{DIR_APP}/gcc/doc/*.texi; do mv -f $i.orig $i; done
232 # cd %{DIR_SRC}/gcc-build && make -k check || true
233 # cd %{DIR_APP} && ./contrib/test_summary
237 cd %{DIR_SRC}/gcc-build
238 make install DESTDIR=%{BUILDROOT}
240 # Check if the installation path exists.
241 FULLPATH="%{BUILDROOT}%{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}"
242 [ -d "${FULLPATH}" ] || exit 1
244 mkdir -pv %{BUILDROOT}%{prefix}/lib
245 ln -sfv ../bin/cpp %{BUILDROOT}%{prefix}/lib/cpp
246 ln -sfv gcc %{BUILDROOT}/usr/bin/cc
248 # Fix libgcc_s symlinks.
249 rm -f ${FULLPATH}/libgcc_s.so %{BUILDROOT}%{libdir}/libgcc_s.so
250 case "%{DISTRO_ARCH}" in
252 cat <<EOF >${FULLPATH}/libgcc_s.so
254 Use the shared library, but some functions are only in
255 the static library, so try that secondarily. */
256 OUTPUT_FORMAT(elf32-littlearm)
257 GROUP ( %{libdir}/libgcc_s.so.1 libgcc.a )
261 ln -svf ../../../../..%{libdir}/libgcc_s.so.1 ${FULLPATH}/libgcc_s.so
264 chmod 755 %{BUILDROOT}%{libdir}/libgcc_s.so.1
266 # Remove some GNU debugger stuff.
267 rm -vf %{BUILDROOT}%{libdir}/lib*.py
269 # Install missing header file(s) on ARM.
270 case "%{DISTRO_ARCH}" in
272 cp -vf %{DIR_APP}/gcc/config/vxworks-dummy.h \
273 ${FULLPATH}/plugin/include/config/
274 cp -vf %{DIR_APP}/gcc/config/arm/arm-cores.def \
275 ${FULLPATH}/plugin/include/config/arm/
280 mv -vf %{BUILDROOT}%{libdir}/libgomp.spec ${FULLPATH}/
281 ln -svf ../../../libgomp.so.1.0.0 ${FULLPATH}/libgomp.so
282 chmod 755 %{BUILDROOT}%{libdir}/libgomp.so.1.*
285 ln -svf ../../../libstdc++.so.6.0.25 ${FULLPATH}/libstdc++.so
286 mv -vf %{BUILDROOT}%{libdir}/lib{std,sup}c++.a ${FULLPATH}
289 if [ "%{build_libquadmath}" = "1" ]; then
290 ln -svf ../../../libquadmath.so.0.0.0 ${FULLPATH}/libquadmath.so
291 chmod 755 %{BUILDROOT}%{libdir}/libquadmath.so.0.*
295 mv -vf %{BUILDROOT}%{libdir}/libitm.spec ${FULLPATH}/
296 ln -svf ../../../libitm.so.1.0.0 ${FULLPATH}/libitm.so
297 chmod 755 %{BUILDROOT}%{libdir}/libitm.so.1.*
300 if [ "%{build_liblsan}" = "1" ]; then
301 ln -svf ../../../liblsan.so.0.0.0 ${FULLPATH}/liblsan.so
302 chmod 755 %{BUILDROOT}%{libdir}/liblsan.so.*
306 if [ "%{build_libtsan}" = "1" ]; then
307 ln -svf ../../../libtsan.so.0.0.0 ${FULLPATH}/libtsan.so
308 chmod 755 %{BUILDROOT}%{libdir}/libtsan.so.*
312 if [ "%{build_libubsan}" = "1" ]; then
313 ln -svf ../../../libubsan.so.1.0.0 ${FULLPATH}/libubsan.so
314 chmod 755 %{BUILDROOT}%{libdir}/libubsan.so.*
317 if [ "%{build_libmpx}" = "1" ]; then
318 ln -svf ../../../libmpx.so.2.0.1 ${FULLPATH}/libmpx.so
319 ln -svf ../../../libmpxwrappers.so.2.0.1 ${FULLPATH}/libmpxwrappers.so
324 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libgcc.a
325 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libgcc_eh.a
326 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libstdc++.a
327 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libsupc++.a
336 binutils >= %{binutils_version}
346 # We do not ship libgcc-devel anymore.
347 provides += libgcc-devel = %{thisver}
348 obsoletes += libgcc-devel < %{thisver}
352 summary = C++ support for GCC.
354 This package adds C++ support to the GNU Compiler Collection.
355 It includes support for most of the current C++ specification,
356 including templates and exception handling.
361 libstdc++ = %{thisver}
362 libstdc++-devel = %{thisver}
367 %{libdir}/gcc/*/*/cc1plus
368 /usr/share/man/man*/*++*
373 summary = The C Preprocessor.
375 Cpp is the GNU C-Compatible Compiler Preprocessor.
376 Cpp is a macro processor which is used automatically
377 by the C compiler to transform your program before actual
378 compilation. It is called a macro processor because it allows
379 you to define macros, abbreviations for longer
382 The C preprocessor provides four separate functionalities: the
383 inclusion of header files (files of declarations that can be
384 substituted into your program); macro expansion (you can define macros,
385 and the C preprocessor will replace the macros with their definitions
386 throughout the program); conditional compilation (using special
387 preprocessing directives, you can include or exclude parts of the
388 program according to various conditions); and line control (if you use
389 a program to combine or rearrange source files into an intermediate
390 file which is then compiled, you can use line control to inform the
391 compiler about where each source line originated).
393 You should install this package if you are a C programmer and you use
396 group = Development/Languages
401 %{mandir}/man1/cpp.1*
402 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/cc1
406 requires = gcc-c++ = %{thisver}
410 summary = GCC shared support library.
412 This package contains GCC shared support library which is needed
413 e.g. for exception handling support.
417 %{libdir}/libgcc*.so.*
427 summary = GNU Standard C++ Library.
429 The libstdc++ package contains a rewritten standard compliant GCC Standard
434 %{libdir}/libstdc++*.so.*
438 package libstdc++-devel
439 summary = Header files and libraries for C++ development.
441 This is the GNU implementation of the standard C++ libraries. This
442 package includes the header files and libraries needed for C++
443 development. This includes rewritten implementation of STL.
447 libstdc++ = %{thisver}
452 %{libdir}/libstdc++*.so
456 package libstdc++-static
457 summary = Static libraries for the GNU standard C++ library
458 description = %{summary}
461 libstdc++-devel = %{thisver}
465 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libstdc++.a
466 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libsupc++.a
471 summary = GCC OpenMP v3.0 shared support library.
473 This package contains GCC shared support library which is needed
474 for OpenMP v3.0 support.
478 %{libdir}/libgomp*.so.*
482 if "%{build_libquadmath}" == "1"
484 summary = GCC __float128 shared support library.
486 This package contains GCC shared support library which is needed
487 for __float128 math support and for Fortran REAL*16 support.
491 %{libdir}/libquadmath*.so.*
495 package libquadmath-devel
496 summary = Development files for GCC __float128 support.
498 This package contains headers for building Fortran programs using
499 REAL*16 and programs using __float128 math.
504 libquadmath = %{thisver}
508 %{libdir}/libquadmath.so
509 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/include/quadmath.h
510 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/include/quadmath_weak.h
511 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libquadmath.so
517 summary = The GNU Transactional Memory library.
519 This package contains the GNU Transactional Memory library
520 which is a GCC transactional memory support runtime library.
524 %{libdir}/libitm.so.*
529 summary = The GNU Transactional Memory support.
531 This package contains headers and support files for the
532 GNU Transactional Memory library.
542 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/include/itm.h
543 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/include/itm_weak.h
544 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libitm.so
549 summary = The GNU Atomic library
551 This package contains the GNU Atomic library which is a
552 GCC support runtime library for atomisc operations not
553 supported by hardware.
557 %{libdir}/libatomic.so.*
562 summary = The Address Sanitizer runtime library
564 This package contains the Address Sanitizer library
565 which is used for -fsanitize=address instrumented programs.
569 %{libdir}/libasan.so.*
573 if "%{build_libtsan}" == "1"
575 summary = The Thread Sanitizer runtime library
577 This package contains the Thread Sanitizer library
578 which is used for -fsanitize=thread instrumented programs.
582 %{libdir}/libtsan.so.*
587 if "%{build_libubsan}" == "1"
589 summary = The Undefined Behavior Sanitizer runtime library
591 This package contains the Undefined Behavior Sanitizer library
592 which is used for -fsanitize=undefined instrumented programs.
596 %{libdir}/libubsan.so.*
601 if "%{build_liblsan}" == "1"
603 summary = The Leak Sanitizer runtime library
605 This package contains the Leak Sanitizer library
606 which is used for -fsanitize=leak instrumented programs.
610 %{libdir}/liblsan.so.*
615 if "%{build_libmpx}" == "1"
617 summary = The Memory Protection Extensions runtime libraries
619 This package contains the Memory Protection Extensions
620 runtime libraries which is used for -fcheck-pointer-bounds
621 -mmpx instrumented programs.
625 %{libdir}/libmpx.so.*
626 %{libdir}/libmpxwrappers.so.*
631 package gcc-plugin-devel
632 summary = Support for compiling GCC plugins.
634 This package contains header files and other support files
635 for compiling GCC plugins. The GCC plugin ABI is currently
636 not stable, so plugins must be rebuilt any time GCC is updated.
643 libmpc-devel >= 0.8.1
647 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/plugin
651 package %{name}-debuginfo