Fail if RocksDB or Snappy source is missing

master
Volker Mische 8 years ago
parent 26c9b9bc8f
commit a890ec3f14
  1. 4
      README.md
  2. 12
      librocksdb-sys/build.rs

@ -11,3 +11,7 @@ Feedback and pull requests welcome! If a particular feature of RocksDB is impor
[dependencies]
rocksdb = "0.6.0"
```
This binding is statically linked with a specific version of RocksDB. If you want to build it yourself, make sure you've also cloned the RocksDB and Snappy submodules:
git submodule update --init --recursive

@ -1,5 +1,7 @@
extern crate gcc;
use std::fs;
fn link(name: &str, bundled: bool) {
use std::env::var;
let target = var("TARGET").unwrap();
@ -13,6 +15,14 @@ fn link(name: &str, bundled: bool) {
}
}
fn fail_on_empty_directory(name: &str) {
if fs::read_dir(name).unwrap().count() == 0 {
println!("The `{}` directory is empty, did you forget to pull the submodules?", name);
println!("Try `git submodule update --init --recursive`");
panic!();
}
}
fn build_rocksdb() {
println!("cargo:rerun-if-changed=build.rs");
println!("cargo:rerun-if-changed=rocksdb/");
@ -118,6 +128,8 @@ fn build_snappy() {
}
fn main() {
fail_on_empty_directory("rocksdb");
fail_on_empty_directory("snappy");
build_rocksdb();
build_snappy();
}

Loading…
Cancel
Save