]> git.ipfire.org Git - ipfire-3.x.git/blob - pkgs/gcc/gcc.nm
Change file layout of the makefiles.
[ipfire-3.x.git] / pkgs / gcc / gcc.nm
1 ###############################################################################
2 # IPFire.org - An Open Source Firewall Solution #
3 # Copyright (C) - IPFire Development Team <info@ipfire.org> #
4 ###############################################################################
5
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.
9 build_cloog_ppl = 0
10
11 name = gcc
12 version = 4.6.1
13 release = 3
14
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, ...).
20
21 description
22 The gcc package contains the GNU Compiler Collection. \
23 You'll need this package in order to compile C code.
24 end
25
26 # This is the at least required version of binutils.
27 required_binutils_version = 2.21.51.0.8-1
28
29 source_dl = http://ftp.gnu.org/gnu/gcc/
30 sources = %{thisapp}.tar.gz
31
32 patches
33 gcc46-hack.patch0
34 gcc46-c++-builtin-redecl.patch0
35 gcc46-pr33763.patch0
36 gcc46-libgomp-omp_h-multilib.patch0
37 gcc46-libtool-no-rpath.patch0
38 gcc46-cloog-dl.patch0
39 gcc46-pr38757.patch0
40 gcc46-no-add-needed.patch0
41 gcc46-unwind-debughook-sdt.patch0
42 gcc46-ppl-0.10.patch
43 gcc46-Woverlength-string.patch0
44 gcc46-Woverlength-string-asm.patch0
45 gcc-4.6.0-piepatches-20110407.patch
46 end
47
48 build
49 requires
50 autogen
51 binutils>=%{required_binutils_version}
52 dejagnu
53 elfutils-devel
54 expect
55 flex
56 glibc-devel
57 gmp-devel
58 libffi-devel
59 mpc-devel
60 mpfr-devel
61 texinfo
62 zlib-devel
63 end
64
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
68 end
69
70 # A couple of configure arguments depending on the architecture and
71 # configuration.
72 configure_options =
73
74 if "%{DISTRO_ARCH}" == "x86_64"
75 configure_options = --disable-multilib
76 end
77
78 if "%{DISTRO_ARCH}" == "i686"
79 configure_options = --with-arch=%{DISTRO_ARCH} --with-tune=generic
80 end
81
82 if "%{build_cloog_ppl}" == "1"
83 configure_options += --with-cloog --with-ppl
84 end
85
86 # CFLAGS for hardening.
87 HARD_CFLAGS = -DEFAULT_PIE_SSP -DEFAULT_RELRO -DEFAULT_BIND_NOW
88
89 prepare_cmds
90 mkdir -v %{DIR_SRC}/gcc-build
91
92 # Remove unneeded features that will save some compile time
93 rm -rf lib{gfortran,java,objc} gcc/{fortran,java,objc,objcp}
94
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
97 # instead:
98 sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in
99
100 # Branding gcc
101 echo "%{DISTRO_NAME} %{version}-%{release}" > gcc/DEV-PHASE
102
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
106
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
112
113 sed -i gcc/Makefile.in \
114 -e "s/-fno-exceptions/& -fno-asynchronous-unwind-tables/"
115
116 # we want to be able to control the pie patch logic via something other
117 # than ALL_CFLAGS...
118 sed -i gcc/Makefile.in \
119 -e '/^ALL_CFLAGS/iHARD_CFLAGS = ' \
120 -e 's|^ALL_CFLAGS = |ALL_CFLAGS = $(HARD_CFLAGS) |'
121
122 # Enable the GCC hardening by default.
123 sed -i gcc/Makefile.in \
124 -e "s|^HARD_CFLAGS = |HARD_CFLAGS = %{HARD_CFLAGS} |"
125
126 # Compile the compiler with -fPIC as well.
127 sed -i gcc/Makefile.in \
128 -e "s|^ESP_NOPIE_CFLAGS = .*|ESP_NOPIE_CFLAGS =|"
129
130 ./contrib/gcc_update --touch
131 end
132
133 build
134 cd %{DIR_SRC}/gcc-build
135
136 # Modify CFLAGS
137 OPT_FLAGS="%{CFLAGS}"
138 CFLAGS="%{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')
145
146 CFLAGS="${CFLAGS}" \
147 CXXFLAGS="${CXXFLAGS}" \
148 XCFLAGS="${CFLAGS}" \
149 TCFLAGS="${CFLAGS}" \
150 ../%{thisapp}/configure \
151 --build=%{DISTRO_BUILDTARGET} \
152 --prefix=/usr \
153 --libexecdir=/usr/lib \
154 --mandir=/usr/share/man \
155 --enable-esp \
156 --enable-shared \
157 --enable-threads=posix \
158 --enable-__cxa_atexit \
159 --enable-clocale=gnu \
160 --enable-languages=c,c++,lto \
161 --enable-bootstrap \
162 --enable-checking=release \
163 --disable-werror \
164 --disable-libssp \
165 --disable-static \
166 --with-system-zlib \
167 --with-bugurl=http://bugtracker.ipfire.org \
168 --disable-libunwind-exceptions \
169 --enable-gnu-unique-object \
170 --enable-linker-build-id \
171 %{configure_options}
172
173 # GCC does not support a parallel build.
174 make profiledbootstrap BOOT_CFLAGS="${OPT_FLAGS}" #%{PARALLELISMFLAGS}
175 end
176
177 #test
178 # cd %{DIR_SRC}/gcc-build && make check
179 # cd %{DIR_APP} && ./contrib/test_summary
180 #end
181
182 install
183 cd %{DIR_SRC}/gcc-build
184 make install DESTDIR=%{BUILDROOT}
185
186 mkdir -pv %{BUILDROOT}/lib
187 ln -sfv ../usr/bin/cpp %{BUILDROOT}/lib/cpp
188 ln -sfv gcc %{BUILDROOT}/usr/bin/cc
189
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
193
194 # Remove some GNU debugger stuff.
195 rm -vf %{BUILDROOT}/usr/lib/lib*.py
196 end
197 end
198
199 packages
200 package %{name}
201 groups += Build
202
203 requires
204 binutils>=%{required_binutils_version}
205 glibc-devel
206 libgcc-devel
207 end
208
209 if "%{build_cloog_ppl}" == "1"
210 requires += cloog-ppl>=0.15
211 end
212 end
213
214 # XXX add package descriptions
215
216 package %{name}-c++
217 requires = gcc=%{thisver} libstdc++-devel
218
219 files
220 /usr/bin/*++
221 /usr/lib/gcc/*/*/cc1plus
222 /usr/share/man/man*/*++*
223 end
224 end
225
226 package libgcc
227 files
228 /lib/libgcc*.so.*
229 end
230 end
231
232 package libgcc-devel
233 requires = libgcc=%{thisver}
234
235 files
236 /usr/lib/libgcc*.so
237 end
238 end
239
240 package libstdc++
241 files
242 /usr/lib/libstdc++*.so.*
243 end
244 end
245
246 package libstdc++-devel
247 files
248 /usr/include/c++
249 /usr/lib/libstdc++*.so
250 end
251 end
252
253 package libgomp
254 files
255 /usr/lib/libgomp*.so.*
256 end
257 end
258
259 package libgomp
260 files
261 /usr/lib/libgomp*.so
262 /usr/lib/libgomp.spec
263 end
264 end
265
266 package libmudflap
267 files
268 /usr/lib/libmudflap*.so.*
269 end
270 end
271
272 package libmudflap-devel
273 files
274 /usr/lib/libmudflap*.so
275 end
276 end
277
278 package libquadmath
279 files
280 /usr/lib/libquadmath*.so.*
281 end
282 end
283
284 package libquadmath-devel
285 files
286 /usr/lib/libquadmath*.so
287 end
288 end
289 end