]> git.ipfire.org Git - ipfire-3.x.git/blame - gcc/gcc.nm
Merge branch 'master' of ssh://git.ipfire.org/pub/git/ipfire-3.x
[ipfire-3.x.git] / gcc / gcc.nm
CommitLineData
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 7build_cloog_ppl = 1
166a6c21 8
802ea3af 9name = gcc
9df4923f 10version = 4.7.2
2a3a31bb 11release = 3
f0d77f5d 12
802ea3af
MT
13maintainer = Michael Tremer <michael.tremer@ipfire.org>
14groups = Development/Compilers
15url = http://gcc.gnu.org/
16license = GPLv3+ and GPLv2+ with exceptions
17summary = Various compilers (C, C++, Objective-C, Java, ...).
166a6c21 18
802ea3af 19description
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
22end
23
24# This is the at least required version of binutils.
25required_binutils_version = 2.21.51.0.8-1
26
de58ea22 27source_dl = http://ftp.gnu.org/gnu/gcc/%{thisapp}/
802ea3af
MT
28sources = %{thisapp}.tar.gz
29
802ea3af
MT
30build
31 requires
32 autogen
33 binutils>=%{required_binutils_version}
34 dejagnu
35 elfutils-devel
36 expect
7e981e59 37 filesystem >= 002
802ea3af 38 flex
e0e5b1d5 39 glibc-devel >= 2.16
802ea3af
MT
40 gmp-devel
41 libffi-devel
56c0b63c 42 libmpc-devel
802ea3af 43 mpfr-devel
4de56d3e 44 perl
802ea3af
MT
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"
2a3a31bb
MT
51 requires += cloog-ppl-devel >= 0.15.11-2
52 requires += ppl-devel >= 1.0
802ea3af
MT
53 end
54
56c0b63c
MT
55 # Build libquadmath (only on x86).
56 build_libquadmath = 0
57
802ea3af
MT
58 # A couple of configure arguments depending on the architecture and
59 # configuration.
60 configure_options =
61
7bc68234
MT
62 make_bootstrap = profiledbootstrap
63
802ea3af
MT
64 if "%{DISTRO_ARCH}" == "x86_64"
65 configure_options = --disable-multilib
56c0b63c
MT
66
67 build_libquadmath = 1
802ea3af
MT
68 end
69
70 if "%{DISTRO_ARCH}" == "i686"
71 configure_options = --with-arch=%{DISTRO_ARCH} --with-tune=generic
56c0b63c
MT
72
73 build_libquadmath = 1
802ea3af
MT
74 end
75
66e276de 76 if "%{DISTRO_ARCH}" == "armv5tel"
7bc68234 77 make_bootstrap = bootstrap
56c0b63c 78
7bc68234 79 configure_options += --disable-sjlj-exceptions
66e276de
MT
80 configure_options += --with-float=soft
81 end
82
1a7bf898 83 if "%{DISTRO_ARCH}" == "armv7hl"
dc788393
MT
84 make_bootstrap = bootstrap
85
56c0b63c
MT
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
802ea3af 97 if "%{build_cloog_ppl}" == "1"
2a3a31bb
MT
98 configure_options += --with-cloog --with-ppl \
99 --disable-ppl-version-check
802ea3af
MT
100 end
101
102 # CFLAGS for hardening.
d72c8258
MT
103 HARD_CFLAGS = -DEFAULT_PIE -DEFAULT_SSP -DEFAULT_PIE_SSP -DEFAULT_ESP_SPP \
104 -DENABLE_ESP_SSP -DEFAULT_RELRO -DEFAULT_BIND_NOW
802ea3af
MT
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
4de56d3e 134 # than ALL_CFLAGS and ALL_CXXFLAGS...
802ea3af
MT
135 sed -i gcc/Makefile.in \
136 -e '/^ALL_CFLAGS/iHARD_CFLAGS = ' \
4de56d3e
MT
137 -e 's|^ALL_CFLAGS = |ALL_CFLAGS = $(HARD_CFLAGS) |' \
138 -e '/^ALL_CXXFLAGS/iHARD_CFLAGS = ' \
139 -e 's|^ALL_CXXFLAGS = |ALL_CXXFLAGS = $(HARD_CFLAGS) |'
802ea3af
MT
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.
4de56d3e
MT
146 # However, genautomata crashes with a "Bus Error" when compiled
147 # with PIC.
802ea3af 148 sed -i gcc/Makefile.in \
4de56d3e
MT
149 -e "s|^ESP_NOPIE_CFLAGS = .*|ESP_NOPIE_CFLAGS =|" \
150 -e 's|^build/genautomata$(build_exeext) .*|& -fno-PIC|'
802ea3af 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 180 --prefix=/usr \
c30b5fa5
MT
181 --libdir=%{libdir} \
182 --libexecdir=%{libdir} \
107ed6ee 183 --mandir=/usr/share/man \
b8b873e7 184 --enable-esp \
166a6c21
MT
185 --enable-shared \
186 --enable-threads=posix \
187 --enable-__cxa_atexit \
188 --enable-clocale=gnu \
f23b0b6e
MT
189 --enable-languages=c,c++,lto \
190 --enable-bootstrap \
191 --enable-checking=release \
4de56d3e
MT
192 --disable-build-with-cxx \
193 --disable-build-poststage1-with-cxx \
166a6c21
MT
194 --disable-werror \
195 --disable-libssp \
196 --disable-static \
f23b0b6e
MT
197 --with-system-zlib \
198 --with-bugurl=http://bugtracker.ipfire.org \
b415c6aa
MT
199 --disable-libunwind-exceptions \
200 --enable-gnu-unique-object \
201 --enable-linker-build-id \
4de56d3e 202 --with-linker-hash-style=gnu \
802ea3af
MT
203 %{configure_options}
204
205 # GCC does not support a parallel build.
7bc68234 206 make %{make_bootstrap} BOOT_CFLAGS="${CFLAGS}"
4de56d3e
MT
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
802ea3af
MT
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
56c0b63c 226 # Check if the installation path exists.
c30b5fa5 227 FULLPATH="%{BUILDROOT}%{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}"
56c0b63c
MT
228 [ -d "${FULLPATH}" ] || exit 1
229
7e981e59
MT
230 mkdir -pv %{BUILDROOT}%{prefix}/lib
231 ln -sfv ../bin/cpp %{BUILDROOT}%{prefix}/lib/cpp
802ea3af
MT
232 ln -sfv gcc %{BUILDROOT}/usr/bin/cc
233
0302fa63 234 # Fix libgcc_s symlinks.
c30b5fa5 235 rm -f ${FULLPATH}/libgcc_s.so %{BUILDROOT}%{libdir}/libgcc_s.so
13319128
MT
236 case "%{DISTRO_ARCH}" in
237 arm*)
13319128
MT
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)
0302fa63 243 GROUP ( %{libdir}/libgcc_s.so.1 libgcc.a )
13319128
MT
244 EOF
245 ;;
246 *)
62f274aa 247 ln -svf ../../../../..%{libdir}/libgcc_s.so.1 ${FULLPATH}/libgcc_s.so
13319128
MT
248 ;;
249 esac
62f274aa 250 chmod 755 %{BUILDROOT}%{libdir}/libgcc_s.so.1
802ea3af
MT
251
252 # Remove some GNU debugger stuff.
c30b5fa5 253 rm -vf %{BUILDROOT}%{libdir}/lib*.py
56c0b63c 254
0f737982
MT
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
56c0b63c 265 # libgomp
c30b5fa5 266 mv -vf %{BUILDROOT}%{libdir}/libgomp.spec ${FULLPATH}/
56c0b63c 267 ln -svf ../../../libgomp.so.1.0.0 ${FULLPATH}/libgomp.so
c30b5fa5 268 chmod 755 %{BUILDROOT}%{libdir}/libgomp.so.1.*
56c0b63c
MT
269
270 # libstdc++
4de56d3e 271 ln -svf ../../../libstdc++.so.6.0.17 ${FULLPATH}/libstdc++.so
56c0b63c
MT
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
c30b5fa5 276 chmod 755 %{BUILDROOT}%{libdir}/libmudflap{,th}.so.0.*
56c0b63c
MT
277
278 # libquadmath
279 if [ "%{build_libquadmath}" = "1" ]; then
9d2ad5e3 280 ln -svf ../../../libquadmath.so.0.0.0 ${FULLPATH}/libquadmath.so
c30b5fa5 281 chmod 755 %{BUILDROOT}%{libdir}/libquadmath.so.0.*
56c0b63c 282 fi
4de56d3e
MT
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.*
802ea3af 288 end
876f9cff
MT
289
290 keep_libraries
c30b5fa5
MT
291 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libgcc.a
292 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libgcc_eh.a
876f9cff 293 end
802ea3af
MT
294end
295
296packages
297 package %{name}
298 groups += Build
299
300 requires
0302fa63 301 binutils >= %{required_binutils_version}
7e981e59 302 filesystem >= 002
e0e5b1d5 303 glibc >= 2.16
802ea3af 304 glibc-devel
7112214f 305 gmp-devel
0302fa63
MT
306 cpp = %{thisver}
307 libgcc = %{thisver}
308 libgomp = %{thisver}
802ea3af
MT
309 end
310
9d2ad5e3 311 # We do not ship libgcc-devel anymore.
0302fa63
MT
312 provides += libgcc-devel = %{thisver}
313 obsoletes += libgcc-devel < %{thisver}
9d2ad5e3 314
802ea3af 315 if "%{build_cloog_ppl}" == "1"
0302fa63 316 requires += cloog-ppl >= 0.15
802ea3af
MT
317 end
318 end
319
802ea3af 320 package %{name}-c++
56c0b63c
MT
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
0302fa63
MT
329 gcc = %{thisver}
330 libstdc++ = %{thisver}
331 libstdc++-devel = %{thisver}
56c0b63c 332 end
802ea3af
MT
333
334 files
335 /usr/bin/*++
c30b5fa5 336 %{libdir}/gcc/*/*/cc1plus
802ea3af
MT
337 /usr/share/man/man*/*++*
338 end
339 end
340
56c0b63c
MT
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
802ea3af 367 files
7e981e59
MT
368 %{prefix}/lib/cpp
369 %{bindir}/cpp
370 %{mandir}/man1/cpp.1*
c30b5fa5 371 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/cc1
802ea3af 372 end
7e981e59
MT
373
374 provides = /lib/cpp
62f274aa 375 requires = gcc-c++ = %{thisver}
802ea3af
MT
376 end
377
56c0b63c
MT
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
802ea3af
MT
384
385 files
0302fa63 386 %{libdir}/libgcc*.so.*
802ea3af
MT
387 end
388 end
389
390 package libstdc++
56c0b63c
MT
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
802ea3af 397 files
c30b5fa5 398 %{libdir}/libstdc++*.so.*
802ea3af
MT
399 end
400 end
401
402 package libstdc++-devel
56c0b63c
MT
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
0302fa63 411 libstdc++ = %{thisver}
56c0b63c
MT
412 end
413
802ea3af 414 files
c30b5fa5
MT
415 %{includedir}/c++
416 %{libdir}/libstdc++*.so
802ea3af
MT
417 end
418 end
419
420 package libgomp
56c0b63c
MT
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.
802ea3af 425 end
802ea3af 426
802ea3af 427 files
c30b5fa5 428 %{libdir}/libgomp*.so.*
802ea3af
MT
429 end
430 end
431
432 package libmudflap
56c0b63c
MT
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
802ea3af 439 files
c30b5fa5 440 %{libdir}/libmudflap*.so.*
802ea3af
MT
441 end
442 end
443
444 package libmudflap-devel
56c0b63c
MT
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
0302fa63 455 libmudflap = %{thisver}
56c0b63c
MT
456 end
457
802ea3af 458 files
2a3a31bb
MT
459 %{libdir}/libmudflap.so
460 %{libdir}/libmudflapth.so
c30b5fa5
MT
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
802ea3af
MT
464 end
465 end
466
56c0b63c
MT
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
c30b5fa5 476 %{libdir}/libquadmath*.so.*
56c0b63c
MT
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
0302fa63
MT
488 gcc = %{thisver}
489 libquadmath = %{thisver}
56c0b63c
MT
490 end
491
492 files
2a3a31bb 493 %{libdir}/libquadmath.so
c30b5fa5
MT
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
56c0b63c 497 end
802ea3af
MT
498 end
499 end
500
4de56d3e
MT
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
2a3a31bb 526 %{libdir}/libitm.so
4de56d3e
MT
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
56c0b63c
MT
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
0302fa63
MT
542 gcc = %{thisver}
543 gmp-devel >= 4.1.2-8
544 mpfr-devel >= 2.2.1
545 libmpc-devel >= 0.8.1
56c0b63c
MT
546 end
547
802ea3af 548 files
c30b5fa5 549 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/plugin
802ea3af
MT
550 end
551 end
1f9bc2f0
MT
552
553 package %{name}-debuginfo
554 template DEBUGINFO
555 end
802ea3af 556end