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
This commit is contained in:
parent
bc7064e92a
commit
44c6bac2af
100
util/build-i586-elf-gcc.sh
Executable file
100
util/build-i586-elf-gcc.sh
Executable file
@ -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
|
Loading…
x
Reference in New Issue
Block a user