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