# -*- 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 89830 2012-02-12 03:09:57Z hum@macports.org $

PortSystem          1.0
PortGroup           python 1.0

name                py-mecab
version             0.993
python.versions     24 25 26 27
categories-append   textproc japanese
platforms           darwin
maintainers         gmail.com:rsky0711 hum openmaintainer
license             GPL-2 LGPL-2.1 BSD

description         a Python module for MeCab
long_description    ${description}

homepage            http://mecab.sourceforge.net/
master_sites        googlecode:mecab
checksums           rmd160  552440d5e55793ecd9e45103300e355960bc91c9 \
                    sha256  58b77fe36ffbcf83fdf84a5567dbadb42af6c133760da53c9bddfbb995646ff7

distname            mecab-python-${version}
dist_subdir         mecab

if {${subport} != ${name}} {
    depends_lib-append  path:bin/mecab-config:mecab-utf8

    post-patch {
        reinplace "s|#!/usr/bin/python|#!${python.bin}|" \
            ${worksrcpath}/test.py
    }

    post-destroot {
        set exdir ${destroot}${prefix}/share/doc/${subport}/examples
        xinstall -m 755 -d ${exdir}
        xinstall -m 755 ${worksrcpath}/test.py ${exdir}
    }

    livecheck.type      none
} else {
    pre-destroot {
        xinstall -m 755 -d ${destroot}${prefix}/share/doc/${name}
    }
    livecheck.type      regex
    livecheck.url       http://code.google.com/p/mecab/downloads/list
    livecheck.regex     {mecab-python-([\d\.]+)\.tar}
}
