# -*- 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: Portfile 89831 2012-02-12 03:25:35Z hum@macports.org $

PortSystem          1.0

set encoding        eucjp
name                mecab
version             0.993
categories          textproc japanese
platforms           darwin
maintainers         gmail.com:rsky0711 hum openmaintainer
license             GPL-2 LGPL-2.1 BSD

homepage            http://mecab.sourceforge.net/
description         yet another part-of-speech and morphological analyzer
long_description    MeCab is ${description}. \
                    This port depends on MeCab base analyzer and a Japanese \
                    dictionary of ${encoding} encoding.

distfiles

depends_lib         port:mecab-base

conflicts           mecab-sjis mecab-utf8

use_configure       no
supported_archs     noarch

build               {}

set dicname         ipadic

if {![variant_isset jumandic] && ![variant_isset naistjdic]} {
    default_variants    +ipadic
}

variant ipadic conflicts jumandic naistjdic description {Use ipadic} {
    set dicname         ipadic
    depends_lib-append  port:mecab-${dicname}
}

variant jumandic conflicts ipadic naistjdic description {Use jumandic} {
    set dicname         jumandic
    depends_lib-append  port:mecab-${dicname}
}

variant naistjdic conflicts ipadic jumandic description {Use naist-jdic} {
    set dicname         naist-jdic
    depends_lib-append  port:mecab-${dicname}
}

variant sjis description {Deprecated, install mecab-sjis instead} {
    ui_msg "Deprecated: please install 'mecab-sjis' instead of 'mecab +sjis'."
    ui_msg "Note: upgrading mecab will be completed if mecab-sjis is successfully installed, although the process fails due to a conflict."
    depends_lib         port:mecab-sjis
}

variant utf8 description {Deprecated, install mecab-utf8 instead} {
    ui_msg "Deprecated: please install 'mecab-utf8' instead of 'mecab +utf8'."
    ui_msg "Note: upgrading mecab will be completed if mecab-utf8 is successfully installed, although the process fails due to a conflict."
    depends_lib         port:mecab-utf8
}

destroot {
    set dest_dic ${destroot}${prefix}/lib/mecab/dic
    file mkdir ${dest_dic}
    ln -s ${dicname}-${encoding} ${dest_dic}/sysdic
}

livecheck.type      none
