# -*- 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
# $Id: Portfile 114781 2013-12-15 03:48:21Z larryv@macports.org $

PortSystem          1.0

name                texinfo
version             5.2
categories          textproc
platforms           darwin
license             GPL-3+
maintainers         nomaintainer

installs_libs       no

description         The official documentation format of the GNU project
long_description    Texinfo is the official documentation format of \
                    the GNU project. It uses a single source file to \
                    produce output in a number of formats, both \
                    online and printed (dvi, info, html, xml, etc.). \
                    This means that instead of writing different \
                    documents for online information and another for \
                    a printed manual, you need write only one \
                    document. Some features need texlive (unnecessary \
                    if only the info command is used).
homepage            http://www.gnu.org/software/texinfo/

depends_lib         port:gettext \
                    port:libiconv \
                    port:ncurses

master_sites        gnu
use_xz              yes
checksums           rmd160  564fb99e6876f982cc03c8570f88edc8100d3aab \
                    sha256  5471ef683a64588a7cfef46ef2bdd3fbcbca89d847e10832612293f105e44eda

destroot.target-append  install-tex
destroot.args           TEXMF=${prefix}/share/texmf

pre-destroot {
    xinstall -d ${destroot}${prefix}/share/doc/${name}
    xinstall -m 644 -v -W ${worksrcpath} \
        AUTHORS COPYING ChangeLog NEWS README TODO doc/refcard/txirefcard.pdf \
        ${destroot}${prefix}/share/doc/${name}
}

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

# mktexlsr is provided by texlive-bin (and needed only if texlive-bin
# is installed). texlive-bin may be installed/uninstalled independently
# of texinfo (but not at the same time, unless a locking mechanism is
# provided). The use of a variant would not be flexible enough.

post-activate {
    if {[file exists ${prefix}/bin/mktexlsr]} {
        ui_debug {Rebuilding TeX ls-R filename databases}
        system ${prefix}/bin/mktexlsr
    }
}

post-deactivate {
    if {[file exists ${prefix}/bin/mktexlsr]} {
        ui_debug {Rebuilding TeX ls-R filename databases}
        system ${prefix}/bin/mktexlsr
    }
}

# We need to support names like 'texinfo-4.8a.tar.bz2'.
livecheck.type      regex
livecheck.url       http://ftp.gnu.org/gnu/texinfo/?C=M\;O=D
livecheck.regex     ${name}-(\[0-9.a-s\]+)\\.tar
