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

PortSystem          1.0

set nameo           blahtex
name                ${nameo}ml
version             0.9
revision            1
categories          tex textproc
platforms           darwin
license             BSD
maintainers         takeshi 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            http://gva.noekeon.org/blahtexml/
master_sites        ${homepage}
worksrcdir          ${name}-${version}
distname            ${worksrcdir}-src

checksums           rmd160  76eac180ecdcbab924fd93b9e6c9332d0be77600 \
                    sha256  c5145b02bdf03cd95b7b136de63286819e696639824961d7408bec4591bc3737

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

patchfiles          patch-main.cpp.diff \
                    patch-mainPng.cpp.diff

use_configure       no

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
}

# https://github.com/gvanas/blahtexml - no tags currently
livecheck.type      none