1 | #! /bin/sh |
---|
2 | # |
---|
3 | # Generate all the specs and then cycle through building them. |
---|
4 | # |
---|
5 | |
---|
6 | RTEMS_DIR=`dirname $0` |
---|
7 | CFG=user.cfg |
---|
8 | dst=@RPM_SPECSdir@ |
---|
9 | |
---|
10 | usage() |
---|
11 | { |
---|
12 | echo "$0 [options] <target_alias>" |
---|
13 | echo " options:" |
---|
14 | echo " -cfg <user.cfg>" |
---|
15 | echo " -o <rpm-spec-dir>" |
---|
16 | exit 1 ; |
---|
17 | } |
---|
18 | |
---|
19 | while test $# -ge 1; do |
---|
20 | case $1 in |
---|
21 | -cfg) |
---|
22 | test $# -ge 2 || usage |
---|
23 | shift |
---|
24 | CFG=$1 |
---|
25 | shift |
---|
26 | ;; |
---|
27 | -o) |
---|
28 | test $# -ge 2 || usage |
---|
29 | shift |
---|
30 | dst=$1 |
---|
31 | shift |
---|
32 | ;; |
---|
33 | -*) |
---|
34 | echo "invalid option $1"; |
---|
35 | usage |
---|
36 | ;; |
---|
37 | *) |
---|
38 | TARGETS="${TARGETS} $1" |
---|
39 | shift |
---|
40 | ;; |
---|
41 | esac |
---|
42 | done |
---|
43 | |
---|
44 | # This is the full list .. hppa1.1 does not build now. |
---|
45 | #ALL_TARGETS="hppa1.1-rtems i386-rtems i960-rtems m68k-rtems \ |
---|
46 | # m68k-rtemself mips64orion-rtems \ |
---|
47 | # powerpc-rtems sh-rtems sh-rtemself sparc-rtems" |
---|
48 | |
---|
49 | # This is the full buildable set. |
---|
50 | if [ "X${TARGETS}" = "X" ] ; then |
---|
51 | TARGETS="i386-rtems i960-rtems m68k-rtems \ |
---|
52 | m68k-rtemself mips64orion-rtems \ |
---|
53 | powerpc-rtems sh-rtems sh-rtemself sparc-rtems" |
---|
54 | fi |
---|
55 | |
---|
56 | . ./$CFG |
---|
57 | |
---|
58 | binutils=${binutils_version} |
---|
59 | gcc=${gcc_version} |
---|
60 | gdb=${gdb_version} |
---|
61 | newlib=${newlib_version} |
---|
62 | # also use binutils_rpm_release |
---|
63 | buildroot=/opt/tmp |
---|
64 | |
---|
65 | testing=yes |
---|
66 | do_binutils=yes |
---|
67 | do_gdb=yes |
---|
68 | do_gccnewlib=yes |
---|
69 | |
---|
70 | # |
---|
71 | # Now get started |
---|
72 | # |
---|
73 | start=`date` |
---|
74 | |
---|
75 | echo PATH=$PATH |
---|
76 | |
---|
77 | if [ ${testing} = yes ] ; then |
---|
78 | ECHO=echo |
---|
79 | fi |
---|
80 | |
---|
81 | installed_count=`rpm -qa | grep rtems | wc -l` |
---|
82 | if [ ${installed_count} -ne 0 ] ; then |
---|
83 | echo This script should be run with NO rtems RPMs installed. |
---|
84 | echo It appears that the following rtems RPMs are installed: |
---|
85 | echo |
---|
86 | rpm -qa | grep rtems |
---|
87 | echo |
---|
88 | echo Please remove these and restart this script. |
---|
89 | exit 1 |
---|
90 | fi |
---|
91 | |
---|
92 | echo Generating specs files. |
---|
93 | if [ ${testing} = no ] ; then |
---|
94 | cd ${RTEMS_DIR} |
---|
95 | ./configure || exit 1 |
---|
96 | make || exit 1 |
---|
97 | |
---|
98 | # Now generate all the specs |
---|
99 | for target in ${TARGETS} |
---|
100 | do |
---|
101 | tspecs=`find . -name "${target}*"` |
---|
102 | ${ECHO} cp -r ${tspecs} ${dst} |
---|
103 | done |
---|
104 | ${ECHO} make distclean |
---|
105 | fi |
---|
106 | |
---|
107 | # clean up a bit before we start |
---|
108 | cd ${dst} |
---|
109 | test -d log || mkdir log |
---|
110 | |
---|
111 | # do all the tools |
---|
112 | for target in ${TARGETS} |
---|
113 | do |
---|
114 | if [ ${do_binutils} = yes ] ; then |
---|
115 | logfile=log/${target}-binutils |
---|
116 | specfile=${dst}/${target}-binutils-${binutils}.spec |
---|
117 | echo "rpm -ba ${specfile} >${logfile} 2>&1" |
---|
118 | if [ ${testing} = no ] ; then |
---|
119 | rpm -ba ${specfile} >${logfile} 2>&1 |
---|
120 | fi |
---|
121 | ${ECHO} rm -rf ${dst}/../BUILD/${target}-binutils* |
---|
122 | ${ECHO} rm -rf ${buildroot}/opt |
---|
123 | else |
---|
124 | echo Skipping binutils for ${target} |
---|
125 | fi |
---|
126 | |
---|
127 | if [ ${do_gdb} = yes ] ; then |
---|
128 | # now build gdb |
---|
129 | logfile=log/${target}-gdb |
---|
130 | specfile=${dst}/${target}-gdb-${gdb}.spec |
---|
131 | echo "rpm -ba ${specfile} >${logfile} 2>&1" |
---|
132 | if [ ${testing} = no ] ; then |
---|
133 | rpm -ba ${specfile} >${logfile} 2>&1 |
---|
134 | fi |
---|
135 | ${ECHO} rm -rf ${dst}/../BUILD/${target}-gdb* |
---|
136 | ${ECHO} rm -rf ${buildroot}/opt |
---|
137 | else |
---|
138 | echo Skipping gdb for ${target} |
---|
139 | fi |
---|
140 | |
---|
141 | if [ ${do_gccnewlib} = yes ] ; then |
---|
142 | # now build gcc/newlib |
---|
143 | # NOTE: This requires having binutils installed and we immediately |
---|
144 | # remove it once finished. |
---|
145 | binutils_rpm=${dst}/../RPMS/i386/${target}-binutils-${binutils}-${binutils_rpm_release}.i386.rpm |
---|
146 | if [ ! -f ${binutils_rpm} ] ; then |
---|
147 | echo There is no RPM for binutils for ${target}. |
---|
148 | echo Looked for ${binutils_rpm}. |
---|
149 | fi |
---|
150 | ${ECHO} rpm -i ${binutils_rpm} |
---|
151 | |
---|
152 | logfile=log/${target}-gccnewlib |
---|
153 | specfile=${dst}/${target}-gcc-${gcc}-newlib-${newlib}.spec |
---|
154 | echo "rpm -ba ${specfile} >${logfile} 2>&1" |
---|
155 | if [ ${testing} = no ] ; then |
---|
156 | rpm -ba ${specfile} >${logfile} 2>&1 |
---|
157 | fi |
---|
158 | ${ECHO} rm -rf ${dst}/../BUILD/${target}-gcc* |
---|
159 | ${ECHO} rm -rf ${buildroot}/opt |
---|
160 | |
---|
161 | echo uninstalling binutils for ${target} |
---|
162 | if [ ${testing} = no ] ; then |
---|
163 | rpm -e `rpm -qa | grep rtems` |
---|
164 | fi |
---|
165 | else |
---|
166 | echo Skipping gcc/newlib for ${target} |
---|
167 | fi |
---|
168 | done |
---|
169 | |
---|
170 | # Now we are done |
---|
171 | |
---|
172 | stop=`date` |
---|
173 | |
---|
174 | echo |
---|
175 | echo "Started: " $start |
---|
176 | echo "Finished: " $stop |
---|
177 | exit 0 |
---|