PKGBUILDs/core/binutils/PKGBUILD

74 lines
2.8 KiB
Bash
Raw Normal View History

# $Id: PKGBUILD 72655 2010-03-19 03:19:22Z allan $
# Maintainer: Allan McRae <allan@archlinux.org>
# PlugApps: Kevin Mihelich <kevin@plugapps.com>
noautobuild=1 # prevent plugbuild from autobuilding this package
# toolchain build order: linux-api-headers->glibc->binutils->gcc->binutils->glibc
pkgname=binutils
pkgver=2.20.1
pkgrel=1
_date=20100318
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.11.1-2' 'zlib')
options=('!libtool' '!distcc' '!ccache')
install=binutils.install
source=(ftp://ftp.archlinux.org/other/${pkgname}/${pkgname}-${pkgver}_${_date}.tar.bz2)
md5sums=('c153213a20a5075bd98d7f12fbd38a51')
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 --host=arm-unknown-linux-gnueabi --build=arm-unknown-linux-gnueabi
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
make prefix=${pkgdir}/usr tooldir=${pkgdir}/usr install
install -m644 ${srcdir}/include/libiberty.h ${pkgdir}/usr/include
if [ "${CARCH}" = "x86_64" ]; then
# 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
make CFLAGS="$CFLAGS -fPIC" -C bfd
install -m644 bfd/libbfd.a ${pkgdir}/usr/lib
fi
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
}