source: rtems/scripts/buildall.in @ df49c60

4.104.114.84.95
Last change on this file since df49c60 was df49c60, checked in by Joel Sherrill <joel.sherrill@…>, on Jun 12, 2000 at 3:00:15 PM

Merged from 4.5.0-beta3a

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