[deps]

[main]
filesize=19973532
sha512=ffe8ef263ef99183e8cc823fe8487ff7d0f7bf9a8efd2853b5f4636aca0023850d13de4eac7d77a5f69413d8a50e6f95bb14569be53df86c0bce38034525ab74

[mirrors]
http://ftpmirror.gnu.org/binutils/binutils-2.22.tar.bz2
http://ftp.gnu.org/gnu/binutils/binutils-2.22.tar.bz2

[build]
patch -p1 < $K/binutils-arm.diff || exit 1
patch -p1 < $K/binutils-as-needed.patch || exit 1

#create directory structure for static toolchain
TC_PATH=$R/opt/toolchain
mkdir -p $TC_PATH
SELF=`pwd`
[ -z "$SELF" ] && exit 1

if [[ ! -e $TC_PATH/usr ]] ; then
        cd $TC_PATH
        ln -sf . usr
        cd $SELF
fi


CC="$CC -static -D_GNU_SOURCE -L$R/lib -I$R/include -D_LARGEFILE64_SOURCE" ./configure -C \
	--prefix=/ --disable-nls --disable-shared --disable-werror \
	--with-build-sysroot=$R --with-sysroot=$TC_PATH \
	|| exit 1

echo "#define __pid_t int" >include/features.h
make -j$MAKE_THREADS tooldir=$R || exit 1
make DESTDIR=$TC_PATH install-gas install-ld install-binutils || exit 1

cd $TC_PATH/bin/
rm -f ld
ln -sf ld.bfd ld

#prevent custom buildscripts from messing with the toolchain
exit 0

