gnu: xxhash: Update to 0.8.1.
[jackhill/guix/guix.git] / gnu / packages / digest.scm
CommitLineData
cc17345d 1;;; GNU Guix --- Functional package management for GNU
9c1324a4 2;;; Copyright © 2017, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
4a829b2d 3;;; Copyright © 2021 Ryan Prior <rprior@protonmail.com>
69a4494a 4;;; Copyright © 2021 Ricardo Wurmus <rekado@elephly.net>
cc17345d
TGR
5;;;
6;;; This file is part of GNU Guix.
7;;;
8;;; GNU Guix is free software; you can redistribute it and/or modify it
9;;; under the terms of the GNU General Public License as published by
10;;; the Free Software Foundation; either version 3 of the License, or (at
11;;; your option) any later version.
12;;;
13;;; GNU Guix is distributed in the hope that it will be useful, but
14;;; WITHOUT ANY WARRANTY; without even the implied warranty of
15;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16;;; GNU General Public License for more details.
17;;;
18;;; You should have received a copy of the GNU General Public License
19;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
20
21(define-module (gnu packages digest)
22 #:use-module ((guix licenses) #:prefix license:)
23 #:use-module (guix packages)
69a4494a 24 #:use-module (guix download)
1bf1bda9 25 #:use-module (guix git-download)
9c1324a4 26 #:use-module (guix build-system gnu)
69a4494a 27 #:use-module (guix build-system python)
4a829b2d 28 #:use-module (guix build-system trivial)
1d25cfba
TGR
29 #:use-module (guix utils)
30 #:use-module (ice-9 match))
cc17345d 31
4a829b2d
RP
32(define-public wyhash
33 (package
34 (name "wyhash")
35 (version "5")
36 (source (origin
37 (method git-fetch)
38 (uri (git-reference
39 (url "https://github.com/wangyi-fudan/wyhash")
40 (commit (string-append "wyhash_v" version))))
41 (file-name (git-file-name name version))
42 (sha256
43 (base32 "03ljs5iw9zrm3bydwggjvpwrcwmsd75h3dv1j4am4hw3h22cjdjc"))))
44 (build-system trivial-build-system) ;; source-only package
45 (arguments
46 `(#:modules ((guix build utils))
47 #:builder
48 (begin
49 (use-modules (guix build utils))
50 (let* ((out (string-append (assoc-ref %outputs "out")))
51 (include (string-append out "/include"))
52 (doc (string-append out "/share/doc/" ,name "-" ,version))
53 (source (assoc-ref %build-inputs "source")))
54 (with-directory-excursion source
55 (install-file "wyhash.h" include)
56 (install-file "LICENSE" doc)
57 (install-file "README.md" doc))
58 #t))))
59 (home-page "https://github.com/wangyi-fudan/wyhash")
60 (synopsis "Embeddable hash function and random number generator")
61 (description "This package provides a portable hash function and random
62number generator suitable for use in data structures. Provided by default in
63Zig, V, and Nim programming language standard libraries.")
64 (license license:unlicense)))
65
cc17345d
TGR
66(define-public xxhash
67 (package
68 (name "xxhash")
7608d2d0
TGR
69 ;; XXX Remove the 'fix-man-page-links phase when updating.
70 (version "0.8.1")
cc17345d
TGR
71 (source
72 (origin
1bf1bda9
TGR
73 (method git-fetch)
74 (uri (git-reference
75 (url "https://github.com/Cyan4973/xxHash")
76 (commit (string-append "v" version))))
f1d4d79f 77 (file-name (git-file-name name version))
cc17345d 78 (sha256
7608d2d0 79 (base32 "1h6080lvcr5mpbvy4fhb4i7wvhpy72nrixk3djmpai4hxq41hsnr"))))
cc17345d
TGR
80 (build-system gnu-build-system)
81 (arguments
82 `(#:make-flags
9c1324a4 83 (list ,(string-append "CC=" (cc-for-target))
1d25cfba
TGR
84 ,(match (or (%current-target-system)
85 (%current-system))
86 ;; Detect vector instruction set at run time.
87 ((or "i686-linux" "x86_64-linux") "DISPATCH=1")
88 (_ "DISPATCH=0"))
cc17345d
TGR
89 "XXH_FORCE_MEMORY_ACCESS=1" ; improved performance with GCC
90 (string-append "prefix=" (assoc-ref %outputs "out")))
cc17345d
TGR
91 #:phases
92 (modify-phases %standard-phases
7608d2d0
TGR
93 (add-after 'unpack 'fix-man-page-links
94 ;; https://github.com/Cyan4973/xxHash/issues/647
95 (lambda _
96 (substitute* "Makefile"
97 (("ln -sf \\$\\(MAN\\)")
98 "ln -sf xxhsum.1"))))
cc17345d
TGR
99 (delete 'configure)))) ; no configure script
100 (home-page "https://cyan4973.github.io/xxHash/")
101 (synopsis "Extremely fast hash algorithm")
102 (description
103 "xxHash is an extremely fast non-cryptographic hash algorithm. It works
104at speeds close to RAM limits, and comes in both 32- and 64-bit flavours.
105The code is highly portable, and hashes of the same length are identical on all
106platforms (both big and little endian).")
107 (license (list license:bsd-2 ; xxhash library (xxhash.[ch])
108 license:gpl2+)))) ; xxhsum.c
69a4494a
RW
109
110(define-public python-xxhash
111 (package
112 (name "python-xxhash")
113 (version "2.0.2")
114 (source
115 (origin
116 (method url-fetch)
117 (uri (pypi-uri "xxhash" version))
118 (sha256
119 (base32
120 "0jbvz19acznq00544gcsjg05fkvrmwbnwdfgrvwss3i1ys6avgmp"))))
121 (build-system python-build-system)
122 (home-page "https://github.com/ifduyue/python-xxhash")
123 (synopsis "Python binding for xxHash")
124 (description "This package provides Python bindings for the xxHash hash
125algorithm.")
126 (license license:bsd-3)))