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