diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..338b56f --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/zstd-sys-1.4.15+zstd.1.4.4.crate diff --git a/rust-zstd-sys.spec b/rust-zstd-sys.spec new file mode 100644 index 0000000..2dbd714 --- /dev/null +++ b/rust-zstd-sys.spec @@ -0,0 +1,166 @@ +# Generated by rust2rpm 12 +%bcond_without check +%global debug_package %{nil} + +%global crate zstd-sys +%global upstream_version 1.4.15+zstd.1.4.4 + +Name: rust-%{crate} +Version: 1.4.15 +Release: 1%{?dist} +Summary: Low-level bindings for the zstd compression library + +# Upstream license specification: MIT/Apache-2.0 +# included in next release +License: MIT or ASL 2.0 +URL: https://crates.io/crates/zstd-sys +Source: %{crates_source %{crate} %{upstream_version}} +# Initial patched metadata +# * Remove zstd version from version field +# * Make pkg-config default +# * Bump bindgen to 0.52 +Patch0: zstd-sys-fix-metadata.diff +# * Disable check of zstd/ +Patch1: zstd-sys-Disable-zstd-verification.patch + +ExclusiveArch: %{rust_arches} +%if %{__cargo_skip_build} +BuildArch: noarch +%endif + +BuildRequires: rust-packaging + +%global _description %{expand: +Low-level bindings for the zstd compression library.} + +%description %{_description} + +%package devel +Summary: %{summary} +BuildArch: noarch +Requires: pkgconfig(libzstd) + +%description devel %{_description} + +This package contains library source intended for building other packages +which use "%{crate}" crate. + +%files devel +#%%license LICENSE +%doc Readme.md +%{cargo_registry}/%{crate}-%{version_no_tilde}/ + +%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 "default" feature of "%{crate}" crate. + +%files -n %{name}+default-devel +%ghost %{cargo_registry}/%{crate}-%{version_no_tilde}/Cargo.toml + +%package -n %{name}+pkgconfig-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+pkgconfig-devel %{_description} + +This package contains library source intended for building other packages +which use "pkgconfig" feature of "%{crate}" crate. + +%files -n %{name}+pkgconfig-devel +%ghost %{cargo_registry}/%{crate}-%{version_no_tilde}/Cargo.toml + +%package -n %{name}+experimental-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+experimental-devel %{_description} + +This package contains library source intended for building other packages +which use "experimental" feature of "%{crate}" crate. + +%files -n %{name}+experimental-devel +%ghost %{cargo_registry}/%{crate}-%{version_no_tilde}/Cargo.toml + +%package -n %{name}+legacy-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+legacy-devel %{_description} + +This package contains library source intended for building other packages +which use "legacy" feature of "%{crate}" crate. + +%files -n %{name}+legacy-devel +%ghost %{cargo_registry}/%{crate}-%{version_no_tilde}/Cargo.toml + +%package -n %{name}+non-cargo-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+non-cargo-devel %{_description} + +This package contains library source intended for building other packages +which use "non-cargo" feature of "%{crate}" crate. + +%files -n %{name}+non-cargo-devel +%ghost %{cargo_registry}/%{crate}-%{version_no_tilde}/Cargo.toml + +%package -n %{name}+std-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+std-devel %{_description} + +This package contains library source intended for building other packages +which use "std" feature of "%{crate}" crate. + +%files -n %{name}+std-devel +%ghost %{cargo_registry}/%{crate}-%{version_no_tilde}/Cargo.toml + +%package -n %{name}+zstdmt-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+zstdmt-devel %{_description} + +This package contains library source intended for building other packages +which use "zstdmt" feature of "%{crate}" crate. + +%files -n %{name}+zstdmt-devel +%ghost %{cargo_registry}/%{crate}-%{version_no_tilde}/Cargo.toml + +%prep +%autosetup -n %{crate}-%{upstream_version} -p1 +%cargo_prep +# Remove bundled zstd +rm -rf zstd/ + +%generate_buildrequires +%cargo_generate_buildrequires -a +echo "pkgconfig(libzstd)" +echo "bindgen" +echo "%{_bindir}/llvm-config-%{__isa_bits}" + +%build +export LLVM_CONFIG_PATH=%{_bindir}/llvm-config-%{__isa_bits} +%cargo_build -a +bindgen %{_includedir}/zstd.h --ctypes-prefix ::libc --blacklist-type max_align_t --rustified-enum '.*' --use-core -o src/bindings.rs -- +bindgen %{_includedir}/zstd.h --blacklist-type max_align_t --rustified-enum '.*' --use-core -o src/bindings_std.rs -- + +%install +%cargo_install + +%if %{with check} +%check +export LLVM_CONFIG_PATH=%{_bindir}/llvm-config-%{__isa_bits} +%cargo_test -a +%endif + +%changelog +* Sun Dec 15 23:59:34 CET 2019 Robert-André Mauchin - 1.4.15-1 +- Initial package diff --git a/sources b/sources new file mode 100644 index 0000000..2d5ee05 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (zstd-sys-1.4.15+zstd.1.4.4.crate) = 523eb1f4183deca8be3cb018e43b9e51f1910b9e04b42795fb23e036c6f13e2b81ac70ea11837200dc3061622562d360499ed3b939fd8ff23c486fbcc35ec779 diff --git a/zstd-sys-Disable-zstd-verification.patch b/zstd-sys-Disable-zstd-verification.patch new file mode 100644 index 0000000..3e9d109 --- /dev/null +++ b/zstd-sys-Disable-zstd-verification.patch @@ -0,0 +1,16 @@ +diff -up zstd-sys-1.4.15+zstd.1.4.4/build.rs.orig2 zstd-sys-1.4.15+zstd.1.4.4/build.rs +--- zstd-sys-1.4.15+zstd.1.4.4/build.rs.orig2 2019-11-01 03:22:22.000000000 +0100 ++++ zstd-sys-1.4.15+zstd.1.4.4/build.rs 2019-12-16 00:04:48.548762859 +0100 +@@ -134,9 +134,9 @@ fn compile_zstd() { + fn main() { + // println!("cargo:rustc-link-lib=zstd"); + +- if !PathBuf::from("zstd/lib").exists() { +- panic!("Folder 'zstd/lib' does not exists. Maybe you forget clone 'zstd' submodule?"); +- } ++ //if !PathBuf::from("zstd/lib").exists() { ++ // panic!("Folder 'zstd/lib' does not exists. Maybe you forget clone 'zstd' submodule?"); ++ //} + + let (defs, headerpaths) = if cfg!(feature = "pkg-config") { + pkg_config() diff --git a/zstd-sys-fix-metadata.diff b/zstd-sys-fix-metadata.diff new file mode 100644 index 0000000..be3cfe1 --- /dev/null +++ b/zstd-sys-fix-metadata.diff @@ -0,0 +1,32 @@ +--- zstd-sys-1.4.15+zstd.1.4.4/Cargo.toml 2019-11-05T19:38:26+00:00 ++++ zstd-sys-1.4.15+zstd.1.4.4/Cargo.toml 2019-12-16T04:04:59.254547+00:00 +@@ -12,7 +12,7 @@ + + [package] + name = "zstd-sys" +-version = "1.4.15+zstd.1.4.4" ++version = "1.4.15" + authors = ["Alexandre Bury "] + build = "build.rs" + links = "zstd" +@@ -25,7 +25,7 @@ + [dependencies.libc] + version = "0.2.45" + [build-dependencies.bindgen] +-version = "0.51" ++version = "0.52" + optional = true + + [build-dependencies.cc] +@@ -40,9 +40,10 @@ + optional = true + + [features] +-default = ["legacy"] ++default = ["legacy", "pkgconfig"] + experimental = [] + legacy = [] + non-cargo = [] + std = [] + zstdmt = [] ++pkgconfig = ["pkg-config", "bindgen"]