mirror of
https://github.com/isar/rusqlite.git
synced 2024-11-26 11:31:37 +08:00
Merge pull request #88 from jgallagher/flexible-build-script
Make libsqlite3-sys's build script slightly more intelligent.
This commit is contained in:
commit
c99ecd6681
@ -10,3 +10,4 @@ rusqlite contributors (sorted alphabetically)
|
|||||||
* [Steve Klabnik](https://github.com/steveklabnik)
|
* [Steve Klabnik](https://github.com/steveklabnik)
|
||||||
* [krdln](https://github.com/krdln)
|
* [krdln](https://github.com/krdln)
|
||||||
* [Ben Striegel](https://github.com/bstrie)
|
* [Ben Striegel](https://github.com/bstrie)
|
||||||
|
* [Andrew Straw](https://github.com/astraw)
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
* Slight change to the closure types passed to `query_map` and `query_and_then`:
|
* Slight change to the closure types passed to `query_map` and `query_and_then`:
|
||||||
* Remove the `'static` requirement on the closure's output type.
|
* Remove the `'static` requirement on the closure's output type.
|
||||||
* Give the closure a `&SqliteRow` instead of a `SqliteRow`.
|
* Give the closure a `&SqliteRow` instead of a `SqliteRow`.
|
||||||
|
* When building, the environment variable `SQLITE3_LIB_DIR` now takes precedence over pkg-config.
|
||||||
|
* If `pkg-config` is not available, we will try to find `libsqlite3` in `/usr/lib`.
|
||||||
* Add more documentation for failure modes of functions that return `SqliteResult`s.
|
* Add more documentation for failure modes of functions that return `SqliteResult`s.
|
||||||
|
|
||||||
# Version 0.4.0 (2015-11-03)
|
# Version 0.4.0 (2015-11-03)
|
||||||
|
@ -1,5 +1,26 @@
|
|||||||
extern crate pkg_config;
|
extern crate pkg_config;
|
||||||
|
|
||||||
|
use std::env;
|
||||||
|
use std::fs;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
pkg_config::find_library("sqlite3").unwrap();
|
// Allow users to specify where to find SQLite.
|
||||||
|
let lib_dir = match env::var("SQLITE3_LIB_DIR") {
|
||||||
|
Ok(dir) => dir,
|
||||||
|
Err(_) => {
|
||||||
|
// See if pkg-config can do everything for us.
|
||||||
|
if pkg_config::find_library("sqlite3").is_ok() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try to fall back to /usr/lib if pkg-config failed.
|
||||||
|
match fs::metadata("/usr/lib") {
|
||||||
|
Ok(ref attr) if attr.is_dir() => "/usr/lib".to_owned(),
|
||||||
|
_ => panic!("Could not find sqlite3. Try setting SQLITE3_LIB_DIR."),
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
println!("cargo:rustc-link-lib=sqlite3");
|
||||||
|
println!("cargo:rustc-link-search={}", lib_dir);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user