#!/bin/sh -e
# $Id: bootstrap,v 1.1 2005/03/29 15:05:30 querbach Exp $

# bootstrap
#----------------------------------------------------------------------------
#
#	Set up Source Trees
#
#	This script sets up the source for the RTEMS SS555 port and the
#	TCIP/IP via CAN software.  It assumes that the required tarballs and
#	patch files are in the current directory.
#
#	If you're tracking the original sources in your own CVS archive, you
#	will want something a little more sophisticated, but perhaps this
#	script will provide a starting point.
#
#	Sponsored by Defence Research and Development Canada -- Suffield,
#	(C) Her Majesty the Queen in Right of Canada (2005).  Authored by
#	Real-Time Systems Inc. (querbach@realtime.bc.ca)
#
#----------------------------------------------------------------------------

top=$(pwd)


# System revision.

rev=ugv-1


# Bootstrap SS555-based software.

tar xzf $top/ss555-$rev.tgz
pushd ss555


# Bootstrap RTEMS.

tar xzf $top/rtems-20050126.tgz
patch -p0 < $top/rtems-20050126-$rev.patch
(
  cd rtems
  chmod 755 build install run-all-tests run-tests check-tests format-tmtests
  source ../Config
  export PATH=$PREFIX/bin:$PATH
  ./bootstrap 2>&1 | tee bootstrap.log
)


# Bootstrap lwIP, the light-weight IP stack.

tar xzf $top/lwip-$rev.tgz
pushd lwip

tar xzf $top/lwip-1.1.0.tgz
patch -p0 < $top/lwip-1.1.0-$rev.patch 2>&1 | tee patch.log

tar xzf $top/contrib-20050213.tgz
patch -p0 < $top/contrib-20050213-$rev.patch

popd # lwip


# Bootstrap the lwIP-over-CAN test program.

tar xzf $top/lwipocan-test-$rev.tgz


exit 0

