class Manticoresearch < Formula desc "Open source text search engine" homepage "https://www.manticoresearch.com" url "https://github.com/manticoresoftware/manticoresearch/releases/download/3.2.0/manticore-3.2.0-191017-e526a01-release.tar.gz" sha256 "df6dbcc4df01065fc3cc6328f043b8cef3eb403a28671455cd3c8fc4217e3391" head "https://github.com/manticoresoftware/manticoresearch.git" bottle do sha256 "fd744cbff75ab0e153d9c4a0eb1e49fec7222daa49b481363be448ab0fc506c0" => :catalina sha256 "ae594e5ef0c1f5c73b6f08b90249081f0df69879453fa379f3f3b5ae935ed17e" => :mojave sha256 "fad052312cbbe75b5a0a6ca4e2184d9531f8c8bfa606597f0487c75a2339b09c" => :high_sierra end depends_on "cmake" => :build depends_on "icu4c" => :build depends_on "libpq" => :build depends_on "mysql" => :build depends_on "unixodbc" => :build depends_on "openssl" conflicts_with "sphinx", :because => "manticore, sphinx install the same binaries." def install args = %W[ -DCMAKE_INSTALL_LOCALSTATEDIR=#{var} -DDISTR_BUILD=macosbrew ] mkdir "build" do system "cmake", "..", *std_cmake_args, *args system "make", "install" end end def post_install (var/"run/manticore").mkpath (var/"log/manticore").mkpath (var/"manticore/data").mkpath end plist_options :manual => "searchd --config #{HOMEBREW_PREFIX}/etc/manticore/sphinx.conf" def plist; <<~EOS Label #{plist_name} RunAtLoad KeepAlive ProgramArguments #{opt_bin}/searchd --config #{etc}/manticore/sphinx.conf --nodetach WorkingDirectory #{HOMEBREW_PREFIX} EOS end test do (testpath/"sphinx.conf").write <<~EOS searchd { pid_file = searchd.pid binlog_path=# } EOS pid = fork do exec bin/"searchd" end ensure Process.kill(9, pid) Process.wait(pid) end end