homebrew-core/Formula/manticoresearch.rb

89 lines
2.6 KiB
Ruby

class Manticoresearch < Formula
desc "Open source text search engine"
homepage "https://www.manticoresearch.com"
url "https://repo.manticoresearch.com/repository/manticoresearch_source/release/manticore-3.5.4-201211-13f8d08-release-source.tar.gz"
version "3.5.4"
sha256 "efe4b92650d31c89fe892750402e6343c5ee580e723ed6ac1235ca62b1e04b7d"
license "GPL-2.0"
version_scheme 1
head "https://github.com/manticoresoftware/manticoresearch.git"
bottle do
sha256 arm64_big_sur: "837c96d0e6944fed2f02ed99672d7e372a2cbba25141e3de7acd096939c6ba35"
sha256 big_sur: "f3f8e3a121f510b81c022c7fcda9563944f9e13c2655ee8b81d50cfc15bdb5bb"
sha256 catalina: "296234167dd9f798c39b8168dba02ac3dff381ad4e61e7f0d4e0558385759af9"
sha256 mojave: "939b0798a3ca5be80832bf1e1e3ebe9dd8b2febe8cf0e84765dfa7caa25f8d89"
end
depends_on "boost" => :build
depends_on "cmake" => :build
depends_on "icu4c" => :build
depends_on "libpq" => :build
depends_on "mysql" => :build
depends_on "openssl@1.1"
conflicts_with "sphinx", because: "manticoresearch is a fork of sphinx"
def install
args = %W[
-DCMAKE_INSTALL_LOCALSTATEDIR=#{var}
-DDISTR_BUILD=macosbrew
-DBoost_NO_BOOST_CMAKE=ON
-DWITH_ODBC=OFF
]
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