sys/build.rs: LIBSQLITE3_FLAGS hook
Enables compiling bundled sources with different flags.
Env variable name modeled after LIBSQLITE3_SYS_BUNDLING.
May want to println!("cargo:warning=...") instead of panicking.
@@ -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);
