]> git.ipfire.org Git - people/stevee/ipfire-3.x.git/blame - gcc/gcc.nm
gcc: Harden this package
[people/stevee/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
b57a0ea8
MT
6# Configure build to compile with graphite
7build_graphite = 1
166a6c21 8
802ea3af 9name = gcc
92cf4b35 10version = 12.2.0
48c0a841 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.
92cf4b35 25binutils_version = 2.35
802ea3af 26
36369ddb 27source_dl = https://ftp.gnu.org/gnu/gcc/%{thisapp}/
802ea3af
MT
28sources = %{thisapp}.tar.gz
29
802ea3af
MT
30build
31 requires
513f8ca4 32 binutils >= %{binutils_version}
802ea3af
MT
33 dejagnu
34 elfutils-devel
35 expect
7e981e59 36 filesystem >= 002
802ea3af 37 flex
e0e5b1d5 38 glibc-devel >= 2.16
92cf4b35
MT
39 gmp-devel >= 4.3.2
40 isl-devel >= 0.15
802ea3af 41 libffi-devel
92cf4b35 42 libmpc-devel >= 1.0.1
f3b6e913 43 libxcrypt-devel
92cf4b35 44 mpfr-devel >= 3.1.0
4de56d3e 45 perl
802ea3af
MT
46 texinfo
47 zlib-devel
92cf4b35 48 zstd-devel
802ea3af
MT
49 end
50
b57a0ea8
MT
51 # If graphite support is enabled, we require the devel packages for build.
52 if "%{build_graphite}" == "1"
53 requires += isl-devel >= 0.14
802ea3af
MT
54 end
55
56c0b63c
MT
56 # Build libquadmath (only on x86).
57 build_libquadmath = 0
58
513f8ca4
MT
59 # Build liblsan (only on x86_64).
60 build_liblsan = 0
61
00c77389
MT
62 # Build libtasn (only on x86_64).
63 build_libtsan = 0
64
b57a0ea8
MT
65 # Build libubsan
66 build_libubsan = 0
67
48c0a841 68 DIR_BUILD = %{DIR_SRC}/gcc-build
7bc68234 69
802ea3af 70 if "%{DISTRO_ARCH}" == "x86_64"
56c0b63c 71 build_libquadmath = 1
513f8ca4 72 build_liblsan = 1
00c77389 73 build_libtsan = 1
b57a0ea8 74 build_libubsan = 1
802ea3af
MT
75 end
76
b57a0ea8
MT
77 if "%{DISTRO_ARCH}" == "aarch64"
78 build_libubsan = 1
66e276de
MT
79 end
80
802ea3af 81 prepare_cmds
802ea3af
MT
82 # Remove unneeded features that will save some compile time
83 rm -rf lib{gfortran,java,objc} gcc/{fortran,java,objc,objcp}
84
85 # Apply a sed substitution that will suppress the installation of
86 # libiberty.a. The version of libiberty.a provided by Binutils will be used
87 # instead:
88 sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in
89
90 # Branding gcc
91 echo "%{DISTRO_NAME} %{version}-%{release}" > gcc/DEV-PHASE
92
802ea3af
MT
93 # The fixincludes script is known to occasionally erroneously attempt to
94 # "fix" the system headers installed so far. As the headers up to this point
95 # are known to not require fixing, issue the following command to prevent
96 # the fixincludes script from running:
97 sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in
802ea3af
MT
98 end
99
36369ddb
MT
100 # Disable LTO
101 LTO_CFLAGS =
102
48c0a841
MT
103 # Disable any string format security checks
104 STRING_FORMAT_SECURITY_CFLAGS =
105
106 configure_options = \
107 CFLAGS="%{CFLAGS}" \
108 CXXFLAGS="%{CXXFLAGS}" \
109 XCFLAGS="%{CFLAGS}" \
110 TCFLAGS="%{CFLAGS}" \
111 --build=%{DISTRO_BUILDTARGET} \
112 --prefix=%{prefix} \
113 --libdir=%{libdir} \
114 --libexecdir=%{libdir} \
115 --mandir=%{mandir} \
116 --disable-static \
117 --enable-shared \
118 --enable-threads=posix \
119 --enable-__cxa_atexit \
120 --enable-languages=c,c++,lto \
121 --enable-bootstrap \
122 --with-build-config=bootstrap-lto \
123 --enable-link-serialization=1 \
124 --enable-checking=release \
125 --enable-default-pie \
126 --enable-default-ssp \
127 --disable-werror \
128 --disable-libssp \
129 --with-system-zlib \
130 --with-bugurl=https://bugzilla.ipfire.org/ \
131 --enable-libstdcxx-backtrace \
132 --disable-libstdcxx-pch \
133 --with-libstdcxx-zoneinfo=%{datadir}/zoneinfo \
134 --disable-libunwind-exceptions \
135 --enable-gnu-unique-object \
136 --enable-linker-build-id \
137 --with-linker-hash-style=gnu \
138 --enable-decimal-float \
139 --enable-plugin \
140 --enable-initfini-array \
141 --disable-libgcj \
142 --enable-gnu-indirect-function
143
144 if "%{build_graphite}" == "1"
145 configure_options += \
146 --with-isl
802ea3af
MT
147 end
148
48c0a841
MT
149 if "%{DISTRO_ARCH}" == "x86_64"
150 configure_options += \
151 --with-arch_64=x86-64-v2 \
152 --with-arch_32=x86-64 \
153 --enable-cet \
154 --with-tune=generic
155 end
156
157 make_build_targets += \
158 profiledbootstrap \
159 BOOT_CFLAGS="%{CFLAGS}" \
160 BOOT_LDFLAGS="%{LDFLAGS}" \
161 LDFLAGS_FOR_TARGET="%{LDFLAGS}"
162
802ea3af 163 #test
513f8ca4 164 # cd %{DIR_SRC}/gcc-build && make -k check || true
802ea3af
MT
165 # cd %{DIR_APP} && ./contrib/test_summary
166 #end
167
168 install
802ea3af
MT
169 make install DESTDIR=%{BUILDROOT}
170
56c0b63c 171 # Check if the installation path exists.
c30b5fa5 172 FULLPATH="%{BUILDROOT}%{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}"
56c0b63c
MT
173 [ -d "${FULLPATH}" ] || exit 1
174
7e981e59
MT
175 mkdir -pv %{BUILDROOT}%{prefix}/lib
176 ln -sfv ../bin/cpp %{BUILDROOT}%{prefix}/lib/cpp
802ea3af
MT
177 ln -sfv gcc %{BUILDROOT}/usr/bin/cc
178
0302fa63 179 # Fix libgcc_s symlinks.
c30b5fa5 180 rm -f ${FULLPATH}/libgcc_s.so %{BUILDROOT}%{libdir}/libgcc_s.so
19e7240e
SS
181 echo '/* GNU ld script
182 Use the shared library, but some functions are only in
183 the static library, so try that secondarily. */
184
185 OUTPUT_FORMAT('`gcc -Wl,--print-output-format -nostdlib -r -o /dev/null`')
186 GROUP ( /%{libdir}/libgcc_s.so.1 libgcc.a )' > ${FULLPATH}/libgcc_s.so
48c0a841
MT
187 chmod -v 755 ${FULLPATH}/libgcc_s.so
188 chmod -v 755 %{BUILDROOT}%{libdir}/libgcc_s.so.1
802ea3af
MT
189
190 # Remove some GNU debugger stuff.
c30b5fa5 191 rm -vf %{BUILDROOT}%{libdir}/lib*.py
56c0b63c
MT
192
193 # libgomp
c30b5fa5 194 mv -vf %{BUILDROOT}%{libdir}/libgomp.spec ${FULLPATH}/
56c0b63c 195 ln -svf ../../../libgomp.so.1.0.0 ${FULLPATH}/libgomp.so
48c0a841 196 chmod -v 755 %{BUILDROOT}%{libdir}/libgomp.so.1.*
56c0b63c
MT
197
198 # libstdc++
92cf4b35 199 ln -svf ../../../libstdc++.so.6.0.30 ${FULLPATH}/libstdc++.so
56c0b63c
MT
200
201 # libquadmath
202 if [ "%{build_libquadmath}" = "1" ]; then
9d2ad5e3 203 ln -svf ../../../libquadmath.so.0.0.0 ${FULLPATH}/libquadmath.so
48c0a841 204 chmod -v 755 %{BUILDROOT}%{libdir}/libquadmath.so.0.*
56c0b63c 205 fi
4de56d3e
MT
206
207 # libitm
208 mv -vf %{BUILDROOT}%{libdir}/libitm.spec ${FULLPATH}/
209 ln -svf ../../../libitm.so.1.0.0 ${FULLPATH}/libitm.so
48c0a841 210 chmod -v 755 %{BUILDROOT}%{libdir}/libitm.so.1.*
513f8ca4
MT
211
212 # liblsan
213 if [ "%{build_liblsan}" = "1" ]; then
214 ln -svf ../../../liblsan.so.0.0.0 ${FULLPATH}/liblsan.so
48c0a841 215 chmod -v 755 %{BUILDROOT}%{libdir}/liblsan.so.*
513f8ca4
MT
216 fi
217
218 # libtsan
219 if [ "%{build_libtsan}" = "1" ]; then
92cf4b35 220 ln -svf ../../../libtsan.so.2.0.0 ${FULLPATH}/libtsan.so
48c0a841 221 chmod -v 755 %{BUILDROOT}%{libdir}/libtsan.so.*
513f8ca4
MT
222 fi
223
224 # libubsan
b57a0ea8 225 if [ "%{build_libubsan}" = "1" ]; then
1ad8926b 226 ln -svf ../../../libubsan.so.1.0.0 ${FULLPATH}/libubsan.so
48c0a841 227 chmod -v 755 %{BUILDROOT}%{libdir}/libubsan.so.*
b57a0ea8 228 fi
802ea3af
MT
229 end
230end
231
232packages
233 package %{name}
234 groups += Build
235
236 requires
513f8ca4 237 binutils >= %{binutils_version}
7e981e59 238 filesystem >= 002
e0e5b1d5 239 glibc >= 2.16
802ea3af 240 glibc-devel
7112214f 241 gmp-devel
0302fa63
MT
242 cpp = %{thisver}
243 libgcc = %{thisver}
244 libgomp = %{thisver}
802ea3af
MT
245 end
246
9d2ad5e3 247 # We do not ship libgcc-devel anymore.
0302fa63
MT
248 provides += libgcc-devel = %{thisver}
249 obsoletes += libgcc-devel < %{thisver}
802ea3af
MT
250 end
251
802ea3af 252 package %{name}-c++
56c0b63c
MT
253 summary = C++ support for GCC.
254 description
255 This package adds C++ support to the GNU Compiler Collection.
256 It includes support for most of the current C++ specification,
257 including templates and exception handling.
258 end
259
260 requires
0302fa63
MT
261 gcc = %{thisver}
262 libstdc++ = %{thisver}
263 libstdc++-devel = %{thisver}
56c0b63c 264 end
802ea3af
MT
265
266 files
267 /usr/bin/*++
c30b5fa5 268 %{libdir}/gcc/*/*/cc1plus
802ea3af
MT
269 /usr/share/man/man*/*++*
270 end
271 end
272
56c0b63c
MT
273 package cpp
274 summary = The C Preprocessor.
275 description
276 Cpp is the GNU C-Compatible Compiler Preprocessor.
277 Cpp is a macro processor which is used automatically
278 by the C compiler to transform your program before actual
279 compilation. It is called a macro processor because it allows
280 you to define macros, abbreviations for longer
281 constructs.
282
283 The C preprocessor provides four separate functionalities: the
284 inclusion of header files (files of declarations that can be
285 substituted into your program); macro expansion (you can define macros,
286 and the C preprocessor will replace the macros with their definitions
287 throughout the program); conditional compilation (using special
288 preprocessing directives, you can include or exclude parts of the
289 program according to various conditions); and line control (if you use
290 a program to combine or rearrange source files into an intermediate
291 file which is then compiled, you can use line control to inform the
292 compiler about where each source line originated).
293
294 You should install this package if you are a C programmer and you use
295 macros.
296 end
297 group = Development/Languages
298
802ea3af 299 files
7e981e59
MT
300 %{prefix}/lib/cpp
301 %{bindir}/cpp
302 %{mandir}/man1/cpp.1*
c30b5fa5 303 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/cc1
802ea3af 304 end
7e981e59
MT
305
306 provides = /lib/cpp
62f274aa 307 requires = gcc-c++ = %{thisver}
802ea3af
MT
308 end
309
56c0b63c
MT
310 package libgcc
311 summary = GCC shared support library.
312 description
313 This package contains GCC shared support library which is needed
314 e.g. for exception handling support.
315 end
802ea3af
MT
316
317 files
0302fa63 318 %{libdir}/libgcc*.so.*
802ea3af 319 end
513f8ca4
MT
320
321 obsoletes
322 libmudflap
323 libmudflap-devel
324 end
802ea3af
MT
325 end
326
327 package libstdc++
56c0b63c
MT
328 summary = GNU Standard C++ Library.
329 description
330 The libstdc++ package contains a rewritten standard compliant GCC Standard
331 C++ Library.
332 end
333
802ea3af 334 files
c30b5fa5 335 %{libdir}/libstdc++*.so.*
802ea3af
MT
336 end
337 end
338
339 package libstdc++-devel
56c0b63c
MT
340 summary = Header files and libraries for C++ development.
341 description
342 This is the GNU implementation of the standard C++ libraries. This
343 package includes the header files and libraries needed for C++
344 development. This includes rewritten implementation of STL.
345 end
346
347 requires
0302fa63 348 libstdc++ = %{thisver}
56c0b63c
MT
349 end
350
802ea3af 351 files
c30b5fa5
MT
352 %{includedir}/c++
353 %{libdir}/libstdc++*.so
802ea3af
MT
354 end
355 end
356
b57a0ea8
MT
357 package libstdc++-static
358 summary = Static libraries for the GNU standard C++ library
359 description = %{summary}
360
361 requires
362 libstdc++-devel = %{thisver}
363 end
364
365 files
366 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libstdc++.a
367 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libsupc++.a
368 end
369 end
370
802ea3af 371 package libgomp
56c0b63c
MT
372 summary = GCC OpenMP v3.0 shared support library.
373 description
374 This package contains GCC shared support library which is needed
375 for OpenMP v3.0 support.
802ea3af 376 end
802ea3af 377
802ea3af 378 files
c30b5fa5 379 %{libdir}/libgomp*.so.*
802ea3af
MT
380 end
381 end
382
56c0b63c
MT
383 if "%{build_libquadmath}" == "1"
384 package libquadmath
385 summary = GCC __float128 shared support library.
386 description
387 This package contains GCC shared support library which is needed
388 for __float128 math support and for Fortran REAL*16 support.
389 end
390
391 files
c30b5fa5 392 %{libdir}/libquadmath*.so.*
56c0b63c
MT
393 end
394 end
395
396 package libquadmath-devel
397 summary = Development files for GCC __float128 support.
398 description
399 This package contains headers for building Fortran programs using
400 REAL*16 and programs using __float128 math.
401 end
402
403 requires
0302fa63
MT
404 gcc = %{thisver}
405 libquadmath = %{thisver}
56c0b63c
MT
406 end
407
408 files
2a3a31bb 409 %{libdir}/libquadmath.so
c30b5fa5
MT
410 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/include/quadmath.h
411 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/include/quadmath_weak.h
412 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libquadmath.so
56c0b63c 413 end
802ea3af
MT
414 end
415 end
416
4de56d3e
MT
417 package libitm
418 summary = The GNU Transactional Memory library.
419 description
420 This package contains the GNU Transactional Memory library
421 which is a GCC transactional memory support runtime library.
422 end
423
424 files
1ad8926b 425 %{libdir}/libitm.so.*
4de56d3e
MT
426 end
427 end
428
429 package libitm-devel
430 summary = The GNU Transactional Memory support.
431 description
432 This package contains headers and support files for the
433 GNU Transactional Memory library.
434 end
435
436 requires
437 gcc = %{thisver}
438 libitm = %{thisver}
439 end
440
441 files
2a3a31bb 442 %{libdir}/libitm.so
4de56d3e
MT
443 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/include/itm.h
444 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/include/itm_weak.h
445 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libitm.so
446 end
447 end
448
00c77389
MT
449 package libatomic
450 summary = The GNU Atomic library
451 description
452 This package contains the GNU Atomic library which is a
453 GCC support runtime library for atomisc operations not
454 supported by hardware.
455 end
456
457 files
1ad8926b 458 %{libdir}/libatomic.so.*
00c77389
MT
459 end
460 end
461
462 package libasan
463 summary = The Address Sanitizer runtime library
464 description
465 This package contains the Address Sanitizer library
466 which is used for -fsanitize=address instrumented programs.
467 end
468
469 files
1ad8926b 470 %{libdir}/libasan.so.*
00c77389
MT
471 end
472 end
473
474 if "%{build_libtsan}" == "1"
475 package libtsan
476 summary = The Thread Sanitizer runtime library
477 description
478 This package contains the Thread Sanitizer library
479 which is used for -fsanitize=thread instrumented programs.
480 end
481
482 files
1ad8926b 483 %{libdir}/libtsan.so.*
00c77389
MT
484 end
485 end
486 end
487
b57a0ea8
MT
488 if "%{build_libubsan}" == "1"
489 package libubsan
490 summary = The Undefined Behavior Sanitizer runtime library
491 description
492 This package contains the Undefined Behavior Sanitizer library
493 which is used for -fsanitize=undefined instrumented programs.
494 end
513f8ca4 495
b57a0ea8 496 files
1ad8926b 497 %{libdir}/libubsan.so.*
b57a0ea8 498 end
513f8ca4
MT
499 end
500 end
501
502 if "%{build_liblsan}" == "1"
503 package liblsan
504 summary = The Leak Sanitizer runtime library
505 description
506 This package contains the Leak Sanitizer library
507 which is used for -fsanitize=leak instrumented programs.
508 end
509
510 files
1ad8926b 511 %{libdir}/liblsan.so.*
513f8ca4
MT
512 end
513 end
514 end
515
56c0b63c
MT
516 package gcc-plugin-devel
517 summary = Support for compiling GCC plugins.
518 description
519 This package contains header files and other support files
520 for compiling GCC plugins. The GCC plugin ABI is currently
521 not stable, so plugins must be rebuilt any time GCC is updated.
522 end
523
524 requires
0302fa63
MT
525 gcc = %{thisver}
526 gmp-devel >= 4.1.2-8
527 mpfr-devel >= 2.2.1
528 libmpc-devel >= 0.8.1
56c0b63c
MT
529 end
530
802ea3af 531 files
c30b5fa5 532 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/plugin
802ea3af
MT
533 end
534 end
1f9bc2f0
MT
535
536 package %{name}-debuginfo
537 template DEBUGINFO
538 end
802ea3af 539end