source: rtems/scripts/buildall @ e4b4a771

4.104.114.84.95
Last change on this file since e4b4a771 was e4b4a771, checked in by Joel Sherrill <joel.sherrill@…>, on 10/20/99 at 16:23:32

Generated files removed.

  • Property mode set to 100644
File size: 4.3 KB
Line 
1#! /bin/sh
2#
3#  Generate all the specs and then cycle through building them.
4#
5
6RTEMS_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.
14ALL_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}
20TARGETS="sh-rtems"
21
22binutils=990901
23gcc=2.95.1
24gdb=4.18
25newlib=1.8.2
26buildroot=/opt/tmp
27
28testing=yes
29do_binutils=yes
30do_gdb=yes
31do_gccnewlib=yes
32staging_dir=/usr3/rtems_cds/test_cd/linux
33
34#
35#  Now get started
36#
37start=`date`
38
39echo PATH=$PATH
40
41if [ ${testing} = yes ] ; then
42  ECHO=echo
43fi
44
45installed_count=`rpm -qa | grep rtems | wc -l`
46if [ ${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
54fi
55
56# Some linux distributions use /usr/src/packages
57# redhat uses /usr/src/redhat
58# others might use /usr/src
59if test -d /usr/src/packages/SPECS;
60then
61dst=/usr/src/packages/SPECS;
62elif test -d /usr/src/redhat/SPECS;
63 then
64dst=/usr/src/redhat/SPECS;
65elif test -d /usr/src/SPECS/;
66then
67dst=/usr/src/SPECS;
68fi
69
70if [ ${testing} = no ] ; then
71  cd ${RTEMS_DIR}/scripts
72  ./configure || exit 1
73  make        || exit 1
74fi
75
76#  Now generate all the specs
77for target in ${TARGETS}
78do
79  tspecs=`find . -name "${target}*"`
80  ${ECHO} cp -r ${tspecs} ${dst}
81done
82
83# clean up a bit before we start
84cd ${dst}
85test -d log || mkdir log
86
87#  do all the tools
88for target in ${TARGETS}
89do
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
144done
145
146if [ 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
168fi
169
170# Now we are done
171
172stop=`date`
173
174echo
175echo "Started:  " $start
176echo "Finished: " $stop
177exit 0
Note: See TracBrowser for help on using the repository browser.