-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #262 from essentialkaos/develop
Add xxhash
- Loading branch information
Showing
3 changed files
with
200 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
################################################################################ | ||
|
||
%global crc_check pushd ../SOURCES ; sha512sum -c %{SOURCE100} ; popd | ||
|
||
################################################################################ | ||
|
||
%ifarch %{ix86} x86_64 | ||
%global dispatch 1 | ||
%global moreflags_dispatch -DXXH_X86DISPATCH_ALLOW_AVX | ||
%else | ||
%global dispatch 0 | ||
%global moreflags_dispatch %{nil} | ||
%endif | ||
|
||
%{!?_without_check: %define _with_check 1} | ||
|
||
################################################################################ | ||
|
||
Summary: Extremely fast hash algorithm | ||
Name: xxhash | ||
Version: 0.8.2 | ||
Release: 0%{?dist} | ||
License: BSD-2-Clause AND GPL-2.0-or-later | ||
Group: System Environment/Libraries | ||
URL: https://www.xxhash.com | ||
|
||
Source0: https://github.com/Cyan4973/xxHash/archive/v%{version}/%{name}-%{version}.tar.gz | ||
|
||
Source100: checksum.sha512 | ||
|
||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) | ||
|
||
BuildRequires: make gcc doxygen | ||
|
||
Provides: %{name} = %{version}-%{release} | ||
|
||
################################################################################ | ||
|
||
%description | ||
xxHash is an Extremely fast Hash algorithm, running at RAM speed | ||
limits. It successfully completes the SMHasher test suite which | ||
evaluates collision, dispersion and randomness qualities of hash | ||
functions. Code is highly portable, and hashes are identical on all | ||
platforms (little / big endian). | ||
|
||
################################################################################ | ||
|
||
%package libs | ||
Summary: Extremely fast hash algorithm - library | ||
Group: Development/Libraries | ||
|
||
%description libs | ||
xxHash is an Extremely fast Hash algorithm, running at RAM speed | ||
limits. It successfully completes the SMHasher test suite which | ||
evaluates collision, dispersion and randomness qualities of hash | ||
functions. Code is highly portable, and hashes are identical on all | ||
platforms (little / big endian). | ||
|
||
################################################################################ | ||
|
||
%package devel | ||
Summary: Extremely fast hash algorithm - development files | ||
Group: Development/Libraries | ||
|
||
Requires: %{name}-libs = %{version}-%{release} | ||
|
||
Provides: %{name}-static = %{version}-%{release} | ||
|
||
%description devel | ||
Development files for the xxhash library | ||
|
||
################################################################################ | ||
|
||
%package doc | ||
Summary: Extremely fast hash algorithm - documentation files | ||
Group: Documentation | ||
|
||
BuildArch: noarch | ||
|
||
%description doc | ||
Documentation files for the xxhash library | ||
|
||
################################################################################ | ||
|
||
%prep | ||
%{crc_check} | ||
|
||
%setup -qn xxHash-%{version} | ||
|
||
%build | ||
%{make_build} \ | ||
MOREFLAGS="%{__global_cflags} %{?__global_ldflags} %{moreflags_dispatch}" \ | ||
DISPATCH=%{dispatch} | ||
|
||
doxygen | ||
|
||
%install | ||
rm -rf %{buildroot} | ||
|
||
%{make_install} PREFIX=%{_prefix} LIBDIR=%{_libdir} | ||
|
||
rm -f %{buildroot}%{_libdir}/libxxhash.a | ||
|
||
%check | ||
%if %{?_with_check:1}%{?_without_check:0} | ||
%{__make} check | ||
%{__make} test-xxhsum-c | ||
%endif | ||
|
||
%post | ||
/sbin/ldconfig | ||
|
||
%postun | ||
/sbin/ldconfig | ||
|
||
%clean | ||
rm -rf %{buildroot} | ||
|
||
################################################################################ | ||
|
||
%files | ||
%defattr(-,root,root,-) | ||
%doc cli/README.md cli/COPYING | ||
%{_bindir}/xxh*sum | ||
%{_mandir}/man1/xxh*sum.1* | ||
|
||
%files libs | ||
%defattr(-,root,root,-) | ||
%doc LICENSE README.md | ||
%{_libdir}/libxxhash.so.* | ||
|
||
%files devel | ||
%defattr(-,root,root,-) | ||
%{_includedir}/%{name}.h | ||
%{_includedir}/xxh3.h | ||
%{_libdir}/lib%{name}.so | ||
%{_libdir}/pkgconfig/lib%{name}.pc | ||
|
||
%files doc | ||
%defattr(-,root,root,-) | ||
%doc doxygen/html | ||
|
||
################################################################################ | ||
|
||
%changelog | ||
* Sat Oct 28 2023 Anton Novojilov <[email protected]> - 0.8.2-0 | ||
- Initial build for kaos repository |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#include <xxh3.h> | ||
#include <xxhash.h> | ||
|
||
int main() { | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Bibop recipe for xxhash | ||
# See more: https://kaos.sh/bibop | ||
|
||
pkg xxhash xxhash-devel xxhash-libs xxhash-doc | ||
|
||
fast-finish yes | ||
|
||
var lib_linking_flags "-lxxhash" | ||
|
||
command "-" "Check apps" | ||
app xxhsum | ||
app xxh32sum | ||
app xxh64sum | ||
app xxh128sum | ||
|
||
command "-" "Check shared libs" | ||
lib-loaded libxxhash.so.* | ||
|
||
command "-" "Check headers" | ||
lib-header xxh3.h | ||
lib-header xxhash.h | ||
|
||
command "-" "Check pkg-config" | ||
lib-config libxxhash | ||
|
||
command "xxhsum test.c" "Check hash generation with xxhsum" | ||
exit 0 | ||
output-contains "c7d16feb831c7fc0 test.c" | ||
|
||
command "xxh32sum test.c" "Check hash generation with xxh32sum" | ||
exit 0 | ||
output-contains "80c41288 test.c" | ||
|
||
command "xxh64sum test.c" "Check hash generation with xxh64sum" | ||
exit 0 | ||
output-contains "c7d16feb831c7fc0 test.c" | ||
|
||
command "xxh128sum test.c" "Check hash generation with xxh128sum" | ||
exit 0 | ||
output-contains "7d9dbb0e56392a4043c367e4f24f6758 test.c" | ||
|
||
command "gcc -o test_bin {lib_linking_flags} test.c" "Compile binary with libxxhash" | ||
exit 0 | ||
exist test_bin | ||
|
||
+command "./test_bin" "Execute built binary" | ||
exit 0 |