parent
f2b6d109c9
commit
5ecf116be1
@ -1,3 +0,0 @@ |
||||
[submodule "rocksdb-sys/rocksdb"] |
||||
path = rocksdb-sys/rocksdb |
||||
url = https://github.com/facebook/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 |
Loading…
Reference in new issue