Skip to content

Commit

Permalink
proper build (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
fishi0x01 committed Mar 7, 2020
1 parent 05ecd4d commit 49e3b7a
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
16 changes: 14 additions & 2 deletions build_4_8.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,18 @@ use std::process::Command;
pub const SOURCE_DIR: &'static str = "db-4.8.30";

pub fn build_unix(out_dir: &str) {
let build_dir = Path::new(SOURCE_DIR).join("build_unix");
let copy_dir = Path::new(out_dir).join(SOURCE_DIR);
let build_dir = copy_dir.join("build_unix");

// copy source to out_dir
Command::new("cp")
.arg("-r")
.arg(Path::new(SOURCE_DIR).to_str().unwrap())
.arg(copy_dir.to_str().unwrap())
.status()
.unwrap();

// build
Command::new("../dist/configure")
.arg(&format!("--prefix={}", out_dir))
.arg("--with-gnu-ld")
Expand All @@ -28,8 +39,9 @@ pub fn build_unix(out_dir: &str) {
}

pub fn generate_bindings(out_dir: &str) {
let build_dir = Path::new(out_dir).join(SOURCE_DIR).join("build_unix");
let bindings = bindgen::Builder::default()
.header("db-4.8.30/build_unix/db.h")
.header(build_dir.join("db.h").to_str().unwrap())
.derive_copy(true)
.derive_debug(true)
.derive_default(true)
Expand Down
16 changes: 14 additions & 2 deletions build_5_3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,18 @@ use std::process::Command;
pub const SOURCE_DIR: &'static str = "db-5.3.21";

pub fn build_unix(out_dir: &str) {
let build_dir = Path::new(SOURCE_DIR).join("build_unix");
let copy_dir = Path::new(out_dir).join(SOURCE_DIR);
let build_dir = copy_dir.join("build_unix");

// copy source to out_dir
Command::new("cp")
.arg("-r")
.arg(Path::new(SOURCE_DIR).to_str().unwrap())
.arg(copy_dir.to_str().unwrap())
.status()
.unwrap();

// build
Command::new("../dist/configure")
.arg(&format!("--prefix={}", out_dir))
.arg("--with-gnu-ld")
Expand All @@ -28,8 +39,9 @@ pub fn build_unix(out_dir: &str) {
}

pub fn generate_bindings(out_dir: &str) {
let build_dir = Path::new(out_dir).join(SOURCE_DIR).join("build_unix");
let bindings = bindgen::Builder::default()
.header("db-5.3.21/build_unix/db.h")
.header(build_dir.join("db.h").to_str().unwrap())
.derive_copy(true)
.derive_debug(true)
.derive_default(true)
Expand Down

0 comments on commit 49e3b7a

Please sign in to comment.