summaryrefslogtreecommitdiffstats
path: root/abs/core/binutils/PKGBUILD
blob: 9a8b925ebf305211b46a9cd57ff5b34666c39f56 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# $Id: PKGBUILD 19325 2008-11-20 11:47:00Z andyrtr $
# Maintainer: Andreas Radke <andyrtr@archlinux.org>

# toolchain build order: kernel-headers->glibc->binutils->gcc-libs->gcc->binutils->glibc

pkgname=binutils
pkgver=2.19
pkgrel=1
_date=20081119
pkgdesc="A set of programs to assemble and manipulate binary and object files"
arch=('i686' 'x86_64')
url="http://sources.redhat.com/binutils"
license=('GPL')
groups=('base')
options=('!libtool' '!distcc' '!ccache')
depends=('glibc>=2.9-1' 'texinfo>=4.12-3')
source=(ftp://ftp.archlinux.org/other/${pkgname}/${pkgname}-${pkgver}_${_date}.tar.bz2)
md5sums=('4a49694b08ef0e5931dba4813326d062')
install=binutils.install

build() {
  # for cvs checkout
#  mkdir ${startdir}/src/${pkgname}-${_date}
#  cd ${startdir}/src/${pkgname}-${_date}
#  export _TAG=binutils-2_19-branch
#  export 'CVSROOT=:pserver:anoncvs@sourceware.org:/cvs/src'
#  cvs -z9 co -r $_TAG binutils || return 1
#  cd src && tar -cvjf ../../../binutils-2.19_${_date}.tar.bz2 *
#  return 1

  cd ${startdir}/src

  mkdir build
  cd build

  CC="gcc -L`pwd`/bfd/.libs/"
  if [ "${CARCH}" = "x86_64" ]; then
    ../configure --prefix=/usr --infodir=/usr/share/info --enable-shared --enable-64-bit-bfd --disable-multilib 
  else
    ../configure --prefix=/usr --infodir=/usr/share/info --enable-shared
  fi
  # 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=${startdir}/pkg/usr || return 1
  make prefix=${startdir}/pkg/usr tooldir=${startdir}/pkg/usr install
  install -m 644 ../include/libiberty.h ${startdir}/pkg/usr/include

  if [ "${CARCH}" = "x86_64" ]; then
    # Rebuild libiberty.a with -fPIC
    make -C libiberty clean
    make CFLAGS="$CFLAGS -fPIC" -C libiberty
    install -m 644 libiberty/libiberty.a ${startdir}/pkg/usr/lib
    # Rebuild libbfd.a with -fPIC
    make -C bfd clean
    make CFLAGS="$CFLAGS -fPIC" -C bfd
    install -m 644 bfd/libbfd.a ${startdir}/pkg/usr/lib
  fi

  rm -f ${startdir}/pkg/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 ${startdir}/pkg/usr/lib/lib{bfd,opcodes}.so

  rm -f ${pkgdir}/usr/share/info/dir
}