# Contributor: Wojtek Kosior <kwojtus@protonmail.com>
# TODO check if it really breaks on i686 (as some PKGBUILDs suggest) and why
_target=arm-linux-gnueabi
pkgname=$_target-binutils
_pkgver=2.28
pkgver=${_pkgver}.0
_debrel=5
pkgrel=1
pkgdesc='A set of programs to assemble and manipulate binary and object files for the ARM GNU/Linux EABI target'
arch=(i686 x86_64)
url='http://www.gnu.org/software/binutils/'
license=('GPL-3' 'LGPL-3')
groups=('cross-devel')
depends=('glibc>=2.25' 'zlib')
makedepends=(binutils-source=$pkgver)
checkdepends=('dejagnu' 'bc')
options=('staticlibs' '!distcc' '!ccache')
conflicts=(arm-unknown-linux-gnueabi-binutils)
prepare() {
prepare-binutils-source "${srcdir}"
cd "${srcdir}/binutils-$_pkgver"
# hack! - libiberty configure tests for header files using "$CPP $CPPFLAGS"
sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" libiberty/configure
mkdir -p ${srcdir}/binutils-build
}
build() {
cd "${srcdir}/binutils-build"
# There's some gossip about --enable-gold causing fail on i686. Needs checking.
"${srcdir}/binutils-$_pkgver/configure" \
--target=$_target \
--prefix=/usr \
--with-lib-path=/lib:/usr/lib:/usr/local/lib \
--with-bugurl=https://issues.hyperbola.info/ \
--with-sysroot=/usr/$_target \
--prefix=/usr \
--with-gnu-as \
--with-gnu-ld \
--with-pic \
--enable-threads \
--enable-ld=default \
--enable-gold \
--enable-plugins \
--enable-deterministic-archives \
--disable-multilib \
--disable-werror \
--disable-gdb \
--disable-nls
# check the host environment and makes sure all the necessary tools are available
make configure-host
make
}
check() {
cd "${srcdir}/binutils-build"
# unset LDFLAGS as testsuite makes assumptions about which ones are active
# do not abort on errors - manually check log files
make -k LDFLAGS="" check || true
}
package() {
cd "${srcdir}/binutils-build"
make DESTDIR="$pkgdir" install
# Remove manpages for MS Windows tools
rm "$pkgdir"/usr/share/man/man1/$_target-{dlltool,nlmconv,windres,windmc}*
# Remove info documents that conflict with host version
rm -r "$pkgdir"/usr/share/info
# install license files
install -dm755 "${pkgdir}/usr/share/licenses/${pkgname}"
install -m644 "${srcdir}/binutils-$_pkgver/"COPYING3{,.LIB} \
"${pkgdir}/usr/share/licenses/${pkgname}"
}