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 "%{build_cloog_ppl}" == "1"
81 configure_options += --with-cloog --with-ppl
84 # CFLAGS for hardening.
85 HARD_CFLAGS = -DEFAULT_PIE_SSP -DEFAULT_RELRO -DEFAULT_BIND_NOW
88 mkdir -v %{DIR_SRC}/gcc-build
90 # Remove unneeded features that will save some compile time
91 rm -rf lib{gfortran,java,objc} gcc/{fortran,java,objc,objcp}
93 # Apply a sed substitution that will suppress the installation of
94 # libiberty.a. The version of libiberty.a provided by Binutils will be used
96 sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in
99 echo "%{DISTRO_NAME} %{version}-%{release}" > gcc/DEV-PHASE
101 # Libgomp uses -Werror regardless of --disable-werror, and this will cause a
102 # build failure when -D_FORTIFY_SOURCE=2 causes build time warnings:
103 sed -e "s/-Werror//" -i libgomp/configure
105 # The fixincludes script is known to occasionally erroneously attempt to
106 # "fix" the system headers installed so far. As the headers up to this point
107 # are known to not require fixing, issue the following command to prevent
108 # the fixincludes script from running:
109 sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in
111 sed -i gcc/Makefile.in \
112 -e "s/-fno-exceptions/& -fno-asynchronous-unwind-tables/"
114 # we want to be able to control the pie patch logic via something other
116 sed -i gcc/Makefile.in \
117 -e '/^ALL_CFLAGS/iHARD_CFLAGS = ' \
118 -e 's|^ALL_CFLAGS = |ALL_CFLAGS = $(HARD_CFLAGS) |'
120 # Enable the GCC hardening by default.
121 sed -i gcc/Makefile.in \
122 -e "s|^HARD_CFLAGS = |HARD_CFLAGS = %{HARD_CFLAGS} |"
124 # Compile the compiler with -fPIC as well.
125 sed -i gcc/Makefile.in \
126 -e "s|^ESP_NOPIE_CFLAGS = .*|ESP_NOPIE_CFLAGS =|"
128 ./contrib/gcc_update --touch
132 cd %{DIR_SRC}/gcc-build
135 OPT_FLAGS="%{CFLAGS}"
137 CFLAGS=$(echo ${CFLAGS} | sed -e 's/\(-Wp,\)\?-D_FORTIFY_SOURCE=[12]//g')
138 CFLAGS=$(echo ${CFLAGS} | sed -e 's/-m64//g;s/-m32//g;s/-m31//g')
139 CFLAGS=$(echo ${CFLAGS} | sed -e 's/-march=i.86//g')
140 #CFLAGS=$(echo ${CFLAGS} | sed -e 's/ -pipe / /g')
141 CFLAGS=$(echo "${CFLAGS}" | sed -e 's/[[:blank:]]\+/ /g')
142 CXXFLAGS=$(echo ${CFLAGS} | sed -e 's/ -Wall//g')
145 CXXFLAGS="${CXXFLAGS}" \
146 XCFLAGS="${CFLAGS}" \
147 TCFLAGS="${CFLAGS}" \
148 ../%{thisapp}/configure \
149 --build=%{DISTRO_BUILDTARGET} \
151 --libexecdir=/usr/lib \
152 --mandir=/usr/share/man \
155 --enable-threads=posix \
156 --enable-__cxa_atexit \
157 --enable-clocale=gnu \
158 --enable-languages=c,c++,lto \
160 --enable-checking=release \
165 --with-bugurl=http://bugtracker.ipfire.org \
166 --disable-libunwind-exceptions \
167 --enable-gnu-unique-object \
168 --enable-linker-build-id \
171 # GCC does not support a parallel build.
172 make profiledbootstrap BOOT_CFLAGS="${OPT_FLAGS}" #%{PARALLELISMFLAGS}
176 # cd %{DIR_SRC}/gcc-build && make check
177 # cd %{DIR_APP} && ./contrib/test_summary
181 cd %{DIR_SRC}/gcc-build
182 make install DESTDIR=%{BUILDROOT}
184 mkdir -pv %{BUILDROOT}/lib
185 ln -sfv ../usr/bin/cpp %{BUILDROOT}/lib/cpp
186 ln -sfv gcc %{BUILDROOT}/usr/bin/cc
188 # Move libgcc_s to /lib
189 mv -vf %{BUILDROOT}/usr/lib/libgcc_s.so.1 %{BUILDROOT}/lib/
190 ln -svf ../../lib/libgcc_s.so.1 %{BUILDROOT}/usr/lib/libgcc_s.so
192 # Remove some GNU debugger stuff.
193 rm -vf %{BUILDROOT}/usr/lib/lib*.py
197 /usr/lib/gcc/%{DISTRO_BUILDTARGET}/%{version}/libgcc.a
198 /usr/lib/gcc/%{DISTRO_BUILDTARGET}/%{version}/libgcc_eh.a
207 binutils>=%{required_binutils_version}
213 if "%{build_cloog_ppl}" == "1"
214 requires += cloog-ppl>=0.15
218 # XXX add package descriptions
221 requires = gcc=%{thisver} libstdc++-devel
225 /usr/lib/gcc/*/*/cc1plus
226 /usr/share/man/man*/*++*
237 requires = libgcc=%{thisver}
246 /usr/lib/libstdc++*.so.*
250 package libstdc++-devel
253 /usr/lib/libstdc++*.so
259 /usr/lib/libgomp*.so.*
266 /usr/lib/libgomp.spec
272 /usr/lib/libmudflap*.so.*
276 package libmudflap-devel
278 /usr/lib/libmudflap*.so
284 /usr/lib/libquadmath*.so.*
288 package libquadmath-devel
290 /usr/lib/libquadmath*.so