homebrew-core/Formula/groonga.rb

101 lines
3.1 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.1.0.tar.gz"
sha256 "762d6ecd36717912debdc492e5dff26dae58ead772db51f636053b66b65339b2"
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_monterey: "c74c9fc39911bda5d82a7de4dc88a003520927f077e6d389bab792f2b807cffa"
sha256 arm64_big_sur: "8398b02011d8ec963bcdc22de03912dfb857feb7e72b29630b41568d5f5f1dd2"
sha256 monterey: "d768b11c9248bc7fe48e3bc686c9bc8fd61986ba8ff13ff5da42924b699d0c8e"
sha256 big_sur: "35d70865b5fd48d8f09844f99cc5b7d44bad1f5d9ac80e80ffff817e3b5876df"
sha256 catalina: "05a10e878b3faf2198e9fbb3ebac8ab7a7ebb3f2eaad16710884ed025a0c0aee"
sha256 x86_64_linux: "257252e342d635a3e9b6549e1eee9af988c394b8e0db4e45f9c70d415ee85744"
end
head do
url "https://github.com/groonga/groonga.git", branch: "master"
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.5.tar.gz"
sha256 "22f1ac0ac766675e4edecb4c9f5a73454e6555dbeba8d259f6ef36483fbcdf52"
end
def install
args = %W[
--prefix=#{prefix}
--disable-zeromq
--disable-apache-arrow
--enable-mruby
--with-luajit=no
--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