URL
https://opencores.org/ocsvn/or1k_old/or1k_old/trunk
Subversion Repositories or1k_old
[/] [or1k_old/] [trunk/] [rtems-20020807/] [scripts/] [buildalltar.in] - Rev 1782
Compare with Previous | Blame | View Log
#! /bin/sh## Generate all the specs and then cycle through building them.#RTEMS_DIR=`dirname $0`CFG=./setup.cache#dst=/usr/src/redhat/SPECSdst=`pwd`target=@target@rpm_cpu=i386usage(){echo "$0 [options] <target_alias>"echo " options:"echo " -b -- build binutils"echo " -g -- build gcc/newlib"echo " -d -- build gdb"echo " -C HOST -- build canadian cross for HOST "echo " -t -- enable test/debug mode"echo " -cfg <setup.cache>"echo " -o <rpm-spec-dir>"exit 1 ;}## Checks the status returned by executables and exits if it is non-zero.#check_fatal(){if [ $1 -ne 0 ] ; thenshiftecho "ERROR: $*" >&2exit 1fi#echo#echo "End of $*"#echo -n "Press return to continue> "#echo#read line}testing=nodo_binutils=nodo_gccnewlib=nodo_gdb=nocdn_cross=nowhile test $# -ge 1; docase $1 in-b) do_binutils=yes ; shift;;-g) do_gccnewlib=yes ; shift;;-d) do_gdb=yes ; shift;;-t) do_test=yes ; shift;;-cfg)test $# -ge 2 || usageshiftCFG=$1shift;;-o)test $# -ge 2 || usageshiftdst=$1shift;;-C)test $# -ge 2 || usageshiftbuild=$1shiftif ! test -x ${RTEMS_DIR}/../config.guess ; thenecho "Missing ${RTEMS_DIR}/../config.guess!"exit 1fiCDN_ARGS="--build=`${RTEMS_DIR}/../config.guess` --host=${build}"cdn_cross=yes;;-*)echo "invalid option $1";usage;;*)TARGETS="${TARGETS} $1"shift;;esacdoneif test ${do_binutils} = no -a ${do_gccnewlib} = no -a ${do_gdb} = no ; thenecho "You must request building binutils, gcc/newlib, or gdb."usagefi# This is the full list .. hppa1.1 does not build now.#ALL_TARGETS="hppa1.1-rtems i386-rtems i960-rtems m68k-rtems \# m68k-rtemself mips-rtems mips64orion-rtems \# powerpc-rtems sh-rtems sh-rtemself sparc-rtems"# This is the full buildable set.if [ "X${TARGETS}" = "X" ] ; then# do not include c4x or hppa primary targets# do not include sh-elf or i960-elf secondary targetsTARGETS="arm-rtems h8300-rtems i386-rtems i960-rtems m68k-rtems \mips-rtems mips64orion-rtems powerpc-rtems sh-rtems sparc-rtems"fi. $CFGbinutils=${binutils_version}gcc=${gcc_version}gdb=${gdb_version}newlib=${newlib_version}# also use binutils_rpm_releasebuildroot=/tmp## Now get started#start=`date`echo PATH=$PATHif [ ${testing} = yes ] ; thenECHO=echofi#installed_count=`rpm -q -g 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 Copying 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}*"`# if [ "X${tspecs}" = "X" ] ; then# echo RPM specifications were not generated for ${tspec}.# exit 1# fi# ${ECHO} cp -r ${tspecs} ${dst}# done#fi# clean up a bit before we startcd ${dst}test -d log || mkdir logif [ "X${rpm_build_root}" = "X" ] ; thenecho rpm_build_root NOT set!exit 1fiCWD=`pwd`test -d tarballs || mkdir tarballsOUT=${CWD}/tarballs# do all the toolsfor target in ${TARGETS}dobintarfile=${OUT}/${target}-binutils-${binutils}-${binutils_rpm_release}.tarif [ ${do_binutils} = yes ] ; thenlogfile=${CWD}/log/${target}-binutils# this part is for tar.bz2cd ${CWD}if [ ! -d binutils-${binutils} ] ; thenecho Could not find binutils-${binutils}!exit 1firm -rf b-${target}-binmkdir b-${target}-bincd b-${target}-binecho "Building binutils-${binutils} for ${target}"../binutils-${binutils}/configure ${CDN_ARGS} --target=${target} \--verbose --prefix=/opt/rtems >${logfile} 2>&1check_fatal $? "binutils configure"make all >>${logfile} 2>&1check_fatal $? "make all"make info >>${logfile} 2>&1check_fatal $? "make info"make prefix=${rpm_build_root}/opt/rtems install >>${logfile} 2>&1check_fatal $? "make install"make prefix=${rpm_build_root}/opt/rtems install-info >>${logfile} 2>&1check_fatal $? "make install-info"cd ${buildroot}tar cjf ${bintarfile}.bz2 optcd ${CWD}rm -rf b-${target}-bin${ECHO} rm -rf ${rpm_build_root}/opt#rm -rf ${rpm_build_root}/optelseecho Skipping binutils for ${target}fi## build gcc/newlib#if [ ${do_gccnewlib} = yes ] ; thenlogfile=${CWD}/log/${target}-gccnewlib# now build gcc/newlib# this part is for tar.bz2gcctarfile=${OUT}/${target}-gcc-${gcc}-newlib-${newlib}-${gccnewlib_rpm_release}.tarif [ ${cdn_cross} = "no" ] ; thenbintarfile=${dst}/binaries/binutils-${binutils}-${binutils_rpm_release}/${target}-binutils-${binutils}-${binutils_rpm_release}.tarcd /rm -rf /opt/*tar xjf ${bintarfile}.bz2ficd ${CWD}if [ ! -d gcc-${gcc} ] ; thenecho Could not find gcc-${gcc}!exit 1fiif [ ! -d gcc-${gcc}/newlib ] ; thenecho Could not find gcc-${gcc}/newlib!exit 1firm -rf b-${target}-gccnewlibmkdir b-${target}-gccnewlibcd b-${target}-gccnewlibecho "Building gcc-${gcc} for ${target}"../gcc-${gcc}/configure ${CDN_ARGS} --target=${target} \--with-gnu-as --with-gnu-ld --with-newlib --verbose --enable-threads \--prefix=/opt/rtems '--enable-languages=c,c++' >${logfile} 2>&1check_fatal $? "gcc configure"make all >>${logfile} 2>&1check_fatal $? "make all"make info >>${logfile} 2>&1check_fatal $? "make info"make prefix=${rpm_build_root}/opt/rtems install >>${logfile} 2>&1check_fatal $? "make install"cd ${target}/newlibmake prefix=${rpm_build_root}/opt/rtems install-info >>${logfile} 2>&1check_fatal $? "newlib make install-info"cd ${buildroot}tar cjf ${gcctarfile}.bz2 optcd ${CWD}rm -rf ${rpm_build_root}/optrm -rf ${rpm_build_root}/opt/rtemsrm -rf b-${target}-gccnewlibelseecho Skipping gcc/newlib for ${target}fi## build gdb#if [ ${do_gdb} = yes ] ; then# now build gdbgdbtarfile=${OUT}/${target}-gdb-${gdb}-${gdb_rpm_release}.tarlogfile=${CWD}/log/${target}-gdb# this part is for tar.bz2if [ ! -d gdb-${gdb} ] ; thenecho Could not find gdb-${gdb}!exit 1fimkdir b-${target}-gdbcd b-${target}-gdbcase ${target} inarm* | d10v* | d30v* | erc32* | fr30* | h8300* | h8500* | i960* | \m32r* | mcore* | mips* | mn10200* | mn10300* | sh* | sparc*| v850* | \w65* | z8k*)extra_configure_arguments="--enable-sim";;powerpc*)extra_configure_arguments="--enable-sim --enable-sim-powerpc --enable-sim-timebase --enable-sim-hardware"# Enabling this causes the program image to be huge and causes# some gcc/hosts combinations to run out of memory.# --enable-sim-inline;;*);;esacecho "Building gdb-${gdb}/configure ${CDN_ARGS} --target=${target}"../gdb-${gdb}/configure ${CDN_ARGS} --target=${target} \${extra_configure_arguments} --verbose --prefix=/opt/rtems >${logfile} 2>&1check_fatal $? "make info"make all >>${logfile} 2>&1check_fatal $? "make all"make info >>${logfile} 2>&1check_fatal $? "make info"make prefix=${rpm_build_root}/opt/rtems install >>${logfile} 2>&1check_fatal $? "make install"make prefix=${rpm_build_root}/opt/rtems install-info >>${logfile} 2>&1check_fatal $? "make install-info"cd ${buildroot}tar cjf ${gdbtarfile}.bz2 optcd ${CWD}${ECHO} rm -rf ${rpm_build_root}/optrm -rf ${rpm_build_root}/opt/rtemsrm -rf b-${target}-gdbelseecho Skipping gdb for ${target}fidone# Now we are donestop=`date`echoecho "Started: " $startecho "Finished: " $stopexit 0
