#! /bin/sh # # This script is a simple script to build and install rtems toolset # for the target you specify on the command line. It should be of # the form -rtems. For example, sparc-rtems4.11 # # This can be used to build versions from CVS/SVN or released versions. # Please be sure to apply appropriate patches from # rtems/contrib/crossrpms/patches. # # Currently only testing of non-RTEMS targets is supported. # ### EDIT THESE AS NEEDED AUTOCONF=autoconf-2.69 AUTOMAKE=automake-1.12.6 BINUTILS=binutils-cvs/src GDB=gdb-cvs/src GCC=gcc-svn NEWLIB=newlib-cvs/src LANGUAGES="c,c++" ### END OF EDIT THESE BASE=`pwd` # log an error to stderr prerr() { echo "$*" >&2 } fatal() { prerr "$USAGE" [ "$1" ] && (prerr ; prerr $*); exit 1 } check_status() { if [ $1 -ne 0 ] ; then shift echo "FAILED: " "$*" >&2 exit 1 fi } toggle() { case $1 in no) echo "yes" ;; yes) echo "no" ;; *) fatal "Unknown value to toggle ($1)" ;; esac } usage() { cat <c.log 2>&1 check_status $? "failed to configure ${pkg}" ;; binutils*) ${sourcedir}/${pkg}/configure --target=${TARGET} \ --prefix=${INSTALL} >c.log 2>&1 check_status $? "failed to configure ${pkg}" ;; gdb*) ${sourcedir}/${pkg}/configure --target=${TARGET} \ --prefix=${INSTALL} \ --enable-sim --enable-sim-hardware \ --enable-timebase --enable-sim-trace >c.log 2>&1 check_status $? "failed to configure ${pkg}" ;; gcc*) ${sourcedir}/${GCC}/configure \ --enable-threads=rtems --with-gnu-as --enable-multilib \ --enable-newlib-mb --enable-newlib-iconv \ --with-gnu-ld --with-newlib --verbose --with-system-zlib --disable-nls \ --enable-version-specific-runtime-libs \ --enable-languages=${LANGUAGES} --target=${TARGET} --prefix=${INSTALL} \ >c.log 2>&1 check_status $? "failed to configure ${pkg}" ;; *) prerr "UNKNOWN PACKAGE ${pkg}" exit 1 ;; esac echo "Building ${pkg}..." make ${JOBS} >b.log 2>&1 check_status $? "failed to make ${pkg}" echo "Installing ${pkg}..." make install >i.log 2>&1 check_status $? "failed to install ${pkg}" # If testing the package, fall into this if if [ ${do_tests} = "yes" ] ; then echo "Testing ${pkg}..." case $pkg in auto*) # currently do not run test suite on autoconf and automake ;; binutils*) echo "Testing binutils for ${TARGET}" make check >check.log 2>&1 ;; gdb*) # currently do not run test suite on gdb ;; gcc*) baseboard=NOT_SET case ${TARGET} in *-rtems*) echo "*** Currently do not support testing GCC with this script" ;; *-elf*|*-eabi*) cpu=`echo ${TARGET} | cut -d'-' -f1` case ${cpu} in arc*|arm*|basic*|cris*|d10v*|d30v*|fr30*|frv*|h8300*|i960*|iq2000*|jmr3904|\ m32r*|m68hc11*|mcore*|mips*|mips64*|mips64vr4100*|mmixware*|mn10200|\ mn10300*|powerpc*|powerpcle*|sh*|sparc*|sparc64*|sparclite*|tic80*|tx39|\ v850*|vr4100*|vr4111*|vr4300*|xtensa*) baseboard=${cpu}-sim ;; *) ;; esac ;; *) ;; esac # now see if we found a configuration to test with if [ ${baseboard} = "NOT_SET" ] ; then echo "*** Do not know how to test gcc on ${target}" continue fi echo "Testing gcc for ${TARGET} on ${baseboard}" make check RUNTESTFLAGS="--target_board=${baseboard}" >check.log 2>&1 if [ ${do_mail} = "yes" ] ; then echo "Sending ${language} test results to GCC community.." ${sourcedir}/${GCC}/contrib/test_summary -m gcc-testresults@gcc.gnu.org | sh check_status $? "Failed to email ${language} Test Results to GCC Community .. bailing" echo "Sending ${language} test results to RTEMS community.." ${sourcedir}/${GCC}/contrib/test_summary -o -m rtems-tooltestresults@rtems.org | sh check_status $? "Failed to email ${language} Test Results to RTEMS Community .. bailing" fi ;; *) prerr "UNKNOWN PACKAGE ${pkg}" exit 1 ;; esac fi # END of if testing the package cd .. if [ ${do_clean} = "yes" ] ; then rm -rf ${BUILD} fi done exit 0