]> git.ipfire.org Git - ipfire-3.x.git/blame - gcc/gcc.nm
gcc: Drop build dependency to autogen
[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
b059a4e1 11release = 2.2
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
802ea3af
MT
68 # A couple of configure arguments depending on the architecture and
69 # configuration.
70 configure_options =
71
92cf4b35 72 #make_bootstrap = profiledbootstrap
7bc68234 73
802ea3af
MT
74 if "%{DISTRO_ARCH}" == "x86_64"
75 configure_options = --disable-multilib
56c0b63c
MT
76
77 build_libquadmath = 1
513f8ca4 78 build_liblsan = 1
00c77389 79 build_libtsan = 1
b57a0ea8 80 build_libubsan = 1
802ea3af
MT
81 end
82
b57a0ea8
MT
83 if "%{DISTRO_ARCH}" == "aarch64"
84 build_libubsan = 1
66e276de
MT
85 end
86
b57a0ea8 87 if "%{build_graphite}" == "1"
513f8ca4 88 configure_options += \
b57a0ea8 89 --with-isl
802ea3af
MT
90 end
91
802ea3af
MT
92 prepare_cmds
93 mkdir -v %{DIR_SRC}/gcc-build
94
95 # Remove unneeded features that will save some compile time
96 rm -rf lib{gfortran,java,objc} gcc/{fortran,java,objc,objcp}
97
98 # Apply a sed substitution that will suppress the installation of
99 # libiberty.a. The version of libiberty.a provided by Binutils will be used
100 # instead:
101 sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in
102
103 # Branding gcc
104 echo "%{DISTRO_NAME} %{version}-%{release}" > gcc/DEV-PHASE
105
106 # Libgomp uses -Werror regardless of --disable-werror, and this will cause a
107 # build failure when -D_FORTIFY_SOURCE=2 causes build time warnings:
108 sed -e "s/-Werror//" -i libgomp/configure
109
110 # The fixincludes script is known to occasionally erroneously attempt to
111 # "fix" the system headers installed so far. As the headers up to this point
112 # are known to not require fixing, issue the following command to prevent
113 # the fixincludes script from running:
114 sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in
115
116 sed -i gcc/Makefile.in \
117 -e "s/-fno-exceptions/& -fno-asynchronous-unwind-tables/"
118
00c77389 119 #./contrib/gcc_update --touch
802ea3af
MT
120 end
121
b57a0ea8
MT
122 export CC=gcc
123 export CXX=g++
124
36369ddb
MT
125 # Disable LTO
126 LTO_CFLAGS =
127
802ea3af
MT
128 build
129 cd %{DIR_SRC}/gcc-build
130
131 # Modify CFLAGS
802ea3af
MT
132 CFLAGS="%{CFLAGS}"
133 CFLAGS=$(echo ${CFLAGS} | sed -e 's/\(-Wp,\)\?-D_FORTIFY_SOURCE=[12]//g')
b57a0ea8 134 CFLAGS=$(echo ${CFLAGS} | sed -e 's/-Werror=format-security//g')
802ea3af 135 CFLAGS=$(echo ${CFLAGS} | sed -e 's/-m64//g;s/-m32//g;s/-m31//g')
513f8ca4 136 CFLAGS=$(echo ${CFLAGS} | sed -e 's/-mfpmath=sse/-mfpmath=sse -msse2/g')
56c0b63c
MT
137 CFLAGS=$(echo ${CFLAGS} | sed -e 's/-march=i.86//g')
138 CFLAGS=$(echo ${CFLAGS} | sed -e 's/ -pipe / /g')
802ea3af
MT
139 CFLAGS=$(echo "${CFLAGS}" | sed -e 's/[[:blank:]]\+/ /g')
140 CXXFLAGS=$(echo ${CFLAGS} | sed -e 's/ -Wall//g')
513f8ca4 141 CXXFLAGS=$(echo ${CXXFLAGS} | sed -e 's/ -fexceptions / /g')
b57a0ea8 142 #CXXFLAGS=$(echo ${CXXFLAGS} | sed -e 's/ -Werror=format-security / -Wformat -Werror=format-security /g')
513f8ca4
MT
143
144 case "${CFLAGS}" in
145 *-fasynchronous-unwind-tables*)
146 sed -i -e "s/-fno-exceptions /-fno-exceptions -fno-asynchronous-unwind-tables/" \
147 ../%{thisapp}/Makefile.in
148 ;;
149 esac
802ea3af
MT
150
151 CFLAGS="${CFLAGS}" \
152 CXXFLAGS="${CXXFLAGS}" \
153 XCFLAGS="${CFLAGS}" \
154 TCFLAGS="${CFLAGS}" \
155 ../%{thisapp}/configure \
156 --build=%{DISTRO_BUILDTARGET} \
166a6c21 157 --prefix=/usr \
c30b5fa5
MT
158 --libdir=%{libdir} \
159 --libexecdir=%{libdir} \
00c77389 160 --mandir=%{mandir} \
ec463524 161 --with-boot-ldflags="%{LDFLAGS}" \
b8b873e7 162 --enable-esp \
166a6c21
MT
163 --enable-shared \
164 --enable-threads=posix \
165 --enable-__cxa_atexit \
166 --enable-clocale=gnu \
f23b0b6e 167 --enable-languages=c,c++,lto \
92cf4b35 168 --disable-bootstrap \
f23b0b6e 169 --enable-checking=release \
ae73e818 170 --enable-default-pie \
36369ddb 171 --enable-default-ssp \
166a6c21
MT
172 --disable-werror \
173 --disable-libssp \
f23b0b6e 174 --with-system-zlib \
92cf4b35 175 --with-bugurl=https://bugzilla.ipfire.org/ \
b415c6aa
MT
176 --disable-libunwind-exceptions \
177 --enable-gnu-unique-object \
178 --enable-linker-build-id \
4de56d3e 179 --with-linker-hash-style=gnu \
00c77389
MT
180 --enable-plugin \
181 --enable-initfini-array \
513f8ca4 182 --disable-libgcj \
b57a0ea8 183 --enable-gnu-indirect-function \
802ea3af
MT
184 %{configure_options}
185
513f8ca4
MT
186 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58012
187 # XXX disabled flags: --disable-static
188
802ea3af 189 # GCC does not support a parallel build.
92cf4b35 190 make %{make_bootstrap} BOOT_CFLAGS="${CFLAGS}" %{PARALLELISMFLAGS}
4de56d3e
MT
191
192 # Generate man pages.
193 perl -pi -e 's/head3/head2/' ../contrib/texi2pod.pl
194 for i in %{DIR_APP}/gcc/doc/*.texi; do
195 cp -a $i $i.orig; sed 's/ftable/table/' $i.orig > $i
196 done
197 make -C gcc generated-manpages
198 for i in %{DIR_APP}/gcc/doc/*.texi; do mv -f $i.orig $i; done
802ea3af
MT
199 end
200
201 #test
513f8ca4 202 # cd %{DIR_SRC}/gcc-build && make -k check || true
802ea3af
MT
203 # cd %{DIR_APP} && ./contrib/test_summary
204 #end
205
206 install
207 cd %{DIR_SRC}/gcc-build
208 make install DESTDIR=%{BUILDROOT}
209
56c0b63c 210 # Check if the installation path exists.
c30b5fa5 211 FULLPATH="%{BUILDROOT}%{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}"
56c0b63c
MT
212 [ -d "${FULLPATH}" ] || exit 1
213
7e981e59
MT
214 mkdir -pv %{BUILDROOT}%{prefix}/lib
215 ln -sfv ../bin/cpp %{BUILDROOT}%{prefix}/lib/cpp
802ea3af
MT
216 ln -sfv gcc %{BUILDROOT}/usr/bin/cc
217
0302fa63 218 # Fix libgcc_s symlinks.
c30b5fa5 219 rm -f ${FULLPATH}/libgcc_s.so %{BUILDROOT}%{libdir}/libgcc_s.so
92cf4b35 220 ln -svf ../../../../..%{libdir}/libgcc_s.so.1 ${FULLPATH}/libgcc_s.so
62f274aa 221 chmod 755 %{BUILDROOT}%{libdir}/libgcc_s.so.1
802ea3af
MT
222
223 # Remove some GNU debugger stuff.
c30b5fa5 224 rm -vf %{BUILDROOT}%{libdir}/lib*.py
56c0b63c
MT
225
226 # libgomp
c30b5fa5 227 mv -vf %{BUILDROOT}%{libdir}/libgomp.spec ${FULLPATH}/
56c0b63c 228 ln -svf ../../../libgomp.so.1.0.0 ${FULLPATH}/libgomp.so
c30b5fa5 229 chmod 755 %{BUILDROOT}%{libdir}/libgomp.so.1.*
56c0b63c
MT
230
231 # libstdc++
92cf4b35 232 ln -svf ../../../libstdc++.so.6.0.30 ${FULLPATH}/libstdc++.so
b57a0ea8 233 mv -vf %{BUILDROOT}%{libdir}/lib{std,sup}c++.a ${FULLPATH}
56c0b63c
MT
234
235 # libquadmath
236 if [ "%{build_libquadmath}" = "1" ]; then
9d2ad5e3 237 ln -svf ../../../libquadmath.so.0.0.0 ${FULLPATH}/libquadmath.so
c30b5fa5 238 chmod 755 %{BUILDROOT}%{libdir}/libquadmath.so.0.*
56c0b63c 239 fi
4de56d3e
MT
240
241 # libitm
242 mv -vf %{BUILDROOT}%{libdir}/libitm.spec ${FULLPATH}/
243 ln -svf ../../../libitm.so.1.0.0 ${FULLPATH}/libitm.so
244 chmod 755 %{BUILDROOT}%{libdir}/libitm.so.1.*
513f8ca4
MT
245
246 # liblsan
247 if [ "%{build_liblsan}" = "1" ]; then
248 ln -svf ../../../liblsan.so.0.0.0 ${FULLPATH}/liblsan.so
249 chmod 755 %{BUILDROOT}%{libdir}/liblsan.so.*
250 fi
251
252 # libtsan
253 if [ "%{build_libtsan}" = "1" ]; then
92cf4b35 254 ln -svf ../../../libtsan.so.2.0.0 ${FULLPATH}/libtsan.so
513f8ca4
MT
255 chmod 755 %{BUILDROOT}%{libdir}/libtsan.so.*
256 fi
257
258 # libubsan
b57a0ea8 259 if [ "%{build_libubsan}" = "1" ]; then
1ad8926b 260 ln -svf ../../../libubsan.so.1.0.0 ${FULLPATH}/libubsan.so
b57a0ea8
MT
261 chmod 755 %{BUILDROOT}%{libdir}/libubsan.so.*
262 fi
802ea3af 263 end
876f9cff
MT
264
265 keep_libraries
c30b5fa5
MT
266 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libgcc.a
267 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libgcc_eh.a
b57a0ea8
MT
268 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libstdc++.a
269 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libsupc++.a
876f9cff 270 end
802ea3af
MT
271end
272
273packages
274 package %{name}
275 groups += Build
276
277 requires
513f8ca4 278 binutils >= %{binutils_version}
7e981e59 279 filesystem >= 002
e0e5b1d5 280 glibc >= 2.16
802ea3af 281 glibc-devel
7112214f 282 gmp-devel
0302fa63
MT
283 cpp = %{thisver}
284 libgcc = %{thisver}
285 libgomp = %{thisver}
802ea3af
MT
286 end
287
9d2ad5e3 288 # We do not ship libgcc-devel anymore.
0302fa63
MT
289 provides += libgcc-devel = %{thisver}
290 obsoletes += libgcc-devel < %{thisver}
802ea3af
MT
291 end
292
802ea3af 293 package %{name}-c++
56c0b63c
MT
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
0302fa63
MT
302 gcc = %{thisver}
303 libstdc++ = %{thisver}
304 libstdc++-devel = %{thisver}
56c0b63c 305 end
802ea3af
MT
306
307 files
308 /usr/bin/*++
c30b5fa5 309 %{libdir}/gcc/*/*/cc1plus
802ea3af
MT
310 /usr/share/man/man*/*++*
311 end
312 end
313
56c0b63c
MT
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
802ea3af 340 files
7e981e59
MT
341 %{prefix}/lib/cpp
342 %{bindir}/cpp
343 %{mandir}/man1/cpp.1*
c30b5fa5 344 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/cc1
802ea3af 345 end
7e981e59
MT
346
347 provides = /lib/cpp
62f274aa 348 requires = gcc-c++ = %{thisver}
802ea3af
MT
349 end
350
56c0b63c
MT
351 package libgcc
352 summary = GCC shared support library.
353 description
354 This package contains GCC shared support library which is needed
355 e.g. for exception handling support.
356 end
802ea3af
MT
357
358 files
0302fa63 359 %{libdir}/libgcc*.so.*
802ea3af 360 end
513f8ca4
MT
361
362 obsoletes
363 libmudflap
364 libmudflap-devel
365 end
802ea3af
MT
366 end
367
368 package libstdc++
56c0b63c
MT
369 summary = GNU Standard C++ Library.
370 description
371 The libstdc++ package contains a rewritten standard compliant GCC Standard
372 C++ Library.
373 end
374
802ea3af 375 files
c30b5fa5 376 %{libdir}/libstdc++*.so.*
802ea3af
MT
377 end
378 end
379
380 package libstdc++-devel
56c0b63c
MT
381 summary = Header files and libraries for C++ development.
382 description
383 This is the GNU implementation of the standard C++ libraries. This
384 package includes the header files and libraries needed for C++
385 development. This includes rewritten implementation of STL.
386 end
387
388 requires
0302fa63 389 libstdc++ = %{thisver}
56c0b63c
MT
390 end
391
802ea3af 392 files
c30b5fa5
MT
393 %{includedir}/c++
394 %{libdir}/libstdc++*.so
802ea3af
MT
395 end
396 end
397
b57a0ea8
MT
398 package libstdc++-static
399 summary = Static libraries for the GNU standard C++ library
400 description = %{summary}
401
402 requires
403 libstdc++-devel = %{thisver}
404 end
405
406 files
407 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libstdc++.a
408 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libsupc++.a
409 end
410 end
411
802ea3af 412 package libgomp
56c0b63c
MT
413 summary = GCC OpenMP v3.0 shared support library.
414 description
415 This package contains GCC shared support library which is needed
416 for OpenMP v3.0 support.
802ea3af 417 end
802ea3af 418
802ea3af 419 files
c30b5fa5 420 %{libdir}/libgomp*.so.*
802ea3af
MT
421 end
422 end
423
56c0b63c
MT
424 if "%{build_libquadmath}" == "1"
425 package libquadmath
426 summary = GCC __float128 shared support library.
427 description
428 This package contains GCC shared support library which is needed
429 for __float128 math support and for Fortran REAL*16 support.
430 end
431
432 files
c30b5fa5 433 %{libdir}/libquadmath*.so.*
56c0b63c
MT
434 end
435 end
436
437 package libquadmath-devel
438 summary = Development files for GCC __float128 support.
439 description
440 This package contains headers for building Fortran programs using
441 REAL*16 and programs using __float128 math.
442 end
443
444 requires
0302fa63
MT
445 gcc = %{thisver}
446 libquadmath = %{thisver}
56c0b63c
MT
447 end
448
449 files
2a3a31bb 450 %{libdir}/libquadmath.so
c30b5fa5
MT
451 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/include/quadmath.h
452 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/include/quadmath_weak.h
453 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libquadmath.so
56c0b63c 454 end
802ea3af
MT
455 end
456 end
457
4de56d3e
MT
458 package libitm
459 summary = The GNU Transactional Memory library.
460 description
461 This package contains the GNU Transactional Memory library
462 which is a GCC transactional memory support runtime library.
463 end
464
465 files
1ad8926b 466 %{libdir}/libitm.so.*
4de56d3e
MT
467 end
468 end
469
470 package libitm-devel
471 summary = The GNU Transactional Memory support.
472 description
473 This package contains headers and support files for the
474 GNU Transactional Memory library.
475 end
476
477 requires
478 gcc = %{thisver}
479 libitm = %{thisver}
480 end
481
482 files
2a3a31bb 483 %{libdir}/libitm.so
4de56d3e
MT
484 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/include/itm.h
485 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/include/itm_weak.h
486 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libitm.so
487 end
488 end
489
00c77389
MT
490 package libatomic
491 summary = The GNU Atomic library
492 description
493 This package contains the GNU Atomic library which is a
494 GCC support runtime library for atomisc operations not
495 supported by hardware.
496 end
497
498 files
1ad8926b 499 %{libdir}/libatomic.so.*
00c77389
MT
500 end
501 end
502
503 package libasan
504 summary = The Address Sanitizer runtime library
505 description
506 This package contains the Address Sanitizer library
507 which is used for -fsanitize=address instrumented programs.
508 end
509
510 files
1ad8926b 511 %{libdir}/libasan.so.*
00c77389
MT
512 end
513 end
514
515 if "%{build_libtsan}" == "1"
516 package libtsan
517 summary = The Thread Sanitizer runtime library
518 description
519 This package contains the Thread Sanitizer library
520 which is used for -fsanitize=thread instrumented programs.
521 end
522
523 files
1ad8926b 524 %{libdir}/libtsan.so.*
00c77389
MT
525 end
526 end
527 end
528
b57a0ea8
MT
529 if "%{build_libubsan}" == "1"
530 package libubsan
531 summary = The Undefined Behavior Sanitizer runtime library
532 description
533 This package contains the Undefined Behavior Sanitizer library
534 which is used for -fsanitize=undefined instrumented programs.
535 end
513f8ca4 536
b57a0ea8 537 files
1ad8926b 538 %{libdir}/libubsan.so.*
b57a0ea8 539 end
513f8ca4
MT
540 end
541 end
542
543 if "%{build_liblsan}" == "1"
544 package liblsan
545 summary = The Leak Sanitizer runtime library
546 description
547 This package contains the Leak Sanitizer library
548 which is used for -fsanitize=leak instrumented programs.
549 end
550
551 files
1ad8926b 552 %{libdir}/liblsan.so.*
513f8ca4
MT
553 end
554 end
555 end
556
56c0b63c
MT
557 package gcc-plugin-devel
558 summary = Support for compiling GCC plugins.
559 description
560 This package contains header files and other support files
561 for compiling GCC plugins. The GCC plugin ABI is currently
562 not stable, so plugins must be rebuilt any time GCC is updated.
563 end
564
565 requires
0302fa63
MT
566 gcc = %{thisver}
567 gmp-devel >= 4.1.2-8
568 mpfr-devel >= 2.2.1
569 libmpc-devel >= 0.8.1
56c0b63c
MT
570 end
571
802ea3af 572 files
c30b5fa5 573 %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/plugin
802ea3af
MT
574 end
575 end
1f9bc2f0
MT
576
577 package %{name}-debuginfo
578 template DEBUGINFO
579 end
802ea3af 580end