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 # A couple of configure arguments depending on the architecture and
71 make_bootstrap = profiledbootstrap
73 if "%{DISTRO_ARCH}" == "x86_64"
74 configure_options = --disable-multilib
82 if "%{DISTRO_ARCH}" == "i686"
83 configure_options = --with-arch=%{DISTRO_ARCH} --with-tune=generic
89 if "%{DISTRO_ARCH}" == "aarch64"
93 if "%{DISTRO_ARCH}" == "armv7hl"
94 make_bootstrap = bootstrap
96 configure_options += --disable-sjlj-exceptions
98 configure_options += \
99 --with-tune=cortex-a8 \
100 --with-arch=armv7-a \
102 --with-fpu=vfpv3-d16 \
103 --with-abi=aapcs-linux
108 if "%{DISTRO_ARCH}" == "armv5tel"
109 make_bootstrap = bootstrap
111 configure_options += --disable-sjlj-exceptions
112 configure_options += --with-float=soft
117 if "%{build_graphite}" == "1"
118 configure_options += \
123 mkdir -v %{DIR_SRC}/gcc-build
125 # Remove unneeded features that will save some compile time
126 rm -rf lib{gfortran,java,objc} gcc/{fortran,java,objc,objcp}
128 # Apply a sed substitution that will suppress the installation of
129 # libiberty.a. The version of libiberty.a provided by Binutils will be used
131 sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in
134 echo "%{DISTRO_NAME} %{version}-%{release}" > gcc/DEV-PHASE
136 # Libgomp uses -Werror regardless of --disable-werror, and this will cause a
137 # build failure when -D_FORTIFY_SOURCE=2 causes build time warnings:
138 sed -e "s/-Werror//" -i libgomp/configure
140 # The fixincludes script is known to occasionally erroneously attempt to
141 # "fix" the system headers installed so far. As the headers up to this point
142 # are known to not require fixing, issue the following command to prevent
143 # the fixincludes script from running:
144 sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in
146 sed -i gcc/Makefile.in \
147 -e "s/-fno-exceptions/& -fno-asynchronous-unwind-tables/"
149 #./contrib/gcc_update --touch
156 cd %{DIR_SRC}/gcc-build
160 CFLAGS=$(echo ${CFLAGS} | sed -e 's/\(-Wp,\)\?-D_FORTIFY_SOURCE=[12]//g')
161 CFLAGS=$(echo ${CFLAGS} | sed -e 's/-Werror=format-security//g')
162 CFLAGS=$(echo ${CFLAGS} | sed -e 's/-m64//g;s/-m32//g;s/-m31//g')
163 CFLAGS=$(echo ${CFLAGS} | sed -e 's/-mfpmath=sse/-mfpmath=sse -msse2/g')
164 CFLAGS=$(echo ${CFLAGS} | sed -e 's/-march=i.86//g')
165 CFLAGS=$(echo ${CFLAGS} | sed -e 's/ -pipe / /g')
166 CFLAGS=$(echo "${CFLAGS}" | sed -e 's/[[:blank:]]\+/ /g')
167 CXXFLAGS=$(echo ${CFLAGS} | sed -e 's/ -Wall//g')
168 CXXFLAGS=$(echo ${CXXFLAGS} | sed -e 's/ -fexceptions / /g')
169 #CXXFLAGS=$(echo ${CXXFLAGS} | sed -e 's/ -Werror=format-security / -Wformat -Werror=format-security /g')
172 *-fasynchronous-unwind-tables*)
173 sed -i -e "s/-fno-exceptions /-fno-exceptions -fno-asynchronous-unwind-tables/" \
174 ../%{thisapp}/Makefile.in
179 CXXFLAGS="${CXXFLAGS}" \
180 XCFLAGS="${CFLAGS}" \
181 TCFLAGS="${CFLAGS}" \
182 ../%{thisapp}/configure \
183 --build=%{DISTRO_BUILDTARGET} \
186 --libexecdir=%{libdir} \
188 --with-boot-ldflags="%{LDFLAGS}" \
191 --enable-threads=posix \
192 --enable-__cxa_atexit \
193 --enable-clocale=gnu \
194 --enable-languages=c,c++,lto \
196 --enable-checking=release \
197 --enable-default-pie \
201 --with-bugurl=http://bugtracker.ipfire.org \
202 --disable-libunwind-exceptions \
203 --enable-gnu-unique-object \
204 --enable-linker-build-id \
205 --with-linker-hash-style=gnu \
207 --enable-initfini-array \
209 --enable-gnu-indirect-function \
212 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58012
213 # XXX disabled flags: --disable-static
215 # GCC does not support a parallel build.
216 make %{make_bootstrap} BOOT_CFLAGS="${CFLAGS}"
218 # Generate man pages.
219 perl -pi -e 's/head3/head2/' ../contrib/texi2pod.pl
220 for i in %{DIR_APP}/gcc/doc/*.texi; do
221 cp -a $i $i.orig; sed 's/ftable/table/' $i.orig > $i
223 make -C gcc generated-manpages
224 for i in %{DIR_APP}/gcc/doc/*.texi; do mv -f $i.orig $i; done
228 # cd %{DIR_SRC}/gcc-build && make -k check || true
229 # cd %{DIR_APP} && ./contrib/test_summary
233 cd %{DIR_SRC}/gcc-build
234 make install DESTDIR=%{BUILDROOT}
236 # Check if the installation path exists.
237 FULLPATH="%{BUILDROOT}%{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}"
238 [ -d "${FULLPATH}" ] || exit 1
240 mkdir -pv %{BUILDROOT}%{prefix}/lib
241 ln -sfv ../bin/cpp %{BUILDROOT}%{prefix}/lib/cpp
242 ln -sfv gcc %{BUILDROOT}/usr/bin/cc
244 # Fix libgcc_s symlinks.
245 rm -f ${FULLPATH}/libgcc_s.so %{BUILDROOT}%{libdir}/libgcc_s.so
246 case "%{DISTRO_ARCH}" in
248 cat <<EOF >${FULLPATH}/libgcc_s.so
250 Use the shared library, but some functions are only in
251 the static library, so try that secondarily. */
252 OUTPUT_FORMAT(elf32-littlearm)
253 GROUP ( %{libdir}/libgcc_s.so.1 libgcc.a )
257 ln -svf ../../../../..%{libdir}/libgcc_s.so.1 ${FULLPATH}/libgcc_s.so
260 chmod 755 %{BUILDROOT}%{libdir}/libgcc_s.so.1
262 # Remove some GNU debugger stuff.
263 rm -vf %{BUILDROOT}%{libdir}/lib*.py
265 # Install missing header file(s) on ARM.
266 case "%{DISTRO_ARCH}" in
268 cp -vf %{DIR_APP}/gcc/config/vxworks-dummy.h \
269 ${FULLPATH}/plugin/include/config/
270 cp -vf %{DIR_APP}/gcc/config/arm/arm-cores.def \
271 ${FULLPATH}/plugin/include/config/arm/
276 mv -vf %{BUILDROOT}%{libdir}/libgomp.spec ${FULLPATH}/
277 ln -svf ../../../libgomp.so.1.0.0 ${FULLPATH}/libgomp.so
278 chmod 755 %{BUILDROOT}%{libdir}/libgomp.so.1.*
281 ln -svf ../../../libstdc++.so.6.0.26 ${FULLPATH}/libstdc++.so
282 mv -vf %{BUILDROOT}%{libdir}/lib{std,sup}c++.a ${FULLPATH}
285 if [ "%{build_libquadmath}" = "1" ]; then
286 ln -svf ../../../libquadmath.so.0.0.0 ${FULLPATH}/libquadmath.so
287 chmod 755 %{BUILDROOT}%{libdir}/libquadmath.so.0.*
291 mv -vf %{BUILDROOT}%{libdir}/libitm.spec ${FULLPATH}/
292 ln -svf ../../../libitm.so.1.0.0 ${FULLPATH}/libitm.so
293 chmod 755 %{BUILDROOT}%{libdir}/libitm.so.1.*
296 if [ "%{build_liblsan}" = "1" ]; then
297 ln -svf ../../../liblsan.so.0.0.0 ${FULLPATH}/liblsan.so
298 chmod 755 %{BUILDROOT}%{libdir}/liblsan.so.*
302 if [ "%{build_libtsan}" = "1" ]; then
303 ln -svf ../../../libtsan.so.0.0.0 ${FULLPATH}/libtsan.so
304 chmod 755 %{BUILDROOT}%{libdir}/libtsan.so.*
308 if [ "%{build_libubsan}" = "1" ]; then
309 ln -svf ../../../libubsan.so.1.0.0 ${FULLPATH}/libubsan.so
310 chmod 755 %{BUILDROOT}%{libdir}/libubsan.so.*
315 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libgcc.a
316 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libgcc_eh.a
317 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libstdc++.a
318 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libsupc++.a
327 binutils >= %{binutils_version}
337 # We do not ship libgcc-devel anymore.
338 provides += libgcc-devel = %{thisver}
339 obsoletes += libgcc-devel < %{thisver}
343 summary = C++ support for GCC.
345 This package adds C++ support to the GNU Compiler Collection.
346 It includes support for most of the current C++ specification,
347 including templates and exception handling.
352 libstdc++ = %{thisver}
353 libstdc++-devel = %{thisver}
358 %{libdir}/gcc/*/*/cc1plus
359 /usr/share/man/man*/*++*
364 summary = The C Preprocessor.
366 Cpp is the GNU C-Compatible Compiler Preprocessor.
367 Cpp is a macro processor which is used automatically
368 by the C compiler to transform your program before actual
369 compilation. It is called a macro processor because it allows
370 you to define macros, abbreviations for longer
373 The C preprocessor provides four separate functionalities: the
374 inclusion of header files (files of declarations that can be
375 substituted into your program); macro expansion (you can define macros,
376 and the C preprocessor will replace the macros with their definitions
377 throughout the program); conditional compilation (using special
378 preprocessing directives, you can include or exclude parts of the
379 program according to various conditions); and line control (if you use
380 a program to combine or rearrange source files into an intermediate
381 file which is then compiled, you can use line control to inform the
382 compiler about where each source line originated).
384 You should install this package if you are a C programmer and you use
387 group = Development/Languages
392 %{mandir}/man1/cpp.1*
393 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/cc1
397 requires = gcc-c++ = %{thisver}
401 summary = GCC shared support library.
403 This package contains GCC shared support library which is needed
404 e.g. for exception handling support.
408 %{libdir}/libgcc*.so.*
418 summary = GNU Standard C++ Library.
420 The libstdc++ package contains a rewritten standard compliant GCC Standard
425 %{libdir}/libstdc++*.so.*
429 package libstdc++-devel
430 summary = Header files and libraries for C++ development.
432 This is the GNU implementation of the standard C++ libraries. This
433 package includes the header files and libraries needed for C++
434 development. This includes rewritten implementation of STL.
438 libstdc++ = %{thisver}
443 %{libdir}/libstdc++*.so
447 package libstdc++-static
448 summary = Static libraries for the GNU standard C++ library
449 description = %{summary}
452 libstdc++-devel = %{thisver}
456 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libstdc++.a
457 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libsupc++.a
462 summary = GCC OpenMP v3.0 shared support library.
464 This package contains GCC shared support library which is needed
465 for OpenMP v3.0 support.
469 %{libdir}/libgomp*.so.*
473 if "%{build_libquadmath}" == "1"
475 summary = GCC __float128 shared support library.
477 This package contains GCC shared support library which is needed
478 for __float128 math support and for Fortran REAL*16 support.
482 %{libdir}/libquadmath*.so.*
486 package libquadmath-devel
487 summary = Development files for GCC __float128 support.
489 This package contains headers for building Fortran programs using
490 REAL*16 and programs using __float128 math.
495 libquadmath = %{thisver}
499 %{libdir}/libquadmath.so
500 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/include/quadmath.h
501 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/include/quadmath_weak.h
502 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libquadmath.so
508 summary = The GNU Transactional Memory library.
510 This package contains the GNU Transactional Memory library
511 which is a GCC transactional memory support runtime library.
515 %{libdir}/libitm.so.*
520 summary = The GNU Transactional Memory support.
522 This package contains headers and support files for the
523 GNU Transactional Memory library.
533 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/include/itm.h
534 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/include/itm_weak.h
535 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libitm.so
540 summary = The GNU Atomic library
542 This package contains the GNU Atomic library which is a
543 GCC support runtime library for atomisc operations not
544 supported by hardware.
548 %{libdir}/libatomic.so.*
553 summary = The Address Sanitizer runtime library
555 This package contains the Address Sanitizer library
556 which is used for -fsanitize=address instrumented programs.
560 %{libdir}/libasan.so.*
564 if "%{build_libtsan}" == "1"
566 summary = The Thread Sanitizer runtime library
568 This package contains the Thread Sanitizer library
569 which is used for -fsanitize=thread instrumented programs.
573 %{libdir}/libtsan.so.*
578 if "%{build_libubsan}" == "1"
580 summary = The Undefined Behavior Sanitizer runtime library
582 This package contains the Undefined Behavior Sanitizer library
583 which is used for -fsanitize=undefined instrumented programs.
587 %{libdir}/libubsan.so.*
592 if "%{build_liblsan}" == "1"
594 summary = The Leak Sanitizer runtime library
596 This package contains the Leak Sanitizer library
597 which is used for -fsanitize=leak instrumented programs.
601 %{libdir}/liblsan.so.*
606 package gcc-plugin-devel
607 summary = Support for compiling GCC plugins.
609 This package contains header files and other support files
610 for compiling GCC plugins. The GCC plugin ABI is currently
611 not stable, so plugins must be rebuilt any time GCC is updated.
618 libmpc-devel >= 0.8.1
622 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/plugin
626 package %{name}-debuginfo