# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4

PortSystem          1.0

name                binutils
version             2.39
revision            1

checksums           rmd160  eb5d638227d0543d3055fc7e6d8d8c28534f55c9 \
                    sha256  645c25f563b8adc0a81dbd6a41cffbf4d37083a382e02d5d3df4f65c09516d00 \
                    size    25167756

description         FSF Binutils for native development.
long_description    Free Software Foundation development toolchain ("binutils") \
                    for native development. Tools are prefixed with g to avoid \
                    conflicts with original tools.

platforms           darwin
categories          devel
license             GPL-3+
maintainers         nomaintainer
homepage            https://www.gnu.org/software/binutils/binutils.html
master_sites        gnu:binutils
use_xz              yes

depends_build-append \
                    port:gettext

depends_lib-append \
                    port:zlib \
                    port:libiconv \
                    port:gettext-runtime

patchfiles          dynamic_lookup-11.patch

configure.args      --infodir='${prefix}/share/info' \
                    --mandir='${prefix}/share/man' \
                    --disable-silent-rules \
                    --disable-werror \
                    --program-prefix=g \
                    --enable-shared \
                    --enable-install-libbfd

# The Makefile runs configure again in subdirectories.
# It correctly passes along most configure variables (CFLAGS, LDFLAGS, ...),
#    but seems to neglect CPPFLAGS.
build.env-append    CPPFLAGS=-I${prefix}/include

# Binutils violates the mtree layout by creating ${prefix}/<arch>/
destroot.violate_mtree  yes

# We don't want the etc module.
# But leave texi2pod.pl untouched for processing man pages
post-extract {
    move ${worksrcpath}/etc/texi2pod.pl ${worksrcpath}
    delete {*}[glob ${worksrcpath}/etc/*]
    move ${worksrcpath}/texi2pod.pl ${worksrcpath}/etc/texi2pod.pl
}

universal_variant   no

notes "Having ${name} installed will cause some other ports to\
fail to build. Consider uninstalling ${name}."
