Added feature to build a static sqlite from the bundled amalgamation.

This commit is contained in:
Chip Collier 2016-06-15 16:34:13 +02:00
parent a9421e2047
commit dde6e9ee3a
3 changed files with 18 additions and 6 deletions

View File

@ -1,6 +1,6 @@
[package] [package]
name = "rusqlite" name = "rusqlite"
version = "0.7.3" version = "0.7.4"
authors = ["John Gallagher <jgallagher@bignerdranch.com>"] authors = ["John Gallagher <jgallagher@bignerdranch.com>"]
description = "Ergonomic wrapper for SQLite" description = "Ergonomic wrapper for SQLite"
repository = "https://github.com/jgallagher/rusqlite" repository = "https://github.com/jgallagher/rusqlite"
@ -18,6 +18,7 @@ backup = []
blob = [] blob = []
functions = [] functions = []
trace = [] trace = []
bundled = ["libsqlite3-sys/bundled"]
[dependencies] [dependencies]
time = "~0.1.0" time = "~0.1.0"
@ -34,7 +35,7 @@ regex = "~0.1.41"
[dependencies.libsqlite3-sys] [dependencies.libsqlite3-sys]
path = "libsqlite3-sys" path = "libsqlite3-sys"
version = "0.5.0" version = "0.6.0"
[[test]] [[test]]
name = "config_log" name = "config_log"

View File

@ -1,6 +1,6 @@
[package] [package]
name = "libsqlite3-sys" name = "libsqlite3-sys"
version = "0.5.0" version = "0.6.0"
authors = ["John Gallagher <jgallagher@bignerdranch.com>"] authors = ["John Gallagher <jgallagher@bignerdranch.com>"]
repository = "https://github.com/jgallagher/rusqlite" repository = "https://github.com/jgallagher/rusqlite"
description = "Native bindings to the libsqlite3 library" description = "Native bindings to the libsqlite3 library"
@ -8,8 +8,12 @@ license = "MIT"
links = "sqlite3" links = "sqlite3"
build = "build.rs" build = "build.rs"
[features]
bundled = []
[build-dependencies] [build-dependencies]
pkg-config = "~0.3" pkg-config = "~0.3"
gcc = "~0.3"
[dependencies] [dependencies]
libc = "~0.2" libc = "~0.2"

View File

@ -1,9 +1,11 @@
extern crate gcc;
extern crate pkg_config; extern crate pkg_config;
#[cfg(not(feature = "bundled"))]
fn main() {
use std::env; use std::env;
use std::fs; use std::fs;
fn main() {
// Allow users to specify where to find SQLite. // Allow users to specify where to find SQLite.
let lib_dir = match env::var("SQLITE3_LIB_DIR") { let lib_dir = match env::var("SQLITE3_LIB_DIR") {
Ok(dir) => dir, Ok(dir) => dir,
@ -24,3 +26,8 @@ fn main() {
println!("cargo:rustc-link-lib=sqlite3"); println!("cargo:rustc-link-lib=sqlite3");
println!("cargo:rustc-link-search={}", lib_dir); println!("cargo:rustc-link-search={}", lib_dir);
} }
#[cfg(feature = "bundled")]
fn main() {
gcc::compile_library("libsqlite3.a", &["sqlite3/sqlite3.c"]);
}