main/binutils: simplify

This commit is contained in:
Sertonix 2024-09-04 17:45:24 +02:00 committed by Natanael Copa
parent e23b1730b6
commit 795d018a06

View file

@ -2,7 +2,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=binutils
pkgver=2.43.1
pkgrel=0
pkgrel=1
pkgdesc="Tools necessary to build programs"
url="https://www.gnu.org/software/binutils/"
makedepends_build="bison flex texinfo"
@ -22,8 +22,10 @@ if [ -z "$BOOTSTRAP" ]; then
_noboot_configure="--enable-jansson --with-zstd"
fi
_gold_configure="--disable-gold"
if [ "$CHOST" = "$CBUILD" ] && [ "$CBUILD" = "$CTARGET" ] && [ "$CTARGET_ARCH" != "riscv64" ] && [ "$CTARGET_ARCH" != "loongarch64" ]; then
subpackages="$subpackages $pkgname-gold"
_gold_configure="--enable-gold"
fi
if [ "$CHOST" != "$CTARGET" ]; then
@ -53,29 +55,18 @@ fi
build() {
local _sysroot=/
local _cross_configure="--enable-install-libiberty --enable-shared"
local _cross_configure="--enable-install-libiberty --enable-shared --enable-plugins"
local _arch_configure=""
local _gold_configure="--disable-gold"
local _plugin_configure="--enable-plugins"
if [ "$CHOST" != "$CTARGET" ]; then
_sysroot="$CBUILDROOT"
_cross_configure="--disable-install-libiberty"
_plugin_configure="--disable-plugins"
fi
if [ "$CHOST" = "$CBUILD" ] && [ "$CBUILD" = "$CTARGET" ] && [ "$CTARGET_ARCH" != "riscv64" ] && [ "$CTARGET_ARCH" != "loongarch64" ]; then
_gold_configure="--enable-gold"
_cross_configure="--disable-install-libiberty --disable-plugins"
fi
if [ "$CTARGET_ARCH" = "x86_64" ]; then
_arch_configure="--enable-targets=x86_64-pep"
fi
if [ "$CTARGET_ARCH" = "riscv64" ] || [ "$CTARGET_ARCH" = "loongarch64" ]; then
_gold_configure="--disable-gold"
fi
CFLAGS="$CFLAGS -O2" \
CXXFLAGS="$CXXFLAGS -O2" \
./configure \
@ -91,7 +82,6 @@ build() {
$_arch_configure \
$_cross_configure \
$_gold_configure \
$_plugin_configure \
$_noboot_configure \
--disable-gdb \
--disable-gprofng \
@ -123,18 +113,14 @@ package() {
if [ "$CHOST" != "$CTARGET" ]; then
# creating cross tools: remove any files that would conflict
# with the native tools, or other cross tools
rm -r "${pkgdir:?}"/usr/share
rm -f "$pkgdir"/usr/lib/libiberty.a
rm -r "${pkgdir:?}"/usr/lib/bfd-plugins
rm -r "${pkgdir:?}"/usr/share "${pkgdir:?}"/usr/lib
fi
}
gold() {
pkgdesc="GNU binutils - gold linker"
if [ -e "$pkgdir"/usr/bin/ld.gold ]; then
amove usr/bin/ld.gold
fi
amove usr/bin/ld.gold
amove usr/$CTARGET/bin/ld.gold
}