Commit 5ecf116b authored by Tyler Neely's avatar Tyler Neely

remove the cargo auto-compiliation. maybe this will be added later as an optional feature.

parent f2b6d109
[submodule "rocksdb-sys/rocksdb"]
path = rocksdb-sys/rocksdb
url = https://github.com/facebook/rocksdb
...@@ -3,7 +3,3 @@ ...@@ -3,7 +3,3 @@
name = "rocksdb" name = "rocksdb"
version = "0.0.1" version = "0.0.1"
authors = ["Tyler Neely <t@jujit.su>"] authors = ["Tyler Neely <t@jujit.su>"]
[dependencies.rocksdb-sys]
path = "rocksdb-sys"
version = "*"
...@@ -2,12 +2,12 @@ rust-rocksdb ...@@ -2,12 +2,12 @@ rust-rocksdb
============ ============
### running ### running
Install RocksDB. rust-rocksdb has been tested with version 3.8.1 on linux and windows.
###### Cargo.toml ###### Cargo.toml
```rust ```rust
[dependencies.rocksdb] [dependencies.rocksdb]
git = "https://github.com/spacejam/rust-rocksdb" git = "https://github.com/spacejam/rust-rocksdb"
``` ```
RocksDB 3.8.1 will be pulled in and compiled automatically.
###### Code ###### Code
```rust ```rust
extern crate rocksdb; extern crate rocksdb;
......
[package]
name = "rocksdb-sys"
version = "0.0.1"
authors = []
links = "rocksdb"
build = "build.rs"
[build-dependencies.pkg-config]
git = "https://github.com/alexcrichton/pkg-config-rs"
[lib]
name = "rocksdb-sys"
path = "lib.rs"
extern crate "pkg-config" as pkg_config;
use std::os;
use std::io::{mod, fs, Command};
use std::io::process::InheritFd;
//TODO windows support
fn main() {
// Next, fall back and try to use pkg-config if its available.
match pkg_config::find_library("librocksdb") {
Ok(()) => return,
Err(..) => {}
}
let src = os::getcwd().unwrap();
let dst = Path::new(os::getenv("OUT_DIR").unwrap());
let _ = fs::mkdir(&dst.join("build"), io::USER_DIR);
println!("cwd: {}", src.join("rocksdb").as_str());
run(Command::new(make())
.arg("shared_lib")
.arg(format!("-j{}", os::getenv("NUM_JOBS").unwrap()))
.cwd(&src.join("rocksdb")));
// Don't run `make install` because apparently it's a little buggy on mingw
// for windows.
fs::mkdir_recursive(&dst.join("lib/pkgconfig"), io::USER_DIR).unwrap();
let target = os::getenv("TARGET").unwrap();
if target.contains("apple") {
fs::rename(&src.join("rocksdb/librocksdb.dylib"), &dst.join("lib/librocksdb.dylib")).unwrap();
} else {
fs::rename(&src.join("rocksdb/librocksdb.so"), &dst.join("lib/librocksdb.so")).unwrap();
}
println!("cargo:rustc-flags=-L {}/lib -l rocksdb:dylib", dst.display());
println!("cargo:root={}", dst.display());
println!("cargo:include={}/include", src.join("rocksdb").display());
}
fn run(cmd: &mut Command) {
println!("running: {}", cmd);
assert!(cmd.stdout(InheritFd(1))
.stderr(InheritFd(2))
.status()
.unwrap()
.success());
}
fn make() -> &'static str {
if cfg!(target_os = "freebsd") {"gmake"} else {"make"}
}
Subproject commit 325722149925b8dfdfcdf96531b2ae114b736b32
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
#![crate_type = "lib"] #![crate_type = "lib"]
#![allow(dead_code)] #![allow(dead_code)]
extern crate "rocksdb-sys" as rocksdb_ffi; pub use ffi as rocksdb_ffi;
pub use rocksdb::{ pub use rocksdb::{
RocksDB, RocksDB,
RocksDBResult, RocksDBResult,
}; };
pub mod rocksdb; pub mod rocksdb;
pub mod ffi;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment