source: rtems/scripts-ada/buildall.in @ 64ab2e9

4.104.114.84.95
Last change on this file since 64ab2e9 was 64ab2e9, checked in by Joel Sherrill <joel.sherrill@…>, on 01/26/00 at 19:56:54

First cut at adding RPM scripts for building GNAT/RTEMS RPMs.

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