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