rocksdb: build both regular and lite versions
Closes #9642. Signed-off-by: ilovezfs <ilovezfs@icloud.com>
This commit is contained in:
parent
a580579f9a
commit
1daa028386
1 changed files with 29 additions and 28 deletions
|
@ -3,6 +3,7 @@ class Rocksdb < Formula
|
|||
homepage "http://rocksdb.org"
|
||||
url "https://github.com/facebook/rocksdb/archive/v5.0.2.tar.gz"
|
||||
sha256 "5e39d2131ebdb92c30eda3d32861f489f4843fad50cc2fbd5d234bc4415948ca"
|
||||
revision 1
|
||||
|
||||
bottle do
|
||||
cellar :any
|
||||
|
@ -11,9 +12,6 @@ class Rocksdb < Formula
|
|||
sha256 "b058bea89af8825ab24bcebe61418ed20a8d504805292dda9d5addca181d13e1" => :yosemite
|
||||
end
|
||||
|
||||
option "without-lite", "Don't build mobile/non-flash optimized lite version"
|
||||
option "with-tools", "Build tools"
|
||||
|
||||
needs :cxx11
|
||||
depends_on "snappy"
|
||||
depends_on "lz4"
|
||||
|
@ -22,25 +20,30 @@ class Rocksdb < Formula
|
|||
def install
|
||||
ENV.cxx11
|
||||
ENV["PORTABLE"] = "1" if build.bottle?
|
||||
if build.with? "lite"
|
||||
ENV.append_to_cflags "-DROCKSDB_LITE=1"
|
||||
ENV["LIBNAME"] = "librocksdb_lite"
|
||||
end
|
||||
|
||||
# build regular rocksdb
|
||||
system "make", "clean"
|
||||
system "make", "static_lib"
|
||||
system "make", "shared_lib"
|
||||
system "make", "tools"
|
||||
system "make", "install", "INSTALL_PATH=#{prefix}"
|
||||
|
||||
bin.install "sst_dump" => "rocksdb_sst_dump"
|
||||
bin.install "db_sanity_test" => "rocksdb_sanity_test"
|
||||
bin.install "db_stress" => "rocksdb_stress"
|
||||
bin.install "write_stress" => "rocksdb_write_stress"
|
||||
bin.install "ldb" => "rocksdb_ldb"
|
||||
bin.install "db_repl_stress" => "rocksdb_repl_stress"
|
||||
bin.install "rocksdb_dump"
|
||||
bin.install "rocksdb_undump"
|
||||
|
||||
# build rocksdb_lite
|
||||
ENV.append_to_cflags "-DROCKSDB_LITE=1"
|
||||
ENV["LIBNAME"] = "librocksdb_lite"
|
||||
system "make", "clean"
|
||||
system "make", "static_lib"
|
||||
system "make", "shared_lib"
|
||||
system "make", "tools" if build.with? "tools"
|
||||
system "make", "install", "INSTALL_PATH=#{prefix}"
|
||||
if build.with? "tools"
|
||||
bin.install "sst_dump" => "rocksdb_sst_dump"
|
||||
bin.install "db_sanity_test" => "rocksdb_sanity_test"
|
||||
bin.install "db_stress" => "rocksdb_stress"
|
||||
bin.install "write_stress" => "rocksdb_write_stress"
|
||||
bin.install "ldb" => "rocksdb_ldb"
|
||||
bin.install "db_repl_stress" => "rocksdb_repl_stress"
|
||||
bin.install "rocksdb_dump"
|
||||
bin.install "rocksdb_undump"
|
||||
end
|
||||
end
|
||||
|
||||
test do
|
||||
|
@ -63,15 +66,13 @@ class Rocksdb < Formula
|
|||
"-L#{Formula["lz4"].opt_lib}", "-llz4"
|
||||
system "./db_test"
|
||||
|
||||
if build.with? "tools"
|
||||
system "#{bin}/rocksdb_sst_dump", "--help"
|
||||
system "#{bin}/rocksdb_sanity_test", "--help"
|
||||
system "#{bin}/rocksdb_stress", "--help"
|
||||
system "#{bin}/rocksdb_write_stress", "--help"
|
||||
system "#{bin}/rocksdb_ldb", "--help"
|
||||
system "#{bin}/rocksdb_repl_stress", "--help"
|
||||
system "#{bin}/rocksdb_dump", "--help"
|
||||
system "#{bin}/rocksdb_undump", "--help"
|
||||
end
|
||||
assert_match "sst_dump --file=", shell_output("#{bin}/rocksdb_sst_dump --help 2>&1", 1)
|
||||
assert_match "rocksdb_sanity_test <path>", shell_output("#{bin}/rocksdb_sanity_test --help 2>&1", 1)
|
||||
assert_match "rocksdb_stress [OPTIONS]...", shell_output("#{bin}/rocksdb_stress --help 2>&1", 1)
|
||||
assert_match "rocksdb_write_stress [OPTIONS]...", shell_output("#{bin}/rocksdb_write_stress --help 2>&1", 1)
|
||||
assert_match "ldb - LevelDB Tool", shell_output("#{bin}/rocksdb_ldb --help 2>&1", 1)
|
||||
assert_match "rocksdb_repl_stress:", shell_output("#{bin}/rocksdb_repl_stress --help 2>&1", 1)
|
||||
assert_match "rocksdb_dump:", shell_output("#{bin}/rocksdb_dump --help 2>&1", 1)
|
||||
assert_match "rocksdb_undump:", shell_output("#{bin}/rocksdb_undump --help 2>&1", 1)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue