homebrew-core/Formula/manticoresearch.rb

88 lines
2.5 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.0-200722-1d34c49-release-source.tar.gz"
version "3.5.0"
sha256 "00d65103d7f07d52b953731566c1015d5f668dd35e8709eeca10cc0fbedb9a66"
license "GPL-2.0"
version_scheme 1
head "https://github.com/manticoresoftware/manticoresearch.git"
bottle do
sha256 "1116f8caad4dfdcd0ede2422e5b5be19e45cf549e0b3d402b90962ce0f2455b4" => :catalina
sha256 "493a87ab30c5cac2f6f4531713259048c7555f03fbd8efa176f58259ca3c8834" => :mojave
sha256 "b27d0c40106e49e2323063fa8cae2d5a4a51a6af902252576cc6d3c7d9f30ffc" => :high_sierra
end
depends_on "boost" => :build
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: "manticoresearch is a fork of sphinx"
def install
args = %W[
-DCMAKE_INSTALL_LOCALSTATEDIR=#{var}
-DDISTR_BUILD=macosbrew
-DBoost_NO_BOOST_CMAKE=ON
]
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