aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorCarbo Kuo2014-09-28 23:21:48 +0200
committerMike McQuaid2014-10-01 23:29:30 -0700
commitba56fb06e9b9ceb86f3f8de35ecff21788adc95f (patch)
tree97b4d9119b51eaffdc5dd52a9449436b003e321c /Library
parent79eba72ddf1227dbbbc01b9af41d342e9aa82567 (diff)
downloadhomebrew-ba56fb06e9b9ceb86f3f8de35ecff21788adc95f.tar.bz2
libmarisa 0.2.4 (new formula)
libmarisa is a library that implements a static and space-efficient trie data structure.
Diffstat (limited to 'Library')
-rw-r--r--Library/Formula/libmarisa.rb34
1 files changed, 34 insertions, 0 deletions
diff --git a/Library/Formula/libmarisa.rb b/Library/Formula/libmarisa.rb
new file mode 100644
index 000000000..85506afd5
--- /dev/null
+++ b/Library/Formula/libmarisa.rb
@@ -0,0 +1,34 @@
+require "formula"
+
+class Libmarisa < Formula
+ homepage "https://code.google.com/p/marisa-trie/"
+ url "https://marisa-trie.googlecode.com/files/marisa-0.2.4.tar.gz"
+ sha1 "fb0ed7d993e84dff32ec456a79bd36a00022629d"
+
+ def install
+ system "./configure", "--prefix=#{prefix}"
+ system "make", "check"
+ system "make", "install"
+ end
+
+ test do
+ (testpath/'test.cpp').write <<-EOS.undent
+ #include <marisa.h>
+ int main() {
+ marisa::Keyset keyset;
+ keyset.push_back("a");
+ keyset.push_back("app");
+ keyset.push_back("apple");
+
+ marisa::Trie trie;
+ trie.build(keyset);
+
+ marisa::Agent agent;
+ agent.set_query("apple");
+ return 0;
+ }
+ EOS
+ system ENV.cxx, "test.cpp", "-lmarisa", "-o", "test"
+ system "./test"
+ end
+end