]> git.ipfire.org Git - people/ms/ipfire-3.x.git/blob - gcc/gcc.nm
cd6b1c31ed69df717d93e2bd41a96684a5a9ff9d
[people/ms/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 = 0
8
9 name = gcc
10 version = 4.6.2
11 release = 8
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 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 \
43 gcc-4.6.0-piepatches-20110407.patch
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
56 libmpc-devel
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
67 # Build libquadmath (only on x86).
68 build_libquadmath = 0
69
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
76
77 build_libquadmath = 1
78 end
79
80 if "%{DISTRO_ARCH}" == "i686"
81 configure_options = --with-arch=%{DISTRO_ARCH} --with-tune=generic
82
83 build_libquadmath = 1
84 end
85
86 if "%{DISTRO_ARCH}" == "armv5tel"
87 configure_options += --disable-sjlj-exceptions
88
89 configure_options += --with-float=soft
90 end
91
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
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
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-werror \
193 --disable-libssp \
194 --disable-static \
195 --with-system-zlib \
196 --with-bugurl=http://bugtracker.ipfire.org \
197 --disable-libunwind-exceptions \
198 --enable-gnu-unique-object \
199 --enable-linker-build-id \
200 %{configure_options}
201
202 # GCC does not support a parallel build.
203 make profiledbootstrap BOOT_CFLAGS="${CFLAGS}"
204 end
205
206 #test
207 # cd %{DIR_SRC}/gcc-build && make check
208 # cd %{DIR_APP} && ./contrib/test_summary
209 #end
210
211 install
212 cd %{DIR_SRC}/gcc-build
213 make install DESTDIR=%{BUILDROOT}
214
215 # Check if the installation path exists.
216 FULLPATH="%{BUILDROOT}%{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}"
217 [ -d "${FULLPATH}" ] || exit 1
218
219 mkdir -pv %{BUILDROOT}/%{lib}
220 ln -sfv ../usr/bin/cpp %{BUILDROOT}/%{lib}/cpp
221 ln -sfv gcc %{BUILDROOT}/usr/bin/cc
222
223 # Move libgcc_s to /lib
224 rm -f ${FULLPATH}/libgcc_s.so %{BUILDROOT}%{libdir}/libgcc_s.so
225 mkdir -pv %{BUILDROOT}/%{lib}
226 mv -vf %{BUILDROOT}%{libdir}/libgcc_s.so.1 %{BUILDROOT}/%{lib}/
227 case "%{DISTRO_ARCH}" in
228 arm*)
229 cat <<EOF >${FULLPATH}/libgcc_s.so
230 /* GNU ld script
231 Use the shared library, but some functions are only in
232 the static library, so try that secondarily. */
233 OUTPUT_FORMAT(elf32-littlearm)
234 GROUP ( /%{lib}/libgcc_s.so.1 libgcc.a )
235 EOF
236 ;;
237 *)
238 ln -svf ../../../../../%{lib}/libgcc_s.so.1 ${FULLPATH}/libgcc_s.so
239 ;;
240 esac
241
242 # Remove some GNU debugger stuff.
243 rm -vf %{BUILDROOT}%{libdir}/lib*.py
244
245 # libgomp
246 mv -vf %{BUILDROOT}%{libdir}/libgomp.spec ${FULLPATH}/
247 ln -svf ../../../libgomp.so.1.0.0 ${FULLPATH}/libgomp.so
248 chmod 755 %{BUILDROOT}%{libdir}/libgomp.so.1.*
249
250 # libstdc++
251 ln -svf ../../../libstdc++.so.6.0.16 ${FULLPATH}/libstdc++.so
252
253 # libmudflap
254 ln -svf ../../../libmudflap.so.0.0.0 ${FULLPATH}/libmudflap.so
255 ln -svf ../../../libmudflapth.so.0.0.0 ${FULLPATH}/libmudflapth.so
256 chmod 755 %{BUILDROOT}%{libdir}/libmudflap{,th}.so.0.*
257
258 # libquadmath
259 if [ "%{build_libquadmath}" = "1" ]; then
260 ln -svf ../../../libquadmath.so.0.0.0 ${FULLPATH}/libquadmath.so
261 chmod 755 %{BUILDROOT}%{libdir}/libquadmath.so.0.*
262 fi
263 end
264
265 keep_libraries
266 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libgcc.a
267 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libgcc_eh.a
268 end
269 end
270
271 packages
272 package %{name}
273 groups += Build
274
275 requires
276 binutils>=%{required_binutils_version}
277 glibc-devel
278 gmp-devel
279 cpp=%{thisver}
280 libgcc=%{thisver}
281 libgomp=%{thisver}
282 end
283
284 # We do not ship libgcc-devel anymore.
285 provides += libgcc-devel=%{thisver}
286 obsoletes += libgcc-devel<%{thisver}
287
288 if "%{build_cloog_ppl}" == "1"
289 requires += cloog-ppl>=0.15
290 end
291 end
292
293 package %{name}-c++
294 summary = C++ support for GCC.
295 description
296 This package adds C++ support to the GNU Compiler Collection.
297 It includes support for most of the current C++ specification,
298 including templates and exception handling.
299 end
300
301 requires
302 gcc=%{thisver}
303 libstdc++=%{thisver}
304 libstdc++-devel=%{thisver}
305 end
306
307 files
308 /usr/bin/*++
309 %{libdir}/gcc/*/*/cc1plus
310 /usr/share/man/man*/*++*
311 end
312 end
313
314 package cpp
315 summary = The C Preprocessor.
316 description
317 Cpp is the GNU C-Compatible Compiler Preprocessor.
318 Cpp is a macro processor which is used automatically
319 by the C compiler to transform your program before actual
320 compilation. It is called a macro processor because it allows
321 you to define macros, abbreviations for longer
322 constructs.
323
324 The C preprocessor provides four separate functionalities: the
325 inclusion of header files (files of declarations that can be
326 substituted into your program); macro expansion (you can define macros,
327 and the C preprocessor will replace the macros with their definitions
328 throughout the program); conditional compilation (using special
329 preprocessing directives, you can include or exclude parts of the
330 program according to various conditions); and line control (if you use
331 a program to combine or rearrange source files into an intermediate
332 file which is then compiled, you can use line control to inform the
333 compiler about where each source line originated).
334
335 You should install this package if you are a C programmer and you use
336 macros.
337 end
338 group = Development/Languages
339
340 files
341 /%{lib}/cpp
342 /usr/bin/cpp
343 /usr/share/man/man1/cpp.1*
344 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/cc1
345 end
346 end
347
348 package libgcc
349 summary = GCC shared support library.
350 description
351 This package contains GCC shared support library which is needed
352 e.g. for exception handling support.
353 end
354
355 files
356 /%{lib}/libgcc*.so.*
357 end
358 end
359
360 package libstdc++
361 summary = GNU Standard C++ Library.
362 description
363 The libstdc++ package contains a rewritten standard compliant GCC Standard
364 C++ Library.
365 end
366
367 files
368 %{libdir}/libstdc++*.so.*
369 end
370 end
371
372 package libstdc++-devel
373 summary = Header files and libraries for C++ development.
374 description
375 This is the GNU implementation of the standard C++ libraries. This
376 package includes the header files and libraries needed for C++
377 development. This includes rewritten implementation of STL.
378 end
379
380 requires
381 libstdc++=%{thisver}
382 end
383
384 files
385 %{includedir}/c++
386 %{libdir}/libstdc++*.so
387 end
388 end
389
390 package libgomp
391 summary = GCC OpenMP v3.0 shared support library.
392 description
393 This package contains GCC shared support library which is needed
394 for OpenMP v3.0 support.
395 end
396
397 files
398 %{libdir}/libgomp*.so.*
399 end
400 end
401
402 package libmudflap
403 summary = GCC mudflap shared support library.
404 description
405 This package contains GCC shared support library which is needed
406 for mudflap support.
407 end
408
409 files
410 %{libdir}/libmudflap*.so.*
411 end
412 end
413
414 package libmudflap-devel
415 summary = Development files for GCC mudflap support.
416 description
417 This package contains headers for building mudflap-instrumented programs.
418
419 To instrument a non-threaded program, add -fmudflap
420 option to GCC and when linking add -lmudflap, for threaded programs
421 also add -fmudflapth and -lmudflapth.
422 end
423
424 requires
425 libmudflap=%{thisver}
426 end
427
428 files
429 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/include/mf-runtime.h
430 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libmudflap.so
431 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libmudflapth.so
432 end
433 end
434
435 if "%{build_libquadmath}" == "1"
436 package libquadmath
437 summary = GCC __float128 shared support library.
438 description
439 This package contains GCC shared support library which is needed
440 for __float128 math support and for Fortran REAL*16 support.
441 end
442
443 files
444 %{libdir}/libquadmath*.so.*
445 end
446 end
447
448 package libquadmath-devel
449 summary = Development files for GCC __float128 support.
450 description
451 This package contains headers for building Fortran programs using
452 REAL*16 and programs using __float128 math.
453 end
454
455 requires
456 gcc=%{thisver}
457 libquadmath=%{thisver}
458 end
459
460 files
461 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/include/quadmath.h
462 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/include/quadmath_weak.h
463 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libquadmath.so
464 end
465 end
466 end
467
468 package gcc-plugin-devel
469 summary = Support for compiling GCC plugins.
470 description
471 This package contains header files and other support files
472 for compiling GCC plugins. The GCC plugin ABI is currently
473 not stable, so plugins must be rebuilt any time GCC is updated.
474 end
475
476 requires
477 gcc=%{thisver}
478 gmp-devel>=4.1.2-8
479 mpfr-devel>=2.2.1
480 libmpc-devel>=0.8.1
481 end
482
483 files
484 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/plugin
485 end
486 end
487
488 package %{name}-debuginfo
489 template DEBUGINFO
490 end
491 end