parent
a090f18f9d
commit
a40c89662a
@ -1,2 +1,2 @@ |
|||||||
/target |
target/ |
||||||
/Cargo.lock |
Cargo.lock |
||||||
|
@ -0,0 +1,3 @@ |
|||||||
|
[submodule "lmdb-sys/mdb"] |
||||||
|
path = lmdb-sys/mdb |
||||||
|
url = https://gitorious.org/mdb/mdb.git |
@ -1,15 +1,19 @@ |
|||||||
[package] |
[package] |
||||||
|
|
||||||
name = "lmdb" |
name = "lmdb" |
||||||
version = "0.1.0" |
version = "0.2.0" |
||||||
authors = ["Dan Burkert <dan@danburkert.com>"] |
authors = ["Dan Burkert <dan@danburkert.com>"] |
||||||
license = "Apache-2.0" |
license = "Apache-2.0" |
||||||
|
|
||||||
description = "Safe Rust bindings for LMDB" |
description = "Safe Rust bindings for LMDB" |
||||||
repository = "https://github.com/danburkert/lmdb-rs.git" |
repository = "https://github.com/danburkert/lmdb-rs.git" |
||||||
readme = "README.md" |
readme = "README.md" |
||||||
keywords = ["LMDB", "database", "storage-engine", "key-value-store", "bindings"] |
keywords = ["LMDB", "database", "storage-engine", "key-value-store", "bindings", "library"] |
||||||
|
|
||||||
[lib] |
[lib] |
||||||
|
|
||||||
name = "lmdb" |
name = "lmdb" |
||||||
|
|
||||||
|
[dependencies.lmdb-sys] |
||||||
|
path = "lmdb-sys" |
||||||
|
|
||||||
|
@ -0,0 +1,16 @@ |
|||||||
|
[package] |
||||||
|
|
||||||
|
name = "lmdb-sys" |
||||||
|
version = "0.2.0" |
||||||
|
authors = ["Dan Burkert <dan@danburkert.com>"] |
||||||
|
license = "Apache-2.0" |
||||||
|
|
||||||
|
links = "lmdb" |
||||||
|
build = "build.rs" |
||||||
|
|
||||||
|
[lib] |
||||||
|
|
||||||
|
name = "lmdb-sys" |
||||||
|
|
||||||
|
[build-dependencies.pkg-config] |
||||||
|
pkg-config = "*" |
@ -0,0 +1,49 @@ |
|||||||
|
extern crate "pkg-config" as pkg_config; |
||||||
|
|
||||||
|
use std::io::process::Command; |
||||||
|
use std::os; |
||||||
|
|
||||||
|
/// Run a command and ensure a successful result.
|
||||||
|
fn run_cmd(cmd: &Command) { |
||||||
|
assert!(cmd.status().unwrap().success(), |
||||||
|
format!("Failed to execute command \"{}\"", cmd)) |
||||||
|
} |
||||||
|
|
||||||
|
fn main() { |
||||||
|
if pkg_config::find_library("liblmdb").is_ok() { return } |
||||||
|
|
||||||
|
let base_dir = Path::new(os::getenv("CARGO_MANIFEST_DIR").unwrap()); |
||||||
|
let lmdb_dir = base_dir.join_many(&["mdb", "libraries", "liblmdb"]); |
||||||
|
let dest_dir = Path::new(os::getenv("OUT_DIR").unwrap()); |
||||||
|
|
||||||
|
let mut cflags = os::getenv("CFLAGS").unwrap_or(String::new()); |
||||||
|
let target = os::getenv("TARGET").unwrap(); |
||||||
|
|
||||||
|
if target.contains("i686") { |
||||||
|
cflags.push_str(" -m32"); |
||||||
|
} else if target.contains("x86_64") { |
||||||
|
cflags.push_str(" -m64"); |
||||||
|
} |
||||||
|
if !target.contains("i686") { |
||||||
|
cflags.push_str(" -fPIC"); |
||||||
|
} |
||||||
|
|
||||||
|
let mut make = Command::new("make"); |
||||||
|
make.arg("-C").arg(lmdb_dir.clone()); |
||||||
|
|
||||||
|
let mut make_build = make.clone(); |
||||||
|
make_build.arg("liblmdb.a") |
||||||
|
.arg(format!("XCFLAGS={}", cflags)); |
||||||
|
|
||||||
|
let mut make_clean = make.clone(); |
||||||
|
make_clean.arg("clean"); |
||||||
|
|
||||||
|
run_cmd(&make_clean); |
||||||
|
run_cmd(&make_build); |
||||||
|
run_cmd(Command::new("cp") |
||||||
|
.arg(lmdb_dir.join("liblmdb.a")) |
||||||
|
.arg(dest_dir.clone())); |
||||||
|
run_cmd(&make_clean); |
||||||
|
|
||||||
|
println!("cargo:rustc-flags=-L {} -l lmdb:static", dest_dir.display()); |
||||||
|
} |
@ -0,0 +1 @@ |
|||||||
|
Subproject commit 9a8eb95674c7b500cfe5f44d03493ff76c9fc0c1 |
Loading…
Reference in new issue