PKGBUILDs/core/binutils/PKGBUILD

133 lines
4.1 KiB
Bash
Raw Normal View History

2022-04-13 23:54:37 +00:00
# Maintainer: Giancarlo Razzolini <grazzolini@archlinux.org>
# Maintainer: Frederik Schwan <freswa at archlinux dot org>
# Contributor: Bartłomiej Piotrowski <bpiotrowski@archlinux.org>
2018-04-24 12:11:31 +00:00
# Contributor: Allan McRae <allan@archlinux.org>
2022-02-15 00:40:14 +00:00
# toolchain build order: linux-api-headers->glibc->binutils->gcc->glibc->binutils->gcc
2011-12-09 20:46:15 +00:00
# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
2018-06-06 12:50:18 +00:00
# - Added a CONFIGFLAG for ARM, defining our build hosts
noautobuild=1
pkgname=binutils
2023-08-01 23:06:04 +00:00
pkgver=2.41
_commit=2c73aeb8d2e02de7b69cbcb13361cfbca9d76a4e
pkgrel=1
2017-09-09 16:46:10 +00:00
pkgdesc='A set of programs to assemble and manipulate binary and object files'
2018-01-06 20:20:15 +00:00
arch=(x86_64)
2019-06-18 12:37:41 +00:00
url='https://www.gnu.org/software/binutils/'
2022-04-13 23:54:37 +00:00
license=('GPL3' 'GPL' 'FDL1.3' 'custom:FSFAP')
2023-01-18 00:26:16 +00:00
depends=(glibc jansson libelf zlib zstd)
2022-05-10 23:43:56 +00:00
makedepends=(git)
2022-02-15 00:40:14 +00:00
checkdepends=(dejagnu debuginfod bc)
optdepends=('debuginfod: for debuginfod server/client functionality')
2022-12-07 00:52:56 +00:00
backup=('etc/gprofng.rc')
2023-01-18 00:26:16 +00:00
options=(staticlibs !distcc !ccache)
2022-05-10 23:43:56 +00:00
source=(git+https://sourceware.org/git/binutils-gdb.git#commit=${_commit}
gold-warn-unsupported.patch)
sha256sums=('SKIP'
'2d430b66f84a19c154725ec535280c493be1d34f1a90f95208dce02fecd0e4e4')
2017-10-21 19:52:04 +00:00
validpgpkeys=(3A24BC1E8FB409FA9F14371813FCEF89DD9E3C4F)
2012-11-05 18:34:52 +00:00
2013-04-12 00:57:49 +00:00
prepare() {
2023-02-06 12:39:54 +00:00
[[ ! -d binutils-gdb ]] && ln -s binutils-${pkgver} binutils-gdb
2017-09-09 16:46:10 +00:00
mkdir -p binutils-build
2020-05-14 12:45:46 +00:00
cd binutils-gdb
2015-02-09 04:07:41 +00:00
2020-05-22 12:41:13 +00:00
# Turn off development mode (-Werror, gas run-time checks, date in sonames)
sed -i '/^development=/s/true/false/' bfd/development.sh
2022-04-13 23:54:37 +00:00
# Creds @Fedora
# Change the gold configuration script to only warn about
# unsupported targets. This allows the binutils to be built with
# BPF support enabled.
patch -Np1 -i "${srcdir}"/gold-warn-unsupported.patch
2013-04-12 00:57:49 +00:00
}
build() {
2016-02-22 13:29:51 +00:00
cd binutils-build
2011-05-17 03:19:40 +00:00
# ALARM: Specify build host types
2012-11-05 16:25:15 +00:00
[[ $CARCH == "armv7h" ]] && CONFIGFLAG="--host=armv7l-unknown-linux-gnueabihf --build=armv7l-unknown-linux-gnueabihf"
2015-07-05 01:45:02 +00:00
[[ $CARCH == "aarch64" ]] && CONFIGFLAG="--host=aarch64-unknown-linux-gnu --build=aarch64-unknown-linux-gnu"
2023-02-06 12:39:54 +00:00
"${srcdir}"/binutils-gdb/configure \
2017-03-11 03:36:13 +00:00
--prefix=/usr \
2022-12-07 00:52:56 +00:00
--sysconfdir="${pkgdir}"/etc \
2012-09-14 01:01:20 +00:00
--with-lib-path=/usr/lib:/usr/local/lib \
2013-01-05 17:40:18 +00:00
--with-bugurl=https://github.com/archlinuxarm/PKGBUILDs/issues \
2023-01-18 00:26:16 +00:00
--enable-colored-disassembly \
2022-08-21 19:12:06 +00:00
--enable-default-execstack=no \
2018-04-24 12:11:31 +00:00
--enable-deterministic-archives \
2017-03-11 03:36:13 +00:00
--enable-gold \
2022-02-15 00:40:14 +00:00
--enable-install-libiberty \
2022-08-07 15:44:36 +00:00
--enable-jansson \
2018-04-24 12:11:31 +00:00
--enable-ld=default \
2022-12-07 00:52:56 +00:00
--enable-new-dtags \
2017-03-11 03:36:13 +00:00
--enable-plugins \
2017-07-14 00:36:39 +00:00
--enable-relro \
2022-02-15 00:40:14 +00:00
--enable-shared \
2022-05-29 16:31:03 +00:00
--enable-targets=bpf-unknown-none \
2018-04-24 12:11:31 +00:00
--enable-threads \
2017-03-11 03:36:13 +00:00
--disable-gdb \
2022-02-15 00:40:14 +00:00
--disable-gdbserver \
--disable-libdecnumber \
--disable-readline \
--disable-sim \
2018-04-24 12:11:31 +00:00
--disable-werror \
2020-03-14 18:06:49 +00:00
--with-debuginfod \
2018-04-24 12:11:31 +00:00
--with-pic \
2017-09-09 16:46:10 +00:00
--with-system-zlib \
2017-03-11 03:36:13 +00:00
$CONFIGFLAG
2022-02-15 00:40:14 +00:00
make -O tooldir=/usr
2022-04-13 23:54:37 +00:00
# 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.
2022-05-10 23:43:56 +00:00
tail -n 5 "${srcdir}"/binutils-gdb/ld/scripttempl/README > FSFAP
2011-05-17 03:19:40 +00:00
}
check() {
2016-02-22 13:29:51 +00:00
cd binutils-build
2018-08-12 18:45:37 +00:00
2022-02-15 00:40:14 +00:00
# Use minimal flags for testsuite
# ld testsuite uses CFLAGS_FOR_TARGET and requires -g
# gold testsuite requires CXXFLAGS/CFLAGS with default PIE/PIC disabled
make -O CFLAGS_FOR_TARGET="-O2 -g" \
CXXFLAGS="-O2 -no-pie -fno-PIC" \
CFLAGS="-O2 -no-pie" \
LDFLAGS="" \
2022-08-03 00:02:25 +00:00
check || true
}
package() {
2016-02-22 13:29:51 +00:00
cd binutils-build
2023-02-06 12:39:54 +00:00
make prefix="${pkgdir}"/usr tooldir="${pkgdir}"/usr install
2016-02-22 13:29:51 +00:00
2022-04-13 23:54:37 +00:00
# install PIC version of libiberty
2023-02-06 12:39:54 +00:00
install -m644 libiberty/pic/libiberty.a "${pkgdir}"/usr/lib
2022-04-13 23:54:37 +00:00
2013-01-05 17:40:18 +00:00
# Remove unwanted files
2023-02-06 12:39:54 +00:00
rm -f "${pkgdir}"/usr/share/man/man1/{dlltool,windres,windmc}*
2012-11-25 06:26:40 +00:00
2013-01-05 17:40:18 +00:00
# No shared linking to these files outside binutils
2023-02-06 12:39:54 +00:00
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
2022-04-13 23:54:37 +00:00
# install FSF All Permissive License
install -Dm644 -t "${pkgdir}"/usr/share/licenses/${pkgname}/ FSFAP
}