Adding LZ4 compression support and updated Snappy version to same version targeted by RocksDb...

master
Jordan Terrell 6 years ago
parent 0475bbeaea
commit f54deaf1e0
  1. 3
      .gitmodules
  2. 29
      librocksdb-sys/build.rs
  3. 1
      librocksdb-sys/lz4
  4. 2
      librocksdb-sys/snappy
  5. 1
      librocksdb-sys/zstd

3
.gitmodules vendored

@ -4,3 +4,6 @@
[submodule "rocksdb_sys/rocksdb"] [submodule "rocksdb_sys/rocksdb"]
path = librocksdb-sys/rocksdb path = librocksdb-sys/rocksdb
url = https://github.com/facebook/rocksdb.git url = https://github.com/facebook/rocksdb.git
[submodule "librocksdb-sys/lz4"]
path = librocksdb-sys/lz4
url = https://github.com/lz4/lz4.git

@ -49,10 +49,12 @@ fn build_rocksdb() {
config.include("rocksdb/"); config.include("rocksdb/");
config.include("rocksdb/third-party/gtest-1.7.0/fused-src/"); config.include("rocksdb/third-party/gtest-1.7.0/fused-src/");
config.include("snappy/"); config.include("snappy/");
config.include("lz4/lib/");
config.include("."); config.include(".");
config.define("NDEBUG", Some("1")); config.define("NDEBUG", Some("1"));
config.define("SNAPPY", Some("1")); config.define("SNAPPY", Some("1"));
config.define("LZ4", Some("1"));
let mut lib_sources = include_str!("rocksdb_lib_sources.txt") let mut lib_sources = include_str!("rocksdb_lib_sources.txt")
.split(" ") .split(" ")
@ -148,6 +150,28 @@ fn build_snappy() {
config.compile("libsnappy.a"); config.compile("libsnappy.a");
} }
fn build_lz4() {
let mut compiler = cc::Build::new();
compiler
.file("lz4/lib/lz4.c")
.file("lz4/lib/lz4frame.c")
.file("lz4/lib/lz4hc.c")
.file("lz4/lib/xxhash.c");
compiler.opt_level(3);
match env::var("TARGET").unwrap().as_str()
{
"i686-pc-windows-gnu" => {
compiler.flag("-fno-tree-vectorize");
},
_ => {}
}
compiler.compile("liblz4.a");
}
fn try_to_find_and_link_lib(lib_name: &str) -> bool { fn try_to_find_and_link_lib(lib_name: &str) -> bool {
if let Ok(lib_dir) = env::var(&format!("{}_LIB_DIR", lib_name)) { if let Ok(lib_dir) = env::var(&format!("{}_LIB_DIR", lib_name)) {
println!("cargo:rustc-link-search=native={}", lib_dir); println!("cargo:rustc-link-search=native={}", lib_dir);
@ -165,9 +189,11 @@ fn main() {
println!("cargo:rerun-if-changed=build.rs"); println!("cargo:rerun-if-changed=build.rs");
println!("cargo:rerun-if-changed=rocksdb/"); println!("cargo:rerun-if-changed=rocksdb/");
println!("cargo:rerun-if-changed=snappy/"); println!("cargo:rerun-if-changed=snappy/");
println!("cargo:rerun-if-changed=lz4/");
fail_on_empty_directory("rocksdb"); fail_on_empty_directory("rocksdb");
fail_on_empty_directory("snappy"); fail_on_empty_directory("snappy");
fail_on_empty_directory("lz4");
bindgen_rocksdb(); bindgen_rocksdb();
if !try_to_find_and_link_lib("ROCKSDB") { if !try_to_find_and_link_lib("ROCKSDB") {
@ -176,4 +202,7 @@ fn main() {
if !try_to_find_and_link_lib("SNAPPY") { if !try_to_find_and_link_lib("SNAPPY") {
build_snappy(); build_snappy();
} }
if !try_to_find_and_link_lib("LZ4") {
build_lz4();
}
} }

@ -0,0 +1 @@
Subproject commit c10863b98e1503af90616ae99725ecd120265dfb

@ -1 +1 @@
Subproject commit efb39e81b8b66b757ec900db33657c47b4750740 Subproject commit 2d99bd14d471664758e4dfdf81b44f413a7353fd

@ -0,0 +1 @@
Subproject commit f3a8bd553a865c59f1bd6e1f68bf182cf75a8f00
Loading…
Cancel
Save