pkgname=binutils
pkgver=2.42
pkgrel=2
arch=('armv7h' 'aarch64')
license=('unknown')
source=("$pkgname-$pkgver.tar.xz")
pkgdesc='A set of programs to assemble and manipulate binary and object files'
url='https://www.gnu.org/software/binutils/'
license=(GPL-2.0-or-later GPL-3.0-or-later LGPL-2.0-or-later LGPL-3.0-or-later GFDL-1.3 FSFAP)
depends=(glibc libelf zlib zstd)
checkdepends=(dejagnu bc)
optdepends=('debuginfod: for debuginfod server/client functionality')
provides=(
libctf.so
libgprofng.so
libsframe.so
)
backup=('etc/gprofng.rc')
options=(staticlibs !distcc !ccache)
prepare() {
[[ ! -d binutils ]] && ln -s binutils-${pkgver} binutils
mkdir -p binutils-build
cd binutils
# Turn off development mode (-Werror, gas run-time checks, date in sonames)
sed -i '/^development=/s/true/false/' bfd/development.sh
}
build() {
local _confflags=(
--prefix=/usr
--sysconfdir="${pkgdir}"/etc
--with-lib-path=/usr/lib:/usr/local/lib
--with-bugurl=https://armlfs.urja.dev
--enable-colored-disassembly
--enable-default-execstack=no
--enable-deterministic-archives
--enable-gold
--enable-install-libiberty
--enable-ld=default
--enable-new-dtags
--enable-plugins
--enable-relro
--enable-shared
--enable-threads
--disable-werror
--disable-gdb
--disable-gdbserver
--disable-libdecnumber
--disable-readline
--disable-sim
--disable-werror
--enable-64-bit-bfd
--with-debuginfod
--with-pic
--with-system-zlib
--enable-default-hash-style=gnu
)
# Specify build host types
[[ $CARCH == "armv7h" ]] && _confflags+=(--host=armv7l-unknown-linux-gnueabihf --build=armv7l-unknown-linux-gnueabihf)
[[ $CARCH == "aarch64" ]] && _confflags+=(--host=aarch64-unknown-linux-gnu --build=aarch64-unknown-linux-gnu)
cd binutils-build
"${srcdir}"/binutils/configure \
"${_confflags[@]:?_confflags unset}"
make -O tooldir=/usr
# Extract the FSF All Permissive License
# <https://www.gnu.org/prep/maintain/html_node/License-Notices-for-Other-Files.html>
# used for some linker scripts.
tail -n 5 "${srcdir}"/binutils/ld/scripttempl/README > FSFAP
}
check() {
cd binutils-build
# Use minimal flags for testsuite
# ld testsuite uses CFLAGS_FOR_TARGET and requires -g
# gold testsuite requires CXXFLAGS/CFLAGS with default PIE/PIC disabled
echo "==== BINUTILS TESTSUITE ===="
make -O CFLAGS_FOR_TARGET="-O2 -g" \
CXXFLAGS="-O2 -no-pie -fno-PIC" \
CFLAGS="-O2 -no-pie" \
LDFLAGS="" \
check || true
# stop to read the results
echo "==== BINUTILS TESTSUITE ===="
}
package() {
cd binutils-build
make prefix="${pkgdir}"/usr tooldir="${pkgdir}"/usr install
# install PIC version of libiberty
install -m644 libiberty/pic/libiberty.a "${pkgdir}"/usr/lib
# Remove unwanted files
rm -f "${pkgdir}"/usr/share/man/man1/{dlltool,windres,windmc}*
# No shared linking to these files outside binutils
rm -f "${pkgdir}"/usr/lib/lib{bfd,opcodes}.so
tee "${pkgdir}"/usr/lib/libbfd.so << EOS
/* GNU ld script */
INPUT( /usr/lib/libbfd.a -lsframe -liberty -lz -lzstd -ldl )
EOS
tee "${pkgdir}"/usr/lib/libopcodes.so << EOS
/* GNU ld script */
INPUT( /usr/lib/libopcodes.a -lbfd )
EOS
# install FSF All Permissive License
install -Dm644 -t "${pkgdir}"/usr/share/licenses/${pkgname}/ FSFAP
}
sha256sums=('f6e4d41fd5fc778b06b7891457b3620da5ecea1006c6a4a41ae998109f85a800')