homebrew-core/Formula/manticoresearch.rb

86 lines
2.4 KiB
Ruby

class Manticoresearch < Formula
desc "Open source text search engine"
homepage "https://www.manticoresearch.com"
url "https://github.com/manticoresoftware/manticoresearch/releases/download/3.3.0/manticore-3.3.0-200204-01fc8ad-release.tar.gz"
version "3.3.0"
sha256 "f62801f6eb50bd08cb8fe976f0a3a43c7600b979a1ced8d14b8261ca06eaf22c"
version_scheme 1
head "https://github.com/manticoresoftware/manticoresearch.git"
bottle do
sha256 "9eca403053abe7eb5308501aec1b8bfeed12444cb15e585c9e4e50190008ddd5" => :catalina
sha256 "441479504af266de98563bcba4757d0ff1d3a40d71a29a070de11877b19727ca" => :mojave
sha256 "623b0cadd47547aafa0e0f647f867826e475cade7b89aef7cd71b60819efca21" => :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@1.1"
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/manticore.conf"
def plist
<<~EOS
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>#{plist_name}</string>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<false/>
<key>ProgramArguments</key>
<array>
<string>#{opt_bin}/searchd</string>
<string>--config</string>
<string>#{etc}/manticore/manticore.conf</string>
<string>--nodetach</string>
</array>
<key>WorkingDirectory</key>
<string>#{HOMEBREW_PREFIX}</string>
</dict>
</plist>
EOS
end
test do
(testpath/"manticore.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