#!/bin/bash
cd /usr/src/binutils-*/ ||exit

#all old:
#patch -p 1 <../binutils-2.16-posix-1.patch
#patch -p 1 <../binutils-2.16-genscripts_multilib-1.patch
#patch -p 1 <../binutils-2.16.91.0.3-flex_fix-1.patch

patch -p 1 <../binutils-2.16.91.0.5-gcc4-1.patch

#the test suite for Binutils in this section is considered critical.

#This package is known to behave badly when you have changed its
#default optimization flags (including the -march and -mcpu options).

cd .. &&
rm -rf _binutils &&
mkdir _binutils &&
cd _binutils &&
../binutils-*/configure --prefix=/usr --enable-shared &&
#we dont need /usr/i686-pc-linux-gnu:
make tooldir=/usr &&
#make -k check
make tooldir=/usr install &&
make tooldir=/usr install-info

#install the libiberty header file that is needed by some packages:
cp ../binutils-*/include/libiberty.h /usr/include
