source: rtems/scripts/buildalltar.in @ 180a2ebd

4.104.114.84.95
Last change on this file since 180a2ebd was 180a2ebd, checked in by Joel Sherrill <joel.sherrill@…>, on 01/27/03 at 16:38:54

2003-01-27 RTEMS

  • buildalltar.in, setup.def: Tool update including binaries for Cygwin with a special RTEMS user account.
  • Property mode set to 100644
File size: 8.5 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
8#dst=/usr/src/redhat/SPECS
9dst=`pwd`
10target=@target@
11rpm_cpu=i386
12
13usage()
14{
15  echo "$0 [options] <target_alias>"
16  echo "  options:"
17  echo "    -b                  -- build binutils"
18  echo "    -g                  -- build gcc/newlib"
19  echo "    -d                  -- build gdb"
20  echo "    -C HOST             -- build canadian cross for HOST "
21  echo "    -t                  -- enable test/debug mode"
22  echo "    -cfg <setup.cache>"
23  echo "    -o <rpm-spec-dir>"
24  exit 1 ;
25}
26
27#   
28#  Checks the status returned by executables and exits if it is non-zero.
29#
30check_fatal()
31{
32  if [ $1 -ne 0 ] ; then
33    shift
34    echo "ERROR: $*" >&2
35    exit 1
36  fi
37  #echo
38  #echo "End of $*"
39  #echo -n "Press return to continue> "
40  #echo
41  #read line
42}
43
44testing=no
45do_binutils=no
46do_gccnewlib=no
47do_gdb=no
48cdn_cross=no
49
50while test $# -ge 1; do
51  case $1 in
52    -b) do_binutils=yes  ; shift;;
53    -g) do_gccnewlib=yes ; shift;;
54    -d) do_gdb=yes       ; shift;;
55    -t) do_test=yes      ; shift;;
56    -cfg)
57      test $# -ge 2 || usage
58      shift
59      CFG=$1
60      shift
61      ;;
62    -o)
63      test $# -ge 2 || usage
64      shift
65      dst=$1
66      shift
67      ;;
68    -C)
69      test $# -ge 2 || usage
70      shift
71      build=$1
72      shift
73      if ! test -x ${RTEMS_DIR}/../config.guess ; then
74        echo "Missing ${RTEMS_DIR}/../config.guess!"
75        exit 1
76      fi
77      CDN_ARGS="--build=`${RTEMS_DIR}/../config.guess` --host=${build}"
78      cdn_cross=yes
79      ;;
80    -*)
81      echo "invalid option $1";
82      usage
83      ;;
84    *)
85      TARGETS="${TARGETS} $1"
86      shift
87      ;;
88  esac
89done
90
91if test ${do_binutils} = no -a ${do_gccnewlib} = no -a ${do_gdb} = no ; then
92  echo "You must request building binutils, gcc/newlib, or gdb."
93  usage
94fi
95
96
97# This is the full list .. hppa1.1 does not build now.
98#ALL_TARGETS="arm-rtems h8300-rtems hppa1.1-rtems i386-rtems i960-rtems \
99#    m68k-rtems mips64orion-rtems mips-rtems or32-rtems powerpc-rtems  \
100#    sh-rtems sh-rtemself sparc-rtems"
101
102# This is the full buildable set.
103if [ "X${TARGETS}" = "X" ] ; then
104  # do not include c4x or hppa primary targets
105  # do not include sh-elf or i960-elf secondary targets
106  TARGETS="arm-rtems h8300-rtems hppa1.1-rtems i386-rtems \
107     m68k-rtems mips64orion-rtems mips-rtems powerpc-rtems  \
108     sh-rtems sh-rtemself sparc-rtems"
109fi
110
111. $CFG
112
113# override the one from $CFG since it likely has a % in it to use the
114# .rpmrc setting which we can't use
115rpm_build_root=${HOME}/tmp
116
117binutils=${binutils_version}
118gcc=${gcc3_version}
119gdb=${gdb_version}
120newlib=${gcc3newlib_version}
121# also use binutils_rpm_release
122
123#
124#  Now get started
125#
126start=`date`
127
128echo PATH=$PATH
129
130if [ ${testing} = yes ] ; then
131  ECHO=echo
132fi
133
134#installed_count=`rpm -q -g rtems | wc -l`
135#if [ ${installed_count} -ne 0 ] ; then
136#  echo This script should be run with NO rtems RPMs installed.
137#  echo It appears that the following rtems RPMs are installed:
138#  echo
139#  rpm -qa | grep rtems
140#  echo
141#  echo Please remove these and restart this script.
142#  exit 1
143#fi
144
145#echo Copying specs files.
146#if [ ${testing} = no ] ; then
147#  cd ${RTEMS_DIR}
148
149#  # ./configure || exit 1
150#  make        || exit 1
151#
152#  #  Now generate all the specs
153#  for target in ${TARGETS}
154#  do
155#    tspecs=`find . -name "${target}*"`
156#    if [ "X${tspecs}" = "X" ] ; then
157#      echo RPM specifications were not generated for ${tspec}.
158#      exit 1
159#    fi
160#    ${ECHO} cp -r ${tspecs} ${dst}
161#  done
162#fi
163
164# clean up a bit before we start
165cd ${dst}
166test -d log || mkdir log
167
168if [ "X${rpm_build_root}" = "X" ] ; then
169  echo rpm_build_root NOT set!
170  exit 1
171fi
172
173CWD=`pwd`
174test -d tarballs || mkdir tarballs
175
176OUT=${CWD}/tarballs
177
178#  do all the tools
179for target in ${TARGETS}
180do
181  bintarfile=${OUT}/${target}-binutils-${binutils}-${binutils_rpm_release}.tar
182  if [ ${do_binutils} = yes ] ; then
183    logfile=${CWD}/log/${target}-binutils
184    # this part is for tar.bz2
185    cd ${CWD}
186    if [ ! -d binutils-${binutils} ] ; then
187      echo Could not find binutils-${binutils}!
188      exit 1
189    fi
190    rm -rf b-${target}-bin
191    mkdir b-${target}-bin
192    cd b-${target}-bin
193    echo "Building binutils-${binutils} for ${target}"
194    ../binutils-${binutils}/configure ${CDN_ARGS} --target=${target} \
195      --verbose --prefix=/opt/rtems   >${logfile} 2>&1
196    check_fatal $? "binutils configure"
197
198    make all >>${logfile} 2>&1
199    check_fatal $? "make all"
200
201    make info >>${logfile} 2>&1
202    check_fatal $? "make info"
203
204    make prefix=${rpm_build_root}/opt/rtems install >>${logfile} 2>&1
205    check_fatal $? "make install"
206
207    make prefix=${rpm_build_root}/opt/rtems install-info >>${logfile} 2>&1
208    check_fatal $? "make install-info"
209
210    cd ${rpm_build_root}
211    tar cjf ${bintarfile}.bz2 opt
212    cd ${CWD}
213    rm -rf b-${target}-bin
214    ${ECHO} rm -rf ${rpm_build_root}/opt
215    rm -rf ${rpm_build_root}/opt
216  else
217    echo Skipping binutils for ${target}
218  fi
219
220  #
221  #  build gcc/newlib
222  #
223
224  if [ ${do_gccnewlib} = yes ] ; then
225    logfile=${CWD}/log/${target}-gccnewlib
226    # now build gcc/newlib
227    # this part is for tar.bz2
228
229    gcctarfile=${OUT}/${target}-gcc-${gcc}-newlib-${newlib}-${gccnewlib_rpm_release}.tar
230    if [ ${cdn_cross} = "no" ] ; then
231      bintarfile=${dst}/binaries/binutils-${binutils}-${binutils_rpm_release}/${target}-binutils-${binutils}-${binutils_rpm_release}.tar
232      rm -rf ${rpm_build_root}/opt/*
233      tar xjf ${bintarfile}.bz2
234    fi
235
236    cd ${CWD}
237    if [ ! -d gcc-${gcc} ] ; then
238      echo Could not find gcc-${gcc}!
239      exit 1
240    fi
241    if [ ! -d gcc-${gcc}/newlib ] ; then
242      echo Could not find gcc-${gcc}/newlib!
243      exit 1
244    fi
245    rm -rf b-${target}-gccnewlib
246    mkdir b-${target}-gccnewlib
247    cd b-${target}-gccnewlib
248    echo "Building gcc-${gcc} for ${target}"
249    ../gcc-${gcc}/configure ${CDN_ARGS} --target=${target} \
250      --with-gnu-as --with-gnu-ld --with-newlib --verbose \
251      --with-system-zlib --disable-nls \
252      --enable-version-specific-runtime-libs \
253      --enable-threads=rtems  \
254      --prefix=/opt/rtems '--enable-languages=c,c++' >${logfile} 2>&1
255    check_fatal $? "gcc configure"
256
257    make all >>${logfile} 2>&1
258    check_fatal $? "make all"
259
260    make info >>${logfile} 2>&1
261    check_fatal $? "make info"
262
263    make prefix=${rpm_build_root}/opt/rtems install >>${logfile} 2>&1
264    check_fatal $? "make install"
265
266    cd ${target}/newlib
267    make prefix=${rpm_build_root}/opt/rtems install-info  >>${logfile} 2>&1
268    check_fatal $? "newlib make install-info"
269
270    cd ${rpm_build_root}
271    tar cjf ${gcctarfile}.bz2 opt
272    cd ${CWD}
273    rm -rf ${rpm_build_root}/opt
274    rm -rf ${rpm_build_root}/opt/rtems
275    rm -rf b-${target}-gccnewlib
276  else
277    echo Skipping gcc/newlib for ${target}
278  fi
279
280  #
281  # build gdb
282  #
283
284  if [ ${do_gdb} = yes ] ; then
285    # now build gdb
286    gdbtarfile=${OUT}/${target}-gdb-${gdb}-${gdb_rpm_release}.tar
287    logfile=${CWD}/log/${target}-gdb
288
289    # this part is for tar.bz2
290   
291    if [ ! -d gdb-${gdb} ] ; then
292      echo Could not find gdb-${gdb}!
293      exit 1
294    fi
295    mkdir b-${target}-gdb
296    cd b-${target}-gdb
297    case ${target} in
298      arm* | d10v* | d30v* | erc32* | fr30* | h8300* | h8500* | i960* | \
299      m32r* | mcore* | mips* | mn10200* | mn10300* | sh* | sparc*| v850* | \
300      w65* | z8k*)
301        extra_configure_arguments="--enable-sim"
302        ;;
303     powerpc*)
304        extra_configure_arguments="--enable-sim --enable-sim-powerpc --enable-sim-timebase --enable-sim-hardware"
305        #  Enabling this causes the program image to be huge and causes
306        #  some gcc/hosts combinations to run out of memory.
307        #          --enable-sim-inline
308        ;;
309      *)
310        ;;
311esac
312    echo "Building gdb-${gdb}/configure ${CDN_ARGS} --target=${target}"
313    ../gdb-${gdb}/configure ${CDN_ARGS} --target=${target} \
314      ${extra_configure_arguments} --verbose --prefix=/opt/rtems >${logfile} 2>&1
315    check_fatal $? "make info"
316
317    make all >>${logfile} 2>&1
318    check_fatal $? "make all"
319
320    make info >>${logfile} 2>&1
321    check_fatal $? "make info"
322
323    make prefix=${rpm_build_root}/opt/rtems install >>${logfile} 2>&1
324    check_fatal $? "make install"
325
326    make prefix=${rpm_build_root}/opt/rtems install-info >>${logfile} 2>&1
327    check_fatal $? "make install-info"
328
329    cd ${rpm_build_root}
330    tar cjf ${gdbtarfile}.bz2 opt
331    cd ${CWD}
332    ${ECHO} rm -rf ${rpm_build_root}/opt
333    rm -rf ${rpm_build_root}/opt/rtems
334    rm -rf b-${target}-gdb
335  else
336    echo Skipping gdb for ${target}
337  fi
338
339done
340
341# Now we are done
342
343stop=`date`
344
345echo
346echo "Started:  " $start
347echo "Finished: " $stop
348exit 0
Note: See TracBrowser for help on using the repository browser.