File cross-mips-gcc12.spec of Package gcc12 (Revision 2fa8203bb0ccce654b92f89b151f33af)
Currently displaying revision 2fa8203bb0ccce654b92f89b151f33af , Show latest
994
1
#
2
# spec file
3
#
4
# Copyright (c) 2023 SUSE LLC
5
#
6
# All modifications and additions to the file contributed by third parties
7
# remain the property of their copyright owners, unless otherwise agreed
8
# upon. The license for this file, and modifications and additions to the
9
# file, is the same license as for the pristine package itself (unless the
10
# license for the pristine package is not an Open Source License, in which
11
# case the license is the MIT License). An "Open Source License" is a
12
# license that conforms to the Open Source Definition (Version 1.9)
13
# published by the Open Source Initiative.
14
15
# Please submit bugfixes or comments via https://bugs.opensuse.org/
16
#
17
18
19
%define pkgname cross-mips-gcc12
20
%define cross_arch mips
21
%define gcc_target_arch mips-suse-linux
22
%define gcc_icecream 1
23
# nospeccleaner
24
25
%define build_cp 0%{!?gcc_accel:1}
26
%if 0%{?gcc_libc_bootstrap:1}
27
%define build_cp 0
28
%endif
29
%define build_ada 0
30
%define build_libjava 0
31
%define build_java 0
32
33
%define build_fortran 0%{?gcc_accel:1}
34
%define build_objc 0
35
%define build_objcp 0
36
%define build_go 0
37
%define build_nvptx 0
38
%define build_gcn 0
39
%define build_d 0
40
41
%define enable_plugins 0
42
%define build_jit 0
43
%define use_lto_bootstrap 0
44
45
%define binutils_target %{cross_arch}
46
%if "%{cross_arch}" == "armv7l" || "%{cross_arch}" == "armv7hl"
47
%define binutils_target arm
48
%endif
49
%if "%{cross_arch}" == "armv6l" || "%{cross_arch}" == "armv6hl"
50
%define binutils_target arm
51
%endif
52
%if "%{cross_arch}" == "armv5tel"
53
%define binutils_target arm
54
%endif
55
%if "%{cross_arch}" == "arm-none"
56
%define binutils_target arm
57
%endif
58
%if "%{cross_arch}" == "riscv64-elf"
59
%define binutils_target riscv64
60
%endif
61
%if "%{cross_arch}" == "sparcv9"
62
%define binutils_target sparc
63
%endif
64
%define canonical_target %(echo %{binutils_target} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
65
%if "%{binutils_target}" == "avr" || "%{binutils_target}" == "spu" || "%{binutils_target}" == "pru"
66
%define binutils_os %{canonical_target}
67
%else
68
%if "%{binutils_target}" == "epiphany" || "%{binutils_target}" == "nds32le" || "%{binutils_target}" == "rl78" || "%{binutils_target}" == "rx"
69
%define binutils_os %{canonical_target}-elf
70
%else
71
%if "%{binutils_target}" == "arm"
72
%define binutils_os %{canonical_target}-suse-linux-gnueabi
73
%else
74
%if 0%{?gcc_accel:1}
75
%define binutils_os %{gcc_target_arch}
76
%else
77
%define binutils_os %{canonical_target}-suse-linux
78
%endif
79
%endif
80
%endif
81
%endif
82
83
%if 0%{?gcc_icecream:1}
84
%define sysroot %{_prefix}/%{gcc_target_arch}
85
%else
86
# offloading builds newlib in-tree and can install in
87
# the GCC private path without extra sysroot
88
%if 0%{!?gcc_accel:1}
89
# use same sysroot as in binutils.spec
90
%define sysroot %{_prefix}/%{binutils_os}/sys-root
91
%endif
92
%endif
93
94
%if %{suse_version} >= 1220
95
%define selfconflict() %1
96
%else
97
%define selfconflict() otherproviders(%1)
98
%endif
99
100
Name: %{pkgname}
101
%define biarch_targets x86_64 s390x powerpc64 powerpc sparc sparc64
102
103
URL: https://gcc.gnu.org/
104
Version: 12.3.0+git1204
105
Release: 0
106
%define gcc_dir_version %(echo %version | sed 's/+.*//' | cut -d '.' -f 1)
107
%define gcc_snapshot_revision %(echo %version | sed 's/[3-9]\.[0-9]\.[0-6]//' | sed 's/+/-/')
108
%define binsuffix -12
109
%if %{suse_version} < 1310
110
BuildRoot: %{_tmppath}/%{name}-%{version}-build
111
%endif
112
Group: Development/Languages/C and C++
113
Source: gcc-%{version}.tar.xz
114
Source1: change_spec
115
Source2: gcc12-rpmlintrc
116
Source3: gcc12-testresults-rpmlintrc
117
Source4: README.First-for.SuSE.packagers
118
Source5: newlib-4.2.0.20211231.tar.xz
119
Patch2: gcc-add-defaultsspec.diff
120
Patch5: tls-no-direct.diff
121
Patch6: gcc43-no-unwind-tables.diff
122
Patch7: gcc48-libstdc++-api-reference.patch
123
Patch11: gcc7-remove-Wexpansion-to-defined-from-Wextra.patch
124
Patch15: gcc7-avoid-fixinc-error.diff
125
Patch16: gcc9-reproducible-builds.patch
126
Patch17: gcc9-reproducible-builds-buildid-for-checksum.patch
127
Patch18: gcc10-amdgcn-llvm-as.patch
128
Patch19: gcc11-gdwarf-4-default.patch
129
Patch20: gcc11-amdgcn-disable-hot-cold-partitioning.patch
130
# taken from https://gcc.gnu.org/pipermail/gcc-patches/2022-April/593378.html
131
Patch22: gcc12-riscv-inline-atomics.patch
132
# remove libatomics linking
133
Patch23: gcc12-riscv-pthread.patch
134
Patch24: gcc12-testsuite-fixes.patch
135
# A set of patches from the RH srpm
136
Patch51: gcc41-ppc32-retaddr.patch
137
# Some patches taken from Debian
138
Patch60: gcc44-textdomain.patch
139
Patch61: gcc44-rename-info-files.patch
140
141
# Define the canonical target and host architecture
142
# %%gcc_target_arch is supposed to be the full target triple
143
# %%cross_arch is supposed to be the rpm target variant arch
144
# %%TARGET_ARCH will be the canonicalized target CPU part
145
# %%HOST_ARCH will be the canonicalized host CPU part
146
%if 0%{?gcc_target_arch:1}
147
%define TARGET_ARCH %(echo %{cross_arch} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
148
%else
149
%define TARGET_ARCH %(echo %{_target_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
150
%endif
151
%if 0%{?disable_32bit:1}
152
%define biarch 0
153
%else
154
%define biarch %(case " %{biarch_targets} " in (*" %{TARGET_ARCH} "*) echo 1;; (*) echo 0;; esac)
155
%endif
156
157
%define HOST_ARCH %(echo %{_host_cpu} | sed -e "s/i.86/i586/;s/ppc/powerpc/;s/sparc64.*/sparc64/;s/sparcv.*/sparc/;")
158
%ifarch ppc
159
%define GCCDIST powerpc64-suse-linux
160
%else
161
%ifarch %sparc
162
%define GCCDIST sparc64-suse-linux
163
%else
164
%ifarch %arm
165
%define GCCDIST %{HOST_ARCH}-suse-linux-gnueabi
166
%else
167
%define GCCDIST %{HOST_ARCH}-suse-linux
168
%endif
169
%endif
170
%endif
171
172
%define libsubdir %{_libdir}/gcc/%{GCCDIST}/%{gcc_dir_version}
173
%define gxxinclude %{_prefix}/include/c++/%{gcc_dir_version}
174
175
%if "%{cross_arch}" != "nvptx"
176
%if "%{cross_arch}" != "amdgcn"
177
BuildRequires: cross-%{binutils_target}-binutils
178
Requires: cross-%{binutils_target}-binutils
179
%endif
180
%endif
181
%define hostsuffix %{nil}
182
%if 0%{suse_version} < 1220
183
%define hostsuffix -4.8
184
BuildRequires: gcc48-c++
185
%else
186
BuildRequires: gcc-c++
187
%endif
188
%if %{suse_version} > 1500
189
BuildRequires: libzstd-devel
190
%endif
191
BuildRequires: bison
192
BuildRequires: flex
193
BuildRequires: gettext-devel
194
BuildRequires: glibc-devel-32bit
195
BuildRequires: mpc-devel
196
BuildRequires: mpfr-devel
197
BuildRequires: perl
198
%if %{suse_version} > 1220
199
BuildRequires: makeinfo
200
%else
201
BuildRequires: texinfo
202
%endif
203
BuildRequires: zlib-devel
204
%if %{suse_version} >= 1230
205
BuildRequires: isl-devel
206
%endif
207
%ifarch ia64
208
BuildRequires: libunwind-devel
209
%endif
210
%if 0%{!?gcc_icecream:1}
211
%if 0%{!?gcc_libc_bootstrap:1}
212
%if 0%{?gcc_target_newlib:1}
213
BuildRequires: cross-%cross_arch-newlib-devel
214
%endif
215
%if "%{cross_arch}" == "avr"
216
BuildRequires: avr-libc
217
%endif
218
%if 0%{?gcc_target_glibc:1}
219
BuildRequires: cross-%cross_arch-glibc-devel
220
Requires: cross-%cross_arch-glibc-devel
221
%endif
222
%endif
223
%if "%{cross_arch}" == "nvptx"
224
BuildRequires: nvptx-tools
225
Requires: cross-nvptx-newlib-devel >= %{version}-%{release}
226
Requires: nvptx-tools
227
ExclusiveArch: x86_64
228
%define nvptx_newlib 1
229
%endif
230
%if "%{cross_arch}" == "amdgcn"
231
# amdgcn uses the llvm assembler and linker
232
%if %{suse_version} < 1550
233
BuildRequires: llvm11
234
%else
235
BuildRequires: llvm
236
%endif
237
BuildRequires: lld
238
%if %{suse_version} < 1550
239
Requires: llvm11
240
%else
241
Requires: llvm
242
%endif
243
Requires: cross-amdgcn-newlib-devel >= %{version}-%{release}
244
Requires: lld
245
# SLE12 does not fulfil build requirements for GCN, SLE15 SP1 does
246
# technically also SLE12 SP5 but do not bother there
247
%if %{suse_version} >= 1550 || 0%{?sle_version:%sle_version} >= 150100
248
ExclusiveArch: x86_64
249
%else
250
ExclusiveArch: do-not-build
251
%endif
252
%define amdgcn_newlib 1
253
%endif
254
%endif
255
%if 0%{?gcc_icecream:1}%{?gcc_target_glibc:1}%{?gcc_libc_bootstrap:1}
256
ExclusiveArch: i586 ppc64le ppc64 x86_64 s390x aarch64 riscv64
257
%if "%{cross_arch}" == "pru"
258
ExclusiveArch: %arm
259
%endif
260
%endif
261
%define _binary_payload w.ufdio
262
# Obsolete cross-ppc-gcc49 from cross-ppc64-gcc49 which has
263
# file conflicts with it and is no longer packaged
264
%if "%pkgname" == "cross-ppc64-gcc49"
265
Obsoletes: cross-ppc-gcc49 <= 4.9.0+r209354
266
%endif
267
%if 0%{?gcc_target_newlib:1}%{?gcc_target_glibc:1}
268
# Generally only one cross for the same target triplet can be installed
269
# at the same time as we are populating a non-version-specific sysroot
270
Provides: %{gcc_target_arch}-gcc
271
Conflicts: %selfconflict %{gcc_target_arch}-gcc
272
%endif
273
%if 0%{?gcc_libc_bootstrap:1}
274
# The -bootstrap packages file-conflict with the non-bootstrap variants.
275
# Even if we don't actually (want to) distribute the bootstrap variants
276
# the following avoids repo-checker spamming us endlessly.
277
Conflicts: cross-%{cross_arch}-gcc12
278
%endif
279
#!BuildIgnore: gcc-PIE
280
%if 0%{build_cp:1}
281
# The cross compiler only packages the arch specific c++ headers, so
282
# we need to depend on the host libstdc++ devel headers (we wouldn't need
283
# the libs, though)
284
Requires: libstdc++6-devel-gcc12
285
%endif
286
AutoReqProv: off
287
BuildRequires: update-alternatives
288
Requires(post): update-alternatives
289
Requires(preun):update-alternatives
290
Summary: The GNU Compiler Collection targeting %{cross_arch}
291
License: GPL-3.0-or-later
292
293
%description
294
The GNU Compiler Collection as a cross-compiler targeting %{cross_arch}.
295
%if 0%{?gcc_icecream:1}
296
Note this is only useful for building freestanding things like the
297
kernel since it fails to include target libraries and headers.
298
%endif
299
%if 0%{?gcc_libc_bootstrap:1}
300
This is a package that is necessary for bootstrapping another package
301
only, it is not intended for any other use.
302
%endif
303
304
%if 0%{suse_version} >= 1500
305
# Synchronize output by lines, useful for configure output
306
%define make_output_sync -Oline
307
%endif
308
309
%prep
310
%if 0%{?nvptx_newlib:1}%{?amdgcn_newlib:1}
311
%setup -q -n gcc-%{version} -a 5
312
ln -s newlib-4.2.0.20211231/newlib .
313
%else
314
%setup -q -n gcc-%{version}
315
%endif
316
317
#test patching start
318
319
%patch2
320
%patch5
321
%patch6
322
%patch7
323
%patch11
324
%patch15
325
%patch16
326
%patch17 -p1
327
%patch22 -p1
328
%patch23 -p1
329
%patch24 -p1
330
# These patches are needed only for llvm11
331
%if "%{TARGET_ARCH}" == "amdgcn" && %{suse_version} < 1550
332
%patch18 -p1
333
%patch20 -p1
334
%endif
335
# In SLE15 and earlier default to dwarf4, not dwarf5
336
%if %{suse_version} < 1550
337
%patch19 -p1
338
%endif
339
%patch51
340
%patch60 -p1
341
%patch61
342
343
#test patching end
344
345
%build
346
%define _lto_cflags %{nil}
347
# Avoid rebuilding of generated files
348
contrib/gcc_update --touch
349
350
# SLE11 does not allow empty rpms
351
%if %{suse_version} < 1310
352
echo "This is a dummy package to provide a dependency." > README
353
%endif
354
355
rm -rf obj-%{GCCDIST}
356
mkdir obj-%{GCCDIST}
357
cd obj-%{GCCDIST}
358
RPM_OPT_FLAGS="$RPM_OPT_FLAGS -U_FORTIFY_SOURCE"
359
RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fno-rtti//g' -e 's/-fno-exceptions//g' -e 's/-Wmissing-format-attribute//g' -e 's/-fstack-protector[^ ]*//g' -e 's/-ffortify=.//g' -e 's/-Wall//g' -e 's/-m32//g' -e 's/-m64//g'`
360
%ifarch %ix86
361
# -mcpu is superceded by -mtune but -mtune is not supported by
362
# our bootstrap compiler. -mcpu gives a warning that stops
363
# the build process, so remove it for now. Also remove all other
364
# -march and -mtune flags. They are superseeded by proper
365
# default compiler settings now.
366
RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-mcpu=i.86//g' -e 's/-march=i.86//g' -e 's/-mtune=i.86//g'`
367
%endif
368
%ifarch s390 s390x
369
RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fsigned-char//g'`
370
RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-O1/-O2/g'`
371
%endif
372
%if 0%{?gcc_target_arch:1}
373
# Kill all -march/tune/cpu because that screws building the target libs
374
RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-m\(arch\|tune\|cpu\)=[^ ]*//g'`
375
%endif
376
# Replace 2 spaces by one finally
377
RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/ / /g'`
378
379
languages=c
380
%if %{build_cp}
381
languages=$languages,c++
382
%endif
383
%if %{build_objc}
384
languages=$languages,objc
385
%endif
386
%if %{build_fortran}
387
languages=$languages,fortran
388
%endif
389
%if %{build_objcp}
390
languages=$languages,obj-c++
391
%endif
392
%if %{build_ada}
393
languages=$languages,ada
394
%endif
395
%if %{build_go}
396
languages=$languages,go
397
%endif
398
%if %{build_d}
399
languages=$languages,d
400
%endif
401
%if %{build_jit}
402
languages=$languages,jit
403
%endif
404
405
# In general we want to ship release checking enabled compilers
406
# which is the default for released compilers
407
#ENABLE_CHECKING="--enable-checking=yes"
408
ENABLE_CHECKING="--enable-checking=release"
409
#ENABLE_CHECKING=""
410
411
# Work around tail/head -1 changes
412
export _POSIX2_VERSION=199209
413
414
%if "%{TARGET_ARCH}" == "amdgcn"
415
mkdir -p target-tools/bin
416
ln -s /usr/bin/llvm-ar target-tools/bin/amdgcn-amdhsa-ar
417
ln -s /usr/bin/llvm-mc target-tools/bin/amdgcn-amdhsa-as
418
ln -s /usr/bin/lld target-tools/bin/amdgcn-amdhsa-ld
419
ln -s /usr/bin/llvm-nm target-tools/bin/amdgcn-amdhsa-nm
420
ln -s /usr/bin/llvm-ranlib target-tools/bin/amdgcn-amdhsa-ranlib
421
export PATH="`pwd`/target-tools/bin:$PATH"
422
%endif
423
424
%if "%{hostsuffix}" != ""
425
mkdir -p host-tools/bin
426
# Using the host gnatmake like
427
# CC="gcc%%{hostsuffix}" GNATBIND="gnatbind%%{hostsuffix}"
428
# GNATMAKE="gnatmake%%{hostsuffix}"
429
# doesn't work due to PR33857, so an un-suffixed gnatmake has to be
430
# available
431
%if %{build_ada}
432
cp -a /usr/bin/gnatmake%{hostsuffix} host-tools/bin/gnatmake
433
cp -a /usr/bin/gnatlink%{hostsuffix} host-tools/bin/gnatlink
434
cp -a /usr/bin/gnatbind%{hostsuffix} host-tools/bin/gnatbind
435
%endif
436
cp -a /usr/bin/gcc%{hostsuffix} host-tools/bin/gcc
437
cp -a /usr/bin/g++%{hostsuffix} host-tools/bin/g++
438
ln -sf /usr/%{_lib} host-tools/%{_lib}
439
export PATH="`pwd`/host-tools/bin:$PATH"
440
%endif
441
442
%if %{build_d} && %{suse_version} < 1550
443
# We are using gcc11-d to bootstrap d
444
export GDC=gdc-11
445
%endif
446
447
# libsanitizer needs <crypt.h> and since the glibc/libxcrypt split
448
# we don't have that yet in a pure cross environment
449
%if 0%{?gcc_target_arch:1}
450
CONFARGS="$CONFARGS --disable-libsanitizer"
451
%endif
452
453
CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" XCFLAGS="$RPM_OPT_FLAGS" \
454
TCFLAGS="$RPM_OPT_FLAGS" \
455
../configure \
456
--prefix=%{_prefix} \
457
--infodir=%{_infodir} \
458
--mandir=%{_mandir} \
459
--libdir=%{_libdir} \
460
--libexecdir=%{_libdir} \
461
--enable-languages=$languages \
462
%if %{build_nvptx} || %{build_gcn}
463
--enable-offload-targets=\
464
%if %{build_nvptx}
465
nvptx-none,\
466
%endif
467
%if %{build_gcn}
468
amdgcn-amdhsa,\
469
%endif
470
--enable-offload-defaulted \
471
%endif
472
%if %{build_nvptx}
473
--without-cuda-driver \
474
%endif
475
%if %{build_jit}
476
--enable-host-shared \
477
%endif
478
$ENABLE_CHECKING \
479
--disable-werror \
480
--with-gxx-include-dir=%{_prefix}/include/c++/%{gcc_dir_version} \
481
--enable-ssp \
482
--disable-libssp \
483
%if 0%{!?build_libvtv:1}
484
--disable-libvtv \
485
%endif
486
%if 0%{suse_version} >= 1500
487
--enable-cet=auto \
488
%else
489
--disable-cet \
490
%endif
491
--disable-libcc1 \
492
%if %{enable_plugins}
493
--enable-plugin \
494
%else
495
--disable-plugin \
496
%endif
497
--with-bugurl="https://bugs.opensuse.org/" \
498
--with-pkgversion="SUSE Linux" \
499
%if 0%{?sysroot:1}
500
--with-slibdir=%{sysroot}/%{_lib} \
501
%else
502
--with-slibdir=/%{_lib} \
503
%endif
504
--with-system-zlib \
505
--enable-libstdcxx-allocator=new \
506
--disable-libstdcxx-pch \
507
%if 0%{suse_version} <= 1320
508
--with-default-libstdcxx-abi=gcc4-compatible \
509
%endif
510
%if %{build_d}
511
--enable-libphobos \
512
%endif
513
--enable-version-specific-runtime-libs \
514
--with-gcc-major-version-only \
515
%if 0%{!?gcc_target_arch:1}
516
--enable-linker-build-id \
517
%else
518
%if 0%{?gcc_target_glibc:1}
519
--enable-linker-build-id \
520
%endif
521
%endif
522
--enable-linux-futex \
523
%if %{suse_version} >= 1315
524
%ifarch %ix86 x86_64 ppc ppc64 ppc64le %arm aarch64 s390 s390x %sparc
525
--enable-gnu-indirect-function \
526
%endif
527
%endif
528
--program-suffix=%{binsuffix} \
529
%ifarch %{disable_multilib_arch}
530
--disable-multilib \
531
%endif
532
%if 0%{!?gcc_target_arch:1}
533
%ifarch ia64
534
--with-system-libunwind \
535
%else
536
--without-system-libunwind \
537
%endif
538
%endif
539
%if 0%{?gcc_target_arch:1}
540
--program-prefix=%{gcc_target_arch}- \
541
--target=%{gcc_target_arch} \
542
--disable-nls \
543
%if 0%{?sysroot:1}
544
--with-sysroot=%sysroot \
545
%endif
546
%if 0%{?build_sysroot:1}
547
--with-build-sysroot=%{build_sysroot} \
548
%else
549
%if 0%{?sysroot:1}
550
--with-build-sysroot=%{sysroot} \
551
%endif
552
%endif
553
%if 0%{?binutils_os:1}
554
--with-build-time-tools=/usr/%{binutils_os}/bin \
555
%endif
556
%if 0%{?gcc_target_newlib}
557
--with-newlib \
558
%if 0%{?gcc_libc_bootstrap:1}
559
--disable-gcov \
560
%endif
561
%else
562
%if 0%{?gcc_libc_bootstrap:1}
563
--disable-gcov --disable-threads --disable-shared \
564
--disable-libmudflap --disable-libssp --disable-libgomp \
565
--disable-libquadmath --disable-libatomic \
566
--without-headers --with-newlib \
567
%endif
568
%endif
569
%if "%{TARGET_ARCH}" == "spu"
570
--with-gxx-include-dir=%sysroot/include/c++/%{gcc_dir_version} \
571
--with-newlib \
572
%endif
573
%if "%{TARGET_ARCH}" == "nvptx"
574
--enable-as-accelerator-for=%{GCCDIST} \
575
--disable-sjlj-exceptions \
576
--enable-newlib-io-long-long \
577
%endif
578
%if "%{TARGET_ARCH}" == "amdgcn"
579
--enable-as-accelerator-for=%{GCCDIST} \
580
--enable-libgomp \
581
%endif
582
%if "%{TARGET_ARCH}" == "avr"
583
--enable-lto \
584
--without-gxx-include-dir \
585
--with-native-system-header-dir=/include \
586
%endif
587
%endif
588
%if "%{TARGET_ARCH}" == "arm-none"
589
--enable-multilib \
590
--with-multilib-list=aprofile,rmprofile \
591
--disable-decimal-float \
592
--disable-libffi \
593
--disable-libgomp \
594
--disable-libmudflap \
595
--disable-libquadmath \
596
--disable-shared \
597
--disable-threads \
598
--disable-tls \
599
%endif
600
%if "%{TARGET_ARCH}" == "armv6hl" || "%{TARGET_ARCH}" == "arm"
601
--with-cpu=arm1176jzf-s \
602
--with-float=hard \
603
--with-abi=aapcs-linux \
604
--with-fpu=vfpv2 \
605
--disable-sjlj-exceptions \
606
%endif
607
%if "%{TARGET_ARCH}" == "armv7hl"
608
--with-cpu=generic-armv7-a \
609
--with-float=hard \
610
--with-abi=aapcs-linux \
611
--with-fpu=vfpv3-d16 \
612
--disable-sjlj-exceptions \
613
%endif
614
%if "%{TARGET_ARCH}" == "aarch64"
615
--enable-fix-cortex-a53-835769 \
616
--enable-fix-cortex-a53-843419 \
617
%endif
618
%if "%{TARGET_ARCH}" == "powerpc64le"
619
%if %{suse_version} >= 1350
620
--with-cpu=power8 \
621
--with-tune=power9 \
622
%else
623
%if %{suse_version} >= 1315 && %{suse_version} != 1320
624
--with-cpu=power8 \
625
--with-tune=power8 \
626
%else
627
--with-cpu=power7 \
628
--with-tune=power7 \
629
%endif
630
%endif
631
%if %{suse_version} > 1500
632
--with-long-double-format=ieee \
633
%else
634
--with-long-double-format=ibm \
635
%endif
636
--enable-secureplt \
637
--with-long-double-128 \
638
--enable-targets=powerpcle-linux \
639
--disable-multilib \
640
%endif
641
%if "%{TARGET_ARCH}" == "powerpc" || "%{TARGET_ARCH}" == "powerpc64"
642
%if "%{TARGET_ARCH}" == "powerpc"
643
--with-cpu=default32 \
644
%endif
645
--with-cpu-64=power4 \
646
--enable-secureplt \
647
--with-long-double-128 \
648
%endif
649
%if "%{TARGET_ARCH}" == "sparc64"
650
--with-cpu=ultrasparc \
651
--with-long-double-128 \
652
%endif
653
%if "%{TARGET_ARCH}" == "sparc"
654
--with-cpu=v8 \
655
--with-long-double-128 \
656
%endif
657
%if "%{TARGET_ARCH}" == "i586"
658
%if 0%{?sle_version:%sle_version} >= 150000
659
--with-arch-32=x86-64 \
660
%else
661
--with-arch-32=i586 \
662
%endif
663
--with-tune=generic \
664
%endif
665
%if "%{TARGET_ARCH}" == "x86_64"
666
%ifnarch %{disable_multilib_arch}
667
--enable-multilib \
668
--with-arch-32=x86-64 \
669
%endif
670
--with-tune=generic \
671
%endif
672
%if "%{TARGET_ARCH}" == "s390"
673
%if %{suse_version} >= 1310
674
--with-tune=zEC12 --with-arch=z196 \
675
%else
676
--with-tune=z9-109 --with-arch=z900 \
677
%endif
678
--with-long-double-128 \
679
--enable-decimal-float \
680
%endif
681
%if "%{TARGET_ARCH}" == "s390x"
682
%if %{suse_version} >= 1310
683
--with-tune=zEC12 --with-arch=z196 \
684
%else
685
--with-tune=z9-109 --with-arch=z900 \
686
%endif
687
--with-long-double-128 \
688
--enable-decimal-float \
689
%endif
690
%if "%{TARGET_ARCH}" == "m68k"
691
--disable-multilib \
692
%endif
693
%if "%{TARGET_ARCH}" == "riscv64"
694
--disable-multilib \
695
%endif
696
%if %{use_lto_bootstrap} && !0%{?building_testsuite:1}
697
--with-build-config=bootstrap-lto-lean \
698
%endif
699
--enable-link-serialization \
700
$CONFARGS \
701
--build=%{GCCDIST} \
702
--host=%{GCCDIST} || \
703
{
704
rc=$?;
705
echo "------- BEGIN config.log ------";
706
%{__cat} config.log;
707
echo "------- END config.log ------";
708
exit $rc;
709
}
710
711
%if 0%{!?gcc_icecream:1}
712
make %{?make_output_sync} %{?_smp_mflags}
713
%else
714
make %{?make_output_sync} %{?_smp_mflags} all-host
715
%endif
716
717
%if 0%{?gcc_icecream:%gcc_icecream}
718
%package -n cross-%cross_arch-gcc12-icecream-backend
719
Summary: Icecream backend for the GNU C Compiler
720
Group: Development/Languages/C and C++
721
722
%description -n cross-%cross_arch-gcc12-icecream-backend
723
This package contains the icecream environment for the GNU C Compiler
724
%endif
725
726
%if 0%{?nvptx_newlib:1}
727
%package -n cross-nvptx-newlib12-devel
728
Summary: Newlib for the nvptx offload target
729
Group: Development/Languages/C and C++
730
Provides: cross-nvptx-newlib-devel = %{version}-%{release}
731
Conflicts: cross-nvptx-newlib-devel
732
733
%description -n cross-nvptx-newlib12-devel
734
Newlib development files for the nvptx offload target compiler.
735
%endif
736
737
%if 0%{?amdgcn_newlib:1}
738
%package -n cross-amdgcn-newlib12-devel
739
Summary: Newlib for the amdgcn offload target
740
Group: Development/Languages/C and C++
741
Provides: cross-amdgcn-newlib-devel = %{version}-%{release}
742
Conflicts: cross-amdgcn-newlib-devel
743
744
%description -n cross-amdgcn-newlib12-devel
745
Newlib development files for the amdgcn offload target compiler.
746
%endif
747
748
%define targetlibsubdir %{_libdir}/gcc/%{gcc_target_arch}/%{gcc_dir_version}
749
750
%install
751
cd obj-%{GCCDIST}
752
753
%if "%{TARGET_ARCH}" == "amdgcn"
754
# libtool needs to be able to call ranlib
755
export PATH="`pwd`/target-tools/bin:$PATH"
756
%endif
757
758
# install and fixup host parts
759
make DESTDIR=$RPM_BUILD_ROOT install-host
760
rm -rf $RPM_BUILD_ROOT/%{targetlibsubdir}/install-tools
761
rm -f $RPM_BUILD_ROOT/%{targetlibsubdir}/liblto_plugin.la
762
# common fixup
763
rm -f $RPM_BUILD_ROOT%{_libdir}/libiberty.a
764
765
# install and fixup target parts
766
%if 0%{?gcc_icecream:1}
767
# so expect the sysroot to be populated from natively built binaries
768
%else
769
# We want shared libraries to reside in the sysroot but the .so symlinks
770
# on the host. Once we have a cross target that has shared libs we need
771
# to manually fix up things here like we do for non-cross compilers
772
mkdir -p $RPM_BUILD_ROOT/%{?sysroot:%sysroot}
773
make DESTDIR=$RPM_BUILD_ROOT install-target
774
%if %{build_cp}
775
# So we installed libstdc++ headers into %prefix where they conflict
776
# with other host compilers. Rip out the non-target specific parts
777
# again. Note not all cross targets support libstdc++, so create the
778
# directory to make things easier.
779
mkdir -p $RPM_BUILD_ROOT/%_prefix/include/c++/%{gcc_dir_version}
780
find $RPM_BUILD_ROOT/%_prefix/include/c++/%{gcc_dir_version} -mindepth 1 -maxdepth 1 -type d -a -not -name %{gcc_target_arch} | xargs -r rm -r
781
find $RPM_BUILD_ROOT/%_prefix/include/c++/%{gcc_dir_version} -maxdepth 1 -type f | xargs -r rm
782
# And also remove installed pretty printers which conflict in similar ways
783
rm -rf $RPM_BUILD_ROOT/%{_datadir}/gcc%{binsuffix}
784
%endif
785
%endif
786
787
%if 0%{?binutils_os:1}
788
for prog in as ld; do
789
ln -s /usr/%{binutils_os}/bin/$prog $RPM_BUILD_ROOT%{targetlibsubdir}/
790
done
791
%endif
792
793
# remove docs
794
rm -rf $RPM_BUILD_ROOT%{_mandir}
795
rm -rf $RPM_BUILD_ROOT%{_infodir}
796
797
# for accelerators remove all frontends but lto1 and also install-tools
798
%if 0%{?gcc_accel:1}
799
rm -f $RPM_BUILD_ROOT%{libsubdir}/accel/%{gcc_target_arch}/cc1
800
rm -f $RPM_BUILD_ROOT%{libsubdir}/accel/%{gcc_target_arch}/cc1plus
801
rm -rf $RPM_BUILD_ROOT%{libsubdir}/accel/%{gcc_target_arch}/install-tools
802
rm -rf $RPM_BUILD_ROOT%{targetlibsubdir}/install-tools
803
# also move things from target directories into the accel path since
804
# that is the place where we later search for (only)
805
( cd $RPM_BUILD_ROOT%{targetlibsubdir} && tar cf - . ) | ( cd $RPM_BUILD_ROOT%{libsubdir}/accel/%{gcc_target_arch} && tar xf - )
806
rm -rf $RPM_BUILD_ROOT%{targetlibsubdir}
807
%endif
808
# for amdgcn install the symlinks to the llvm tools
809
# follow alternatives symlinks to the hardcoded version requirement
810
%if "%{TARGET_ARCH}" == "amdgcn"
811
mkdir -p $RPM_BUILD_ROOT%{_prefix}/amdgcn-amdhsa/bin
812
ln -s `readlink -f /usr/bin/llvm-ar` $RPM_BUILD_ROOT%{_prefix}/amdgcn-amdhsa/bin/ar
813
ln -s `readlink -f /usr/bin/llvm-mc` $RPM_BUILD_ROOT%{_prefix}/amdgcn-amdhsa/bin/as
814
ln -s /usr/bin/lld $RPM_BUILD_ROOT%{_prefix}/amdgcn-amdhsa/bin/ld
815
ln -s `readlink -f /usr/bin/llvm-nm` $RPM_BUILD_ROOT%{_prefix}/amdgcn-amdhsa/bin/nm
816
ln -s `readlink -f /usr/bin/llvm-ranlib` $RPM_BUILD_ROOT%{_prefix}/amdgcn-amdhsa/bin/ranlib
817
ln -s %{_prefix}/amdgcn-amdhsa/bin/ar $RPM_BUILD_ROOT%{_prefix}/bin/amdgcn-amdhsa-ar
818
ln -s %{_prefix}/amdgcn-amdhsa/bin/as $RPM_BUILD_ROOT%{_prefix}/bin/amdgcn-amdhsa-as
819
ln -s %{_prefix}/amdgcn-amdhsa/bin/ld $RPM_BUILD_ROOT%{_prefix}/bin/amdgcn-amdhsa-ld
820
ln -s %{_prefix}/amdgcn-amdhsa/bin/nm $RPM_BUILD_ROOT%{_prefix}/bin/amdgcn-amdhsa-nm
821
ln -s %{_prefix}/amdgcn-amdhsa/bin/ranlib $RPM_BUILD_ROOT%{_prefix}/bin/amdgcn-amdhsa-ranlib
822
%endif
823
824
%if 0%{?gcc_icecream:%gcc_icecream}
825
# Build an icecream environment
826
# The assembler comes from the cross-binutils, and hence is _not_
827
# named funnily, not even on ppc, so there we need the original target
828
install -s -D %{_prefix}/bin/%{binutils_os}-as \
829
$RPM_BUILD_ROOT/env/usr/bin/as
830
install -s $RPM_BUILD_ROOT/%{_prefix}/bin/%{gcc_target_arch}-g++%{binsuffix} \
831
$RPM_BUILD_ROOT/env/usr/bin/g++
832
install -s $RPM_BUILD_ROOT/%{_prefix}/bin/%{gcc_target_arch}-gcc%{binsuffix} \
833
$RPM_BUILD_ROOT/env/usr/bin/gcc
834
835
for back in cc1 cc1plus; do
836
install -s -D $RPM_BUILD_ROOT/%{targetlibsubdir}/$back \
837
$RPM_BUILD_ROOT/env%{targetlibsubdir}/$back
838
done
839
if test -f $RPM_BUILD_ROOT/%{targetlibsubdir}/liblto_plugin.so; then
840
install -s -D $RPM_BUILD_ROOT/%{targetlibsubdir}/liblto_plugin.so \
841
$RPM_BUILD_ROOT/env%{targetlibsubdir}/liblto_plugin.so
842
fi
843
844
# Make sure to also pull in all shared library requirements for the
845
# binaries we put into the environment which is operated by chrooting
846
# into it and execing the compiler
847
libs=`for bin in $RPM_BUILD_ROOT/env/usr/bin/* $RPM_BUILD_ROOT/env%{targetlibsubdir}/*; do \
848
ldd $bin | sed -n '\,^[^/]*\(/[^ ]*\).*,{ s//\1/; p; }' ;\
849
done | sort -u `
850
for lib in $libs; do
851
# Check wether the same library also exists in the parent directory,
852
# and prefer that on the assumption that it is a more generic one.
853
baselib=`echo "$lib" | sed 's,/[^/]*\(/[^/]*\)$,\1,'`
854
test -f "$baselib" && lib=$baselib
855
install -s -D $lib $RPM_BUILD_ROOT/env$lib
856
done
857
858
cd $RPM_BUILD_ROOT/env
859
tar --no-recursion --mtime @${SOURCE_DATE_EPOCH:-$(date +%s)} --format=gnu -cv `find *|LC_ALL=C sort` |\
860
gzip -n9 > ../%{name}_%{_arch}.tar.gz
861
cd ..
862
mkdir -p usr/share/icecream-envs
863
mv %{name}_%{_arch}.tar.gz usr/share/icecream-envs
864
rpm -q --changelog glibc > usr/share/icecream-envs/%{name}_%{_arch}.glibc
865
rpm -q --changelog binutils > usr/share/icecream-envs/%{name}_%{_arch}.binutils
866
rm -r env
867
%endif
868
869
# we provide update-alternatives for selecting a compiler version for
870
# crosses
871
%if 0%{!?gcc_accel:1}
872
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
873
for ex in gcc cpp \
874
%if %{build_cp}
875
c++ g++ \
876
%endif
877
gcc-ar gcc-nm gcc-ranlib lto-dump \
878
%if 0%{!?gcc_libc_bootstrap:1}
879
gcov gcov-dump gcov-tool \
880
%endif
881
; do
882
ln -s %{_sysconfdir}/alternatives/%{gcc_target_arch}-$ex \
883
%{buildroot}%{_bindir}/%{gcc_target_arch}-$ex
884
done
885
886
%post
887
%{_sbindir}/update-alternatives \
888
--install %{_bindir}/%{gcc_target_arch}-gcc %{gcc_target_arch}-gcc %{_bindir}/%{gcc_target_arch}-gcc%{binsuffix} 12 \
889
--slave %{_bindir}/%{gcc_target_arch}-cpp %{gcc_target_arch}-cpp %{_bindir}/%{gcc_target_arch}-cpp%{binsuffix} \
890
%if %{build_cp}
891
--slave %{_bindir}/%{gcc_target_arch}-c++ %{gcc_target_arch}-c++ %{_bindir}/%{gcc_target_arch}-c++%{binsuffix} \
892
--slave %{_bindir}/%{gcc_target_arch}-g++ %{gcc_target_arch}-g++ %{_bindir}/%{gcc_target_arch}-g++%{binsuffix} \
893
%endif
894
%if 0%{!?gcc_libc_bootstrap:1}
895
--slave %{_bindir}/%{gcc_target_arch}-gcov %{gcc_target_arch}-gcov %{_bindir}/%{gcc_target_arch}-gcov%{binsuffix} \
896
--slave %{_bindir}/%{gcc_target_arch}-gcov-dump %{gcc_target_arch}-gcov-dump %{_bindir}/%{gcc_target_arch}-gcov-dump%{binsuffix} \
897
--slave %{_bindir}/%{gcc_target_arch}-gcov-tool %{gcc_target_arch}-gcov-tool %{_bindir}/%{gcc_target_arch}-gcov-tool%{binsuffix} \
898
%endif
899
--slave %{_bindir}/%{gcc_target_arch}-gcc-ar %{gcc_target_arch}-gcc-ar %{_bindir}/%{gcc_target_arch}-gcc-ar%{binsuffix} \
900
--slave %{_bindir}/%{gcc_target_arch}-gcc-nm %{gcc_target_arch}-gcc-nm %{_bindir}/%{gcc_target_arch}-gcc-nm%{binsuffix} \
901
--slave %{_bindir}/%{gcc_target_arch}-lto-dump %{gcc_target_arch}-lto-dump %{_bindir}/%{gcc_target_arch}-lto-dump%{binsuffix} \
902
--slave %{_bindir}/%{gcc_target_arch}-gcc-ranlib %{gcc_target_arch}-gcc-ranlib %{_bindir}/%{gcc_target_arch}-gcc-ranlib%{binsuffix}
903
904
%postun
905
if [ ! -f %{_bindir}/%{gcc_target_arch}-gcc ] ; then
906
%{_sbindir}/update-alternatives --remove %{gcc_target_arch}-gcc %{_bindir}/%{gcc_target_arch}-gcc%{binsuffix}
907
fi
908
%endif
909
910
%files
911
%defattr(-,root,root)
912
%if 0%{?gcc_accel:1}
913
%{_prefix}/bin/%{GCCDIST}-accel-%{gcc_target_arch}-*
914
%dir %{libsubdir}
915
%dir %{libsubdir}/accel
916
%{libsubdir}/accel/%{gcc_target_arch}
917
%else
918
%{_prefix}/bin/%{gcc_target_arch}-gcc%{binsuffix}
919
%{_prefix}/bin/%{gcc_target_arch}-cpp%{binsuffix}
920
%{_prefix}/bin/%{gcc_target_arch}-gcc-ar%{binsuffix}
921
%{_prefix}/bin/%{gcc_target_arch}-gcc-nm%{binsuffix}
922
%{_prefix}/bin/%{gcc_target_arch}-gcc-ranlib%{binsuffix}
923
%{_prefix}/bin/%{gcc_target_arch}-lto-dump%{binsuffix}
924
%if 0%{!?gcc_libc_bootstrap:1}
925
%{_prefix}/bin/%{gcc_target_arch}-gcov%{binsuffix}
926
%{_prefix}/bin/%{gcc_target_arch}-gcov-dump%{binsuffix}
927
%{_prefix}/bin/%{gcc_target_arch}-gcov-tool%{binsuffix}
928
%{_prefix}/bin/%{gcc_target_arch}-gcov
929
%{_prefix}/bin/%{gcc_target_arch}-gcov-dump
930
%{_prefix}/bin/%{gcc_target_arch}-gcov-tool
931
%endif
932
%{_prefix}/bin/%{gcc_target_arch}-gcc
933
%{_prefix}/bin/%{gcc_target_arch}-cpp
934
%{_prefix}/bin/%{gcc_target_arch}-gcc-ar
935
%{_prefix}/bin/%{gcc_target_arch}-gcc-nm
936
%{_prefix}/bin/%{gcc_target_arch}-gcc-ranlib
937
%{_prefix}/bin/%{gcc_target_arch}-lto-dump
938
%ghost %{_sysconfdir}/alternatives/%{gcc_target_arch}-gcc
939
%ghost %{_sysconfdir}/alternatives/%{gcc_target_arch}-cpp
940
%ghost %{_sysconfdir}/alternatives/%{gcc_target_arch}-gcc-ar
941
%ghost %{_sysconfdir}/alternatives/%{gcc_target_arch}-gcc-nm
942
%ghost %{_sysconfdir}/alternatives/%{gcc_target_arch}-gcc-ranlib
943
%ghost %{_sysconfdir}/alternatives/%{gcc_target_arch}-lto-dump
944
%if 0%{!?gcc_libc_bootstrap:1}
945
%ghost %{_sysconfdir}/alternatives/%{gcc_target_arch}-gcov
946
%ghost %{_sysconfdir}/alternatives/%{gcc_target_arch}-gcov-dump
947
%ghost %{_sysconfdir}/alternatives/%{gcc_target_arch}-gcov-tool
948
%endif
949
%if %{build_cp}
950
%{_prefix}/bin/%{gcc_target_arch}-c++%{binsuffix}
951
%{_prefix}/bin/%{gcc_target_arch}-g++%{binsuffix}
952
%{_prefix}/bin/%{gcc_target_arch}-c++
953
%{_prefix}/bin/%{gcc_target_arch}-g++
954
%ghost %{_sysconfdir}/alternatives/%{gcc_target_arch}-c++
955
%ghost %{_sysconfdir}/alternatives/%{gcc_target_arch}-g++
956
%if 0%{!?gcc_libc_bootstrap:1}
957
%if "%{cross_arch}" == "avr" || 0%{?gcc_target_newlib:1} || 0%{?gcc_target_glibc:1}
958
%{_prefix}/include/c++
959
%endif
960
%endif
961
%endif
962
%dir %{targetlibsubdir}
963
%dir %{_libdir}/gcc/%{gcc_target_arch}
964
%{targetlibsubdir}
965
%endif
966
%if 0%{!?gcc_icecream:1} && 0%{!?gcc_libc_bootstrap:1} && 0%{?sysroot:1}
967
%{sysroot}
968
%endif
969
970
%if 0%{?gcc_icecream:%gcc_icecream}
971
%files -n cross-%cross_arch-gcc12-icecream-backend
972
%defattr(-,root,root)
973
/usr/share/icecream-envs
974
%endif
975
976
%if 0%{?nvptx_newlib:1}
977
%files -n cross-nvptx-newlib12-devel
978
%defattr(-,root,root)
979
%{_prefix}/%{gcc_target_arch}
980
%endif
981
982
%if 0%{?amdgcn_newlib:1}
983
%files -n cross-amdgcn-newlib12-devel
984
%defattr(-,root,root)
985
%{_prefix}/%{gcc_target_arch}
986
%{_prefix}/bin/amdgcn-amdhsa-ar
987
%{_prefix}/bin/amdgcn-amdhsa-as
988
%{_prefix}/bin/amdgcn-amdhsa-ld
989
%{_prefix}/bin/amdgcn-amdhsa-nm
990
%{_prefix}/bin/amdgcn-amdhsa-ranlib
991
%endif
992
993
%changelog
994