homebrew-core/Formula/rocksdb.rb
2016-10-03 07:39:12 -07:00

52 lines
1.7 KiB
Ruby

class Rocksdb < Formula
desc "Persistent key-value store for fast storage environments"
homepage "http://rocksdb.org"
url "https://github.com/facebook/rocksdb/archive/v4.11.2.tar.gz"
sha256 "9374be06fdfccbbdbc60de90b72b5db7040e1bc4e12532e4c67aaec8181b45be"
bottle do
cellar :any
sha256 "ebe5099edd16e6897c687951de29f70d8d893a5cdffc6bed8443503a687f768f" => :sierra
sha256 "0184712061b258b36d0ddc0bb556b039c152ab01497f36546da808d34dcbf29c" => :el_capitan
sha256 "63fe9af87305406c0651971b836bb8e4b7a683dfa9c6b9855fc6c8522cef6645" => :yosemite
end
option "with-lite", "Build mobile/non-flash optimized lite version"
needs :cxx11
depends_on "snappy"
depends_on "lz4"
def install
ENV.cxx11
ENV["PORTABLE"] = "1" if build.bottle?
ENV.append_to_cflags "-DROCKSDB_LITE=1" if build.with? "lite"
system "make", "clean"
system "make", "static_lib"
system "make", "shared_lib"
system "make", "install", "INSTALL_PATH=#{prefix}"
end
test do
(testpath/"test.cpp").write <<-EOS.undent
#include <assert.h>
#include <rocksdb/options.h>
#include <rocksdb/memtablerep.h>
using namespace rocksdb;
int main() {
Options options;
options.memtable_factory.reset(
NewHashSkipListRepFactory(16));
return 0;
}
EOS
system ENV.cxx, "test.cpp", "-o", "db_test", "-v",
"-std=c++11", "-stdlib=libc++", "-lstdc++",
"-lz", "-lbz2",
"-L#{lib}", "-lrocksdb",
"-L#{Formula["snappy"].opt_lib}", "-lsnappy",
"-L#{Formula["lz4"].opt_lib}", "-llz4"
system "./db_test"
end
end