class MecabIpadic < Formula desc "IPA dictionary compiled for MeCab" homepage "https://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_skip_relocation sha256 "33f42c18d7347708a56d8846c0bde5c8291b7685ce06b342e96442bca35f6663" => :sierra sha256 "9f0ae0a62141e3b28807349cb7a9560e36770acb869f4a4e7a54ea1a28ef8ba5" => :el_capitan 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