# $Id: Portfile,v 1.1 2006/05/21 09:12:52 erickt Exp $

PortSystem 1.0

name            latex2man
version         1.19
revision        1
categories      textproc
platforms       darwin
maintainers     erickt@opendarwin.org

description     Translator program intended to translate a LaTeX document into man

long_description \
                Latex2man is a tool to translate UNIX manual pages written \
                with LaTeX into a format understood by the UNIX man(1)-command. \
                Alternatively HTML, TexInfo, or LaTeX code can be produced too. 

homepage        http://www.informatik-vollmer.de/software/latex2man.php
master_sites    http://www.informatik-vollmer.de/software
checksums       md5 59fb43f8d9e4f56609a81e77b57b312c

depends_run     bin:tex:teTeX

worksrcdir      ${name}

configure       {
                cd ${worksrcpath}
                reinplace "s|\$(HOME)/man|${destroot}${prefix}/share/man|g" Makefile
                reinplace "s|\$(HOME)/info|${destroot}${prefix}/share/info|g" Makefile
                reinplace "s|\$(HOME)/public_html|${destroot}${prefix}/share/doc/latex2man|g" Makefile
                reinplace "s|\$(HOME)/tex/inputs|${destroot}${prefix}/share/texmf-local/tex/latex/latex2man|g" Makefile
                reinplace "s|\$(HOME)|${destroot}${prefix}|g" Makefile
                reinplace "s|/usr/local/bin/perl|${prefix}/bin/perl|" latex2man
}

pre-destroot    {
    file mkdir ${destroot}${prefix}/share/doc/latex2man
    file mkdir ${destroot}${prefix}/share/texmf-local/tex/latex/latex2man

}

post-activate   {
    system "\
        texhash && \
        fmtutil-sys --enablefmt latex2man && \
        fmtutil-sys --missing && \
        fmtutil-sys --all"

    # These are required so that local additions are picked
    # up if teTeX is updated:
    system "mktexlsr"
    system "updmap-sys"
}
