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