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

set nameo           blahtex
name                ${nameo}ml
github.setup        gvanas blahtexml 1.0 v
revision            1
categories          tex textproc
license             BSD
maintainers         {takeshi @tenomoto} openmaintainer
description         TeX to MathML converter
long_description \
    ${nameo} converts an equation given in a syntax close to TeX into MathML. \
    In addition, ${name} is able to process a whole XML document into another XML document.
homepage            https://gva.noekeon.org/blahtexml

checksums           rmd160  8d26cc57577f264ba804503597fd1677ca3c57c4 \
                    sha256  ef746642b1371f591b222ce3461c08656734c32ad3637fd0574d91e83995849e \
                    size    191236
github.tarball_from archive

depends_lib         port:libiconv \
                    port:xercesc3
depends_run         bin:latex:texlive-latex \
                    bin:dvipng:dvipng

use_configure       no

compiler.blacklist-append \
                    *gcc-4.0 *gcc-4.2

build.args          CC=${configure.cc} \
                    CXX=${configure.cxx} \
                    CFLAGS="${configure.cppflags} ${configure.optflags} ${configure.ldflags}"
build.target        ${nameo}-mac ${name}-mac
if {[variant_isset doc]} {
    build.target-append doc
}

destroot {
    xinstall -c -m 755 ${worksrcpath}/${nameo} ${destroot}${prefix}/bin
    xinstall -c -m 755 ${worksrcpath}/${name} ${destroot}${prefix}/bin
    set docdir ${destroot}${prefix}/share/doc/${name}
    xinstall -d -m 755 ${docdir}
    file copy ${worksrcpath}/README ${docdir}
    if {[variant_isset doc]} {
        file copy ${worksrcpath}/Documentation/manual.pdf ${docdir}
    }
}

variant doc description {generate documentation} {
    depends_build-append    port:texlive-latex-extra \
                            port:latex2html \
                            port:libxslt
}
