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

name                stanford-postagger
version             4.2.0
revision            0
checksums           rmd160  be8261f0418db031fee00247ba6848934690d4b4 \
                    sha256  0e900017c052114d30e688a6218e229551c045f6abb6907ba8a52b2a119bcb23 \
                    size    78034596

categories          textproc java
maintainers         nomaintainer

description         a Java implementation of the log-linear part-of-speech taggers
long_description    ${description}

platforms           darwin
license             GPL-2+

master_sites        https://nlp.stanford.edu/software/
homepage            ${master_sites}tagger.html
distname            stanford-tagger-${version}
use_zip             yes

patchfiles          wrappers.patch

use_configure       no
supported_archs     noarch

build {}

destroot {
    # install jar files and scripts.
    set java_dir ${prefix}/share/java/${name}
    set dest_java ${destroot}${java_dir}
    xinstall -d ${dest_java}
    xinstall -m 644 -W ${worksrcpath} \
        stanford-postagger.jar \
        stanford-postagger-${version}.jar \
        ${dest_java}
    xinstall -m 755 -W ${worksrcpath} \
        stanford-postagger.sh stanford-postagger-gui.sh \
        ${dest_java}
    reinplace -W ${dest_java} \
        "s|@JAVA_DIR@|${java_dir}|g" \
        stanford-postagger.sh stanford-postagger-gui.sh
    # install models.
    set dest_models ${dest_java}/models
    xinstall -d ${dest_models}
    xinstall -m 644 {*}[glob ${worksrcpath}/models/*.tagger] ${dest_models}
    # install examples.
    set dest_ex ${destroot}${prefix}/share/examples/${name}
    xinstall -d ${dest_ex}
    xinstall -m 644 -W ${worksrcpath} \
        sample-input.txt sample-output.txt \
        ${dest_ex}
    # install additional documents.
    set dest_doc ${destroot}${prefix}/share/doc/${name}
    xinstall -d ${dest_doc}
    xinstall -m 644 -W ${worksrcpath} \
        LICENSE.txt README.txt \
        ${dest_doc}
    xinstall -m 644 ${worksrcpath}/models/README-Models.txt \
        ${dest_doc}
}

notes "
$name requires Java v1.8+
"

livecheck.type      regex
livecheck.regex     {Tagger version *([0-9.]+) *}
