Changeset 08f224b in rtems for scripts/buildalltar.in


Ignore:
Timestamp:
Jan 22, 2002, 3:38:43 PM (19 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
451199b8
Parents:
9dd6edf
Message:

2001-01-22 Joel Sherrill <joel@…>

  • buildalltar.in: Modified to support Canadian cross builds. It was testing using a RedHat? 7.2 host to build *-rtems tools that run on an i386-cygwin host.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • scripts/buildalltar.in

    r9dd6edf r08f224b  
    1818  echo "    -g                  -- build gcc/newlib"
    1919  echo "    -d                  -- build gdb"
     20  echo "    -C HOST             -- build canadian cross for HOST "
    2021  echo "    -t                  -- enable test/debug mode"
    2122  echo "    -cfg <setup.cache>"
     
    2425}
    2526
     27#   
     28#  Checks the status returned by executables and exits if it is non-zero.
     29#
     30check_fatal()
     31{
     32  if [ $1 -ne 0 ] ; then
     33    shift
     34    echo "ERROR: $*" >&2
     35    exit 1
     36  fi
     37  #echo
     38  #echo "End of $*"
     39  #echo -n "Press return to continue> "
     40  #echo
     41  #read line
     42}
     43
    2644testing=no
    2745do_binutils=no
    2846do_gccnewlib=no
    2947do_gdb=no
     48cdn_cross=no
    3049
    3150while test $# -ge 1; do
     
    4665      dst=$1
    4766      shift
     67      ;;
     68    -C)
     69      test $# -ge 2 || usage
     70      shift
     71      build=$1
     72      shift
     73      if ! test -x ${RTEMS_DIR}/../config.guess ; then
     74        echo "Missing ${RTEMS_DIR}/../config.guess!"
     75        exit 1
     76      fi
     77      CDN_ARGS="--build=`${RTEMS_DIR}/../config.guess` --host=${build}"
     78      cdn_cross=yes
    4879      ;;
    4980    -*)
     
    131162test -d log || mkdir log
    132163
     164if [ "X${rpm_build_root}" = "X" ] ; then
     165  echo rpm_build_root NOT set!
     166  exit 1
     167fi
     168
     169CWD=`pwd`
     170test -d tarballs || mkdir tarballs
     171
     172OUT=${CWD}/tarballs
     173
    133174#  do all the tools
    134175for target in ${TARGETS}
    135176do
    136   bintarfile=${PWD}/${target}-binutils-${binutils}-${binutils_rpm_release}.tar
     177  bintarfile=${OUT}/${target}-binutils-${binutils}-${binutils_rpm_release}.tar
    137178  if [ ${do_binutils} = yes ] ; then
    138     # this part is for RPMS
    139     logfile=log/${target}-binutils
    140     #specfile=${dst}/${target}-binutils-${binutils}.spec
    141     #echo "rpm -ba ${specfile} >${logfile} 2>&1"
    142     #if [ ${testing} = no ] ; then
    143     #  rpm -ba ${specfile} >${logfile} 2>&1
    144     #fi
    145     #${ECHO} rm -rf ${dst}/../BUILD/${target}-binutils*
    146 
    147 
     179    logfile=${CWD}/log/${target}-binutils
    148180    # this part is for tar.bz2
    149     PWD=`pwd`
    150     mkdir b-${target}
    151     cd b-${target}
    152     ../binutils-${binutils}/configure --target=${target} \
    153       --verbose --prefix=/opt/rtems
    154     make all
    155     make info
    156     make prefix=${rpm_build_root}/opt/rtems install
    157     make prefix=${rpm_build_root}/opt/rtems install-info         
     181    cd ${CWD}
     182    if [ ! -d binutils-${binutils} ] ; then
     183      echo Could not find binutils-${binutils}!
     184      exit 1
     185    fi
     186    rm -rf b-${target}-bin
     187    mkdir b-${target}-bin
     188    cd b-${target}-bin
     189    echo "Building binutils-${binutils} for ${target}"
     190    ../binutils-${binutils}/configure ${CDN_ARGS} --target=${target} \
     191      --verbose --prefix=/opt/rtems   >${logfile} 2>&1
     192    check_fatal $? "binutils configure"
     193
     194    make all >>${logfile} 2>&1
     195    check_fatal $? "make all"
     196
     197    make info >>${logfile} 2>&1
     198    check_fatal $? "make info"
     199
     200    make prefix=${rpm_build_root}/opt/rtems install >>${logfile} 2>&1
     201    check_fatal $? "make install"
     202
     203    make prefix=${rpm_build_root}/opt/rtems install-info >>${logfile} 2>&1
     204    check_fatal $? "make install-info"
     205
    158206    cd ${buildroot}
    159     tar cf ${PWD}/${target}-binutils-${binutils}-${binutils_rpm_release}.tar opt
    160     cd ${PWD}
    161     bzip2 -9 ${target}-binutils-${binutils}.tar
     207    tar cjf ${bintarfile}.bz2 opt
     208    cd ${CWD}
     209    rm -rf b-${target}-bin
    162210    ${ECHO} rm -rf ${rpm_build_root}/opt
    163     rm -rf ${rpm_build_root}/opt/rtems
    164     rm -rf b-${target}
     211    #rm -rf ${rpm_build_root}/opt
    165212  else
    166213    echo Skipping binutils for ${target}
     
    172219
    173220  if [ ${do_gccnewlib} = yes ] ; then
     221    logfile=${CWD}/log/${target}-gccnewlib
    174222    # now build gcc/newlib
    175     #    NOTE: This requires having binutils installed and we immediately
    176     #          remove it once finished.
    177     #base_binutils_rpm=${dst}/../RPMS/${rpm_cpu}/rtems-base-binutils-${binutils}-${binutils_rpm_release}.${rpm_cpu}.rpm
    178     #binutils_rpm=${dst}/../RPMS/${rpm_cpu}/${target}-binutils-${binutils}-${binutils_rpm_release}.${rpm_cpu}.rpm
    179     #if [ ! -f ${binutils_rpm} ] ; then
    180     #  echo There is no RPM for binutils for ${target}.
    181     #  echo Looked for ${binutils_rpm}.
    182     #fi
    183     #${ECHO} rpm -i ${base_binutils_rpm}
    184     #${ECHO} rpm -i ${binutils_rpm}
    185 
    186     #logfile=log/${target}-gccnewlib
    187     #specfile=${dst}/${target}-gcc-${gcc}-newlib-${newlib}.spec
    188     #echo "rpm -ba ${specfile} >${logfile} 2>&1"
    189     #if [ ${testing} = no ] ; then
    190     #  rpm -ba ${specfile} >${logfile} 2>&1
    191     #fi
    192     #${ECHO} rm -rf ${dst}/../BUILD/${target}-gcc*
    193     #${ECHO} rm -rf ${buildroot}/opt/rtems
    194 
    195     #echo uninstalling binutils for ${target}
    196     #if [ ${testing} = no ] ; then
    197     #  rpm -e `rpm -qa | grep rtems`
    198     #  rm -rf /opt/rtems/*
    199     #fi
    200  
    201223    # this part is for tar.bz2
    202     PWD=`pwd`
    203 
    204     gcctarfile=${PWD}/${target}-gcc-${gcc}-newlib-${newlib}-${gccnewlib_rpm_release}.tar
    205     bintarfile=${dst}/binaries/binutils-${binutils}-${binutils_rpm_release}/${target}-binutils-${binutils}-${binutils_rpm_release}.tar
    206     cd /
    207     rm -rf /opt/*
    208     bzcat ${bintarfile}.bz2 | tar xf -
    209 
    210     cd ${PWD}
    211     rm -rf b-${target}
    212     mkdir b-${target}
    213     cd b-${target}
    214     ../gcc-${gcc}/configure --target=${target} \
    215       --with-gnu-as --with-gnu-ld --with-newlib --verbose \
    216       --enable-threads --prefix=/opt/rtems '--enable-languages=c,c++'
    217     make all
    218     make info
    219     make prefix=${rpm_build_root}/opt/rtems install
    220     make prefix=${rpm_build_root}/opt/rtems install-info         
     224
     225    gcctarfile=${OUT}/${target}-gcc-${gcc}-newlib-${newlib}-${gccnewlib_rpm_release}.tar
     226    if [ ${cdn_cross} = "no" ] ; then
     227      bintarfile=${dst}/binaries/binutils-${binutils}-${binutils_rpm_release}/${target}-binutils-${binutils}-${binutils_rpm_release}.tar
     228      cd /
     229      rm -rf /opt/*
     230      tar xjf ${bintarfile}.bz2
     231    fi
     232
     233    cd ${CWD}
     234    if [ ! -d gcc-${gcc} ] ; then
     235      echo Could not find gcc-${gcc}!
     236      exit 1
     237    fi
     238    if [ ! -d gcc-${gcc}/newlib ] ; then
     239      echo Could not find gcc-${gcc}/newlib!
     240      exit 1
     241    fi
     242    rm -rf b-${target}-gccnewlib
     243    mkdir b-${target}-gccnewlib
     244    cd b-${target}-gccnewlib
     245    echo "Building gcc-${gcc} for ${target}"
     246    ../gcc-${gcc}/configure ${CDN_ARGS} --target=${target} \
     247      --with-gnu-as --with-gnu-ld --with-newlib --verbose --enable-threads \
     248      --prefix=/opt/rtems '--enable-languages=c,c++' >${logfile} 2>&1
     249    check_fatal $? "gcc configure"
     250
     251    make all >>${logfile} 2>&1
     252    check_fatal $? "make all"
     253
     254    make info >>${logfile} 2>&1
     255    check_fatal $? "make info"
     256
     257    make prefix=${rpm_build_root}/opt/rtems install >>${logfile} 2>&1
     258    check_fatal $? "make install"
     259
    221260    cd ${target}/newlib
    222     make prefix=${rpm_build_root}/opt/rtems install-info         
     261    make prefix=${rpm_build_root}/opt/rtems install-info  >>${logfile} 2>&1
     262    check_fatal $? "newlib make install-info"
     263
    223264    cd ${buildroot}
    224     tar cf ${gcctarfile} opt
    225     cd ${PWD}
    226     bzip2 -9 ${gcctarfile}
     265    tar cjf ${gcctarfile}.bz2 opt
     266    cd ${CWD}
    227267    rm -rf ${rpm_build_root}/opt
    228268    rm -rf ${rpm_build_root}/opt/rtems
    229     rm -rf b-${target}
     269    rm -rf b-${target}-gccnewlib
    230270  else
    231271    echo Skipping gcc/newlib for ${target}
     
    238278  if [ ${do_gdb} = yes ] ; then
    239279    # now build gdb
    240     #logfile=log/${target}-gdb
    241     #specfile=${dst}/${target}-gdb-${gdb}.spec
    242     #echo "rpm -ba ${specfile} >${logfile} 2>&1"
    243     #if [ ${testing} = no ] ; then
    244     #  rpm -ba ${specfile} >${logfile} 2>&1
    245     #fi
    246     #${ECHO} rm -rf ${dst}/../BUILD/${target}-gdb*
    247     #${ECHO} rm -rf ${buildroot}/opt/rtems
     280    gdbtarfile=${OUT}/${target}-gdb-${gdb}-${gdb_rpm_release}.tar
     281    logfile=${CWD}/log/${target}-gdb
    248282
    249283    # this part is for tar.bz2
    250284   
    251     PWD=`pwd`
    252     mkdir b-${target}
    253     cd b-${target}
     285    if [ ! -d gdb-${gdb} ] ; then
     286      echo Could not find gdb-${gdb}!
     287      exit 1
     288    fi
     289    mkdir b-${target}-gdb
     290    cd b-${target}-gdb
    254291    case ${target} in
    255292      arm* | d10v* | d30v* | erc32* | fr30* | h8300* | h8500* | i960* | \
     
    267304        ;;
    268305esac
    269     ../gdb-${gdb}/configure --target=${target} \
    270       ${extra_configure_arguments} --verbose --prefix=/opt/rtems
    271     make all
    272     make info
    273     make prefix=${rpm_build_root}/opt/rtems install
    274     make prefix=${rpm_build_root}/opt/rtems install-info         
     306    echo "Building gdb-${gdb}/configure ${CDN_ARGS} --target=${target}"
     307    ../gdb-${gdb}/configure ${CDN_ARGS} --target=${target} \
     308      ${extra_configure_arguments} --verbose --prefix=/opt/rtems >${logfile} 2>&1
     309    check_fatal $? "make info"
     310
     311    make all >>${logfile} 2>&1
     312    check_fatal $? "make all"
     313
     314    make info >>${logfile} 2>&1
     315    check_fatal $? "make info"
     316
     317    make prefix=${rpm_build_root}/opt/rtems install >>${logfile} 2>&1
     318    check_fatal $? "make install"
     319
     320    make prefix=${rpm_build_root}/opt/rtems install-info >>${logfile} 2>&1
     321    check_fatal $? "make install-info"
     322
    275323    cd ${buildroot}
    276     tar cf ${PWD}/${target}-gdb-${gdb}-${gdb_rpm_release}.tar opt
    277     cd ${PWD}
    278     bzip2 -9 ${target}-gdb-${gdb}.tar
     324    tar cjf ${gdbtarfile}.bz2 opt
     325    cd ${CWD}
    279326    ${ECHO} rm -rf ${rpm_build_root}/opt
    280327    rm -rf ${rpm_build_root}/opt/rtems
    281     rm -rf b-${target}
     328    rm -rf b-${target}-gdb
    282329  else
    283330    echo Skipping gdb for ${target}
Note: See TracChangeset for help on using the changeset viewer.