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
34 gcc46-libgomp-omp_h-multilib.patch0
35 gcc46-libtool-no-rpath.patch0
38 gcc46-no-add-needed.patch0
39 gcc46-unwind-debughook-sdt.patch0
41 gcc46-Woverlength-string.patch0
42 gcc46-Woverlength-string-asm.patch0
43 gcc-4.6.0-piepatches-20110407.patch
49 binutils>=%{required_binutils_version}
63 # If cloog support is enabled, we require the devel packages for build.
64 if "%{build_cloog_ppl}" == "1"
65 requires += cloog-ppl-devel ppl-devel
68 # A couple of configure arguments depending on the architecture and
72 if "%{DISTRO_ARCH}" == "x86_64"
73 configure_options = --disable-multilib
76 if "%{DISTRO_ARCH}" == "i686"
77 configure_options = --with-arch=%{DISTRO_ARCH} --with-tune=generic
80 if "%{DISTRO_ARCH}" == "armv5tel"
81 configure_options += --with-float=soft
84 if "%{build_cloog_ppl}" == "1"
85 configure_options += --with-cloog --with-ppl
88 # CFLAGS for hardening.
89 HARD_CFLAGS = -DEFAULT_PIE_SSP -DEFAULT_RELRO -DEFAULT_BIND_NOW
92 mkdir -v %{DIR_SRC}/gcc-build
94 # Remove unneeded features that will save some compile time
95 rm -rf lib{gfortran,java,objc} gcc/{fortran,java,objc,objcp}
97 # Apply a sed substitution that will suppress the installation of
98 # libiberty.a. The version of libiberty.a provided by Binutils will be used
100 sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in
103 echo "%{DISTRO_NAME} %{version}-%{release}" > gcc/DEV-PHASE
105 # Libgomp uses -Werror regardless of --disable-werror, and this will cause a
106 # build failure when -D_FORTIFY_SOURCE=2 causes build time warnings:
107 sed -e "s/-Werror//" -i libgomp/configure
109 # The fixincludes script is known to occasionally erroneously attempt to
110 # "fix" the system headers installed so far. As the headers up to this point
111 # are known to not require fixing, issue the following command to prevent
112 # the fixincludes script from running:
113 sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in
115 sed -i gcc/Makefile.in \
116 -e "s/-fno-exceptions/& -fno-asynchronous-unwind-tables/"
118 # we want to be able to control the pie patch logic via something other
120 sed -i gcc/Makefile.in \
121 -e '/^ALL_CFLAGS/iHARD_CFLAGS = ' \
122 -e 's|^ALL_CFLAGS = |ALL_CFLAGS = $(HARD_CFLAGS) |'
124 # Enable the GCC hardening by default.
125 sed -i gcc/Makefile.in \
126 -e "s|^HARD_CFLAGS = |HARD_CFLAGS = %{HARD_CFLAGS} |"
128 # Compile the compiler with -fPIC as well.
129 sed -i gcc/Makefile.in \
130 -e "s|^ESP_NOPIE_CFLAGS = .*|ESP_NOPIE_CFLAGS =|"
132 ./contrib/gcc_update --touch
136 cd %{DIR_SRC}/gcc-build
139 OPT_FLAGS="%{CFLAGS}"
141 CFLAGS=$(echo ${CFLAGS} | sed -e 's/\(-Wp,\)\?-D_FORTIFY_SOURCE=[12]//g')
142 CFLAGS=$(echo ${CFLAGS} | sed -e 's/-m64//g;s/-m32//g;s/-m31//g')
143 CFLAGS=$(echo ${CFLAGS} | sed -e 's/-march=i.86//g')
144 #CFLAGS=$(echo ${CFLAGS} | sed -e 's/ -pipe / /g')
145 CFLAGS=$(echo "${CFLAGS}" | sed -e 's/[[:blank:]]\+/ /g')
146 CXXFLAGS=$(echo ${CFLAGS} | sed -e 's/ -Wall//g')
149 CXXFLAGS="${CXXFLAGS}" \
150 XCFLAGS="${CFLAGS}" \
151 TCFLAGS="${CFLAGS}" \
152 ../%{thisapp}/configure \
153 --build=%{DISTRO_BUILDTARGET} \
155 --libexecdir=/usr/lib \
156 --mandir=/usr/share/man \
159 --enable-threads=posix \
160 --enable-__cxa_atexit \
161 --enable-clocale=gnu \
162 --enable-languages=c,c++,lto \
164 --enable-checking=release \
169 --with-bugurl=http://bugtracker.ipfire.org \
170 --disable-libunwind-exceptions \
171 --enable-gnu-unique-object \
172 --enable-linker-build-id \
175 # GCC does not support a parallel build.
176 make profiledbootstrap BOOT_CFLAGS="${OPT_FLAGS}" #%{PARALLELISMFLAGS}
180 # cd %{DIR_SRC}/gcc-build && make check
181 # cd %{DIR_APP} && ./contrib/test_summary
185 cd %{DIR_SRC}/gcc-build
186 make install DESTDIR=%{BUILDROOT}
188 mkdir -pv %{BUILDROOT}/lib
189 ln -sfv ../usr/bin/cpp %{BUILDROOT}/lib/cpp
190 ln -sfv gcc %{BUILDROOT}/usr/bin/cc
192 # Move libgcc_s to /lib
193 mv -vf %{BUILDROOT}/usr/lib/libgcc_s.so.1 %{BUILDROOT}/lib/
194 ln -svf ../../lib/libgcc_s.so.1 %{BUILDROOT}/usr/lib/libgcc_s.so
196 # Remove some GNU debugger stuff.
197 rm -vf %{BUILDROOT}/usr/lib/lib*.py
201 /usr/lib/gcc/%{DISTRO_BUILDTARGET}/%{version}/libgcc.a
202 /usr/lib/gcc/%{DISTRO_BUILDTARGET}/%{version}/libgcc_eh.a
211 binutils>=%{required_binutils_version}
217 if "%{build_cloog_ppl}" == "1"
218 requires += cloog-ppl>=0.15
222 # XXX add package descriptions
225 requires = gcc=%{thisver} libstdc++-devel
229 /usr/lib/gcc/*/*/cc1plus
230 /usr/share/man/man*/*++*
241 requires = libgcc=%{thisver}
250 /usr/lib/libstdc++*.so.*
254 package libstdc++-devel
257 /usr/lib/libstdc++*.so
263 /usr/lib/libgomp*.so.*
270 /usr/lib/libgomp.spec
276 /usr/lib/libmudflap*.so.*
280 package libmudflap-devel
282 /usr/lib/libmudflap*.so
288 /usr/lib/libquadmath*.so.*
292 package libquadmath-devel
294 /usr/lib/libquadmath*.so
298 package %{name}-debuginfo