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

github.setup        neologd mecab-ipadic-neologd cc06317f4f0ee4815360f5bd500e4fc8cfbe9c65
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
version             20150716
set dic_version     ${version}
categories          textproc japanese
license             Apache-2
platforms           any
supported_archs     noarch
maintainers         nomaintainer

description         Neologism dictionary for MeCab
long_description    mecab-ipadic-neologd is customized system dictionary for \
                    MeCab. This dictionary includes many neologisms (new word), \
                    which are \extracted from many language resources on the Web. \
                    When you analyze the Web documents, it's better to use this \
                    system dictionary and default one (ipadic) together.

dist_subdir         mecab
checksums           rmd160  15a86d19fe02138c8ba5622b4e568f2a1d341696 \
                    sha256  c46ad13f6a023c05429b27a55d46861f23443722fa8151b86c8072f967ffa680

depends_lib         port:mecab-base

depends_build       port:mecab-ipadic-utf8 \
                    port:libiconv \
                    port:xz

patchfiles          patch-test.sh.diff

post-patch {
    reinplace "s|@PREFIX@|${prefix}|g" ${worksrcpath}/libexec/test-mecab-ipadic-neologd.sh
}

use_configure       no

build {
    system -W ${worksrcpath} ./libexec/make-mecab-ipadic-neologd.sh
    system -W ${worksrcpath} ./libexec/test-mecab-ipadic-neologd.sh
}

destroot.dir        ${worksrcpath}/build/mecab-ipadic-2.7.0-20070801-neologd-${dic_version}

post-destroot {
    move ${destroot}${prefix}/lib/mecab/dic/${name} \
        ${destroot}${prefix}/lib/mecab/dic/neologd-utf8
    # install additional documents
    set docdir      ${prefix}/share/doc/${name}
    xinstall -d ${destroot}${docdir}
    xinstall -m 644 -W ${worksrcpath} \
        ChangeLog COPYING README.ja.md README.md \
        ${destroot}${docdir}
    xinstall -m 644 ${destroot.dir}/COPYING ${destroot}${docdir}/COPYING-ipadic
} 
