homebrew-core/Formula/groonga.rb

97 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.2.tar.gz"
sha256 "de29cb5648e3c29873d343747d626a5efcb302357dc7bd82dc4df776e2de558c"
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: "840a214dbd6057506f062ff10c96654d17ad47345f1ae128f272835c79ab08c7"
sha256 big_sur: "1c9131afc85d7f3d74f30bafc313acf58caa76c90276e915968f83552203c5f4"
sha256 catalina: "7380bc185cde1a86452bc367474522df3686ec239eb38f595c9c1f0f5d442267"
sha256 mojave: "e50c7f92c091e3b7998869b659422d015b300d70966aa071f5b6952394f835c1"
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