source: rtems/scripts/buildalltar.in @ 64cc4bb5

4.104.114.84.95
Last change on this file since 64cc4bb5 was 302b76d, checked in by Joel Sherrill <joel.sherrill@…>, on 08/30/01 at 13:33:32

2001-08-30 Joel Sherrill <joel@…>

  • buildalltar.in: New file.
  • configure.in, Makefile.am: Modified to reflect addition of file.
  • Property mode set to 100644
File size: 7.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
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 "    -t                  -- enable test/debug mode"
21  echo "    -cfg <setup.cache>"
22  echo "    -o <rpm-spec-dir>"
23  exit 1 ;
24}
25
26testing=no
27do_binutils=no
28do_gccnewlib=no
29do_gdb=no
30
31while test $# -ge 1; do
32  case $1 in
33    -b) do_binutils=yes  ; shift;;
34    -g) do_gccnewlib=yes ; shift;;
35    -d) do_gdb=yes       ; shift;;
36    -t) do_test=yes      ; shift;;
37    -cfg)
38      test $# -ge 2 || usage
39      shift
40      CFG=$1
41      shift
42      ;;
43    -o)
44      test $# -ge 2 || usage
45      shift
46      dst=$1
47      shift
48      ;;
49    -*)
50      echo "invalid option $1";
51      usage
52      ;;
53    *)
54      TARGETS="${TARGETS} $1"
55      shift
56      ;;
57  esac
58done
59
60if test ${do_binutils} = no -a ${do_gccnewlib} = no -a ${do_gdb} = no ; then
61  echo "You must request building binutils, gcc/newlib, or gdb."
62  usage
63fi
64
65
66# This is the full list .. hppa1.1 does not build now.
67#ALL_TARGETS="hppa1.1-rtems i386-rtems i960-rtems m68k-rtems \
68#  m68k-rtemself mips-rtems mips64orion-rtems \
69#  powerpc-rtems sh-rtems sh-rtemself sparc-rtems"
70
71# This is the full buildable set.
72if [ "X${TARGETS}" = "X" ] ; then
73  # do not include c4x or hppa primary targets
74  # do not include sh-elf or i960-elf secondary targets
75  TARGETS="arm-rtems h8300-rtems i386-rtems i960-rtems m68k-rtems \
76    mips-rtems mips64orion-rtems powerpc-rtems sh-rtems sparc-rtems"
77fi
78
79. $CFG
80
81binutils=${binutils_version}
82gcc=${gcc_version}
83gdb=${gdb_version}
84newlib=${newlib_version}
85# also use binutils_rpm_release
86buildroot=/tmp
87
88#
89#  Now get started
90#
91start=`date`
92
93echo PATH=$PATH
94
95if [ ${testing} = yes ] ; then
96  ECHO=echo
97fi
98
99#installed_count=`rpm -q -g rtems | wc -l`
100#if [ ${installed_count} -ne 0 ] ; then
101#  echo This script should be run with NO rtems RPMs installed.
102#  echo It appears that the following rtems RPMs are installed:
103#  echo
104#  rpm -qa | grep rtems
105#  echo
106#  echo Please remove these and restart this script.
107#  exit 1
108#fi
109
110#echo Copying specs files.
111#if [ ${testing} = no ] ; then
112#  cd ${RTEMS_DIR}
113
114#  # ./configure || exit 1
115#  make        || exit 1
116#
117#  #  Now generate all the specs
118#  for target in ${TARGETS}
119#  do
120#    tspecs=`find . -name "${target}*"`
121#    if [ "X${tspecs}" = "X" ] ; then
122#      echo RPM specifications were not generated for ${tspec}.
123#      exit 1
124#    fi
125#    ${ECHO} cp -r ${tspecs} ${dst}
126#  done
127#fi
128
129# clean up a bit before we start
130cd ${dst}
131test -d log || mkdir log
132
133#  do all the tools
134for target in ${TARGETS}
135do
136  bintarfile=${PWD}/${target}-binutils-${binutils}-${binutils_rpm_release}.tar
137  if [ ${do_binutils} = yes ] ; then
138    # this part is for RPMS
139    logfile=log/${target}-binutils
140    #specfile=${dst}/${target}-binutils-${binutils}.spec
141    #echo "rpm -ba ${specfile} >${logfile} 2>&1"
142    #if [ ${testing} = no ] ; then
143    #  rpm -ba ${specfile} >${logfile} 2>&1
144    #fi
145    #${ECHO} rm -rf ${dst}/../BUILD/${target}-binutils*
146
147
148    # this part is for tar.bz2
149    PWD=`pwd`
150    mkdir b-${target}
151    cd b-${target}
152    ../binutils-${binutils}/configure --target=${target} \
153      --verbose --prefix=/opt/rtems
154    make all
155    make info
156    make prefix=${rpm_build_root}/opt/rtems install
157    make prefix=${rpm_build_root}/opt/rtems install-info         
158    cd ${buildroot}
159    tar cf ${PWD}/${target}-binutils-${binutils}-${binutils_rpm_release}.tar opt
160    cd ${PWD}
161    bzip2 -9 ${target}-binutils-${binutils}.tar
162    ${ECHO} rm -rf ${rpm_build_root}/opt
163    rm -rf ${rpm_build_root}/opt/rtems
164    rm -rf b-${target}
165  else
166    echo Skipping binutils for ${target}
167  fi
168
169  #
170  #  build gcc/newlib
171  #
172
173  if [ ${do_gccnewlib} = yes ] ; then
174    # now build gcc/newlib
175    #    NOTE: This requires having binutils installed and we immediately
176    #          remove it once finished.
177    #base_binutils_rpm=${dst}/../RPMS/${rpm_cpu}/rtems-base-binutils-${binutils}-${binutils_rpm_release}.${rpm_cpu}.rpm
178    #binutils_rpm=${dst}/../RPMS/${rpm_cpu}/${target}-binutils-${binutils}-${binutils_rpm_release}.${rpm_cpu}.rpm
179    #if [ ! -f ${binutils_rpm} ] ; then
180    #  echo There is no RPM for binutils for ${target}.
181    #  echo Looked for ${binutils_rpm}.
182    #fi
183    #${ECHO} rpm -i ${base_binutils_rpm}
184    #${ECHO} rpm -i ${binutils_rpm}
185
186    #logfile=log/${target}-gccnewlib
187    #specfile=${dst}/${target}-gcc-${gcc}-newlib-${newlib}.spec
188    #echo "rpm -ba ${specfile} >${logfile} 2>&1"
189    #if [ ${testing} = no ] ; then
190    #  rpm -ba ${specfile} >${logfile} 2>&1
191    #fi
192    #${ECHO} rm -rf ${dst}/../BUILD/${target}-gcc*
193    #${ECHO} rm -rf ${buildroot}/opt/rtems
194
195    #echo uninstalling binutils for ${target}
196    #if [ ${testing} = no ] ; then
197    #  rpm -e `rpm -qa | grep rtems`
198    #  rm -rf /opt/rtems/*
199    #fi
200 
201    # this part is for tar.bz2
202    PWD=`pwd`
203
204    gcctarfile=${PWD}/${target}-gcc-${gcc}-newlib-${newlib}-${gccnewlib_rpm_release}.tar
205    bintarfile=${dst}/binaries/binutils-${binutils}-${binutils_rpm_release}/${target}-binutils-${binutils}-${binutils_rpm_release}.tar
206    cd /
207    rm -rf /opt/*
208    bzcat ${bintarfile}.bz2 | tar xf -
209
210    cd ${PWD}
211    rm -rf b-${target}
212    mkdir b-${target}
213    cd b-${target}
214    ../gcc-${gcc}/configure --target=${target} \
215      --with-gnu-as --with-gnu-ld --with-newlib --verbose \
216      --enable-threads --prefix=/opt/rtems '--enable-languages=c,c++'
217    make all
218    make info
219    make prefix=${rpm_build_root}/opt/rtems install
220    make prefix=${rpm_build_root}/opt/rtems install-info         
221    cd ${target}/newlib
222    make prefix=${rpm_build_root}/opt/rtems install-info         
223    cd ${buildroot}
224    tar cf ${gcctarfile} opt
225    cd ${PWD}
226    bzip2 -9 ${gcctarfile}
227    rm -rf ${rpm_build_root}/opt
228    rm -rf ${rpm_build_root}/opt/rtems
229    rm -rf b-${target}
230  else
231    echo Skipping gcc/newlib for ${target}
232  fi
233
234  #
235  # build gdb
236  #
237
238  if [ ${do_gdb} = yes ] ; then
239    # now build gdb
240    #logfile=log/${target}-gdb
241    #specfile=${dst}/${target}-gdb-${gdb}.spec
242    #echo "rpm -ba ${specfile} >${logfile} 2>&1"
243    #if [ ${testing} = no ] ; then
244    #  rpm -ba ${specfile} >${logfile} 2>&1
245    #fi
246    #${ECHO} rm -rf ${dst}/../BUILD/${target}-gdb*
247    #${ECHO} rm -rf ${buildroot}/opt/rtems
248
249    # this part is for tar.bz2
250   
251    PWD=`pwd`
252    mkdir b-${target}
253    cd b-${target}
254    case ${target} in
255      arm* | d10v* | d30v* | erc32* | fr30* | h8300* | h8500* | i960* | \
256      m32r* | mcore* | mips* | mn10200* | mn10300* | sh* | sparc*| v850* | \
257      w65* | z8k*)
258        extra_configure_arguments="--enable-sim"
259        ;;
260     powerpc*)
261        extra_configure_arguments="--enable-sim --enable-sim-powerpc --enable-sim-timebase --enable-sim-hardware"
262        #  Enabling this causes the program image to be huge and causes
263        #  some gcc/hosts combinations to run out of memory.
264        #          --enable-sim-inline
265        ;;
266      *)
267        ;;
268esac
269    ../gdb-${gdb}/configure --target=${target} \
270      ${extra_configure_arguments} --verbose --prefix=/opt/rtems
271    make all
272    make info
273    make prefix=${rpm_build_root}/opt/rtems install
274    make prefix=${rpm_build_root}/opt/rtems install-info         
275    cd ${buildroot}
276    tar cf ${PWD}/${target}-gdb-${gdb}-${gdb_rpm_release}.tar opt
277    cd ${PWD}
278    bzip2 -9 ${target}-gdb-${gdb}.tar
279    ${ECHO} rm -rf ${rpm_build_root}/opt
280    rm -rf ${rpm_build_root}/opt/rtems
281    rm -rf b-${target}
282  else
283    echo Skipping gdb for ${target}
284  fi
285
286done
287
288# Now we are done
289
290stop=`date`
291
292echo
293echo "Started:  " $start
294echo "Finished: " $stop
295exit 0
Note: See TracBrowser for help on using the repository browser.