52 lines
1.7 KiB
Ruby
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.8.tar.gz"
|
|
sha256 "dd129782c32adc80a1201c727a05e2f6d637c71941a4f797fb39e2ebe279415d"
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "3655f68bd3a9b15d691543f6dfa78313222adf6995211ffb22d7dd9e9506c0a3" => :el_capitan
|
|
sha256 "6963d3d4b3a72217f58d61834275b32900c3c39fc4f8af8c126349cddc14ef34" => :yosemite
|
|
sha256 "0b54a1226dbdd35b38573ae27e898e596143a9db36d82bc11e25d2c3f14783b3" => :mavericks
|
|
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
|