# -*- 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
categories textproc japanese
subport mecab-${dicname}-sjis {
subport mecab-${dicname}-utf8 {
description ${dicname} of ${encoding} encoding for MeCab
long_description ${description}
homepage http://taku910.github.io/mecab/
master_sites macports_distfiles:mecab
checksums rmd160 3f5009263fcfa609c3f19f0e64b8c5f8a1b3afbe \
sha256 eaf216758edee9a159bc3d02507007318686b9537943268c4565cc1f9ef07f15
depends_lib port:mecab-base
if {${encoding} != "utf8"} {
# ignore invalid entries in AuxV.csv.
file rename ${worksrcpath}/AuxV.csv ${worksrcpath}/AuxV.csv.orig
system -W ${worksrcpath} "head -n 587 AuxV.csv.orig > AuxV.csv"
# convert character encoding of dic and def files if the target is other than utf8.
if {${encoding} != "utf8"} {
foreach f [glob ${worksrcpath}/*.csv ${worksrcpath}/*.def] {
system "nkf --in-place -${nkf_encoding} ${f}"
reinplace -locale C -W ${worksrcpath} "s|utf-8|${encoding}|" Makefile.in
reinplace -locale C -W ${worksrcpath} "s|charset: utf8|charset: ${encoding}|" model.def
configure.args --with-mecab-config=${prefix}/bin/mecab-config \
--with-charset=${encoding} \
--with-dicdir=${prefix}/lib/mecab/dic/${dicname}-${encoding}