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