From 5e8814f855eb07ddda2c725b03e45184420cf347 Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Tue, 30 Apr 2024 13:11:34 -0400 Subject: [PATCH 1/3] Downstream-only: never try to build blosc2 from source --- build.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/build.rs b/build.rs index 81639d0..a08c47f 100644 --- a/build.rs +++ b/build.rs @@ -2,14 +2,13 @@ use std::path::Path; #[cfg(feature = "regenerate-bindings")] use std::path::PathBuf; -#[cfg(feature = "use-system-blosc2")] const VENDORED_BLOSC2_VERSION: &'static str = "2.15.1"; fn main() { println!("cargo:rerun-if-changed=build.rs"); - // build blosc2 from source - #[cfg(not(feature = "use-system-blosc2"))] + // downstream patch: never try to build blosc2 from source + #[cfg(any())] { let out_dir_str = std::env::var("OUT_DIR").unwrap(); let out_dir = Path::new(&out_dir_str); @@ -87,8 +86,7 @@ fn main() { } } - // Use system blosc2 - #[cfg(feature = "use-system-blosc2")] + // downstream patch: never try to build blosc2 from source { match std::env::var("BLOSC2_INSTALL_PREFIX") { Ok(prefix) => { -- 2.46.0 From 7acede9e6f444d92e8167cee9c4fe8fea3c341b4 Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Sun, 5 May 2024 23:29:10 -0400 Subject: [PATCH 2/3] Downstream-only: always regenerate bindings --- build.rs | 6 ++---- src/lib.rs | 7 +------ 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/build.rs b/build.rs index a08c47f..2c3639f 100644 --- a/build.rs +++ b/build.rs @@ -1,6 +1,4 @@ -use std::path::Path; -#[cfg(feature = "regenerate-bindings")] -use std::path::PathBuf; +use std::path::{Path,PathBuf}; const VENDORED_BLOSC2_VERSION: &'static str = "2.15.1"; @@ -127,7 +125,7 @@ fn main() { #[cfg(feature = "shared")] println!("cargo:rustc-link-lib=blosc2"); - #[cfg(feature = "regenerate-bindings")] + // downstream patch: always regenerate bindings { let out = PathBuf::from(&(format!("{}/bindings.rs", std::env::var("OUT_DIR").unwrap()))); bindgen::Builder::default() diff --git a/src/lib.rs b/src/lib.rs index 6dc5ee4..9b81e03 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -9,10 +9,5 @@ pub use libc; use libc::{timespec, FILE}; -#[cfg(not(feature = "regenerate-bindings"))] -mod bindings; -#[cfg(not(feature = "regenerate-bindings"))] -pub use bindings::*; - -#[cfg(feature = "regenerate-bindings")] +// downstream patch: always regenerate bindings include!(concat!(env!("OUT_DIR"), "/bindings.rs")); -- 2.46.0 From 33e97f9c2dd858f1b298a1c8cb3b8b7ebb29f108 Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Sun, 5 May 2024 23:45:44 -0400 Subject: [PATCH 3/3] Downstream-only: generate bindings using the system header --- build.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.rs b/build.rs index 2c3639f..e681475 100644 --- a/build.rs +++ b/build.rs @@ -131,7 +131,7 @@ fn main() { bindgen::Builder::default() // The input header we would like to generate // bindings for. - .header("c-blosc2/include/blosc2.h") + .header("/usr/include/blosc2.h") // Tell cargo to invalidate the built crate whenever any of the // included header files changed. .parse_callbacks(Box::new(bindgen::CargoCallbacks::new())) -- 2.46.0