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

PortSystem          1.0

set dicname         ipadic
name                chasen-${dicname}
version             2.7.0
categories          textproc japanese
maintainers         hum openmaintainer
homepage            http://sourceforge.jp/projects/${dicname}/
description         IPA dictionary of EUC-JP encoding for ChaSen
long_description    ${description}
platforms           darwin
license             BSD

dist_subdir         chasen
distname            ${dicname}-${version}

master_sites        sourceforge_jp:${dicname}/24435

checksums           rmd160  5e37c750801df63439032be4954c4b63a44012cb \
                    sha256  ba2744cc16142159b330075e13eed4565908915ac95a790d38dea540e0963c1c

depends_lib         port:chasen-base

if {[file exists ${prefix}/share/doc/chasen/chasen_dartsclone]} {
    default_variants    +dartsclone
}

variant dartsclone description {Use darts-clone instead of darts} {}

supported_archs     noarch
configure.args      --with-chasenrc-path=${destroot}${prefix}/etc/chasen/chasenrc-${dicname}

pre-configure {
    if {[variant_isset dartsclone]} {
        set dartslib "dartsclone"
    } else {
        set dartslib "darts"
    }
    if {![file exists ${prefix}/share/doc/chasen/chasen_${dartslib}]} {
        return -code error "The variant you chose is not compatible with the ChaSen you've installed."
    }
}

use_parallel_build  no

pre-destroot {
    file mkdir ${destroot}${prefix}/etc/chasen
}

post-destroot {
    file mkdir ${destroot}${prefix}/share/doc/chasen-${dicname}
    xinstall -m 644 -W ${worksrcpath} \
        AUTHORS COPYING ChangeLog NEWS README doc/${dicname}-ja.pdf \
        ${destroot}${prefix}/share/doc/chasen-${dicname}
}

livecheck.type      regex
livecheck.url       http://sourceforge.jp/projects/${dicname}/releases
livecheck.regex     ${dicname}-(\[0-9.a-z\-\]+)\\.tar