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