PKGBUILD 2.67 KB
Newer Older
1
# $Id: PKGBUILD 77602 2010-04-16 11:58:22Z allan $
Jan Mette's avatar
Jan Mette committed
2 3
# Maintainer: Allan McRae <allan@archlinux.org>

Jan Mette's avatar
Jan Mette committed
4
# toolchain build order: linux-api-headers->glibc->binutils->gcc->binutils->glibc
Jan Mette's avatar
Jan Mette committed
5 6

pkgname=binutils
Jan Mette's avatar
Jan Mette committed
7
pkgver=2.20.1
8
pkgrel=2
Jan Mette's avatar
Jan Mette committed
9
_date=20100318
Jan Mette's avatar
Jan Mette committed
10 11 12 13 14
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')
15
depends=('glibc>=2.11.1-3' 'zlib')
Jan Mette's avatar
Jan Mette committed
16 17
options=('!libtool' '!distcc' '!ccache')
install=binutils.install
18
source=(ftp://ftp.archlinux.org/other/${pkgname}/${pkgname}-${pkgver}_${_date}.tar.bz2)
Jan Mette's avatar
Jan Mette committed
19
md5sums=('c153213a20a5075bd98d7f12fbd38a51')
Jan Mette's avatar
Jan Mette committed
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48

mksource() {
  mkdir ${pkgname}-${_date}
  cd ${pkgname}-${_date}
  export _TAG=binutils-2_20-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 *
}

build() {
  cd ${srcdir}
  mkdir build && cd 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

  # This checks the host environment and makes sure all the necessary tools are available to compile Binutils.
  make configure-host || return 1

  make tooldir=${pkgdir}/usr || return 1
49 50 51 52
}

package() {
  cd ${srcdir}/build
Jan Mette's avatar
Jan Mette committed
53 54 55
  make prefix=${pkgdir}/usr tooldir=${pkgdir}/usr install
  install -m644 ${srcdir}/include/libiberty.h ${pkgdir}/usr/include

56 57 58 59 60 61 62 63 64 65
  # Rebuild libiberty.a with -fPIC
  make -C libiberty clean
  make CFLAGS="$CFLAGS -fPIC" -C libiberty
  install -m644 libiberty/libiberty.a ${pkgdir}/usr/lib

  # Rebuild libbfd.a with -fPIC
  make -C bfd clean
  # hidden visability prevent 3rd party shared libraries exporting bfd non-stable API
  make CFLAGS="$CFLAGS -fPIC -fvisibility=hidden" -C bfd
  install -m644 bfd/libbfd.a ${pkgdir}/usr/lib
Jan Mette's avatar
Jan Mette committed
66 67 68 69 70 71 72 73 74

  rm -f ${pkgdir}/usr/share/man/man1/{dlltool,nlmconv,windres,windmc}*

  # Remove these symlinks, with binutils prereleases 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
  echo "INPUT ( /usr/lib/libopcodes.a -lbfd )" >${pkgdir}/usr/lib/libopcodes.so
}