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
32 gcc46-c++-builtin-redecl.patch0 \
33 gcc46-pr33763.patch0 \
34 gcc46-libgomp-omp_h-multilib.patch0 \
35 gcc46-libtool-no-rpath.patch0 \
36 gcc46-cloog-dl.patch0 \
37 gcc46-pr38757.patch0 \
38 gcc46-no-add-needed.patch0 \
39 gcc46-unwind-debughook-sdt.patch0 \
40 gcc46-ppl-0.10.patch \
41 gcc46-Woverlength-string.patch0 \
42 gcc46-Woverlength-string-asm.patch0 \
43 gcc-4.6.0-piepatches-20110407.patch
48 binutils>=%{required_binutils_version}
62 # If cloog support is enabled, we require the devel packages for build.
63 if "%{build_cloog_ppl}" == "1"
64 requires += cloog-ppl-devel
68 # Build libquadmath (only on x86).
71 # A couple of configure arguments depending on the architecture and
75 make_bootstrap = profiledbootstrap
77 if "%{DISTRO_ARCH}" == "x86_64"
78 configure_options = --disable-multilib
83 if "%{DISTRO_ARCH}" == "i686"
84 configure_options = --with-arch=%{DISTRO_ARCH} --with-tune=generic
89 if "%{DISTRO_ARCH}" == "armv5tel"
90 make_bootstrap = bootstrap
92 configure_options += --disable-sjlj-exceptions
93 configure_options += --with-float=soft
96 if "%{DISTRO_ARCH}" == "armv7hl"
97 make_bootstrap = bootstrap
99 configure_options += --disable-sjlj-exceptions
101 configure_options += \
102 --with-cpu=cortex-a8 \
103 --with-tune=cortex-a8 \
104 --with-arch=armv7-a \
106 --with-fpu=vfpv3-d16 \
107 --with-abi=aapcs-linux
110 if "%{build_cloog_ppl}" == "1"
111 configure_options += --with-cloog --with-ppl
114 # CFLAGS for hardening.
115 HARD_CFLAGS = -DEFAULT_PIE_SSP -DEFAULT_RELRO -DEFAULT_BIND_NOW
118 mkdir -v %{DIR_SRC}/gcc-build
120 # Remove unneeded features that will save some compile time
121 rm -rf lib{gfortran,java,objc} gcc/{fortran,java,objc,objcp}
123 # Apply a sed substitution that will suppress the installation of
124 # libiberty.a. The version of libiberty.a provided by Binutils will be used
126 sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in
129 echo "%{DISTRO_NAME} %{version}-%{release}" > gcc/DEV-PHASE
131 # Libgomp uses -Werror regardless of --disable-werror, and this will cause a
132 # build failure when -D_FORTIFY_SOURCE=2 causes build time warnings:
133 sed -e "s/-Werror//" -i libgomp/configure
135 # The fixincludes script is known to occasionally erroneously attempt to
136 # "fix" the system headers installed so far. As the headers up to this point
137 # are known to not require fixing, issue the following command to prevent
138 # the fixincludes script from running:
139 sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in
141 sed -i gcc/Makefile.in \
142 -e "s/-fno-exceptions/& -fno-asynchronous-unwind-tables/"
144 # we want to be able to control the pie patch logic via something other
146 sed -i gcc/Makefile.in \
147 -e '/^ALL_CFLAGS/iHARD_CFLAGS = ' \
148 -e 's|^ALL_CFLAGS = |ALL_CFLAGS = $(HARD_CFLAGS) |'
150 # Enable the GCC hardening by default.
151 sed -i gcc/Makefile.in \
152 -e "s|^HARD_CFLAGS = |HARD_CFLAGS = %{HARD_CFLAGS} |"
154 # Compile the compiler with -fPIC as well.
155 sed -i gcc/Makefile.in \
156 -e "s|^ESP_NOPIE_CFLAGS = .*|ESP_NOPIE_CFLAGS =|"
158 # Default to -gdwarf-4 -fno-debug-types-section rather than -gdwarf-2
159 sed -i gcc/common.opt \
160 -e '/UInteger Var(dwarf_version)/s/Init(2)/Init(4)/' \
161 -e '/flag_debug_types_section/s/Init(1)/Init(0)/' \
162 -e '/dwarf_record_gcc_switches/s/Init(0)/Init(1)/' \
163 -e 's/\(may be either 2, 3 or 4; the default version is \)2\./\14./'
165 ./contrib/gcc_update --touch
169 cd %{DIR_SRC}/gcc-build
173 CFLAGS=$(echo ${CFLAGS} | sed -e 's/\(-Wp,\)\?-D_FORTIFY_SOURCE=[12]//g')
174 CFLAGS=$(echo ${CFLAGS} | sed -e 's/-m64//g;s/-m32//g;s/-m31//g')
175 CFLAGS=$(echo ${CFLAGS} | sed -e 's/-march=i.86//g')
176 CFLAGS=$(echo ${CFLAGS} | sed -e 's/ -pipe / /g')
177 CFLAGS=$(echo "${CFLAGS}" | sed -e 's/[[:blank:]]\+/ /g')
178 CXXFLAGS=$(echo ${CFLAGS} | sed -e 's/ -Wall//g')
181 CXXFLAGS="${CXXFLAGS}" \
182 XCFLAGS="${CFLAGS}" \
183 TCFLAGS="${CFLAGS}" \
184 ../%{thisapp}/configure \
185 --build=%{DISTRO_BUILDTARGET} \
188 --libexecdir=%{libdir} \
189 --mandir=/usr/share/man \
192 --enable-threads=posix \
193 --enable-__cxa_atexit \
194 --enable-clocale=gnu \
195 --enable-languages=c,c++,lto \
197 --enable-checking=release \
202 --with-bugurl=http://bugtracker.ipfire.org \
203 --disable-libunwind-exceptions \
204 --enable-gnu-unique-object \
205 --enable-linker-build-id \
208 # GCC does not support a parallel build.
209 make %{make_bootstrap} BOOT_CFLAGS="${CFLAGS}"
213 # cd %{DIR_SRC}/gcc-build && make check
214 # cd %{DIR_APP} && ./contrib/test_summary
218 cd %{DIR_SRC}/gcc-build
219 make install DESTDIR=%{BUILDROOT}
221 # Check if the installation path exists.
222 FULLPATH="%{BUILDROOT}%{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}"
223 [ -d "${FULLPATH}" ] || exit 1
225 mkdir -pv %{BUILDROOT}/lib
226 ln -sfv ../usr/bin/cpp %{BUILDROOT}/lib/cpp
227 ln -sfv gcc %{BUILDROOT}/usr/bin/cc
229 # Fix libgcc_s symlinks.
230 rm -f ${FULLPATH}/libgcc_s.so %{BUILDROOT}%{libdir}/libgcc_s.so
231 case "%{DISTRO_ARCH}" in
233 cat <<EOF >${FULLPATH}/libgcc_s.so
235 Use the shared library, but some functions are only in
236 the static library, so try that secondarily. */
237 OUTPUT_FORMAT(elf32-littlearm)
238 GROUP ( %{libdir}/libgcc_s.so.1 libgcc.a )
242 ln -svf ../../../../../%{libdir}/libgcc_s.so.1 ${FULLPATH}/libgcc_s.so
246 # Remove some GNU debugger stuff.
247 rm -vf %{BUILDROOT}%{libdir}/lib*.py
249 # Install missing header file(s) on ARM.
250 case "%{DISTRO_ARCH}" in
252 cp -vf %{DIR_APP}/gcc/config/vxworks-dummy.h \
253 ${FULLPATH}/plugin/include/config/
254 cp -vf %{DIR_APP}/gcc/config/arm/arm-cores.def \
255 ${FULLPATH}/plugin/include/config/arm/
260 mv -vf %{BUILDROOT}%{libdir}/libgomp.spec ${FULLPATH}/
261 ln -svf ../../../libgomp.so.1.0.0 ${FULLPATH}/libgomp.so
262 chmod 755 %{BUILDROOT}%{libdir}/libgomp.so.1.*
265 ln -svf ../../../libstdc++.so.6.0.16 ${FULLPATH}/libstdc++.so
268 ln -svf ../../../libmudflap.so.0.0.0 ${FULLPATH}/libmudflap.so
269 ln -svf ../../../libmudflapth.so.0.0.0 ${FULLPATH}/libmudflapth.so
270 chmod 755 %{BUILDROOT}%{libdir}/libmudflap{,th}.so.0.*
273 if [ "%{build_libquadmath}" = "1" ]; then
274 ln -svf ../../../libquadmath.so.0.0.0 ${FULLPATH}/libquadmath.so
275 chmod 755 %{BUILDROOT}%{libdir}/libquadmath.so.0.*
280 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libgcc.a
281 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libgcc_eh.a
290 binutils >= %{required_binutils_version}
298 # We do not ship libgcc-devel anymore.
299 provides += libgcc-devel = %{thisver}
300 obsoletes += libgcc-devel < %{thisver}
302 if "%{build_cloog_ppl}" == "1"
303 requires += cloog-ppl >= 0.15
308 summary = C++ support for GCC.
310 This package adds C++ support to the GNU Compiler Collection.
311 It includes support for most of the current C++ specification,
312 including templates and exception handling.
317 libstdc++ = %{thisver}
318 libstdc++-devel = %{thisver}
323 %{libdir}/gcc/*/*/cc1plus
324 /usr/share/man/man*/*++*
329 summary = The C Preprocessor.
331 Cpp is the GNU C-Compatible Compiler Preprocessor.
332 Cpp is a macro processor which is used automatically
333 by the C compiler to transform your program before actual
334 compilation. It is called a macro processor because it allows
335 you to define macros, abbreviations for longer
338 The C preprocessor provides four separate functionalities: the
339 inclusion of header files (files of declarations that can be
340 substituted into your program); macro expansion (you can define macros,
341 and the C preprocessor will replace the macros with their definitions
342 throughout the program); conditional compilation (using special
343 preprocessing directives, you can include or exclude parts of the
344 program according to various conditions); and line control (if you use
345 a program to combine or rearrange source files into an intermediate
346 file which is then compiled, you can use line control to inform the
347 compiler about where each source line originated).
349 You should install this package if you are a C programmer and you use
352 group = Development/Languages
357 /usr/share/man/man1/cpp.1*
358 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/cc1
363 summary = GCC shared support library.
365 This package contains GCC shared support library which is needed
366 e.g. for exception handling support.
370 %{libdir}/libgcc*.so.*
375 summary = GNU Standard C++ Library.
377 The libstdc++ package contains a rewritten standard compliant GCC Standard
382 %{libdir}/libstdc++*.so.*
386 package libstdc++-devel
387 summary = Header files and libraries for C++ development.
389 This is the GNU implementation of the standard C++ libraries. This
390 package includes the header files and libraries needed for C++
391 development. This includes rewritten implementation of STL.
395 libstdc++ = %{thisver}
400 %{libdir}/libstdc++*.so
405 summary = GCC OpenMP v3.0 shared support library.
407 This package contains GCC shared support library which is needed
408 for OpenMP v3.0 support.
412 %{libdir}/libgomp*.so.*
417 summary = GCC mudflap shared support library.
419 This package contains GCC shared support library which is needed
424 %{libdir}/libmudflap*.so.*
428 package libmudflap-devel
429 summary = Development files for GCC mudflap support.
431 This package contains headers for building mudflap-instrumented programs.
433 To instrument a non-threaded program, add -fmudflap
434 option to GCC and when linking add -lmudflap, for threaded programs
435 also add -fmudflapth and -lmudflapth.
439 libmudflap = %{thisver}
443 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/include/mf-runtime.h
444 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libmudflap.so
445 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libmudflapth.so
449 if "%{build_libquadmath}" == "1"
451 summary = GCC __float128 shared support library.
453 This package contains GCC shared support library which is needed
454 for __float128 math support and for Fortran REAL*16 support.
458 %{libdir}/libquadmath*.so.*
462 package libquadmath-devel
463 summary = Development files for GCC __float128 support.
465 This package contains headers for building Fortran programs using
466 REAL*16 and programs using __float128 math.
471 libquadmath = %{thisver}
475 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/include/quadmath.h
476 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/include/quadmath_weak.h
477 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libquadmath.so
482 package gcc-plugin-devel
483 summary = Support for compiling GCC plugins.
485 This package contains header files and other support files
486 for compiling GCC plugins. The GCC plugin ABI is currently
487 not stable, so plugins must be rebuilt any time GCC is updated.
494 libmpc-devel >= 0.8.1
498 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/plugin
502 package %{name}-debuginfo