#! /bin/sh

# If you don't use rpm, you can use this file to apply additional Linux
# patches. At the top level of the binutils source tree, do
#
# /bin/sh patches/README
#
# You may have to do
#
# cd bfd
# make headers
#
# if the build fails.

dir=`dirname $0`

patch -p0 -b --suffix .archive < $dir/libtool-archive-1.patch &&
patch -p0 -b --suffix .relink < $dir/libtool-relink-1.patch &&
patch -p0 -b --suffix .ref_addr < $dir/bfd-ref_addr-5.patch &&
patch -p1 -b --suffix .indirect < $dir/binutils-indirect-1.patch &&
patch -p1 -b --suffix .relro < $dir/binutils-tls-relro-9.patch &&
true
[ $? = 0 ] || exit 1
find -name "*.orig" | xargs rm -fv
find -name "*.gmo" | xargs rm -fv
