From 844609e9d1f361321d717b91c3b11d58d8782101 Mon Sep 17 00:00:00 2001 From: Fabio Valentini Date: Thu, 5 May 2022 20:50:12 +0200 Subject: [PATCH] Initial import (#2080245) --- .gitignore | 2 + .rust2rpm.conf | 5 ++ ...d-link-against-shared-xxhash-library.patch | 27 ++++++ README.md | 3 - rust-xxhash-c-sys.spec | 82 +++++++++++++++++++ sources | 2 + xxhash-c-sys-fix-metadata.diff | 22 +++++ 7 files changed, 140 insertions(+), 3 deletions(-) create mode 100644 .gitignore create mode 100644 .rust2rpm.conf create mode 100644 0001-build-and-link-against-shared-xxhash-library.patch delete mode 100644 README.md create mode 100644 rust-xxhash-c-sys.spec create mode 100644 sources create mode 100644 xxhash-c-sys-fix-metadata.diff diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6f6abc8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/xxhash-c-sys-0.8.3.crate +/LICENSE diff --git a/.rust2rpm.conf b/.rust2rpm.conf new file mode 100644 index 0000000..8ca8087 --- /dev/null +++ b/.rust2rpm.conf @@ -0,0 +1,5 @@ +[DEFAULT] +buildrequires = + pkgconfig(libxxhash) >= 0.8.1 +lib.requires = + pkgconfig(libxxhash) >= 0.8.1 diff --git a/0001-build-and-link-against-shared-xxhash-library.patch b/0001-build-and-link-against-shared-xxhash-library.patch new file mode 100644 index 0000000..badc96c --- /dev/null +++ b/0001-build-and-link-against-shared-xxhash-library.patch @@ -0,0 +1,27 @@ +From cfd35c97f0cfe947d8d31ea89613b2f66489d34c Mon Sep 17 00:00:00 2001 +From: Fabio Valentini +Date: Fri, 29 Apr 2022 12:16:10 +0200 +Subject: [PATCH] build and link against shared xxhash library + +--- + build.rs | 8 +------- + 1 file changed, 1 insertion(+), 7 deletions(-) + +diff --git a/build.rs b/build.rs +index 15ceda2..fa9739e 100644 +--- a/build.rs ++++ b/build.rs +@@ -1,9 +1,3 @@ + fn main() { +- let mut cc = cc::Build::new(); +- +- cc.include("src/c/"); +- cc.file("src/c/xxhash.c"); +- cc.warnings(false); +- +- cc.compile("xxhash"); ++ pkg_config::Config::new().atleast_version("0.8.1").probe("libxxhash").unwrap(); + } +-- +2.36.0 + diff --git a/README.md b/README.md deleted file mode 100644 index 9be7569..0000000 --- a/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# rust-xxhash-c-sys - -The rust-xxhash-c-sys package diff --git a/rust-xxhash-c-sys.spec b/rust-xxhash-c-sys.spec new file mode 100644 index 0000000..7899fa0 --- /dev/null +++ b/rust-xxhash-c-sys.spec @@ -0,0 +1,82 @@ +# Generated by rust2rpm 21 +%bcond_without check +%global debug_package %{nil} + +%global crate xxhash-c-sys + +Name: rust-%{crate} +Version: 0.8.3 +Release: %autorelease +Summary: Bindings to xxhash + +# Upstream license specification: BSL-1.0 +# https://github.com/DoumanAsh/xxhash-c-sys/pull/3 +License: Boost +URL: https://crates.io/crates/xxhash-c-sys +Source0: %{crates_source} +Source1: https://github.com/DoumanAsh/xxhash-c-sys/raw/d241dc8/LICENSE +# Initial patched metadata +# * build and link against shared xxhash library +Patch0: xxhash-c-sys-fix-metadata.diff +Patch1: 0001-build-and-link-against-shared-xxhash-library.patch + +ExclusiveArch: %{rust_arches} + +BuildRequires: rust-packaging >= 21 + +%global _description %{expand: +Bindings to xxhash.} + +%description %{_description} + +%package devel +Summary: %{summary} +BuildArch: noarch +Requires: pkgconfig(libxxhash) >= 0.8.1 + +%description devel %{_description} + +This package contains library source intended for building other packages which +use the "%{crate}" crate. + +%files devel +%license %{crate_instdir}/LICENSE +%doc %{crate_instdir}/README.md +%{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 + +%prep +%autosetup -n %{crate}-%{version_no_tilde} -p1 +# remove bundled copy of xxhash +rm -r src/c +%cargo_prep +cp %{SOURCE1} . + +%generate_buildrequires +%cargo_generate_buildrequires +echo 'pkgconfig(libxxhash) >= 0.8.1' + +%build +%cargo_build + +%install +%cargo_install + +%if %{with check} +%check +%cargo_test +%endif + +%changelog +%autochangelog diff --git a/sources b/sources new file mode 100644 index 0000000..6262c76 --- /dev/null +++ b/sources @@ -0,0 +1,2 @@ +SHA512 (xxhash-c-sys-0.8.3.crate) = a7daed0bcd2bbdff65ce5e0842e38e1811a4e5e1dd42d279c76ebaf837d5d036ce533a4dd43a05388434564ed767b98cd8a085f39151194abad117c5648b3a0e +SHA512 (LICENSE) = d6078467835dba8932314c1c1e945569a64b065474d7aced27c9a7acc391d52e9f234138ed9f1aa9cd576f25f12f557e0b733c14891d42c16ecdc4a7bd4d60b8 diff --git a/xxhash-c-sys-fix-metadata.diff b/xxhash-c-sys-fix-metadata.diff new file mode 100644 index 0000000..ae8e618 --- /dev/null +++ b/xxhash-c-sys-fix-metadata.diff @@ -0,0 +1,22 @@ +--- xxhash-c-sys-0.8.3/Cargo.toml 1970-01-01T00:00:01+00:00 ++++ xxhash-c-sys-0.8.3/Cargo.toml 2022-04-29T10:20:53.096396+00:00 +@@ -16,10 +16,9 @@ + authors = ["Douman "] + include = [ + "**/*.rs", +- "**/*.c", +- "**/*.h", + "Cargo.toml", + "README.md", ++ "LICENSE", + ] + description = "Bindings to xxhash" + readme = "README.md" +@@ -36,5 +35,5 @@ + version = "0.2" + default-features = false + +-[build-dependencies.cc] +-version = "1" ++[build-dependencies.pkg-config] ++version = "0.3"