PKGNAME=binutils
PKGSEC=devel
PKGDEP="glibc zlib zstd"
PKGDES="Programs to assemble and manipulate binaries and object files"
# diagnostics.h moved from gdb to binutils
PKGBREAK="gdb<=12.1-2"
PKGREP="gdb<=12.1-2"

NOSTATIC=0
NOLTO=1
AB_FLAGS_O3=1

AUTOTOOLS_AFTER=(
    '--prefix=/usr'
    '--sysconfdir=/etc'
    '--with-bugurl=https://github.com/AOSC-Dev/aosc-os-abbs/issues'
    '--with-sysroot=/'
    # Combined with --with-sysroot, the leading '=' in the path is replaced
    # with the --sysroot= value at runtime, allowing to use the linker for
    # multiple targets (with a wrapper script to override the value / above).
    '--with-lib-path==/usr/lib'
    '--enable-threads'
    '--enable-shared'
    '--with-pic'
    '--with-zstd'
    '--enable-ld'
    '--enable-plugins'
    '--disable-werror'
    '--enable-lto'
    '--disable-gdb'
    '--disable-gdbserver'
    '--enable-deterministic-archives'
    '--enable-64-bit-bfd'
    '--enable-default-hash-style=gnu'
    '--enable-targets=all'
)
AUTOTOOLS_AFTER__LOONGSON3=(
    "${AUTOTOOLS_AFTER[@]}"
    '--enable-mips-fix-loongson3-llsc'
)

# Needed by Afterglow, whereas FAIL_ARCH defaults to mainline-only.
FAIL_ARCH="!(mainline|retro)"
