Blame SPECS/wyhash.spec

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