From 44a503869709ea793a5f8452bfb9e2a99b7160fc Mon Sep 17 00:00:00 2001 From: Georg Semmler Date: Mon, 26 Feb 2024 13:48:42 +0100 Subject: [PATCH] Do not enforce building libsqlite3 from source Instead we now just check if it was build from source (by checking the relevant environment variables) and if that was the case we link that version statically. --- proj-sys/Cargo.toml | 2 +- proj-sys/build.rs | 14 ++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/proj-sys/Cargo.toml b/proj-sys/Cargo.toml index 24a59d3..6188d90 100644 --- a/proj-sys/Cargo.toml +++ b/proj-sys/Cargo.toml @@ -12,7 +12,7 @@ links = "proj" rust-version = "1.70" [dependencies] -libsqlite3-sys = { version = "0.28", features = ["bundled"] } +libsqlite3-sys = "0.28" link-cplusplus = "1.0" [build-dependencies] diff --git a/proj-sys/build.rs b/proj-sys/build.rs index d9645f3..1b29a60 100644 --- a/proj-sys/build.rs +++ b/proj-sys/build.rs @@ -98,14 +98,12 @@ fn build_from_source() -> Result> config.define("BUILD_PROJINFO", "OFF"); config.define("BUILD_PROJSYNC", "OFF"); config.define("ENABLE_CURL", "OFF"); - config.define( - "SQLITE3_INCLUDE_DIR", - std::env::var("DEP_SQLITE3_INCLUDE").expect("This is set by libsqlite3-sys"), - ); - config.define( - "SQLITE3_LIBRARY", - format!("{}/libsqlite3.a", std::env::var("DEP_SQLITE3_LIB_DIR").unwrap()), - ); + if let Ok(sqlite_include) = std::env::var("DEP_SQLITE3_INCLUDE") { + config.define("SQLITE3_INCLUDE_DIR", sqlite_include); + } + if let Ok(sqlite_lib_dir) = std::env::var("DEP_SQLITE3_LIB_DIR") { + config.define("SQLITE3_LIBRARY", format!("{sqlite_lib_dir}/libsqlite3.a",)); + } if cfg!(feature = "tiff") { eprintln!("enabling tiff support");