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