File change_spec of Package gcc43
#!/bin/bash
do_icecream=1
do_cross_static=1
do_cross_shared=1
rm -f gcc*.spec cross*.spec cross*.changes
# 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
# disabled: mips, sparc, alpha, arm
if test "$do_icecream" = 1 ; then
for arch in hppa i386 x86_64 s390 s390x ppc ppc64 ia64; do
{ sed -n -e '1,/COMMON-BEGIN/p' cross-icecream.spec.in
sed -n -e '/COMMON-BEGIN/,/COMMON-END/p' $outfile
sed -n -e '/COMMON-END/,$p' cross-icecream.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
fi
export outfile
# avr is static but wants the non-static versioned name
if test "$do_cross_static" = 1 ; then
echo '%define build_static 1' > cross-avr-gcc$base_ver.spec
cross_arch=avr name_suffix="43" sh cross.spec.in >> cross-avr-gcc$base_ver.spec
test -f gcc*.changes && ln -f gcc*.changes cross-avr-gcc$base_ver.changes
fi
if test "$do_cross_shared" = 1 ; then
# shared cross
for arch in spu; do
cross_arch=$arch name_suffix="" sh cross.spec.in > cross-$arch-gcc.spec
test -f gcc*.changes && ln -f gcc*.changes cross-$arch-gcc.changes
done
fi
if test "$do_cross_static" = 1 ; then
# static cross
# for arch in spu i586 x86_64 s390x s390 sparc powerpc powerpc64; do
for arch in spu; do
echo '%define build_static 1' > cross-$arch-gcc-static.spec
cross_arch=$arch name_suffix="-static" sh cross.spec.in >> cross-$arch-gcc-static.spec
test -f gcc*.changes && ln -f gcc*.changes cross-$arch-gcc-static.changes
done
fi
exit 0