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.
7 # XXX THIS PACKAGE DOES CURRENTLY NOT BUILD WITH CLOOG AND PPL WHICH
8 # NEEDS TO BE FIXED SOON.
15 maintainer = Michael Tremer <michael.tremer@ipfire.org>
16 groups = Development/Compilers
17 url = http://gcc.gnu.org/
18 license = GPLv3+ and GPLv2+ with exceptions
19 summary = Various compilers (C, C++, Objective-C, Java, ...).
22 The gcc package contains the GNU Compiler Collection. \
23 You'll need this package in order to compile C code.
26 # This is the at least required version of binutils.
27 required_binutils_version = 2.21.51.0.8-1
29 source_dl = http://ftp.gnu.org/gnu/gcc/%{thisapp}/
30 sources = %{thisapp}.tar.gz
34 gcc46-c++-builtin-redecl.patch0
36 gcc46-libgomp-omp_h-multilib.patch0
37 gcc46-libtool-no-rpath.patch0
40 gcc46-no-add-needed.patch0
41 gcc46-unwind-debughook-sdt.patch0
43 gcc46-Woverlength-string.patch0
44 gcc46-Woverlength-string-asm.patch0
45 gcc-4.6.0-piepatches-20110407.patch
51 binutils>=%{required_binutils_version}
65 # If cloog support is enabled, we require the devel packages for build.
66 if "%{build_cloog_ppl}" == "1"
67 requires += cloog-ppl-devel ppl-devel
70 # A couple of configure arguments depending on the architecture and
74 if "%{DISTRO_ARCH}" == "x86_64"
75 configure_options = --disable-multilib
78 if "%{DISTRO_ARCH}" == "i686"
79 configure_options = --with-arch=%{DISTRO_ARCH} --with-tune=generic
82 if "%{build_cloog_ppl}" == "1"
83 configure_options += --with-cloog --with-ppl
86 # CFLAGS for hardening.
87 HARD_CFLAGS = -DEFAULT_PIE_SSP -DEFAULT_RELRO -DEFAULT_BIND_NOW
90 mkdir -v %{DIR_SRC}/gcc-build
92 # Remove unneeded features that will save some compile time
93 rm -rf lib{gfortran,java,objc} gcc/{fortran,java,objc,objcp}
95 # Apply a sed substitution that will suppress the installation of
96 # libiberty.a. The version of libiberty.a provided by Binutils will be used
98 sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in
101 echo "%{DISTRO_NAME} %{version}-%{release}" > gcc/DEV-PHASE
103 # Libgomp uses -Werror regardless of --disable-werror, and this will cause a
104 # build failure when -D_FORTIFY_SOURCE=2 causes build time warnings:
105 sed -e "s/-Werror//" -i libgomp/configure
107 # The fixincludes script is known to occasionally erroneously attempt to
108 # "fix" the system headers installed so far. As the headers up to this point
109 # are known to not require fixing, issue the following command to prevent
110 # the fixincludes script from running:
111 sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in
113 sed -i gcc/Makefile.in \
114 -e "s/-fno-exceptions/& -fno-asynchronous-unwind-tables/"
116 # we want to be able to control the pie patch logic via something other
118 sed -i gcc/Makefile.in \
119 -e '/^ALL_CFLAGS/iHARD_CFLAGS = ' \
120 -e 's|^ALL_CFLAGS = |ALL_CFLAGS = $(HARD_CFLAGS) |'
122 # Enable the GCC hardening by default.
123 sed -i gcc/Makefile.in \
124 -e "s|^HARD_CFLAGS = |HARD_CFLAGS = %{HARD_CFLAGS} |"
126 # Compile the compiler with -fPIC as well.
127 sed -i gcc/Makefile.in \
128 -e "s|^ESP_NOPIE_CFLAGS = .*|ESP_NOPIE_CFLAGS =|"
130 ./contrib/gcc_update --touch
134 cd %{DIR_SRC}/gcc-build
137 OPT_FLAGS="%{CFLAGS}"
139 CFLAGS=$(echo ${CFLAGS} | sed -e 's/\(-Wp,\)\?-D_FORTIFY_SOURCE=[12]//g')
140 CFLAGS=$(echo ${CFLAGS} | sed -e 's/-m64//g;s/-m32//g;s/-m31//g')
141 CFLAGS=$(echo ${CFLAGS} | sed -e 's/-march=i.86//g')
142 #CFLAGS=$(echo ${CFLAGS} | sed -e 's/ -pipe / /g')
143 CFLAGS=$(echo "${CFLAGS}" | sed -e 's/[[:blank:]]\+/ /g')
144 CXXFLAGS=$(echo ${CFLAGS} | sed -e 's/ -Wall//g')
147 CXXFLAGS="${CXXFLAGS}" \
148 XCFLAGS="${CFLAGS}" \
149 TCFLAGS="${CFLAGS}" \
150 ../%{thisapp}/configure \
151 --build=%{DISTRO_BUILDTARGET} \
153 --libexecdir=/usr/lib \
154 --mandir=/usr/share/man \
157 --enable-threads=posix \
158 --enable-__cxa_atexit \
159 --enable-clocale=gnu \
160 --enable-languages=c,c++,lto \
162 --enable-checking=release \
167 --with-bugurl=http://bugtracker.ipfire.org \
168 --disable-libunwind-exceptions \
169 --enable-gnu-unique-object \
170 --enable-linker-build-id \
173 # GCC does not support a parallel build.
174 make profiledbootstrap BOOT_CFLAGS="${OPT_FLAGS}" #%{PARALLELISMFLAGS}
178 # cd %{DIR_SRC}/gcc-build && make check
179 # cd %{DIR_APP} && ./contrib/test_summary
183 cd %{DIR_SRC}/gcc-build
184 make install DESTDIR=%{BUILDROOT}
186 mkdir -pv %{BUILDROOT}/lib
187 ln -sfv ../usr/bin/cpp %{BUILDROOT}/lib/cpp
188 ln -sfv gcc %{BUILDROOT}/usr/bin/cc
190 # Move libgcc_s to /lib
191 mv -vf %{BUILDROOT}/usr/lib/libgcc_s.so.1 %{BUILDROOT}/lib/
192 ln -svf ../../lib/libgcc_s.so.1 %{BUILDROOT}/usr/lib/libgcc_s.so
194 # Remove some GNU debugger stuff.
195 rm -vf %{BUILDROOT}/usr/lib/lib*.py
199 /usr/lib/gcc/%{DISTRO_BUILDTARGET}/%{version}/libgcc.a
200 /usr/lib/gcc/%{DISTRO_BUILDTARGET}/%{version}/libgcc_eh.a
209 binutils>=%{required_binutils_version}
215 if "%{build_cloog_ppl}" == "1"
216 requires += cloog-ppl>=0.15
220 # XXX add package descriptions
223 requires = gcc=%{thisver} libstdc++-devel
227 /usr/lib/gcc/*/*/cc1plus
228 /usr/share/man/man*/*++*
239 requires = libgcc=%{thisver}
248 /usr/lib/libstdc++*.so.*
252 package libstdc++-devel
255 /usr/lib/libstdc++*.so
261 /usr/lib/libgomp*.so.*
268 /usr/lib/libgomp.spec
274 /usr/lib/libmudflap*.so.*
278 package libmudflap-devel
280 /usr/lib/libmudflap*.so
286 /usr/lib/libquadmath*.so.*
290 package libquadmath-devel
292 /usr/lib/libquadmath*.so