Add in_gecko feature to libsqlite3-sys to bypass linking.

This commit is contained in:
Thom Chiovoloni 2020-04-02 09:12:36 -07:00
parent 3ae52545a9
commit a2db66ee3e
3 changed files with 9 additions and 0 deletions

View File

@ -57,6 +57,7 @@ series = ["vtab"]
extra_check = [] extra_check = []
modern_sqlite = ["libsqlite3-sys/bundled_bindings"] modern_sqlite = ["libsqlite3-sys/bundled_bindings"]
unstable = [] unstable = []
in_gecko = ["modern_sqlite", "libsqlite3-sys/in_gecko"]
[dependencies] [dependencies]
time = "0.1.0" time = "0.1.0"

View File

@ -30,6 +30,7 @@ unlock_notify = []
preupdate_hook = [] preupdate_hook = []
# 3.13.0 # 3.13.0
session = ["preupdate_hook"] session = ["preupdate_hook"]
in_gecko = []
[build-dependencies] [build-dependencies]
bindgen = { version = "0.53", optional = true, default-features = false, features = ["runtime"] } bindgen = { version = "0.53", optional = true, default-features = false, features = ["runtime"] }

View File

@ -4,6 +4,13 @@ use std::path::Path;
fn main() { fn main() {
let out_dir = env::var("OUT_DIR").unwrap(); let out_dir = env::var("OUT_DIR").unwrap();
let out_path = Path::new(&out_dir).join("bindgen.rs"); let out_path = Path::new(&out_dir).join("bindgen.rs");
if cfg!(feature = "in_gecko") {
// When inside mozilla-central, we are included into the build with
// sqlite3.o directly, so we don't want to provide any linker arguments.
std::fs::copy("sqlite3/bindgen_bundled_version.rs", out_path)
.expect("Could not copy bindings to output directory");
return;
}
if cfg!(feature = "sqlcipher") { if cfg!(feature = "sqlcipher") {
if cfg!(any( if cfg!(any(
feature = "bundled", feature = "bundled",