homebrew-core/Formula/groonga.rb

104 lines
3.2 KiB
Ruby

class Groonga < Formula
desc "Fulltext search engine and column store"
homepage "https://groonga.org/"
url "https://packages.groonga.org/source/groonga/groonga-12.1.0.tar.gz"
sha256 "a4b53589f726f237eaafd8d032335b71c369ac3cfab99f7335c5d127920139d7"
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_ventura: "e12cccf164d9e565cd3843d774846df00914d9af32b8a57881e16635f4e1a321"
sha256 arm64_monterey: "012ffa1ccaca3883ac7f6e8dd14d8de429035ae05a3e20d132e3110459d84c89"
sha256 arm64_big_sur: "0217a9f338f6beab585b2d569ea5957ed1da4bbe0c0fa0d6efdb313e6432ad29"
sha256 ventura: "d9e692f877a17f1e090bef5df0811062c9458a3d097b1dd562f6476d78f58018"
sha256 monterey: "19771e5e4ab1933e6708192b7fa42fb261f03951a8a31a078e9c37ce6a1f1578"
sha256 big_sur: "de3ff95ce498883ee9b543714a8a965211cce103aa91b802369ccec387152b02"
sha256 x86_64_linux: "1dfc9da82e4b8a96034b4f3466c9a891cff3ed7088f646bd607b2c8e21f1f615"
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"
uses_from_macos "libxcrypt"
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.9.tar.gz"
sha256 "5e70fa226c7469094bc625829b990dfe6d482f8f1110d7177d3594296dd1632d"
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