From 3e3ed70db56967b9ac0e14ace9b2c5313647f418 Mon Sep 17 00:00:00 2001 From: rdobuilder Date: Jan 11 2022 09:37:55 +0000 Subject: Build wyhash final1 version It comes from https://src.fedoraproject.org/rpms/wyhash Related-to: https://review.rdoproject.org/r/q/Iad7b9f0976e129a4297b9be81a036d2110e06da1 --- diff --git a/.wyhash.metadata b/.wyhash.metadata new file mode 100644 index 0000000..e30d089 --- /dev/null +++ b/.wyhash.metadata @@ -0,0 +1 @@ +bb4419f7e7c0b4214ace5ae5cad2bd1eca060844 SOURCES/wyhash-wyhash_final.tar.gz diff --git a/SOURCES/.gitignore b/SOURCES/.gitignore new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/SOURCES/.gitignore diff --git a/SPECS/wyhash.spec b/SPECS/wyhash.spec new file mode 100644 index 0000000..adf2e70 --- /dev/null +++ b/SPECS/wyhash.spec @@ -0,0 +1,137 @@ +## START: Set by rpmautospec +## (rpmautospec version 0.2.5) +%define autorelease(e:s:pb:) %{?-p:0.}%{lua: + release_number = 4; + base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}")); + print(release_number + base_release_number - 1); +}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{?dist} +## END: Set by rpmautospec + +Name: wyhash +Summary: No hash function is perfect, but some are useful +%global forgeurl https://github.com/wangyi-fudan/wyhash +%global tag wyhash_final +%forgemeta +# Upstream has haphazard versioning: after going through “v1”-“v6”, they +# selected a version “final1”, and are now working on “final2”. They also keep +# all old versions in the git repository. We will package only based on the +# “final” version numbers. When “final2” is released, this package will move +# forward to that version, with “final1” offered in a parallel-installable +# compat package, +Version: final1 +# Note that the forgemeta macro prepends commit information to the dist macro. +Release: %autorelease + +URL: %{forgeurl} +Source0: %{forgesource} +License: Unlicense + +BuildRequires: gcc-c++ +BuildRequires: make + +# We need the delimiter in the “compat” version because the name ends, and the +# version starts, with a letter. See +# https://docs.fedoraproject.org/en-US/packaging-guidelines/Naming/#multiple. +%global compat_name wyhash_%{version} + +# No compiled code is installed, so this would be empty. +%global debug_package %{nil} + +%global common_description %{expand: +No hash function is perfect, but some are useful. + +wyhash and wyrand are the ideal 64-bit hash function and PRNG respectively: + +solid: wyhash passed SMHasher, wyrand passed BigCrush, practrand. + +portable: 64-bit/32-bit system, big/little endian. + +fastest: Efficient on 64-bit machines, especially for short keys. + +simplest: In the sense of code size.} + +%description %{common_description} + + +%package devel +Summary: %{summary} + +BuildArch: noarch + +# Since this is a header-only library, dependent packages must require one of +# the -static virtual Provides. +Provides: wyhash-static = %{version}-%{release} + +Provides: %{compat_name}-devel = %{version}-%{release} +Provides: %{compat_name}-static = %{version}-%{release} + +%description devel %{common_description} + +Dependent packages that require version %{version} in particular should use the +virtual Provides for %{compat_name}-devel/%{compat_name}-static, and should add +-I%{_includedir}/%{compat_name} to their compiler flags. + + +%package doc +Summary: Documentation for wyhash +BuildArch: noarch + +%description doc %{common_description} + + +%prep +%forgeautosetup + +# Build the tests with the distribution’s preferred flags +sed -r -i \ + -e 's/ -O3\b//g' \ + -e 's/ -march=native\b/ \$\(CXXFLAGS\) \$\(LDFLAGS\)/g' \ + makefile + + +%build +%set_build_flags +# We build only the test executable, not the benchmarks. +%make_build test_vector CXX="${CXX-g++}" + + +%install +# We install only the main wyhash header; others, like wyhash32 and o1hash, are +# not yet properly versioned. We put it in a subdirectory of _includedir for +# parallel-installability; dependent packages requiring particular versions +# will have to adjust their CFLAGS. +install -D -p -m 0644 -t %{buildroot}%{_includedir}/%{compat_name} wyhash.h + +# For this package, which tracks the latest version, we also allow the header +# to be used without adding the subdirectory to the CFLAGS. +ln -s %{compat_name}/wyhash.h %{buildroot}%{_includedir}/wyhash.h + + +%check +./test_vector + + +%files devel +%license LICENSE + +%{_includedir}/%{compat_name} +%{_includedir}/wyhash.h + + +%files doc +%license LICENSE +%doc README.md +# An academic paper on the algorithm: +%doc *.docx + + +%changelog +* Fri Dec 17 2021 Benjamin A. Beasley final1-4 +- Let -devel subpackage be noarch + +* Sat Nov 13 2021 Benjamin A. Beasley final1-3 +- Reduce macro indirection in the spec file + +* Sat Mar 06 2021 Benjamin A. Beasley - 1.20210306gitfinal +- Initial package +