#! /bin/sh

ConfigureGCC () {
	./djconfig.sh;
}

BootstrapGCC () {
	if ./djmake.sh bootstrap ; then
		if [ -d gcc/ada ] ; then
			./djmake.sh -C gcc gnatlib_and_tools
		fi
	fi
}

InstallTMP () {
	./djinsttmp.sh
}


MakePackages () {
	cd $TOP/../install.gcc 
	./makepkg.sh
	cd $TOP
}


TOP=`pwd`

cd $TOP
echo "Configuring GCC ..."
ConfigureGCC >djconfig.log 2>&1 || exit 1;

cd $TOP
echo "Bootstrapping GCC ..."
BootstrapGCC >bootstrap.log 2>&1 || exit 1

cd $TOP
echo "Installing GCC in temporary directory ..."
InstallTMP >insttmp.log 2>&1 || exit 1

cd $TOP
echo "Creating binary packages ..."
MakePackages >makepkg.log 2>&1 || exit 1
