This commit is contained in:
gwenn
2018-08-11 12:48:21 +02:00
parent 57df0ac3d5
commit c925d1aa97
26 changed files with 1214 additions and 970 deletions

View File

@@ -5,8 +5,8 @@ fn main() {
#[cfg(feature = "bundled")]
mod build {
extern crate cc;
use std::{env, fs};
use std::path::Path;
use std::{env, fs};
pub fn main() {
if cfg!(feature = "sqlcipher") {
@@ -68,8 +68,10 @@ mod build {
match header {
HeaderLocation::FromEnvironment => {
let prefix = env_prefix();
let mut header = env::var(format!("{}_INCLUDE_DIR", prefix))
.expect(&format!("{}_INCLUDE_DIR must be set if {}_LIB_DIR is set", prefix, prefix));
let mut header = env::var(format!("{}_INCLUDE_DIR", prefix)).expect(&format!(
"{}_INCLUDE_DIR must be set if {}_LIB_DIR is set",
prefix, prefix
));
header.push_str("/sqlite3.h");
header
}
@@ -90,7 +92,7 @@ mod build {
println!("cargo:rerun-if-env-changed={}_INCLUDE_DIR", env_prefix());
println!("cargo:rerun-if-env-changed={}_LIB_DIR", env_prefix());
if cfg!(target_os="windows") {
if cfg!(target_os = "windows") {
println!("cargo:rerun-if-env-changed=PATH");
}
// Allow users to specify where to find SQLite.
@@ -105,7 +107,10 @@ mod build {
}
// See if pkg-config can do everything for us.
match pkg_config::Config::new().print_system_libs(false).probe(link_lib) {
match pkg_config::Config::new()
.print_system_libs(false)
.probe(link_lib)
{
Ok(mut lib) => {
if let Some(mut header) = lib.include_paths.pop() {
header.push("sqlite3.h");
@@ -162,10 +167,9 @@ mod build {
mod bindings {
use super::HeaderLocation;
use std::{env, fs};
use std::path::Path;
use std::{env, fs};
#[cfg_attr(rustfmt, rustfmt_skip)]
static PREBUILT_BINDGEN_PATHS: &'static [&'static str] = &[
"bindgen-bindings/bindgen_3.6.8.rs",
@@ -197,12 +201,12 @@ mod build {
mod bindings {
extern crate bindgen;
use self::bindgen::callbacks::{ParseCallbacks, IntKind};
use self::bindgen::callbacks::{IntKind, ParseCallbacks};
use super::HeaderLocation;
use std::env;
use std::io::Write;
use std::fs::OpenOptions;
use std::io::Write;
use std::path::Path;
#[derive(Debug)]
@@ -249,7 +253,8 @@ mod build {
.open(path.clone())
.expect(&format!("Could not write to {:?}", path));
file.write_all(output.as_bytes()).expect(&format!("Could not write to {:?}", path));
file.write_all(output.as_bytes())
.expect(&format!("Could not write to {:?}", path));
}
}
}