# Automatically generated aport, do not edit!
# Generator: pmbootstrap aportgen binutils-armv7
# Based on: main/binutils

pkgname=binutils-armv7
pkgver=2.37
pkgrel=3
pkgdesc="Tools necessary to build programs for armv7 targets"
url="https://www.gnu.org/software/binutils/"
makedepends="gettext libtool autoconf automake bison texinfo"
arch="x86_64"
license="GPL-2.0 GPL-3.0-or-later LGPL-2.0 BSD"
source="https://ftp.gnu.org/gnu/binutils/binutils-$pkgver.tar.xz
	binutils-ld-fix-static-linking.patch
	gold-mips.patch
	ld-bfd-mips.patch
	0001-Revert-PR25882-.gnu.attributes-are-not-checked-for-s.patch
	binutils-mips-disable-assert.patch
	bfd-close-file-desriptor-if-there-is-no-archive-fd.patch
	defang-no-split.patch
	"
builddir="$srcdir/binutils-$pkgver"

if [ "$CHOST" = "$CBUILD" ] && [ "$CBUILD" = "$CTARGET" ] && [ "$CTARGET_ARCH" != "riscv64" ]; then
	subpackages=""
fi

if [ "$CHOST" != "$CTARGET" ]; then
	pkgname="binutils-$CTARGET_ARCH"
	subpackages=""
	sonameprefix="binutils:"
fi

# secfixes:
#   2.35.2-r1:
#     - CVE-2021-3487
#   2.32-r0:
#     - CVE-2018-19931
#     - CVE-2018-19932
#     - CVE-2018-20002
#     - CVE-2018-20712
#   2.28-r1:
#     - CVE-2017-7614

build() {
	_target="$(arch_to_hostspec armv7)"
	"$builddir"/configure \
		--build="$CBUILD" \
		--target=$_target \
		--with-lib-path=/usr/lib \
		--prefix=/usr \
		--with-sysroot=/usr/$_target \
		--enable-ld=default \
		--enable-gold=yes \
		--enable-plugins \
		--enable-deterministic-archives \
		--disable-multilib \
		--disable-werror \
		--disable-nls
	make
}

package() {
	make install DESTDIR="$pkgdir"

	# remove man, info folders
	rm -rf "$pkgdir"/usr/share

	# remove files that conflict with non-cross binutils
	rm -rf "$pkgdir"/usr/lib/bfd-plugins
}



sha512sums="
5c11aeef6935860a6819ed3a3c93371f052e52b4bdc5033da36037c1544d013b7f12cb8d561ec954fe7469a68f1b66f1a3cd53d5a3af7293635a90d69edd15e7  binutils-2.37.tar.xz
ecee33b0e435aa704af1c334e560f201638ff79e199aa11ed78a72f7c9b46f85fbb227af5748e735fd681d1965fcc42ac81b0c8824e540430ce0c706c81e8b49  binutils-ld-fix-static-linking.patch
f55cf2e0bf82f97583a1abe10710e4013ecf7d64f1da2ef8659a44a06d0dd8beaf58dab98a183488ea137f03e32d62efc878d95f018f836f8cec870bc448556f  gold-mips.patch
314d2ef9071c89940aa6c8118e8a1e2f191a5d0a4bf596da1ad9cc84f884d8bc7dea8bd7b9fc3f8f1bddd3fd41c6eb017e1e804044b3bf084df1ed9e6e095e2d  ld-bfd-mips.patch
70ec22bd72ef6dddecfd970613387dd4a8cdc8730dd3cbf03d5a0c3a7c4d839383167bb06dad21bf7c235329fd44b5dc4aefe762f68544f17155cf002bf1be4a  0001-Revert-PR25882-.gnu.attributes-are-not-checked-for-s.patch
609cd90d8b334eb309f586b17b9d335a08d3dbb6def7c3eb5c010028fcb681674031e5b9d853aa7a39a50304356a86afc184b85562b3f228f8197f4d29395c8f  binutils-mips-disable-assert.patch
10a0074583d2cc4598710c7e434ba7088da074b105f4f5e951fc61af7150ad62adf60a7c98f6fd13b1771f169e45a5a1ef618240c6893d3f0f3d93fd768a03c6  bfd-close-file-desriptor-if-there-is-no-archive-fd.patch
4652f092c9376f0cb7fd6c72cb37ff7c15c1c6e3408fac79329b7f41a7925c98eb35989a9a040682130988a36401901d6d95afa44f0ce50caa85ee478db6bf03  defang-no-split.patch
"
