# -*- 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
PortGroup           muniversal 1.1

conflicts           heirloom-doctools

name                groff
version             1.24.1
revision            0

categories          sysutils textproc
maintainers         nomaintainer
license             GPL-3+
installs_libs       no

description         GNU Troff (Groff)
long_description    The groff (GNU Troff) software is a typesetting package \
                    which reads plain text mixed with formatting commands and \
                    produces formatted output. Groff now supports HTML.

homepage            https://www.gnu.org/software/groff
master_sites        gnu

checksums           rmd160  2a79b56fa3cd8b8fb71d9d4fe14fad8c413858bf \
                    sha256  74e2819795b6aff431aeac983d63a9c8968eeaba2a2eba7df8ba4c7b41e7cfd8 \
                    size    9005760

# patchfiles          patch-implicitly-defined.diff

if {[string match *gcc-4.* ${configure.compiler}]} {
    patchfiles-append \
                    patch-remove-pragmas.diff
}

configure.args      --infodir=${prefix}/share/info \
                    --mandir=${prefix}/share/man \
                    --without-x \
                    --disable-silent-rules \
                    ac_cv_prog_AWK=/usr/bin/awk

depends_build       port:m4 \
                    port:texinfo

compiler.blacklist-append macports-clang-9.0

configure.env       M4=${prefix}/bin/gm4

build.env-append    LC_CTYPE=C
destroot.env-append LC_CTYPE=C

# README file lists the following as dependencies:
depends_lib-append  port:ghostscript \
                    port:psutils \
                    port:netpbm \
                    port:uchardet \
                    port:urw-fonts

# build times are baked into PDF files
muniversal.equivalent \
                    ${prefix}/share/doc/groff-${version}/pdf/automake.pdf \
                    ${prefix}/share/doc/groff-${version}/pdf/pdfmark.pdf \
                    ${prefix}/share/doc/groff-${version}/examples/mom/typesetting.pdf \
                    ${prefix}/share/doc/groff-${version}/examples/mom/letter.pdf \
                    ${prefix}/share/doc/groff-${version}/examples/mom/mon_premier_doc.pdf \
                    ${prefix}/share/doc/groff-${version}/examples/mom/sample_docs.pdf \
                    ${prefix}/share/doc/groff-${version}/examples/mom/mom-pdf.pdf \
                    ${prefix}/share/doc/groff-${version}/examples/mom/slide-demo.pdf

# Fix for Rosetta: https://trac.macports.org/ticket/64542
platform darwin 10 powerpc {
    configure.args-append --build=powerpc-apple-darwin${os.major}
}

post-destroot {
    delete ${destroot}${prefix}/lib/charset.alias
}
