From 09ec7e57ac7f9907122de23be187b1f05d19a18f Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Thu, 21 Jul 2011 01:16:00 -0500
Subject: binutils: Bump to latest

---
 abs/core/binutils/PKGBUILD         | 59 ++++++++++++++++++++++----------------
 abs/core/binutils/binutils.install |  2 +-
 2 files changed, 35 insertions(+), 26 deletions(-)

diff --git a/abs/core/binutils/PKGBUILD b/abs/core/binutils/PKGBUILD
index 0ec1438..4c6e5a9 100644
--- a/abs/core/binutils/PKGBUILD
+++ b/abs/core/binutils/PKGBUILD
@@ -1,57 +1,65 @@
-# $Id: PKGBUILD 80784 2010-05-22 08:05:08Z allan $
+# $Id$
 # Maintainer: Allan McRae <allan@archlinux.org>
 
 # toolchain build order: linux-api-headers->glibc->binutils->gcc->binutils->glibc
 
 pkgname=binutils
-pkgver=2.20.1
-pkgrel=3
-_date=20100521
+pkgver=2.21.1
+pkgrel=1
+_date=20110627
 pkgdesc="A set of programs to assemble and manipulate binary and object files"
 arch=('i686' 'x86_64')
 url="http://www.gnu.org/software/binutils/"
 license=('GPL')
 groups=('base')
-depends=('glibc>=2.12-1' 'zlib')
+depends=('glibc>=2.14' 'zlib')
+checkdepends=('dejagnu')
 options=('!libtool' '!distcc' '!ccache')
 install=binutils.install
 source=(ftp://ftp.archlinux.org/other/${pkgname}/${pkgname}-${pkgver}_${_date}.tar.bz2)
-md5sums=('67053ffd8582e646e171fccd55b2f0f6')
+md5sums=('2face559e80d649ba148e42bb2d1fb0f')
 
 mksource() {
   mkdir ${pkgname}-${_date}
   cd ${pkgname}-${_date}
-  export _TAG=binutils-2_20-branch
+  export _TAG=binutils-2_21-branch
   export 'CVSROOT=:pserver:anoncvs@sourceware.org:/cvs/src'
   cvs -z9 co -r $_TAG binutils || return 1
-  cd src && tar -cvjf ../../binutils-${pkgver}_${_date}.tar.bz2 *
+  mv src binutils
+  tar -cvjf ../binutils-${pkgver}_${_date}.tar.bz2 binutils/*
 }
 
 build() {
   cd ${srcdir}
-  mkdir build && cd build
+  mkdir binutils-build && cd binutils-build
 
-  CC="gcc -L`pwd`/bfd/.libs/"
-  if [ "${CARCH}" = "x86_64" ]; then
-    ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-64-bit-bfd --disable-multilib 
-  else
-    ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared
-  fi
-  # fix man files install path
-  sed -i -e "s:mandir \= \/usr\/share:mandir \= ${pkgdir}\/usr\/share:" ${srcdir}/build/Makefile || return 1
-  # fix info files install path
-  sed -i -e "s:infodir \= \/usr\/share:infodir \= ${pkgdir}\/usr\/share:" ${srcdir}/build/Makefile || return 1
+  [[ $CARCH == "x86_64" ]] && CONFIGFLAG="--enable-64-bit-bfd --disable-multilib"
 
-  # This checks the host environment and makes sure all the necessary tools are available to compile Binutils.
-  make configure-host || return 1
+  ${srcdir}/binutils/configure --prefix=/usr \
+    --enable-ld=default --enable-gold \
+    --enable-plugins --enable-threads \
+    --enable-shared $CONFIGFLAG
 
-  make tooldir=${pkgdir}/usr || return 1
+  # check the host environment and makes sure all the necessary tools are available
+  make configure-host
+
+  make tooldir=${pkgdir}/usr
+}
+
+check() {
+  cd ${srcdir}/binutils-build
+
+  # do not abort on errors - manually check log files
+  make -k -j1 check || true
 }
 
 package() {
-  cd ${srcdir}/build
+  cd ${srcdir}/binutils-build
   make prefix=${pkgdir}/usr tooldir=${pkgdir}/usr install
-  install -m644 ${srcdir}/include/libiberty.h ${pkgdir}/usr/include
+  
+  # Add some useful headers
+  install -m644 ${srcdir}/binutils/include/libiberty.h ${pkgdir}/usr/include
+  install -m644 ${srcdir}/binutils/include/demangle.h ${pkgdir}/usr/include
 
   # Rebuild libiberty.a with -fPIC
   make -C libiberty clean
@@ -64,9 +72,10 @@ package() {
   make CFLAGS="$CFLAGS -fPIC -fvisibility=hidden" -C bfd
   install -m644 bfd/libbfd.a ${pkgdir}/usr/lib
 
+  # Remove Windows/Novell specific man pages
   rm -f ${pkgdir}/usr/share/man/man1/{dlltool,nlmconv,windres,windmc}*
 
-  # Remove these symlinks, with binutils prereleases they are not ABI stable.
+  # Remove these symlinks, they are not ABI stable.
   # Programs should compile static to the .a file.
   rm -f ${pkgdir}/usr/lib/lib{bfd,opcodes}.so
   echo "INPUT ( /usr/lib/libbfd.a -liberty -lz )" >${pkgdir}/usr/lib/libbfd.so
diff --git a/abs/core/binutils/binutils.install b/abs/core/binutils/binutils.install
index 51781e7..8bf9f3a 100644
--- a/abs/core/binutils/binutils.install
+++ b/abs/core/binutils/binutils.install
@@ -1,4 +1,4 @@
-infodir=/usr/share/info
+infodir=usr/share/info
 filelist=(as.info bfd.info binutils.info configure.info gprof.info ld.info standards.info)
 
 post_upgrade() {
-- 
cgit v0.12

