File change_spec of Package gcc33
#!/bin/bash
rm -f gcc*.spec cross*.spec cross*.changes
if [ -f gcc-mainline.changes ] ; then
mv gcc-mainline.changes gcc.changes
fi
# Default is to generate the normal gcc package
# unless a parameter is given. In case that it is '-*',
# that parameter will be used as suffix for the package name
# and as suffix for the install path (/opt/gccSUFFIX)
# In case that it is '[0-9]*', that parameter will be used
# as a suffix for a versioned package name.
if [ $# -lt 1 ]; then
outfile=gcc.spec
else
case $1 in
[0-9]*)
base_ver=$1
outfile=gcc$1.spec
;;
*)
exit 1
;;
esac
fi
sed -e 's%@base_ver@%'$base_ver'%g' \
gcc.spec.in \
| sed -n -e '{
/^# PACKAGE-BEGIN/h
/^# PACKAGE-BEGIN/,/^# PACKAGE-END/H
/^# PACKAGE-BEGIN/,/^# PACKAGE-END/!p
/^# PACKAGE-END/{g
s/@variant@//g
p
g
s/@variant@/-32bit/g
p
g
s/@variant@/-64bit/g
p
}
}' > $outfile
echo '%define building_libjava 1' > libgcj$base_ver.spec
echo '%define run_tests 1' >> libgcj$base_ver.spec
sed -e '/^# LIBJAVA-DELETE-BEGIN/,/^# LIBJAVA-DELETE-END/d;s/-n libgcj@base_ver@$//g;s/^Name:[[:space:]]*gcc/Name: libgcj/g' \
gcc.spec.in \
| sed -e 's%@base_ver@%'$base_ver'%g' \
| sed -n -e '{
/^# PACKAGE-BEGIN/h
/^# PACKAGE-BEGIN/,/^# PACKAGE-END/H
/^# PACKAGE-BEGIN/,/^# PACKAGE-END/!p
/^# PACKAGE-END/{g
s/@variant@//g
p
g
s/@variant@/-32bit/g
p
g
s/@variant@/-64bit/g
p
}
}' >> libgcj$base_ver.spec
test -f gcc$base_ver.changes && ln -f gcc$base_ver.changes libgcj$base_ver.changes
# early out for non-default gcc
exit 0
# disabled: mips, sparc
for arch in alpha hppa arm i386 x86_64 s390 s390x ppc ppc64 ia64; do
{ sed -n -e '1,/COMMON-BEGIN/p' cross.spec.in
sed -n -e '/COMMON-BEGIN/,/COMMON-END/p' $outfile
sed -n -e '/COMMON-END/,$p' cross.spec.in; } |
sed -e "s#@cross_arch@#$arch#" > cross-$arch-gcc-icecream-backend.spec
test -f gcc*.changes && ln -f gcc*.changes cross-$arch-gcc-icecream-backend.changes
done
## non-icecream cross compilers.
export outfile
for arch in avr; do
cross_arch=$arch sh micro-cross.spec.in > cross-$arch-gcc.spec
test -f gcc*.changes && ln -f gcc*.changes cross-$arch-gcc.changes
done
exit 0