]>
Commit | Line | Data |
---|---|---|
166a6c21 | 1 | ############################################################################### |
802ea3af MT |
2 | # IPFire.org - An Open Source Firewall Solution # |
3 | # Copyright (C) - IPFire Development Team <info@ipfire.org> # | |
166a6c21 MT |
4 | ############################################################################### |
5 | ||
802ea3af | 6 | # Configure build to compile with cloog and ppl. |
7bc68234 | 7 | build_cloog_ppl = 1 |
166a6c21 | 8 | |
802ea3af | 9 | name = gcc |
de58ea22 | 10 | version = 4.6.2 |
7bc68234 | 11 | release = 9 |
f0d77f5d | 12 | |
802ea3af MT |
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, ...). | |
166a6c21 | 18 | |
802ea3af | 19 | description |
166a6c21 MT |
20 | The gcc package contains the GNU Compiler Collection. \ |
21 | You'll need this package in order to compile C code. | |
802ea3af MT |
22 | end |
23 | ||
24 | # This is the at least required version of binutils. | |
25 | required_binutils_version = 2.21.51.0.8-1 | |
26 | ||
de58ea22 | 27 | source_dl = http://ftp.gnu.org/gnu/gcc/%{thisapp}/ |
802ea3af MT |
28 | sources = %{thisapp}.tar.gz |
29 | ||
56c0b63c MT |
30 | patches = \ |
31 | gcc46-hack.patch0 \ | |
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 \ | |
3c926509 | 43 | gcc-4.6.0-piepatches-20110407.patch |
802ea3af MT |
44 | |
45 | build | |
46 | requires | |
47 | autogen | |
48 | binutils>=%{required_binutils_version} | |
49 | dejagnu | |
50 | elfutils-devel | |
51 | expect | |
52 | flex | |
53 | glibc-devel | |
54 | gmp-devel | |
55 | libffi-devel | |
56c0b63c | 56 | libmpc-devel |
802ea3af MT |
57 | mpfr-devel |
58 | texinfo | |
59 | zlib-devel | |
60 | end | |
61 | ||
62 | # If cloog support is enabled, we require the devel packages for build. | |
63 | if "%{build_cloog_ppl}" == "1" | |
64 | requires += cloog-ppl-devel ppl-devel | |
65 | end | |
66 | ||
56c0b63c MT |
67 | # Build libquadmath (only on x86). |
68 | build_libquadmath = 0 | |
69 | ||
802ea3af MT |
70 | # A couple of configure arguments depending on the architecture and |
71 | # configuration. | |
72 | configure_options = | |
73 | ||
7bc68234 MT |
74 | make_bootstrap = profiledbootstrap |
75 | ||
802ea3af MT |
76 | if "%{DISTRO_ARCH}" == "x86_64" |
77 | configure_options = --disable-multilib | |
56c0b63c MT |
78 | |
79 | build_libquadmath = 1 | |
802ea3af MT |
80 | end |
81 | ||
82 | if "%{DISTRO_ARCH}" == "i686" | |
83 | configure_options = --with-arch=%{DISTRO_ARCH} --with-tune=generic | |
56c0b63c MT |
84 | |
85 | build_libquadmath = 1 | |
802ea3af MT |
86 | end |
87 | ||
66e276de | 88 | if "%{DISTRO_ARCH}" == "armv5tel" |
7bc68234 | 89 | make_bootstrap = bootstrap |
56c0b63c | 90 | |
7bc68234 | 91 | configure_options += --disable-sjlj-exceptions |
66e276de MT |
92 | configure_options += --with-float=soft |
93 | end | |
94 | ||
56c0b63c MT |
95 | if "${DISTRO_ARCH}" == "armv7hl" |
96 | configure_options += --disable-sjlj-exceptions | |
97 | ||
98 | configure_options += \ | |
99 | --with-cpu=cortex-a8 \ | |
100 | --with-tune=cortex-a8 \ | |
101 | --with-arch=armv7-a \ | |
102 | --with-float=hard \ | |
103 | --with-fpu=vfpv3-d16 \ | |
104 | --with-abi=aapcs-linux | |
105 | end | |
106 | ||
802ea3af MT |
107 | if "%{build_cloog_ppl}" == "1" |
108 | configure_options += --with-cloog --with-ppl | |
109 | end | |
110 | ||
111 | # CFLAGS for hardening. | |
112 | HARD_CFLAGS = -DEFAULT_PIE_SSP -DEFAULT_RELRO -DEFAULT_BIND_NOW | |
113 | ||
114 | prepare_cmds | |
115 | mkdir -v %{DIR_SRC}/gcc-build | |
116 | ||
117 | # Remove unneeded features that will save some compile time | |
118 | rm -rf lib{gfortran,java,objc} gcc/{fortran,java,objc,objcp} | |
119 | ||
120 | # Apply a sed substitution that will suppress the installation of | |
121 | # libiberty.a. The version of libiberty.a provided by Binutils will be used | |
122 | # instead: | |
123 | sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in | |
124 | ||
125 | # Branding gcc | |
126 | echo "%{DISTRO_NAME} %{version}-%{release}" > gcc/DEV-PHASE | |
127 | ||
128 | # Libgomp uses -Werror regardless of --disable-werror, and this will cause a | |
129 | # build failure when -D_FORTIFY_SOURCE=2 causes build time warnings: | |
130 | sed -e "s/-Werror//" -i libgomp/configure | |
131 | ||
132 | # The fixincludes script is known to occasionally erroneously attempt to | |
133 | # "fix" the system headers installed so far. As the headers up to this point | |
134 | # are known to not require fixing, issue the following command to prevent | |
135 | # the fixincludes script from running: | |
136 | sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in | |
137 | ||
138 | sed -i gcc/Makefile.in \ | |
139 | -e "s/-fno-exceptions/& -fno-asynchronous-unwind-tables/" | |
140 | ||
141 | # we want to be able to control the pie patch logic via something other | |
142 | # than ALL_CFLAGS... | |
143 | sed -i gcc/Makefile.in \ | |
144 | -e '/^ALL_CFLAGS/iHARD_CFLAGS = ' \ | |
145 | -e 's|^ALL_CFLAGS = |ALL_CFLAGS = $(HARD_CFLAGS) |' | |
146 | ||
147 | # Enable the GCC hardening by default. | |
148 | sed -i gcc/Makefile.in \ | |
149 | -e "s|^HARD_CFLAGS = |HARD_CFLAGS = %{HARD_CFLAGS} |" | |
150 | ||
151 | # Compile the compiler with -fPIC as well. | |
152 | sed -i gcc/Makefile.in \ | |
153 | -e "s|^ESP_NOPIE_CFLAGS = .*|ESP_NOPIE_CFLAGS =|" | |
154 | ||
56c0b63c MT |
155 | # Default to -gdwarf-4 -fno-debug-types-section rather than -gdwarf-2 |
156 | sed -i gcc/common.opt \ | |
157 | -e '/UInteger Var(dwarf_version)/s/Init(2)/Init(4)/' \ | |
158 | -e '/flag_debug_types_section/s/Init(1)/Init(0)/' \ | |
159 | -e '/dwarf_record_gcc_switches/s/Init(0)/Init(1)/' \ | |
160 | -e 's/\(may be either 2, 3 or 4; the default version is \)2\./\14./' | |
161 | ||
802ea3af MT |
162 | ./contrib/gcc_update --touch |
163 | end | |
164 | ||
165 | build | |
166 | cd %{DIR_SRC}/gcc-build | |
167 | ||
168 | # Modify CFLAGS | |
802ea3af MT |
169 | CFLAGS="%{CFLAGS}" |
170 | CFLAGS=$(echo ${CFLAGS} | sed -e 's/\(-Wp,\)\?-D_FORTIFY_SOURCE=[12]//g') | |
171 | CFLAGS=$(echo ${CFLAGS} | sed -e 's/-m64//g;s/-m32//g;s/-m31//g') | |
56c0b63c MT |
172 | CFLAGS=$(echo ${CFLAGS} | sed -e 's/-march=i.86//g') |
173 | CFLAGS=$(echo ${CFLAGS} | sed -e 's/ -pipe / /g') | |
802ea3af MT |
174 | CFLAGS=$(echo "${CFLAGS}" | sed -e 's/[[:blank:]]\+/ /g') |
175 | CXXFLAGS=$(echo ${CFLAGS} | sed -e 's/ -Wall//g') | |
176 | ||
177 | CFLAGS="${CFLAGS}" \ | |
178 | CXXFLAGS="${CXXFLAGS}" \ | |
179 | XCFLAGS="${CFLAGS}" \ | |
180 | TCFLAGS="${CFLAGS}" \ | |
181 | ../%{thisapp}/configure \ | |
182 | --build=%{DISTRO_BUILDTARGET} \ | |
166a6c21 | 183 | --prefix=/usr \ |
c30b5fa5 MT |
184 | --libdir=%{libdir} \ |
185 | --libexecdir=%{libdir} \ | |
107ed6ee | 186 | --mandir=/usr/share/man \ |
b8b873e7 | 187 | --enable-esp \ |
166a6c21 MT |
188 | --enable-shared \ |
189 | --enable-threads=posix \ | |
190 | --enable-__cxa_atexit \ | |
191 | --enable-clocale=gnu \ | |
f23b0b6e MT |
192 | --enable-languages=c,c++,lto \ |
193 | --enable-bootstrap \ | |
194 | --enable-checking=release \ | |
166a6c21 MT |
195 | --disable-werror \ |
196 | --disable-libssp \ | |
197 | --disable-static \ | |
f23b0b6e MT |
198 | --with-system-zlib \ |
199 | --with-bugurl=http://bugtracker.ipfire.org \ | |
b415c6aa MT |
200 | --disable-libunwind-exceptions \ |
201 | --enable-gnu-unique-object \ | |
202 | --enable-linker-build-id \ | |
802ea3af MT |
203 | %{configure_options} |
204 | ||
205 | # GCC does not support a parallel build. | |
7bc68234 | 206 | make %{make_bootstrap} BOOT_CFLAGS="${CFLAGS}" |
802ea3af MT |
207 | end |
208 | ||
209 | #test | |
210 | # cd %{DIR_SRC}/gcc-build && make check | |
211 | # cd %{DIR_APP} && ./contrib/test_summary | |
212 | #end | |
213 | ||
214 | install | |
215 | cd %{DIR_SRC}/gcc-build | |
216 | make install DESTDIR=%{BUILDROOT} | |
217 | ||
56c0b63c | 218 | # Check if the installation path exists. |
c30b5fa5 | 219 | FULLPATH="%{BUILDROOT}%{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}" |
56c0b63c MT |
220 | [ -d "${FULLPATH}" ] || exit 1 |
221 | ||
c30b5fa5 MT |
222 | mkdir -pv %{BUILDROOT}/%{lib} |
223 | ln -sfv ../usr/bin/cpp %{BUILDROOT}/%{lib}/cpp | |
802ea3af MT |
224 | ln -sfv gcc %{BUILDROOT}/usr/bin/cc |
225 | ||
226 | # Move libgcc_s to /lib | |
c30b5fa5 MT |
227 | rm -f ${FULLPATH}/libgcc_s.so %{BUILDROOT}%{libdir}/libgcc_s.so |
228 | mkdir -pv %{BUILDROOT}/%{lib} | |
229 | mv -vf %{BUILDROOT}%{libdir}/libgcc_s.so.1 %{BUILDROOT}/%{lib}/ | |
13319128 MT |
230 | case "%{DISTRO_ARCH}" in |
231 | arm*) | |
13319128 MT |
232 | cat <<EOF >${FULLPATH}/libgcc_s.so |
233 | /* GNU ld script | |
234 | Use the shared library, but some functions are only in | |
235 | the static library, so try that secondarily. */ | |
236 | OUTPUT_FORMAT(elf32-littlearm) | |
c30b5fa5 | 237 | GROUP ( /%{lib}/libgcc_s.so.1 libgcc.a ) |
13319128 MT |
238 | EOF |
239 | ;; | |
240 | *) | |
c30b5fa5 | 241 | ln -svf ../../../../../%{lib}/libgcc_s.so.1 ${FULLPATH}/libgcc_s.so |
13319128 MT |
242 | ;; |
243 | esac | |
802ea3af MT |
244 | |
245 | # Remove some GNU debugger stuff. | |
c30b5fa5 | 246 | rm -vf %{BUILDROOT}%{libdir}/lib*.py |
56c0b63c MT |
247 | |
248 | # libgomp | |
c30b5fa5 | 249 | mv -vf %{BUILDROOT}%{libdir}/libgomp.spec ${FULLPATH}/ |
56c0b63c | 250 | ln -svf ../../../libgomp.so.1.0.0 ${FULLPATH}/libgomp.so |
c30b5fa5 | 251 | chmod 755 %{BUILDROOT}%{libdir}/libgomp.so.1.* |
56c0b63c MT |
252 | |
253 | # libstdc++ | |
254 | ln -svf ../../../libstdc++.so.6.0.16 ${FULLPATH}/libstdc++.so | |
255 | ||
256 | # libmudflap | |
257 | ln -svf ../../../libmudflap.so.0.0.0 ${FULLPATH}/libmudflap.so | |
258 | ln -svf ../../../libmudflapth.so.0.0.0 ${FULLPATH}/libmudflapth.so | |
c30b5fa5 | 259 | chmod 755 %{BUILDROOT}%{libdir}/libmudflap{,th}.so.0.* |
56c0b63c MT |
260 | |
261 | # libquadmath | |
262 | if [ "%{build_libquadmath}" = "1" ]; then | |
9d2ad5e3 | 263 | ln -svf ../../../libquadmath.so.0.0.0 ${FULLPATH}/libquadmath.so |
c30b5fa5 | 264 | chmod 755 %{BUILDROOT}%{libdir}/libquadmath.so.0.* |
56c0b63c | 265 | fi |
802ea3af | 266 | end |
876f9cff MT |
267 | |
268 | keep_libraries | |
c30b5fa5 MT |
269 | %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libgcc.a |
270 | %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libgcc_eh.a | |
876f9cff | 271 | end |
802ea3af MT |
272 | end |
273 | ||
274 | packages | |
275 | package %{name} | |
276 | groups += Build | |
277 | ||
278 | requires | |
279 | binutils>=%{required_binutils_version} | |
280 | glibc-devel | |
7112214f | 281 | gmp-devel |
56c0b63c MT |
282 | cpp=%{thisver} |
283 | libgcc=%{thisver} | |
284 | libgomp=%{thisver} | |
802ea3af MT |
285 | end |
286 | ||
9d2ad5e3 MT |
287 | # We do not ship libgcc-devel anymore. |
288 | provides += libgcc-devel=%{thisver} | |
289 | obsoletes += libgcc-devel<%{thisver} | |
290 | ||
802ea3af MT |
291 | if "%{build_cloog_ppl}" == "1" |
292 | requires += cloog-ppl>=0.15 | |
293 | end | |
294 | end | |
295 | ||
802ea3af | 296 | package %{name}-c++ |
56c0b63c MT |
297 | summary = C++ support for GCC. |
298 | description | |
299 | This package adds C++ support to the GNU Compiler Collection. | |
300 | It includes support for most of the current C++ specification, | |
301 | including templates and exception handling. | |
302 | end | |
303 | ||
304 | requires | |
305 | gcc=%{thisver} | |
306 | libstdc++=%{thisver} | |
307 | libstdc++-devel=%{thisver} | |
308 | end | |
802ea3af MT |
309 | |
310 | files | |
311 | /usr/bin/*++ | |
c30b5fa5 | 312 | %{libdir}/gcc/*/*/cc1plus |
802ea3af MT |
313 | /usr/share/man/man*/*++* |
314 | end | |
315 | end | |
316 | ||
56c0b63c MT |
317 | package cpp |
318 | summary = The C Preprocessor. | |
319 | description | |
320 | Cpp is the GNU C-Compatible Compiler Preprocessor. | |
321 | Cpp is a macro processor which is used automatically | |
322 | by the C compiler to transform your program before actual | |
323 | compilation. It is called a macro processor because it allows | |
324 | you to define macros, abbreviations for longer | |
325 | constructs. | |
326 | ||
327 | The C preprocessor provides four separate functionalities: the | |
328 | inclusion of header files (files of declarations that can be | |
329 | substituted into your program); macro expansion (you can define macros, | |
330 | and the C preprocessor will replace the macros with their definitions | |
331 | throughout the program); conditional compilation (using special | |
332 | preprocessing directives, you can include or exclude parts of the | |
333 | program according to various conditions); and line control (if you use | |
334 | a program to combine or rearrange source files into an intermediate | |
335 | file which is then compiled, you can use line control to inform the | |
336 | compiler about where each source line originated). | |
337 | ||
338 | You should install this package if you are a C programmer and you use | |
339 | macros. | |
340 | end | |
341 | group = Development/Languages | |
342 | ||
802ea3af | 343 | files |
c30b5fa5 | 344 | /%{lib}/cpp |
56c0b63c MT |
345 | /usr/bin/cpp |
346 | /usr/share/man/man1/cpp.1* | |
c30b5fa5 | 347 | %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/cc1 |
802ea3af MT |
348 | end |
349 | end | |
350 | ||
56c0b63c MT |
351 | package libgcc |
352 | summary = GCC shared support library. | |
353 | description | |
354 | This package contains GCC shared support library which is needed | |
355 | e.g. for exception handling support. | |
356 | end | |
802ea3af MT |
357 | |
358 | files | |
c30b5fa5 | 359 | /%{lib}/libgcc*.so.* |
802ea3af MT |
360 | end |
361 | end | |
362 | ||
363 | package libstdc++ | |
56c0b63c MT |
364 | summary = GNU Standard C++ Library. |
365 | description | |
366 | The libstdc++ package contains a rewritten standard compliant GCC Standard | |
367 | C++ Library. | |
368 | end | |
369 | ||
802ea3af | 370 | files |
c30b5fa5 | 371 | %{libdir}/libstdc++*.so.* |
802ea3af MT |
372 | end |
373 | end | |
374 | ||
375 | package libstdc++-devel | |
56c0b63c MT |
376 | summary = Header files and libraries for C++ development. |
377 | description | |
378 | This is the GNU implementation of the standard C++ libraries. This | |
379 | package includes the header files and libraries needed for C++ | |
380 | development. This includes rewritten implementation of STL. | |
381 | end | |
382 | ||
383 | requires | |
384 | libstdc++=%{thisver} | |
385 | end | |
386 | ||
802ea3af | 387 | files |
c30b5fa5 MT |
388 | %{includedir}/c++ |
389 | %{libdir}/libstdc++*.so | |
802ea3af MT |
390 | end |
391 | end | |
392 | ||
393 | package libgomp | |
56c0b63c MT |
394 | summary = GCC OpenMP v3.0 shared support library. |
395 | description | |
396 | This package contains GCC shared support library which is needed | |
397 | for OpenMP v3.0 support. | |
802ea3af | 398 | end |
802ea3af | 399 | |
802ea3af | 400 | files |
c30b5fa5 | 401 | %{libdir}/libgomp*.so.* |
802ea3af MT |
402 | end |
403 | end | |
404 | ||
405 | package libmudflap | |
56c0b63c MT |
406 | summary = GCC mudflap shared support library. |
407 | description | |
408 | This package contains GCC shared support library which is needed | |
409 | for mudflap support. | |
410 | end | |
411 | ||
802ea3af | 412 | files |
c30b5fa5 | 413 | %{libdir}/libmudflap*.so.* |
802ea3af MT |
414 | end |
415 | end | |
416 | ||
417 | package libmudflap-devel | |
56c0b63c MT |
418 | summary = Development files for GCC mudflap support. |
419 | description | |
420 | This package contains headers for building mudflap-instrumented programs. | |
421 | ||
422 | To instrument a non-threaded program, add -fmudflap | |
423 | option to GCC and when linking add -lmudflap, for threaded programs | |
424 | also add -fmudflapth and -lmudflapth. | |
425 | end | |
426 | ||
427 | requires | |
428 | libmudflap=%{thisver} | |
429 | end | |
430 | ||
802ea3af | 431 | files |
c30b5fa5 MT |
432 | %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/include/mf-runtime.h |
433 | %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libmudflap.so | |
434 | %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libmudflapth.so | |
802ea3af MT |
435 | end |
436 | end | |
437 | ||
56c0b63c MT |
438 | if "%{build_libquadmath}" == "1" |
439 | package libquadmath | |
440 | summary = GCC __float128 shared support library. | |
441 | description | |
442 | This package contains GCC shared support library which is needed | |
443 | for __float128 math support and for Fortran REAL*16 support. | |
444 | end | |
445 | ||
446 | files | |
c30b5fa5 | 447 | %{libdir}/libquadmath*.so.* |
56c0b63c MT |
448 | end |
449 | end | |
450 | ||
451 | package libquadmath-devel | |
452 | summary = Development files for GCC __float128 support. | |
453 | description | |
454 | This package contains headers for building Fortran programs using | |
455 | REAL*16 and programs using __float128 math. | |
456 | end | |
457 | ||
458 | requires | |
459 | gcc=%{thisver} | |
460 | libquadmath=%{thisver} | |
461 | end | |
462 | ||
463 | files | |
c30b5fa5 MT |
464 | %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/include/quadmath.h |
465 | %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/include/quadmath_weak.h | |
466 | %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libquadmath.so | |
56c0b63c | 467 | end |
802ea3af MT |
468 | end |
469 | end | |
470 | ||
56c0b63c MT |
471 | package gcc-plugin-devel |
472 | summary = Support for compiling GCC plugins. | |
473 | description | |
474 | This package contains header files and other support files | |
475 | for compiling GCC plugins. The GCC plugin ABI is currently | |
476 | not stable, so plugins must be rebuilt any time GCC is updated. | |
477 | end | |
478 | ||
479 | requires | |
480 | gcc=%{thisver} | |
481 | gmp-devel>=4.1.2-8 | |
482 | mpfr-devel>=2.2.1 | |
483 | libmpc-devel>=0.8.1 | |
484 | end | |
485 | ||
802ea3af | 486 | files |
c30b5fa5 | 487 | %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/plugin |
802ea3af MT |
488 | end |
489 | end | |
1f9bc2f0 MT |
490 | |
491 | package %{name}-debuginfo | |
492 | template DEBUGINFO | |
493 | end | |
802ea3af | 494 | end |