source: rtems/scripts/buildall.in @ 58271f6

Last change on this file since 58271f6 was 58271f6, checked in by Joel Sherrill <joel.sherrill@…>, on 05/21/00 at 15:23:02

Added code to determine RPM CPU type for the host OS. This is
needed to determine that on x86-linux, RPM builds "i386" RPMs
while on Sparc/Solaris?, it builds "sparc" RPMs. Since the
buildall script installs the binutils RPM to build the gccnewlib
RPM, it needs to know this.

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