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