103 lines
3.2 KiB
Ruby
103 lines
3.2 KiB
Ruby
class Groonga < Formula
|
|
desc "Fulltext search engine and column store"
|
|
homepage "http://groonga.org/"
|
|
url "http://packages.groonga.org/source/groonga/groonga-5.1.1.tar.gz"
|
|
sha256 "a265e64d30128646cfd84eec8a2e76cba23a2f662d30037027d4e7bc57aa7da4"
|
|
|
|
bottle do
|
|
sha256 "6025d8a2e3c248a9dafe00138c963e463d98fa02ec48b99fa1a2625406520d42" => :el_capitan
|
|
sha256 "f730ff929c7d6d28da05b0f0c38398c968d6eccf7685e442f6183e1b8de4eb81" => :yosemite
|
|
sha256 "90d61a688f18e74bed5eaaafbe0a59da5cdee402c5d53596d63c37ec7267afe5" => :mavericks
|
|
end
|
|
|
|
head do
|
|
url "https://github.com/groonga/groonga.git"
|
|
depends_on "autoconf" => :build
|
|
depends_on "automake" => :build
|
|
depends_on "libtool" => :build
|
|
end
|
|
|
|
option "with-benchmark", "With benchmark program for developer use"
|
|
option "with-suggest-plugin", "With suggest plugin for suggesting"
|
|
|
|
deprecated_option "enable-benchmark" => "with-benchmark"
|
|
|
|
resource "groonga-normalizer-mysql" do
|
|
url "http://packages.groonga.org/source/groonga-normalizer-mysql/groonga-normalizer-mysql-1.1.0.tar.gz"
|
|
sha256 "525daffdb999b647ce87328ec2e94c004ab59803b00a71ce1afd0b5dfd167116"
|
|
end
|
|
|
|
depends_on "pkg-config" => :build
|
|
depends_on "pcre"
|
|
depends_on "msgpack"
|
|
depends_on "mecab" => :optional
|
|
depends_on "lz4" => :optional
|
|
depends_on "openssl"
|
|
depends_on "mecab-ipadic" if build.with? "mecab"
|
|
depends_on "glib" if build.with? "benchmark"
|
|
|
|
if build.with? "suggest-plugin"
|
|
depends_on "libevent"
|
|
depends_on "zeromq"
|
|
end
|
|
|
|
link_overwrite "lib/groonga/plugins/normalizers/"
|
|
link_overwrite "share/doc/groonga-normalizer-mysql/"
|
|
link_overwrite "lib/pkgconfig/groonga-normalizer-mysql.pc"
|
|
|
|
def install
|
|
args = %W[
|
|
--prefix=#{prefix}
|
|
--with-zlib
|
|
--enable-mruby
|
|
--without-libstemmer
|
|
]
|
|
|
|
# ZeroMQ is an optional dependency that will be auto-detected unless we disable it
|
|
if build.with? "suggest-plugin"
|
|
args << "--enable-zeromq"
|
|
else
|
|
args << "--disable-zeromq"
|
|
end
|
|
|
|
args << "--enable-benchmark" if build.with? "benchmark"
|
|
args << "--with-mecab" if build.with? "mecab"
|
|
args << "--with-lz4" if build.with? "lz4"
|
|
|
|
if build.head?
|
|
args << "--with-ruby"
|
|
system "./autogen.sh"
|
|
end
|
|
|
|
system "./configure", *args
|
|
system "make", "install"
|
|
|
|
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+") {|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)
|
|
}
|
|
|
|
IO.popen("#{bin}/groonga -n #{testpath}/test-normalizer-mysql.db", "r+") {|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
|