48 lines
1.5 KiB
Ruby
48 lines
1.5 KiB
Ruby
class MecabIpadic < Formula
|
|
desc "IPA dictionary compiled for MeCab"
|
|
homepage "http://mecab.googlecode.com/svn/trunk/mecab/doc/index.html"
|
|
url "https://downloads.sourceforge.net/project/mecab/mecab-ipadic/2.7.0-20070801/mecab-ipadic-2.7.0-20070801.tar.gz"
|
|
sha256 "b62f527d881c504576baed9c6ef6561554658b175ce6ae0096a60307e49e3523"
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "55703c812de3e7cff503b9cd1eafa0656b3f17c4885165ce4d8e4d2b2356050e" => :yosemite
|
|
sha256 "0a9ea36b7cc03f73ae34f72e078b7e84ebe814cf8e1cfbea2d5f876c1893b1c5" => :mavericks
|
|
sha256 "c70d627c447086a66b6eaca37cd98e1da099f65bfb6b87f2c47d1901d5e4a090" => :mountain_lion
|
|
end
|
|
|
|
# Via ./configure --help, valid choices are utf8 (default), euc-jp, sjis
|
|
option "charset=", "Select charset: utf8 (default), euc-jp, or sjis"
|
|
|
|
depends_on "mecab"
|
|
|
|
link_overwrite "lib/mecab/dic"
|
|
|
|
def install
|
|
charset = ARGV.value("charset") || "utf8"
|
|
args = %W[
|
|
--disable-debug
|
|
--disable-dependency-tracking
|
|
--prefix=#{prefix}
|
|
--with-charset=#{charset}
|
|
--with-dicdir=#{lib}/mecab/dic/ipadic
|
|
]
|
|
|
|
system "./configure", *args
|
|
system "make", "install"
|
|
end
|
|
|
|
def caveats; <<-EOS.undent
|
|
To enable mecab-ipadic dictionary, add to #{HOMEBREW_PREFIX}/etc/mecabrc:
|
|
dicdir = #{HOMEBREW_PREFIX}/lib/mecab/dic/ipadic
|
|
EOS
|
|
end
|
|
|
|
test do
|
|
(testpath/"mecabrc").write <<-EOS.undent
|
|
dicdir = #{HOMEBREW_PREFIX}/lib/mecab/dic/ipadic
|
|
EOS
|
|
|
|
pipe_output("mecab --rcfile=#{testpath}/mecabrc", "すもももももももものうち\n", 0)
|
|
end
|
|
end
|