homebrew-core/Formula/rocksdb.rb
2016-03-08 20:37:27 +08: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/rocksdb-4.4.tar.gz"
sha256 "ff79856613e628c2181c4e2e0bc98763e05a4536e0662e5d84f4d237bf40cdb8"
bottle do
cellar :any
sha256 "b14163ab3b6b274bf856a7286406bd1bfd66dcf353deb34d562bf380d33d2a06" => :el_capitan
sha256 "97abd3d4c4d275e7ce766d60d27ce7464e441f3dd88b85cd4d1c11f846847336" => :yosemite
sha256 "d604d2a1d462ab484d029724a308c5d9da75729b1f6447425c17b07e593059f1" => :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++",
"-lrocksdb",
"-lz", "-lbz2",
"-lsnappy", "-llz4"
system "./db_test"
end
end