diff --git a/libsqlite3-sys/build.rs b/libsqlite3-sys/build.rs index 14c5f2a..c4cd5aa 100644 --- a/libsqlite3-sys/build.rs +++ b/libsqlite3-sys/build.rs @@ -127,6 +127,19 @@ mod build_bundled { } println!("cargo:rerun-if-env-changed=SQLITE_MAX_EXPR_DEPTH"); + if let Ok(extras) = env::var("LIBSQLITE3_FLAGS") { + for extra in extras.split_whitespace() { + if extra.starts_with("-D") || extra.starts_with("-U") { + cfg.flag(extra); + } else if extra.starts_with("SQLITE_") { + cfg.flag(&format!("-D{}", extra)); + } else { + panic!("Don't understand {} in LIBSQLITE3_FLAGS", extra); + } + } + } + println!("cargo:rerun-if-env-changed=LIBSQLITE3_FLAGS"); + cfg.compile("libsqlite3.a"); println!("cargo:lib_dir={}", out_dir);