From 44c6bac2afb85015f386851f89e7a21e85c81f9a Mon Sep 17 00:00:00 2001 From: josh Date: Sat, 2 Jan 2010 02:10:20 +0000 Subject: [PATCH] added util folder with build script for i586-elf target cross-compiler git-svn-id: svn://anubis/hos/trunk@70 5b3e749e-e535-0410-8002-a9bb6afbdfca --- util/build-i586-elf-gcc.sh | 100 +++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100755 util/build-i586-elf-gcc.sh diff --git a/util/build-i586-elf-gcc.sh b/util/build-i586-elf-gcc.sh new file mode 100755 index 0000000..03cab7e --- /dev/null +++ b/util/build-i586-elf-gcc.sh @@ -0,0 +1,100 @@ +#!/bin/bash -x + +BINUTILS_VERSION=${BINUTILS_VERSION:-"2.20"} +GCC_VERSION=${GCC_VERSION:-"4.4.2"} +TARGET=${TARGET:-"i586-elf"} +PREFIX=${PREFIX:-"$HOME/local/$TARGET"} +GNUFTP=ftp://ftp.gnu.org/gnu +export PATH=$PREFIX/bin:$PATH + +mkdir -p build-binutils build-gcc + +if [ ! -f "binutils-$BINUTILS_VERSION.tar.bz2" ]; then + wget "$GNUFTP/binutils/binutils-$BINUTILS_VERSION.tar.bz2" + if [ $? != 0 ]; then + echo "Error downloading binutils" + exit 1 + fi +fi + +if [ ! -f "gcc-$GCC_VERSION.tar.bz2" ]; then + wget "$GNUFTP/gcc/gcc-$GCC_VERSION/gcc-$GCC_VERSION.tar.bz2" + if [ $? != 0 ]; then + echo "Error downloading gcc" + exit 1 + fi +fi + +if [ ! -d "binutils-$BINUTILS_VERSION" ]; then + tar xvjf "binutils-$BINUTILS_VERSION.tar.bz2" + if [ $? != 0 ]; then + echo "Error extracting binutils" + exit 1 + fi +fi + +if [ ! -d "gcc-$GCC_VERSION" ]; then + tar xvjf "gcc-$GCC_VERSION.tar.bz2" + if [ $? != 0 ]; then + echo "Error extracting gcc" + exit 1 + fi +fi + + +# build binutils +dum=`which $TARGET-ar` +if [ $? != 0 ]; then + pushd build-binutils + ../binutils-$BINUTILS_VERSION/configure --target=$TARGET --prefix=$PREFIX --disable-nls + if [ $? != 0 ]; then + echo "Error configuring binutils" + exit 1 + fi + make all + if [ $? != 0 ]; then + echo "Error building binutils" + exit 1 + fi + make install + if [ $? != 0 ]; then + echo "Error installing binutils" + exit 1 + fi + popd +fi + + +# build gcc +dum=`which $TARGET-gcc` +if [ $? != 0 ]; then + pushd build-gcc + ../gcc-$GCC_VERSION/configure --target=$TARGET --prefix=$PREFIX --disable-nls --enable-languages=c,c++ --without-headers + if [ $? != 0 ]; then + echo "Error configuring gcc" + exit 1 + fi + make all-gcc + if [ $? != 0 ]; then + echo "Error building gcc" + exit 1 + fi + make install-gcc + if [ $? != 0 ]; then + echo "Error installing gcc" + exit 1 + fi + make all-target-libgcc + if [ $? != 0 ]; then + echo "Error building libgcc" + exit 1 + fi + make install-target-libgcc + if [ $? != 0 ]; then + echo "Error installing libgcc" + exit 1 + fi + popd +fi + +exit 0