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