class OpenJtalk < Formula desc "Japanese text-to-speech system" homepage "https://open-jtalk.sourceforge.io/" url "https://downloads.sourceforge.net/project/open-jtalk/Open%20JTalk/open_jtalk-1.11/open_jtalk-1.11.tar.gz" sha256 "20fdc6aeb6c757866034abc175820573db43e4284707c866fcd02c8ec18de71f" bottle do cellar :any_skip_relocation sha256 "0a251febe3197994355ab780ce02aa45264c7d148b0f1b0dfd1a80a7f7aa9937" => :catalina sha256 "bed36f972fe3dc3d5f286eff5c1b1605a1bcfae6cc755b7b2aee57fc497f7913" => :mojave sha256 "cd50656bb81db4528b82b844c773440d6cdfec63e545a64002a473da05a7eb18" => :high_sierra sha256 "b015d173b77980d0da3a8eedad02fdff95ac919c790917ba9cb197db91207235" => :sierra end resource "hts_engine API" do url "https://downloads.sourceforge.net/project/hts-engine/hts_engine%20API/hts_engine_API-1.10/hts_engine_API-1.10.tar.gz" sha256 "e2132be5860d8fb4a460be766454cfd7c3e21cf67b509c48e1804feab14968f7" end resource "voice" do url "https://downloads.sourceforge.net/project/open-jtalk/HTS%20voice/hts_voice_nitech_jp_atr503_m001-1.05/hts_voice_nitech_jp_atr503_m001-1.05.tar.gz" sha256 "2e555c88482267b2931c7dbc7ecc0e3df140d6f68fc913aa4822f336c9e0adfc" end resource "mei" do url "https://downloads.sourceforge.net/project/mmdagent/MMDAgent_Example/MMDAgent_Example-1.8/MMDAgent_Example-1.8.zip" sha256 "f702f2109a07dca103c7b9a5123a25c6dda038f0d7fcc899ff0281d07e873a63" end def install resource("hts_engine API").stage do system "./configure", "--prefix=#{prefix}" system "make", "install" end system "./configure", "--with-hts-engine-header-path=#{include}", "--with-hts-engine-library-path=#{lib}", "--with-charset=UTF-8", "--prefix=#{prefix}" system "make", "install" resource("voice").stage do (prefix/"voice/m100").install Dir["*"] end resource("mei").stage do (prefix/"voice").install "Voice/mei" end end test do (testpath/"sample.txt").write "OpenJTalkのインストールが完了しました。" system bin/"open_jtalk", "-x", "#{prefix}/dic", "-m", "#{prefix}/voice/mei/mei_normal.htsvoice", "-ow", "out.wav", "sample.txt" end end