homebrew-core/Formula/groonga.rb

98 lines
2.9 KiB
Ruby

class Groonga < Formula
desc "Fulltext search engine and column store"
homepage "https://groonga.org/"
url "https://packages.groonga.org/source/groonga/groonga-11.0.6.tar.gz"
sha256 "456d2515896d8e77b120052b093257c2f6ca3435a1dd2c7c72b803b4652f51a9"
license "LGPL-2.1-or-later"
livecheck do
url :homepage
regex(%r{>v?(\d+(?:\.\d+)+)</a> is the latest release}i)
end
bottle do
sha256 arm64_big_sur: "4ea0e896a4fbcd3a4cf11efb3826f0891904783a6cd2b6882cc7b85547eaf3e9"
sha256 big_sur: "61475c0bc0a44a95d6f8e71dcc1de31ae72042658b8ed85b074cb1434f185966"
sha256 catalina: "763ba986ae90b0e78a43b60070277817b5ac93f2bfa1a4f4221e99524a4b8387"
sha256 mojave: "cab315ba5e2d1f608c31bad92a9f5af45c503dc3822246bc34c6a4fd75d72505"
sha256 x86_64_linux: "bfb993ce5c06cf4e9dad05e573dd4c79b875b8feed8042ca5c0cbd82cb544c2b"
end
head do
url "https://github.com/groonga/groonga.git"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
end
depends_on "pkg-config" => :build
depends_on "mecab"
depends_on "mecab-ipadic"
depends_on "msgpack"
depends_on "openssl@1.1"
depends_on "pcre"
on_linux do
depends_on "glib"
end
link_overwrite "lib/groonga/plugins/normalizers/"
link_overwrite "share/doc/groonga-normalizer-mysql/"
link_overwrite "lib/pkgconfig/groonga-normalizer-mysql.pc"
resource "groonga-normalizer-mysql" do
url "https://packages.groonga.org/source/groonga-normalizer-mysql/groonga-normalizer-mysql-1.1.4.tar.gz"
sha256 "084a74742ba7cf396c617354fa58d691b0c22e1c5d1ddfc3722123d7161fcd96"
end
def install
args = %W[
--prefix=#{prefix}
--disable-zeromq
--enable-mruby
--with-ssl
--with-zlib
--without-libstemmer
--with-mecab
]
if build.head?
args << "--with-ruby"
system "./autogen.sh"
end
mkdir "builddir" do
system "../configure", *args
system "make", "install"
end
resource("groonga-normalizer-mysql").stage do
ENV.prepend_path "PATH", bin
ENV.prepend_path "PKG_CONFIG_PATH", lib/"pkgconfig"
system "./configure", "--prefix=#{prefix}"
system "make"
system "make", "install"
end
end
test do
IO.popen("#{bin}/groonga -n #{testpath}/test.db", "r+") do |io|
io.puts("table_create --name TestTable --flags TABLE_HASH_KEY --key_type ShortText")
sleep 2
io.puts("shutdown")
# expected returned result is like this:
# [[0,1447502555.38667,0.000824928283691406],true]\n
assert_match(/\[\[0,\d+.\d+,\d+.\d+\],true\]/, io.read)
end
IO.popen("#{bin}/groonga -n #{testpath}/test-normalizer-mysql.db", "r+") do |io|
io.puts "register normalizers/mysql"
sleep 2
io.puts("shutdown")
# expected returned result is like this:
# [[0,1447502555.38667,0.000824928283691406],true]\n
assert_match(/\[\[0,\d+.\d+,\d+.\d+\],true\]/, io.read)
end
end
end