commit b5e2045cba82124450b1fd65a5a156cd33f3b3a6 Author: tigro Date: Sun Jan 5 22:29:37 2025 +0300 import rust-blosc2-sys-0.3.1-1.el10 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e05157d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/blosc2-sys-0.3.1+2.15.1.crate diff --git a/.rust-blosc2-sys.metadata b/.rust-blosc2-sys.metadata new file mode 100644 index 0000000..703d535 --- /dev/null +++ b/.rust-blosc2-sys.metadata @@ -0,0 +1 @@ +c786eaa6fd73f6b6c909d64ef75155f80ccc6ed2 SOURCES/blosc2-sys-0.3.1+2.15.1.crate diff --git a/SOURCES/blosc2-sys-0.3.1-system-blosc2.patch b/SOURCES/blosc2-sys-0.3.1-system-blosc2.patch new file mode 100644 index 0000000..4a2ed32 --- /dev/null +++ b/SOURCES/blosc2-sys-0.3.1-system-blosc2.patch @@ -0,0 +1,121 @@ +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 + diff --git a/SOURCES/blosc2-sys-fix-metadata-auto.diff b/SOURCES/blosc2-sys-fix-metadata-auto.diff new file mode 100644 index 0000000..52c3ddb --- /dev/null +++ b/SOURCES/blosc2-sys-fix-metadata-auto.diff @@ -0,0 +1,16 @@ +--- blosc2-sys-0.3.1+2.15.1/Cargo.toml 1970-01-01T00:00:01+00:00 ++++ blosc2-sys-0.3.1+2.15.1/Cargo.toml 2024-09-18T13:58:51.900645+00:00 +@@ -12,7 +12,7 @@ + [package] + edition = "2021" + name = "blosc2-sys" +-version = "0.3.1+2.15.1" ++version = "0.3.1" + build = "build.rs" + links = "blosc2" + exclude = [ +@@ -65,3 +65,4 @@ + shared = [] + static = [] + use-system-blosc2 = ["dep:pkg-config"] ++ diff --git a/SOURCES/blosc2-sys-fix-metadata.diff b/SOURCES/blosc2-sys-fix-metadata.diff new file mode 100644 index 0000000..a58277a --- /dev/null +++ b/SOURCES/blosc2-sys-fix-metadata.diff @@ -0,0 +1,33 @@ +--- blosc2-sys-0.3.1+2.15.1/Cargo.toml 1970-01-01T00:00:01+00:00 ++++ blosc2-sys-0.3.1+2.15.1/Cargo.toml 2024-09-18T13:59:39.863103+00:00 +@@ -41,7 +41,6 @@ + + [build-dependencies.bindgen] + version = "^0.69" +-optional = true + + [build-dependencies.cmake] + version = "^0.1" +@@ -51,7 +50,6 @@ + + [build-dependencies.pkg-config] + version = "^0.3" +-optional = true + + [features] + deactivate-zlib = [] +@@ -61,8 +59,12 @@ + prefer-external-lz4 = [] + prefer-external-zlib = [] + prefer-external-zstd = [] +-regenerate-bindings = ["bindgen"] ++regenerate-bindings = [] ++# Since we made bindgen non-optional, we dropped the corresponding ++# implicit-feature-for-optional-dependency. Reintroduce it as an empty, ++# do-nothing feature, just for parity and in case anything asks for it. ++bindgen = [] + shared = [] + static = [] +-use-system-blosc2 = ["dep:pkg-config"] ++use-system-blosc2 = [] + diff --git a/SPECS/rust-blosc2-sys.spec b/SPECS/rust-blosc2-sys.spec new file mode 100644 index 0000000..ce6aebe --- /dev/null +++ b/SPECS/rust-blosc2-sys.spec @@ -0,0 +1,201 @@ +## START: Set by rpmautospec +## (rpmautospec version 0.7.2) +## RPMAUTOSPEC: autorelease, autochangelog +%define autorelease(e:s:pb:n) %{?-p:0.}%{lua: + release_number = 1; + base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}")); + print(release_number + base_release_number - 1); +}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}} +## END: Set by rpmautospec + +# Generated by rust2rpm 26 +%bcond_without check +%global debug_package %{nil} + +%global crate blosc2-sys +%global upstream_version 0.3.1+2.15.1 + +Name: rust-blosc2-sys +Version: 0.3.1 +Release: %autorelease +Summary: Bindings to C Blosc2 + +License: MIT +URL: https://crates.io/crates/blosc2-sys +Source: %{crates_source %{crate} %{upstream_version}} +# Automatically generated patch to strip dependencies and normalize metadata +Patch: blosc2-sys-fix-metadata-auto.diff +# Manually created patch for downstream crate metadata changes +# * Make bindgen and pkg-config non-optional +Patch: blosc2-sys-fix-metadata.diff +# * Downstream-only: always use the system blosc2 and regenerate bindings +Patch10: blosc2-sys-0.3.1-system-blosc2.patch + +BuildRequires: cargo-rpm-macros >= 24 +BuildRequires: tomcli +BuildRequires: pkgconfig(blosc2) + +%global _description %{expand: +Bindings to C Blosc2.} + +%description %{_description} + +%package devel +Summary: %{summary} +BuildArch: noarch +Requires: pkgconfig(blosc2) + +%description devel %{_description} + +This package contains library source intended for building other packages which +use the "%{crate}" crate. + +%files devel +%license %{crate_instdir}/LICENSE +%{crate_instdir}/ + +%package -n %{name}+default-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+default-devel %{_description} + +This package contains library source intended for building other packages which +use the "default" feature of the "%{crate}" crate. + +%files -n %{name}+default-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+bindgen-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+bindgen-devel %{_description} + +This package contains library source intended for building other packages which +use the "bindgen" feature of the "%{crate}" crate. + +%files -n %{name}+bindgen-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+prefer-external-lz4-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+prefer-external-lz4-devel %{_description} + +This package contains library source intended for building other packages which +use the "prefer-external-lz4" feature of the "%{crate}" crate. + +%files -n %{name}+prefer-external-lz4-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+prefer-external-zlib-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+prefer-external-zlib-devel %{_description} + +This package contains library source intended for building other packages which +use the "prefer-external-zlib" feature of the "%{crate}" crate. + +%files -n %{name}+prefer-external-zlib-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+prefer-external-zstd-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+prefer-external-zstd-devel %{_description} + +This package contains library source intended for building other packages which +use the "prefer-external-zstd" feature of the "%{crate}" crate. + +%files -n %{name}+prefer-external-zstd-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+regenerate-bindings-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+regenerate-bindings-devel %{_description} + +This package contains library source intended for building other packages which +use the "regenerate-bindings" feature of the "%{crate}" crate. + +%files -n %{name}+regenerate-bindings-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+shared-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+shared-devel %{_description} + +This package contains library source intended for building other packages which +use the "shared" feature of the "%{crate}" crate. + +%files -n %{name}+shared-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+use-system-blosc2-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+use-system-blosc2-devel %{_description} + +This package contains library source intended for building other packages which +use the "use-system-blosc2" feature of the "%{crate}" crate. + +%files -n %{name}+use-system-blosc2-devel +%ghost %{crate_instdir}/Cargo.toml + +%prep +%autosetup -n %{crate}-%{upstream_version} -p1 +# Remove the bundled copy of blosc2 +rm -rv c-blosc2 + +# These would only be needed to build the bundled blosc2: +tomcli set Cargo.toml del build-dependencies.cmake +tomcli set Cargo.toml del build-dependencies.copy_dir + +# To be more pedantically correct, replace the hard-coded /usr/include patched +# into build.rs with the expansion of %%{_includedir}. +sed -r -i 's@/usr/include\b@%{_includedir}@' build.rs + +# Remove pre-generated bindings, proving that we actually re-generate them +rm src/bindings.rs + +%cargo_prep + +%generate_buildrequires +%cargo_generate_buildrequires + +%build +%cargo_build + +%install +%cargo_install + +%if %{with check} +%check +%cargo_test +%endif + +%changelog +* Sun Jan 05 2025 Arkady L. Shane - 0.3.1-1 +- Rebuilt for MSVSphere 10 + +## START: Generated by rpmautospec +* Wed Sep 18 2024 Benjamin A. Beasley - 0.3.1-1 +- Update to 0.3.1 (close RHBZ#2313162) + +* Mon Sep 09 2024 Benjamin A. Beasley - 0.3.0-1 +- Update to 0.3.0 (close RHBZ#2310843) + +* Tue Aug 27 2024 Benjamin A. Beasley - 0.2.6-2 +- Fix unconditional regeneration of bindings + +* Tue Aug 27 2024 Benjamin A. Beasley - 0.2.6-1 +- Initial package (close RHBZ#2279337) +## END: Generated by rpmautospec