OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [scripts/] [buildall.in] - Blame information for rev 173

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
#! /bin/sh
2
#
3
#  Generate all the specs and then cycle through building them.
4
#
5
 
6
RTEMS_DIR=`dirname $0`
7
CFG=./setup.cache
8
dst=@RPM_SPECSdir@
9
target=@target@
10
rpm_cpu=@RPM_CPU@
11
 
12
usage()
13
{
14
  echo "$0 [options] "
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 "
21
  echo "    -o "
22
  exit 1 ;
23
}
24
 
25
testing=no
26
do_binutils=no
27
do_gccnewlib=no
28
do_gdb=no
29
 
30
while 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
57
done
58
 
59
if 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
62
fi
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.
71
if [ "X${TARGETS}" = "X" ] ; then
72
  TARGETS="i386-rtems i960-rtems m68k-rtems \
73
    mips64orion-rtems powerpc-rtems sh-rtems sparc-rtems"
74
fi
75
 
76
. $CFG
77
 
78
binutils=${binutils_version}
79
gcc=${gcc_version}
80
gdb=${gdb_version}
81
newlib=${newlib_version}
82
# also use binutils_rpm_release
83
buildroot=/tmp
84
 
85
#
86
#  Now get started
87
#
88
start=`date`
89
 
90
echo PATH=$PATH
91
 
92
if [ ${testing} = yes ] ; then
93
  ECHO=echo
94
fi
95
 
96
installed_count=`rpm -q -g rtems | wc -l`
97
if [ ${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
105
fi
106
 
107
echo Copying specs files.
108
if [ ${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
124
fi
125
 
126
# clean up a bit before we start
127
cd ${dst}
128
test -d log || mkdir log
129
 
130
#  do all the tools
131
for target in ${TARGETS}
132
do
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
 
199
done
200
 
201
# Now we are done
202
 
203
stop=`date`
204
 
205
echo
206
echo "Started:  " $start
207
echo "Finished: " $stop
208
exit 0

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.