#! /bin/sh
|
#! /bin/sh
|
#
|
#
|
# Generate all the specs and then cycle through building them.
|
# Generate all the specs and then cycle through building them.
|
#
|
#
|
|
|
RTEMS_DIR=`dirname $0`
|
RTEMS_DIR=`dirname $0`
|
CFG=./setup.cache
|
CFG=./setup.cache
|
dst=@RPM_SPECSdir@
|
dst=@RPM_SPECSdir@
|
target=@target@
|
target=@target@
|
rpm_cpu=@RPM_CPU@
|
rpm_cpu=@RPM_CPU@
|
|
|
usage()
|
usage()
|
{
|
{
|
echo "$0 [options] "
|
echo "$0 [options] "
|
echo " options:"
|
echo " options:"
|
echo " -b -- build binutils"
|
echo " -b -- build binutils"
|
echo " -g -- build gcc/newlib"
|
echo " -g -- build gcc/newlib"
|
echo " -d -- build gdb"
|
echo " -d -- build gdb"
|
echo " -t -- enable test/debug mode"
|
echo " -t -- enable test/debug mode"
|
echo " -cfg "
|
echo " -cfg "
|
echo " -o "
|
echo " -o "
|
exit 1 ;
|
exit 1 ;
|
}
|
}
|
|
|
testing=no
|
testing=no
|
do_binutils=no
|
do_binutils=no
|
do_gccnewlib=no
|
do_gccnewlib=no
|
do_gdb=no
|
do_gdb=no
|
|
|
while test $# -ge 1; do
|
while test $# -ge 1; do
|
case $1 in
|
case $1 in
|
-b) do_binutils=yes ; shift;;
|
-b) do_binutils=yes ; shift;;
|
-g) do_gccnewlib=yes ; shift;;
|
-g) do_gccnewlib=yes ; shift;;
|
-d) do_gdb=yes ; shift;;
|
-d) do_gdb=yes ; shift;;
|
-t) do_test=yes ; shift;;
|
-t) do_test=yes ; shift;;
|
-cfg)
|
-cfg)
|
test $# -ge 2 || usage
|
test $# -ge 2 || usage
|
shift
|
shift
|
CFG=$1
|
CFG=$1
|
shift
|
shift
|
;;
|
;;
|
-o)
|
-o)
|
test $# -ge 2 || usage
|
test $# -ge 2 || usage
|
shift
|
shift
|
dst=$1
|
dst=$1
|
shift
|
shift
|
;;
|
;;
|
-*)
|
-*)
|
echo "invalid option $1";
|
echo "invalid option $1";
|
usage
|
usage
|
;;
|
;;
|
*)
|
*)
|
TARGETS="${TARGETS} $1"
|
TARGETS="${TARGETS} $1"
|
shift
|
shift
|
;;
|
;;
|
esac
|
esac
|
done
|
done
|
|
|
if test ${do_binutils} = no -a ${do_gccnewlib} = no -a ${do_gdb} = no ; then
|
if test ${do_binutils} = no -a ${do_gccnewlib} = no -a ${do_gdb} = no ; then
|
echo "You must request building binutils, gcc/newlib, or gdb."
|
echo "You must request building binutils, gcc/newlib, or gdb."
|
usage
|
usage
|
fi
|
fi
|
|
|
|
|
# This is the full list .. hppa1.1 does not build now.
|
# This is the full list .. hppa1.1 does not build now.
|
#ALL_TARGETS="hppa1.1-rtems i386-rtems i960-rtems m68k-rtems \
|
#ALL_TARGETS="hppa1.1-rtems i386-rtems i960-rtems m68k-rtems \
|
# m68k-rtemself mips64orion-rtems \
|
# m68k-rtemself mips64orion-rtems \
|
# powerpc-rtems sh-rtems sh-rtemself sparc-rtems"
|
# powerpc-rtems sh-rtems sh-rtemself sparc-rtems"
|
|
|
# This is the full buildable set.
|
# This is the full buildable set.
|
if [ "X${TARGETS}" = "X" ] ; then
|
if [ "X${TARGETS}" = "X" ] ; then
|
TARGETS="i386-rtems i960-rtems m68k-rtems \
|
TARGETS="i386-rtems i960-rtems m68k-rtems \
|
mips64orion-rtems powerpc-rtems sh-rtems sparc-rtems"
|
mips64orion-rtems powerpc-rtems sh-rtems sparc-rtems"
|
fi
|
fi
|
|
|
. $CFG
|
. $CFG
|
|
|
binutils=${binutils_version}
|
binutils=${binutils_version}
|
gcc=${gcc_version}
|
gcc=${gcc_version}
|
gdb=${gdb_version}
|
gdb=${gdb_version}
|
newlib=${newlib_version}
|
newlib=${newlib_version}
|
# also use binutils_rpm_release
|
# also use binutils_rpm_release
|
buildroot=/tmp
|
buildroot=/tmp
|
|
|
#
|
#
|
# Now get started
|
# Now get started
|
#
|
#
|
start=`date`
|
start=`date`
|
|
|
echo PATH=$PATH
|
echo PATH=$PATH
|
|
|
if [ ${testing} = yes ] ; then
|
if [ ${testing} = yes ] ; then
|
ECHO=echo
|
ECHO=echo
|
fi
|
fi
|
|
|
installed_count=`rpm -q -g rtems | wc -l`
|
installed_count=`rpm -q -g rtems | wc -l`
|
if [ ${installed_count} -ne 0 ] ; then
|
if [ ${installed_count} -ne 0 ] ; then
|
echo This script should be run with NO rtems RPMs installed.
|
echo This script should be run with NO rtems RPMs installed.
|
echo It appears that the following rtems RPMs are installed:
|
echo It appears that the following rtems RPMs are installed:
|
echo
|
echo
|
rpm -qa | grep rtems
|
rpm -qa | grep rtems
|
echo
|
echo
|
echo Please remove these and restart this script.
|
echo Please remove these and restart this script.
|
exit 1
|
exit 1
|
fi
|
fi
|
|
|
echo Copying specs files.
|
echo Copying specs files.
|
if [ ${testing} = no ] ; then
|
if [ ${testing} = no ] ; then
|
cd ${RTEMS_DIR}
|
cd ${RTEMS_DIR}
|
|
|
# ./configure || exit 1
|
# ./configure || exit 1
|
make || exit 1
|
make || exit 1
|
|
|
# Now generate all the specs
|
# Now generate all the specs
|
for target in ${TARGETS}
|
for target in ${TARGETS}
|
do
|
do
|
tspecs=`find . -name "${target}*"`
|
tspecs=`find . -name "${target}*"`
|
if [ "X${tspecs}" = "X" ] ; then
|
if [ "X${tspecs}" = "X" ] ; then
|
echo RPM specifications were not generated for ${tspec}.
|
echo RPM specifications were not generated for ${tspec}.
|
exit 1
|
exit 1
|
fi
|
fi
|
${ECHO} cp -r ${tspecs} ${dst}
|
${ECHO} cp -r ${tspecs} ${dst}
|
done
|
done
|
fi
|
fi
|
|
|
# clean up a bit before we start
|
# clean up a bit before we start
|
cd ${dst}
|
cd ${dst}
|
test -d log || mkdir log
|
test -d log || mkdir log
|
|
|
# do all the tools
|
# do all the tools
|
for target in ${TARGETS}
|
for target in ${TARGETS}
|
do
|
do
|
if [ ${do_binutils} = yes ] ; then
|
if [ ${do_binutils} = yes ] ; then
|
logfile=log/${target}-binutils
|
logfile=log/${target}-binutils
|
specfile=${dst}/${target}-binutils-${binutils}.spec
|
specfile=${dst}/${target}-binutils-${binutils}.spec
|
echo "rpm -ba ${specfile} >${logfile} 2>&1"
|
echo "rpm -ba ${specfile} >${logfile} 2>&1"
|
if [ ${testing} = no ] ; then
|
if [ ${testing} = no ] ; then
|
rpm -ba ${specfile} >${logfile} 2>&1
|
rpm -ba ${specfile} >${logfile} 2>&1
|
fi
|
fi
|
${ECHO} rm -rf ${dst}/../BUILD/${target}-binutils*
|
${ECHO} rm -rf ${dst}/../BUILD/${target}-binutils*
|
${ECHO} rm -rf ${buildroot}/opt/rtems
|
${ECHO} rm -rf ${buildroot}/opt/rtems
|
else
|
else
|
echo Skipping binutils for ${target}
|
echo Skipping binutils for ${target}
|
fi
|
fi
|
|
|
#
|
#
|
# build gcc/newlib
|
# build gcc/newlib
|
#
|
#
|
|
|
if [ ${do_gccnewlib} = yes ] ; then
|
if [ ${do_gccnewlib} = yes ] ; then
|
# now build gcc/newlib
|
# now build gcc/newlib
|
# NOTE: This requires having binutils installed and we immediately
|
# NOTE: This requires having binutils installed and we immediately
|
# remove it once finished.
|
# remove it once finished.
|
base_binutils_rpm=${dst}/../RPMS/${rpm_cpu}/rtems-base-binutils-${binutils}-${binutils_rpm_release}.${rpm_cpu}.rpm
|
base_binutils_rpm=${dst}/../RPMS/${rpm_cpu}/rtems-base-binutils-${binutils}-${binutils_rpm_release}.${rpm_cpu}.rpm
|
binutils_rpm=${dst}/../RPMS/${rpm_cpu}/${target}-binutils-${binutils}-${binutils_rpm_release}.${rpm_cpu}.rpm
|
binutils_rpm=${dst}/../RPMS/${rpm_cpu}/${target}-binutils-${binutils}-${binutils_rpm_release}.${rpm_cpu}.rpm
|
if [ ! -f ${binutils_rpm} ] ; then
|
if [ ! -f ${binutils_rpm} ] ; then
|
echo There is no RPM for binutils for ${target}.
|
echo There is no RPM for binutils for ${target}.
|
echo Looked for ${binutils_rpm}.
|
echo Looked for ${binutils_rpm}.
|
fi
|
fi
|
${ECHO} rpm -i ${base_binutils_rpm}
|
${ECHO} rpm -i ${base_binutils_rpm}
|
${ECHO} rpm -i ${binutils_rpm}
|
${ECHO} rpm -i ${binutils_rpm}
|
|
|
logfile=log/${target}-gccnewlib
|
logfile=log/${target}-gccnewlib
|
specfile=${dst}/${target}-gcc-${gcc}-newlib-${newlib}.spec
|
specfile=${dst}/${target}-gcc-${gcc}-newlib-${newlib}.spec
|
echo "rpm -ba ${specfile} >${logfile} 2>&1"
|
echo "rpm -ba ${specfile} >${logfile} 2>&1"
|
if [ ${testing} = no ] ; then
|
if [ ${testing} = no ] ; then
|
rpm -ba ${specfile} >${logfile} 2>&1
|
rpm -ba ${specfile} >${logfile} 2>&1
|
fi
|
fi
|
${ECHO} rm -rf ${dst}/../BUILD/${target}-gcc*
|
${ECHO} rm -rf ${dst}/../BUILD/${target}-gcc*
|
${ECHO} rm -rf ${buildroot}/opt/rtems
|
${ECHO} rm -rf ${buildroot}/opt/rtems
|
|
|
echo uninstalling binutils for ${target}
|
echo uninstalling binutils for ${target}
|
if [ ${testing} = no ] ; then
|
if [ ${testing} = no ] ; then
|
rpm -e `rpm -qa | grep rtems`
|
rpm -e `rpm -qa | grep rtems`
|
rm -rf /opt/rtems/*
|
rm -rf /opt/rtems/*
|
fi
|
fi
|
else
|
else
|
echo Skipping gcc/newlib for ${target}
|
echo Skipping gcc/newlib for ${target}
|
fi
|
fi
|
|
|
#
|
#
|
# build gdb
|
# build gdb
|
#
|
#
|
|
|
if [ ${do_gdb} = yes ] ; then
|
if [ ${do_gdb} = yes ] ; then
|
# now build gdb
|
# now build gdb
|
logfile=log/${target}-gdb
|
logfile=log/${target}-gdb
|
specfile=${dst}/${target}-gdb-${gdb}.spec
|
specfile=${dst}/${target}-gdb-${gdb}.spec
|
echo "rpm -ba ${specfile} >${logfile} 2>&1"
|
echo "rpm -ba ${specfile} >${logfile} 2>&1"
|
if [ ${testing} = no ] ; then
|
if [ ${testing} = no ] ; then
|
rpm -ba ${specfile} >${logfile} 2>&1
|
rpm -ba ${specfile} >${logfile} 2>&1
|
fi
|
fi
|
${ECHO} rm -rf ${dst}/../BUILD/${target}-gdb*
|
${ECHO} rm -rf ${dst}/../BUILD/${target}-gdb*
|
${ECHO} rm -rf ${buildroot}/opt/rtems
|
${ECHO} rm -rf ${buildroot}/opt/rtems
|
else
|
else
|
echo Skipping gdb for ${target}
|
echo Skipping gdb for ${target}
|
fi
|
fi
|
|
|
done
|
done
|
|
|
# Now we are done
|
# Now we are done
|
|
|
stop=`date`
|
stop=`date`
|
|
|
echo
|
echo
|
echo "Started: " $start
|
echo "Started: " $start
|
echo "Finished: " $stop
|
echo "Finished: " $stop
|
exit 0
|
exit 0
|
|
|