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

master
Tyler Neely 10 years ago
parent f2b6d109c9
commit 5ecf116be1
  1. 3
      .gitmodules
  2. 4
      Cargo.toml
  3. 2
      README.md
  4. 13
      rocksdb-sys/Cargo.toml
  5. 55
      rocksdb-sys/build.rs
  6. 1
      rocksdb-sys/rocksdb
  7. 0
      src/ffi.rs
  8. 4
      src/lib.rs

3
.gitmodules vendored

@ -1,3 +0,0 @@
[submodule "rocksdb-sys/rocksdb"]
path = rocksdb-sys/rocksdb
url = https://github.com/facebook/rocksdb

@ -3,7 +3,3 @@
name = "rocksdb"
version = "0.0.1"
authors = ["Tyler Neely <t@jujit.su>"]
[dependencies.rocksdb-sys]
path = "rocksdb-sys"
version = "*"

@ -2,12 +2,12 @@ rust-rocksdb
============
### running
Install RocksDB. rust-rocksdb has been tested with version 3.8.1 on linux and windows.
###### Cargo.toml
```rust
[dependencies.rocksdb]
git = "https://github.com/spacejam/rust-rocksdb"
```
RocksDB 3.8.1 will be pulled in and compiled automatically.
###### Code
```rust
extern crate rocksdb;

@ -1,13 +0,0 @@
[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"

@ -1,55 +0,0 @@
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"}
}

@ -1 +0,0 @@
Subproject commit 325722149925b8dfdfcdf96531b2ae114b736b32

@ -2,10 +2,10 @@
#![crate_type = "lib"]
#![allow(dead_code)]
extern crate "rocksdb-sys" as rocksdb_ffi;
pub use ffi as rocksdb_ffi;
pub use rocksdb::{
RocksDB,
RocksDBResult,
};
pub mod rocksdb;
pub mod ffi;

Loading…
Cancel
Save