# -*- 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                eda
version             0.3.3
categories          textproc japanese
maintainers         nomaintainer

description         a word-based dependency parser written in C++
long_description    EDA is ${description}. \
                    The name EDA stands for Easily adaptable Dependency Analyzer.

homepage            http://plata.ar.media.kyoto-u.ac.jp/tool/EDA/
platforms           darwin
license             BSD

master_sites        ${homepage}downloads/
checksums           ${distname}${extract.suffix} \
                    rmd160  39f4767b034d98af705058201c83227cc112f534 \
                    sha256  d7324d588b8d44fdfeda51a34ffeb3431cb585cc85ac9927ff172e5f56c55b7f

patchfiles          patch-LBFGS.hpp.diff

installs_libs       no

depends_run         port:kytea

use_configure       no

variant universal   {}

set cflags          "${configure.cflags} [get_canonical_archflags]"
set cxxflags        "${configure.cxxflags} [get_canonical_archflags cxx]"
build.args          CC="${configure.cc}" CFLAGS="${cflags}" \
                    CXX="${configure.cxx}" CXXFLAGS="${cxxflags}"

destroot {
    # install binaries.
    xinstall -m 755 -W ${worksrcpath} eda train-eda \
        ${destroot}${prefix}/bin
    # install additional documents.
    set dest_doc ${destroot}${prefix}/share/doc/${name}
    xinstall -d ${dest_doc}
    xinstall -m 644 -W ${worksrcpath} README \
        ${dest_doc}
    # install sample data.
    set dest_ex ${destroot}${prefix}/share/examples/${name}
    xinstall -d ${dest_ex}
    xinstall -m 644 -W ${worksrcpath} \
        sample.eda sample.eda_ne sample.kytea \
        ${dest_ex}
}

default_variants    +model

set model_file      bccwj-20130906.etm

variant model description {Add model} {
    distfiles-append   ${model_file}
    checksums-append   ${model_file} \
        rmd160  73a31ef68615df9fd5d167c4f01a591cfb663bc7 \
        sha256  c665c79ca264f59de15edb0fbb96103e6655a8a9fee826068341bdfc768d7ce5

    post-destroot {
        # install models.
        set dest_models ${destroot}${prefix}/lib/${name}/models
        xinstall -d ${dest_models}
        xinstall -m 644 -W ${distpath} ${model_file} ${dest_models}
        # install a demo script.
        xinstall -m 755 ${filespath}/eda_demo ${destroot}${prefix}/bin
        reinplace "s|@prefix@|${prefix}|g" ${destroot}${prefix}/bin/eda_demo
    }
}

livecheck.type      regex
livecheck.regex     ${name}-(\[0-9.\]+)\\.
