remove unused files
[platform/upstream/gcc48.git] / packaging / change_spec
1 #!/bin/bash
2
3 do_icecream=1
4 do_cross_static=0
5 do_cross_shared=1
6 do_optional_compiler_languages=0
7 rm -f libgcj*.spec libgcj*.changes libffi*.spec libffi*.changes gcc*.spec cross*.spec cross*.changes
8
9 # Default is to generate the normal gcc package
10 # unless a parameter is given.  In case that it is '-*',
11 # that parameter will be used as suffix for the package name
12 # and as suffix for the install path (/opt/gccSUFFIX)
13 # In case that it is '[0-9]*', that parameter will be used
14 # as a suffix for a versioned package name.
15
16 if [ $# -lt 1 ]; then
17         outfile=gcc.spec
18 else
19         case $1 in
20         [0-9]*)
21           base_ver=$1
22           outfile=gcc$1.spec
23         ;;
24         *)
25           exit 1
26         ;;
27         esac
28 fi
29
30         : > $outfile
31         if test "$do_optional_compiler_languages" = "1"; then
32             echo '%define run_tests 1' >> $outfile
33             echo '%define build_optional_compiler_languages 1' >> $outfile
34         fi
35         sed -e 's%@base_ver@%'$base_ver'%g' \
36             gcc.spec.in \
37         | sed -n -e '{
38 /^# PACKAGE-BEGIN/h
39 /^# PACKAGE-BEGIN/,/^# PACKAGE-END/H
40 /^# PACKAGE-BEGIN/,/^# PACKAGE-END/!p
41 /^# PACKAGE-END/{g
42 s/@variant@//g
43 p
44 g
45 s/@variant@/-32bit/g
46 p
47 g
48 s/@variant@/-64bit/g
49 p
50 }
51 }' >> $outfile
52
53 # disabled: mips, sparc, alpha
54 if test "$do_icecream" = 1 ; then
55   for arch in x86_64 armv7hl armv7l; do
56     exclarch=`echo $arch | sed -e 's/ppc$/ppc64/'`
57     { sed -n -e '1,/COMMON-BEGIN/p' cross-icecream.spec.in
58       sed -n -e '/COMMON-BEGIN/,/COMMON-END/p' $outfile
59       sed -n -e '/COMMON-END/,$p' cross-icecream.spec.in; } |
60     sed -e "s#@cross_arch@#$arch#" \
61         -e "s#@base_ver@#$base_ver#" \
62         -e "s/^\(ExclusiveArch.*\) $exclarch /\1 /" \
63         > cross-$arch-gcc$base_ver-icecream-backend.spec
64     test -f gcc$base_ver.changes && ln -f gcc$base_ver.changes cross-$arch-gcc$base_ver-icecream-backend.changes
65   done
66 fi
67
68 export outfile
69 if test "$do_cross_shared" = 1 ; then
70   # shared cross
71   for arch in ; do
72     base_ver=$base_ver cross_arch=$arch sh cross.spec.in > cross-$arch-gcc$base_ver.spec
73     test -f gcc$base_ver.changes && ln -f gcc$base_ver.changes cross-$arch-gcc$base_ver.changes
74   done
75 fi
76 if test "$do_cross_static" = 1 ; then
77   # static crosses
78   for arch in ; do
79     echo '%define build_static 1' > cross-$arch-gcc$base_ver-static.spec
80     base_ver=$base_ver cross_arch=$arch name_suffix="-static" sh cross.spec.in >> cross-$arch-gcc$base_ver-static.spec
81     test -f gcc$base_ver.changes && ln -f gcc$base_ver.changes cross-$arch-gcc$base_ver-static.changes
82   done
83 #  # avr is static but wants the non-static versioned name
84 #  echo '%define build_static 1' > cross-avr-gcc$base_ver.spec
85 #  base_ver=$base_ver cross_arch=avr sh cross.spec.in >> cross-avr-gcc$base_ver.spec
86 #  test -f gcc$base_ver.changes && ln -f gcc$base_ver.changes cross-avr-gcc$base_ver.changes
87 fi
88
89 for f in *.spec; do
90   sed -i -e '/^# .*-\(BEGIN\|END\)$/d' $f
91 done
92
93 exit 0