File change_spec of Package cross-riscv64-elf-gcc10
129
1
#!/bin/bash
2
3
do_crosses=1
4
do_optional_compiler_languages=0
5
rm -f gcc*-testresults.spec gcc*-testresults.changes gcc*.spec cross*.spec cross*.changes
6
7
# Default is to generate the normal gcc package
8
# unless a parameter is given. In case that it is '-*',
9
# that parameter will be used as suffix for the package name
10
# and as suffix for the install path (/opt/gccSUFFIX)
11
# In case that it is '[0-9]*', that parameter will be used
12
# as a suffix for a versioned package name.
13
14
if [ $# -lt 1 ]; then
15
echo No package suffix given
16
outfile=gcc.spec
17
else
18
case $1 in
19
[0-9]*)
20
base_ver=$1
21
outfile=gcc$1.spec
22
;;
23
*)
24
echo Invalid package suffix
25
exit 1
26
;;
27
esac
28
fi
29
30
: > $outfile
31
if test "$do_optional_compiler_languages" = "1"; then
32
echo '%define build_optional_compiler_languages 1' >> $outfile
33
fi
34
sed -e 's%@base_ver@%'$base_ver'%g' \
35
gcc.spec.in \
36
| sed -n -e '{
37
/^# PACKAGE-BEGIN/h
38
/^# PACKAGE-BEGIN/,/^# PACKAGE-END/H
39
/^# PACKAGE-BEGIN/,/^# PACKAGE-END/!p
40
/^# PACKAGE-END/{g
41
s/@variant@//g
42
p
43
g
44
s/@variant@/-32bit/g
45
p
46
g
47
s/@variant@/-64bit/g
48
p
49
}
50
}' >> $outfile
51
52
echo '%define building_testsuite 1' > gcc$base_ver-testresults.spec
53
echo '%define run_tests 1' >> gcc$base_ver-testresults.spec
54
sed -e '/^# GCC-TESTSUITE-DELETE-BEGIN/,/^# GCC-TESTSUITE-DELETE-END/d;s/-n gcc@base_ver@-testresults$//g;s/^Name:[[:space:]]*gcc@base_ver@/Name: gcc@base_ver@-testresults/g' \
55
gcc.spec.in \
56
| sed -e 's%@base_ver@%'$base_ver'%g' \
57
>> gcc$base_ver-testresults.spec
58
test -f gcc$base_ver.changes \
59
&& ( ln -f gcc$base_ver.changes gcc$base_ver-testresults.changes; )
60
61
62
63
add_cross() {
64
local pkgname="$1"; shift
65
local rpmtarget="$1"; shift
66
local triplet="$1"; shift
67
68
echo "%define pkgname $pkgname" > $pkgname.spec
69
echo "%define cross_arch $rpmtarget" >> $pkgname.spec
70
echo "%define gcc_target_arch $triplet" >> $pkgname.spec
71
echo "$@" >> $pkgname.spec
72
{ sed -n -e '1,/SRC-COMMON-BEGIN/p' cross.spec.in
73
sed -n -e '/SRC-COMMON-BEGIN/,/SRC-COMMON-END/p' $outfile
74
sed -n -e '/SRC-COMMON-END/,/BUILD-COMMON-BEGIN/p' cross.spec.in
75
sed -n -e '/BUILD-COMMON-BEGIN/,/BUILD-COMMON-END/p' $outfile
76
sed -n -e '/BUILD-COMMON-END/,$p' cross.spec.in; } |
77
sed -e "s#@base_ver@#$base_ver#" \
78
-e "s/^\(ExclusiveArch.*\) $rpmtarget[^ \r]*/\1 /" \
79
>> $pkgname.spec
80
test -f gcc$base_ver.changes && ln -f gcc$base_ver.changes $pkgname.changes
81
}
82
83
add_newlib_cross() {
84
add_cross $1-bootstrap $2 $3 "%define gcc_target_newlib 1
85
%define gcc_libc_bootstrap 1"
86
add_cross $1 $2 $3 "%define gcc_target_newlib 1"
87
}
88
89
# We now support "proper" cross-compilers to suse targets via a
90
# cross-glibc package, enable that via for example
91
#
92
# add_cross cross-aarch64-gcc$base_ver aarch64 aarch64-suse-linux
93
#
94
# For now keep the old way of doing things
95
if test "$do_crosses" = 1 ; then
96
add_cross cross-aarch64-gcc$base_ver aarch64 aarch64-suse-linux %define gcc_icecream 1
97
add_cross cross-arm-gcc$base_ver arm arm-suse-linux-gnueabi %define gcc_icecream 1
98
add_cross cross-avr-gcc$base_ver-bootstrap avr avr "%define gcc_libc_bootstrap 1"
99
add_cross cross-avr-gcc$base_ver avr avr
100
add_cross cross-i386-gcc$base_ver i386 i586-suse-linux %define gcc_icecream 1
101
add_cross cross-x86_64-gcc$base_ver x86_64 x86_64-suse-linux %define gcc_icecream 1
102
add_cross cross-s390x-gcc$base_ver s390x s390x-suse-linux %define gcc_icecream 1
103
add_cross cross-sparc-gcc$base_ver sparcv9 sparc-suse-linux %define gcc_icecream 1
104
add_cross cross-sparc64-gcc$base_ver sparc64 sparc64-suse-linux %define gcc_icecream 1
105
add_cross cross-ppc64-gcc$base_ver ppc64 powerpc64-suse-linux %define gcc_icecream 1
106
add_cross cross-ppc64le-gcc$base_ver ppc64le powerpc64le-suse-linux %define gcc_icecream 1
107
add_cross cross-m68k-gcc$base_ver m68k m68k-suse-linux %define gcc_icecream 1
108
add_cross cross-mips-gcc$base_ver mips mips-suse-linux %define gcc_icecream 1
109
add_cross cross-hppa-gcc$base_ver hppa hppa-suse-linux %define gcc_icecream 1
110
add_cross cross-riscv64-gcc$base_ver riscv64 riscv64-suse-linux %define gcc_icecream 1
111
add_newlib_cross cross-arm-none-gcc$base_ver arm-none arm-none-eabi
112
add_newlib_cross cross-epiphany-gcc$base_ver epiphany epiphany-elf
113
#add_newlib_cross cross-nds32le-gcc$base_ver nds32le nds32le-elf
114
add_newlib_cross cross-riscv64-elf-gcc$base_ver riscv64 riscv64-elf
115
#add_newlib_cross cross-rl78-gcc$base_ver rl78 rl78-elf
116
add_newlib_cross cross-rx-gcc$base_ver rx rx-elf
117
fi
118
# the nvptx and amdgcn crosses are used for offloading
119
add_cross cross-nvptx-gcc$base_ver nvptx nvptx-none %define gcc_accel 1
120
add_cross cross-amdgcn-gcc$base_ver amdgcn amdgcn-amdhsa %define gcc_accel 1
121
122
for f in *.spec; do
123
sed -i -e '/^# .*-\(BEGIN\|END\)$/d' $f
124
done
125
126
osc service localrun format_spec_file
127
128
exit 0
129