]> git.ipfire.org Git - ipfire-3.x.git/blob - gcc/gcc.nm
gcc: Update to version 5.2
[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 graphite
7 build_graphite = 1
8
9 name = gcc
10 version = 5.2.0
11 release = 1
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 binutils_version = 2.24
26
27 source_dl = http://ftp.gnu.org/gnu/gcc/%{thisapp}/
28 source_dl += ftp://gcc.gnu.org/pub/gcc/infrastructure/
29 sources = %{thisapp}.tar.gz
30
31 build
32 requires
33 autogen
34 binutils >= %{binutils_version}
35 dejagnu
36 elfutils-devel
37 expect
38 filesystem >= 002
39 flex
40 glibc-devel >= 2.16
41 gmp-devel
42 libffi-devel
43 libmpc-devel >= 0.8.1
44 mpfr-devel
45 perl
46 texinfo
47 zlib-devel
48 end
49
50 # If graphite support is enabled, we require the devel packages for build.
51 if "%{build_graphite}" == "1"
52 requires += isl-devel >= 0.14
53 end
54
55 # Build libquadmath (only on x86).
56 build_libquadmath = 0
57
58 # Build liblsan (only on x86_64).
59 build_liblsan = 0
60
61 # Build libtasn (only on x86_64).
62 build_libtsan = 0
63
64 # Build libubsan
65 build_libubsan = 0
66
67 # Build libcilkrts (only x86)
68 build_libcilkrts = 0
69
70 # A couple of configure arguments depending on the architecture and
71 # configuration.
72 configure_options =
73
74 make_bootstrap = profiledbootstrap
75
76 if "%{DISTRO_ARCH}" == "x86_64"
77 configure_options = --disable-multilib
78
79 build_libquadmath = 1
80 build_liblsan = 1
81 build_libtsan = 1
82 build_libubsan = 1
83 build_libcilkrts = 1
84 end
85
86 if "%{DISTRO_ARCH}" == "i686"
87 configure_options = --with-arch=%{DISTRO_ARCH} --with-tune=generic
88
89 build_libquadmath = 1
90 build_libubsan = 1
91 build_libcilkrts = 1
92 end
93
94 if "%{DISTRO_ARCH}" == "aarch64"
95 build_libubsan = 1
96 end
97
98 if "%{DISTRO_ARCH}" == "armv7hl"
99 make_bootstrap = bootstrap
100
101 configure_options += --disable-sjlj-exceptions
102
103 configure_options += \
104 --with-tune=cortex-a8 \
105 --with-arch=armv7-a \
106 --with-float=hard \
107 --with-fpu=vfpv3-d16 \
108 --with-abi=aapcs-linux
109
110 build_libubsan = 1
111 end
112
113 if "%{DISTRO_ARCH}" == "armv5tel"
114 make_bootstrap = bootstrap
115
116 configure_options += --disable-sjlj-exceptions
117 configure_options += --with-float=soft
118
119 build_libubsan = 1
120 end
121
122 if "%{build_graphite}" == "1"
123 configure_options += \
124 --with-isl
125 end
126
127 # CFLAGS for hardening.
128 HARD_CFLAGS = -DENABLE_ESP -DEFAULT_PIE_SSP -DEFAULT_RELRO -DEFAULT_BIND_NOW
129
130 prepare_cmds
131 mkdir -v %{DIR_SRC}/gcc-build
132
133 # Remove unneeded features that will save some compile time
134 rm -rf lib{gfortran,java,objc} gcc/{fortran,java,objc,objcp}
135
136 # Apply a sed substitution that will suppress the installation of
137 # libiberty.a. The version of libiberty.a provided by Binutils will be used
138 # instead:
139 sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in
140
141 # Branding gcc
142 echo "%{DISTRO_NAME} %{version}-%{release}" > gcc/DEV-PHASE
143
144 # Libgomp uses -Werror regardless of --disable-werror, and this will cause a
145 # build failure when -D_FORTIFY_SOURCE=2 causes build time warnings:
146 sed -e "s/-Werror//" -i libgomp/configure
147
148 # The fixincludes script is known to occasionally erroneously attempt to
149 # "fix" the system headers installed so far. As the headers up to this point
150 # are known to not require fixing, issue the following command to prevent
151 # the fixincludes script from running:
152 sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in
153
154 sed -i gcc/Makefile.in \
155 -e "s/-fno-exceptions/& -fno-asynchronous-unwind-tables/"
156
157 # we want to be able to control the pie patch logic via something other
158 # than ALL_CFLAGS and ALL_CXXFLAGS...
159 sed -i gcc/Makefile.in \
160 -e '/^ALL_CFLAGS/iHARD_CFLAGS = %{HARD_CFLAGS}' \
161 -e 's|^ALL_CFLAGS = |ALL_CFLAGS = $(HARD_CFLAGS) |' \
162 -e '/^ALL_CXXFLAGS/iHARD_CFLAGS = %{HARD_CFLAGS}' \
163 -e 's|^ALL_CXXFLAGS = |ALL_CXXFLAGS = $(HARD_CFLAGS) |'
164
165 # However, genautomata crashes with a "Bus Error" when compiled
166 # with PIC.
167 sed -i gcc/Makefile.in \
168 -e 's|^build/genautomata$(build_exeext) .*|& -fno-PIC|'
169
170 # Default to -gdwarf-4 -fno-debug-types-section rather than -gdwarf-2
171 sed -i gcc/common.opt \
172 -e '/UInteger Var(dwarf_version)/s/Init(2)/Init(4)/' \
173 -e '/flag_debug_types_section/s/Init(1)/Init(0)/' \
174 -e '/dwarf_record_gcc_switches/s/Init(0)/Init(1)/' \
175 -e 's/\(may be either 2, 3 or 4; the default version is \)2\./\14./'
176
177 #./contrib/gcc_update --touch
178 end
179
180 export CC=gcc
181 export CXX=g++
182
183 build
184 cd %{DIR_SRC}/gcc-build
185
186 # Modify CFLAGS
187 CFLAGS="%{CFLAGS}"
188 CFLAGS=$(echo ${CFLAGS} | sed -e 's/\(-Wp,\)\?-D_FORTIFY_SOURCE=[12]//g')
189 CFLAGS=$(echo ${CFLAGS} | sed -e 's/-Werror=format-security//g')
190 CFLAGS=$(echo ${CFLAGS} | sed -e 's/-m64//g;s/-m32//g;s/-m31//g')
191 CFLAGS=$(echo ${CFLAGS} | sed -e 's/-mfpmath=sse/-mfpmath=sse -msse2/g')
192 CFLAGS=$(echo ${CFLAGS} | sed -e 's/-march=i.86//g')
193 CFLAGS=$(echo ${CFLAGS} | sed -e 's/ -pipe / /g')
194 CFLAGS=$(echo "${CFLAGS}" | sed -e 's/[[:blank:]]\+/ /g')
195 CXXFLAGS=$(echo ${CFLAGS} | sed -e 's/ -Wall//g')
196 CXXFLAGS=$(echo ${CXXFLAGS} | sed -e 's/ -fexceptions / /g')
197 #CXXFLAGS=$(echo ${CXXFLAGS} | sed -e 's/ -Werror=format-security / -Wformat -Werror=format-security /g')
198
199 case "${CFLAGS}" in
200 *-fasynchronous-unwind-tables*)
201 sed -i -e "s/-fno-exceptions /-fno-exceptions -fno-asynchronous-unwind-tables/" \
202 ../%{thisapp}/Makefile.in
203 ;;
204 esac
205
206 CFLAGS="${CFLAGS}" \
207 CXXFLAGS="${CXXFLAGS}" \
208 XCFLAGS="${CFLAGS}" \
209 TCFLAGS="${CFLAGS}" \
210 ../%{thisapp}/configure \
211 --build=%{DISTRO_BUILDTARGET} \
212 --prefix=/usr \
213 --libdir=%{libdir} \
214 --libexecdir=%{libdir} \
215 --mandir=%{mandir} \
216 --enable-esp \
217 --enable-shared \
218 --enable-threads=posix \
219 --enable-__cxa_atexit \
220 --enable-clocale=gnu \
221 --enable-languages=c,c++,lto \
222 --enable-bootstrap \
223 --enable-checking=release \
224 --disable-werror \
225 --disable-libssp \
226 --with-system-zlib \
227 --with-bugurl=http://bugtracker.ipfire.org \
228 --disable-libunwind-exceptions \
229 --enable-gnu-unique-object \
230 --enable-linker-build-id \
231 --with-linker-hash-style=gnu \
232 --enable-plugin \
233 --enable-initfini-array \
234 --disable-libgcj \
235 --enable-gnu-indirect-function \
236 %{configure_options}
237
238 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58012
239 # XXX disabled flags: --disable-static
240
241 # GCC does not support a parallel build.
242 make %{make_bootstrap} BOOT_CFLAGS="${CFLAGS}"
243
244 # Generate man pages.
245 perl -pi -e 's/head3/head2/' ../contrib/texi2pod.pl
246 for i in %{DIR_APP}/gcc/doc/*.texi; do
247 cp -a $i $i.orig; sed 's/ftable/table/' $i.orig > $i
248 done
249 make -C gcc generated-manpages
250 for i in %{DIR_APP}/gcc/doc/*.texi; do mv -f $i.orig $i; done
251 end
252
253 #test
254 # cd %{DIR_SRC}/gcc-build && make -k check || true
255 # cd %{DIR_APP} && ./contrib/test_summary
256 #end
257
258 install
259 cd %{DIR_SRC}/gcc-build
260 make install DESTDIR=%{BUILDROOT}
261
262 # Check if the installation path exists.
263 FULLPATH="%{BUILDROOT}%{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}"
264 [ -d "${FULLPATH}" ] || exit 1
265
266 mkdir -pv %{BUILDROOT}%{prefix}/lib
267 ln -sfv ../bin/cpp %{BUILDROOT}%{prefix}/lib/cpp
268 ln -sfv gcc %{BUILDROOT}/usr/bin/cc
269
270 # Fix libgcc_s symlinks.
271 rm -f ${FULLPATH}/libgcc_s.so %{BUILDROOT}%{libdir}/libgcc_s.so
272 case "%{DISTRO_ARCH}" in
273 arm*)
274 cat <<EOF >${FULLPATH}/libgcc_s.so
275 /* GNU ld script
276 Use the shared library, but some functions are only in
277 the static library, so try that secondarily. */
278 OUTPUT_FORMAT(elf32-littlearm)
279 GROUP ( %{libdir}/libgcc_s.so.1 libgcc.a )
280 EOF
281 ;;
282 *)
283 ln -svf ../../../../..%{libdir}/libgcc_s.so.1 ${FULLPATH}/libgcc_s.so
284 ;;
285 esac
286 chmod 755 %{BUILDROOT}%{libdir}/libgcc_s.so.1
287
288 # Remove some GNU debugger stuff.
289 rm -vf %{BUILDROOT}%{libdir}/lib*.py
290
291 # Install missing header file(s) on ARM.
292 case "%{DISTRO_ARCH}" in
293 arm*)
294 cp -vf %{DIR_APP}/gcc/config/vxworks-dummy.h \
295 ${FULLPATH}/plugin/include/config/
296 cp -vf %{DIR_APP}/gcc/config/arm/arm-cores.def \
297 ${FULLPATH}/plugin/include/config/arm/
298 ;;
299 esac
300
301 # libgomp
302 mv -vf %{BUILDROOT}%{libdir}/libgomp.spec ${FULLPATH}/
303 ln -svf ../../../libgomp.so.1.0.0 ${FULLPATH}/libgomp.so
304 chmod 755 %{BUILDROOT}%{libdir}/libgomp.so.1.*
305
306 # libstdc++
307 ln -svf ../../../libstdc++.so.6.0.21 ${FULLPATH}/libstdc++.so
308 mv -vf %{BUILDROOT}%{libdir}/lib{std,sup}c++.a ${FULLPATH}
309
310 # libquadmath
311 if [ "%{build_libquadmath}" = "1" ]; then
312 ln -svf ../../../libquadmath.so.0.0.0 ${FULLPATH}/libquadmath.so
313 chmod 755 %{BUILDROOT}%{libdir}/libquadmath.so.0.*
314 fi
315
316 # libitm
317 mv -vf %{BUILDROOT}%{libdir}/libitm.spec ${FULLPATH}/
318 ln -svf ../../../libitm.so.1.0.0 ${FULLPATH}/libitm.so
319 chmod 755 %{BUILDROOT}%{libdir}/libitm.so.1.*
320
321 # liblsan
322 if [ "%{build_liblsan}" = "1" ]; then
323 ln -svf ../../../liblsan.so.0.0.0 ${FULLPATH}/liblsan.so
324 chmod 755 %{BUILDROOT}%{libdir}/liblsan.so.*
325 fi
326
327 # libtsan
328 if [ "%{build_libtsan}" = "1" ]; then
329 ln -svf ../../../libtsan.so.0.0.0 ${FULLPATH}/libtsan.so
330 chmod 755 %{BUILDROOT}%{libdir}/libtsan.so.*
331 fi
332
333 # libubsan
334 if [ "%{build_libubsan}" = "1" ]; then
335 ln -svf ../../../libubsan.so.0.0.0 ${FULLPATH}/libubsan.so
336 chmod 755 %{BUILDROOT}%{libdir}/libubsan.so.*
337 fi
338
339 # libcilkrts
340 if [ "%{build_libcilkrts}" = "1" ]; then
341 ln -svf ../../../libcilkrts.so.5.0.0 ${FULLPATH}/libcilkrts.so
342 chmod 755 %{BUILDROOT}%{libdir}/libcilkrts.so.5.*
343 fi
344 end
345
346 keep_libraries
347 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libgcc.a
348 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libgcc_eh.a
349 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libstdc++.a
350 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libsupc++.a
351 end
352 end
353
354 packages
355 package %{name}
356 groups += Build
357
358 requires
359 binutils >= %{binutils_version}
360 filesystem >= 002
361 glibc >= 2.16
362 glibc-devel
363 gmp-devel
364 cpp = %{thisver}
365 libgcc = %{thisver}
366 libgomp = %{thisver}
367 end
368
369 # We do not ship libgcc-devel anymore.
370 provides += libgcc-devel = %{thisver}
371 obsoletes += libgcc-devel < %{thisver}
372
373 if "%{build_cloog}" == "1"
374 requires += cloog >= %{cloog_version}
375 end
376 end
377
378 package %{name}-c++
379 summary = C++ support for GCC.
380 description
381 This package adds C++ support to the GNU Compiler Collection.
382 It includes support for most of the current C++ specification,
383 including templates and exception handling.
384 end
385
386 requires
387 gcc = %{thisver}
388 libstdc++ = %{thisver}
389 libstdc++-devel = %{thisver}
390 end
391
392 files
393 /usr/bin/*++
394 %{libdir}/gcc/*/*/cc1plus
395 /usr/share/man/man*/*++*
396 end
397 end
398
399 package cpp
400 summary = The C Preprocessor.
401 description
402 Cpp is the GNU C-Compatible Compiler Preprocessor.
403 Cpp is a macro processor which is used automatically
404 by the C compiler to transform your program before actual
405 compilation. It is called a macro processor because it allows
406 you to define macros, abbreviations for longer
407 constructs.
408
409 The C preprocessor provides four separate functionalities: the
410 inclusion of header files (files of declarations that can be
411 substituted into your program); macro expansion (you can define macros,
412 and the C preprocessor will replace the macros with their definitions
413 throughout the program); conditional compilation (using special
414 preprocessing directives, you can include or exclude parts of the
415 program according to various conditions); and line control (if you use
416 a program to combine or rearrange source files into an intermediate
417 file which is then compiled, you can use line control to inform the
418 compiler about where each source line originated).
419
420 You should install this package if you are a C programmer and you use
421 macros.
422 end
423 group = Development/Languages
424
425 files
426 %{prefix}/lib/cpp
427 %{bindir}/cpp
428 %{mandir}/man1/cpp.1*
429 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/cc1
430 end
431
432 provides = /lib/cpp
433 requires = gcc-c++ = %{thisver}
434 end
435
436 package libgcc
437 summary = GCC shared support library.
438 description
439 This package contains GCC shared support library which is needed
440 e.g. for exception handling support.
441 end
442
443 files
444 %{libdir}/libgcc*.so.*
445 end
446
447 obsoletes
448 libmudflap
449 libmudflap-devel
450 end
451 end
452
453 package libstdc++
454 summary = GNU Standard C++ Library.
455 description
456 The libstdc++ package contains a rewritten standard compliant GCC Standard
457 C++ Library.
458 end
459
460 files
461 %{libdir}/libstdc++*.so.*
462 end
463 end
464
465 package libstdc++-devel
466 summary = Header files and libraries for C++ development.
467 description
468 This is the GNU implementation of the standard C++ libraries. This
469 package includes the header files and libraries needed for C++
470 development. This includes rewritten implementation of STL.
471 end
472
473 requires
474 libstdc++ = %{thisver}
475 end
476
477 files
478 %{includedir}/c++
479 %{libdir}/libstdc++*.so
480 end
481 end
482
483 package libstdc++-static
484 summary = Static libraries for the GNU standard C++ library
485 description = %{summary}
486
487 requires
488 libstdc++-devel = %{thisver}
489 end
490
491 files
492 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libstdc++.a
493 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libsupc++.a
494 end
495 end
496
497 package libgomp
498 summary = GCC OpenMP v3.0 shared support library.
499 description
500 This package contains GCC shared support library which is needed
501 for OpenMP v3.0 support.
502 end
503
504 files
505 %{libdir}/libgomp*.so.*
506 end
507 end
508
509 if "%{build_libquadmath}" == "1"
510 package libquadmath
511 summary = GCC __float128 shared support library.
512 description
513 This package contains GCC shared support library which is needed
514 for __float128 math support and for Fortran REAL*16 support.
515 end
516
517 files
518 %{libdir}/libquadmath*.so.*
519 end
520 end
521
522 package libquadmath-devel
523 summary = Development files for GCC __float128 support.
524 description
525 This package contains headers for building Fortran programs using
526 REAL*16 and programs using __float128 math.
527 end
528
529 requires
530 gcc = %{thisver}
531 libquadmath = %{thisver}
532 end
533
534 files
535 %{libdir}/libquadmath.so
536 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/include/quadmath.h
537 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/include/quadmath_weak.h
538 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libquadmath.so
539 end
540 end
541 end
542
543 package libitm
544 summary = The GNU Transactional Memory library.
545 description
546 This package contains the GNU Transactional Memory library
547 which is a GCC transactional memory support runtime library.
548 end
549
550 files
551 %{libdir}/libitm.so.1*
552 end
553 end
554
555 package libitm-devel
556 summary = The GNU Transactional Memory support.
557 description
558 This package contains headers and support files for the
559 GNU Transactional Memory library.
560 end
561
562 requires
563 gcc = %{thisver}
564 libitm = %{thisver}
565 end
566
567 files
568 %{libdir}/libitm.so
569 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/include/itm.h
570 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/include/itm_weak.h
571 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libitm.so
572 end
573 end
574
575 package libatomic
576 summary = The GNU Atomic library
577 description
578 This package contains the GNU Atomic library which is a
579 GCC support runtime library for atomisc operations not
580 supported by hardware.
581 end
582
583 files
584 %{libdir}/libatomic.so.1*
585 end
586 end
587
588 package libasan
589 summary = The Address Sanitizer runtime library
590 description
591 This package contains the Address Sanitizer library
592 which is used for -fsanitize=address instrumented programs.
593 end
594
595 files
596 %{libdir}/libasan.so.2*
597 end
598 end
599
600 if "%{build_libtsan}" == "1"
601 package libtsan
602 summary = The Thread Sanitizer runtime library
603 description
604 This package contains the Thread Sanitizer library
605 which is used for -fsanitize=thread instrumented programs.
606 end
607
608 files
609 %{libdir}/libtsan.so.0*
610 end
611 end
612 end
613
614 if "%{build_libubsan}" == "1"
615 package libubsan
616 summary = The Undefined Behavior Sanitizer runtime library
617 description
618 This package contains the Undefined Behavior Sanitizer library
619 which is used for -fsanitize=undefined instrumented programs.
620 end
621
622 files
623 %{libdir}/libubsan.so.0*
624 end
625 end
626 end
627
628 if "%{build_liblsan}" == "1"
629 package liblsan
630 summary = The Leak Sanitizer runtime library
631 description
632 This package contains the Leak Sanitizer library
633 which is used for -fsanitize=leak instrumented programs.
634 end
635
636 files
637 %{libdir}/liblsan.so.0*
638 end
639 end
640 end
641
642 if "%{build_libcilkrts}" == "1"
643 package libcilkrts
644 summary = The Cilk+ runtime library
645 description
646 This package contains the Cilk+ runtime library.
647 end
648
649 files
650 %{libdir}/libcilkrts.so.5*
651 end
652 end
653 end
654
655 package gcc-plugin-devel
656 summary = Support for compiling GCC plugins.
657 description
658 This package contains header files and other support files
659 for compiling GCC plugins. The GCC plugin ABI is currently
660 not stable, so plugins must be rebuilt any time GCC is updated.
661 end
662
663 requires
664 gcc = %{thisver}
665 gmp-devel >= 4.1.2-8
666 mpfr-devel >= 2.2.1
667 libmpc-devel >= 0.8.1
668 end
669
670 files
671 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/plugin
672 end
673 end
674
675 package %{name}-debuginfo
676 template DEBUGINFO
677 end
678 end