# Contributor: Natanael Copa # Contributor: Ariadne Conill # Maintainer: Pablo Correa Gómez pkgname=binutils-cross pkgver=2.40 pkgrel=2 pkgdesc="Tools necessary to build programs for foreign architectures" url="https://www.gnu.org/software/binutils/" makedepends_build="bison flex texinfo" makedepends_host="zlib-dev zstd-dev" makedepends="$makedepends_build $makedepends_host" arch="all" 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 " builddir="$srcdir/binutils-$pkgver" targets="aarch64 armhf armv7 mips64 ppc64le riscv64 s390x x86 x86_64" options="!check" for target in $targets do subpackages="$subpackages binutils-$target:_$target" done build() { for target in $targets do local _arch_configure="" if [ "$target" = "x86_64" ]; then _arch_configure="--enable-targets=x86_64-pep" fi case "$target" in mips*) _hash_style_configure="--enable-default-hash-style=sysv" ;; *) _hash_style_configure="--enable-default-hash-style=gnu" ;; esac mkdir "$srcdir/$target" cd "$srcdir/$target" local ctarget="$(arch_to_hostspec "$target")" "$builddir"/configure \ --build=$CBUILD \ --host=$CHOST \ --target=$ctarget \ --program-prefix=$ctarget- \ --prefix=/usr \ --mandir=/usr/share/man \ --infodir=/usr/share/info \ --disable-multilib \ --disable-gprofng \ --enable-ld=default \ --disable-gold \ --enable-64-bit-bfd \ --disable-plugins \ --enable-relro \ --enable-deterministic-archives \ --enable-default-execstack=no \ --disable-internal-libiberty \ $_arch_configure \ $_hash_style_configure \ --with-pic \ --disable-werror \ --disable-nls \ --with-mmap \ --with-system-zlib make done } package() { pkgdesc="Tools necessary to build programs for foreign architectures" for target in $targets do depends="$depends binutils-$target" done mkdir -p "$pkgdir" } _install_target() { local target="$1" pkgdesc="Tools necessary to build programs for $target" cd "$srcdir/$target" make install DESTDIR="$subpkgdir" rm -rf "$subpkgdir"/usr/share rm -rf "$subpkgdir"/usr/lib rm -rf "$subpkgdir"/usr/include } _aarch64() { _install_target aarch64 } _armhf() { _install_target armhf } _armv7() { _install_target armv7 } _mips64() { _install_target mips64 } _ppc64le() { _install_target ppc64le } _riscv64() { _install_target riscv64 } _s390x() { _install_target s390x } _x86() { _install_target x86 } _x86_64() { _install_target x86_64 } sha512sums=" a37e042523bc46494d99d5637c3f3d8f9956d9477b748b3b1f6d7dfbb8d968ed52c932e88a4e946c6f77b8f48f1e1b360ca54c3d298f17193f3b4963472f6925 binutils-2.40.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 "