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

name                expgram
version             0.2.1
revision            3
categories          textproc
maintainers         nomaintainer

description         an ngram toolkit with succinct storage
long_description    ${description}

homepage            http://www2.nict.go.jp/univ-com/multi_trans/expgram
platforms           darwin
license             LGPL-3+

master_sites        ${homepage}
checksums           rmd160  1d66e9c18ca8892366c57b9755a3b899a5ab3223 \
                    sha256  982e8df505fb410db7bace7e1aebc03fe5a8132538973e1382c922edbec906f6

mpi.setup           require

depends_lib         port:boost

depends_build       port:py27-docutils \
                    port:py27-pygments

configure.env-append \
    MPI_CXX_COMPILER=${mpi.cxx}

configure.optflags  -O3

post-build {
    system -W ${worksrcpath}/doc "${build.cmd} index.html"
}

post-destroot {
    # install additional documents.
    set docdir ${prefix}/share/doc/${name}
    xinstall -d ${destroot}${docdir}
    xinstall -m 644 -W ${worksrcpath} \
        COPYING.GPL COPYING.LGPL FAQ LICENSE NEWS.rst README.rst TODO.rst \
        doc/index.html \
        ${destroot}${docdir}
    # install sample scripts.
    set exdir ${prefix}/share/examples/${name}
    xinstall -d ${destroot}${exdir}
    foreach sh {web1t-en.sh web1t-ja.sh web1t-zh.sh} {
        xinstall -m 644 ${worksrcpath}/sample/${sh} ${destroot}${exdir}
        reinplace "s|expgram-directory|${prefix}/bin|" ${destroot}${exdir}/${sh}
    }
}

livecheck.type      regex
livecheck.url       [lindex ${master_sites} 0]
livecheck.regex     "${name}-(\\d+(?:\\.\\d+)*)${extract.suffix}"