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