# -*- 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

name                groff
version             1.23.0
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  bfe2a3158cf6033733375b33ebca9a1f98a7fb93 \
                    sha256  6b9757f592b7518b4902eb6af7e54570bdccba37a871fddb2d30ae3863511c13 \
                    size    7433031

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
}
