1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2017, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
3 ;;; Copyright © 2021 Ryan Prior <rprior@protonmail.com>
4 ;;; Copyright © 2021 Ricardo Wurmus <rekado@elephly.net>
6 ;;; This file is part of GNU Guix.
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.
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.
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/>.
21 (define-module (gnu packages digest)
22 #:use-module (guix gexp)
23 #:use-module ((guix licenses) #:prefix license:)
24 #:use-module (guix packages)
25 #:use-module (guix download)
26 #:use-module (guix git-download)
27 #:use-module (guix build-system gnu)
28 #:use-module (guix build-system python)
29 #:use-module (guix build-system trivial)
30 #:use-module (guix utils)
31 #:use-module (ice-9 match))
40 (url "https://github.com/wangyi-fudan/wyhash")
41 (commit (string-append "wyhash_v" version))))
42 (file-name (git-file-name name version))
44 (base32 "03ljs5iw9zrm3bydwggjvpwrcwmsd75h3dv1j4am4hw3h22cjdjc"))))
45 (build-system trivial-build-system) ;; source-only package
47 `(#:modules ((guix build utils))
50 (use-modules (guix build utils))
51 (let* ((out (string-append (assoc-ref %outputs "out")))
52 (include (string-append out "/include"))
53 (doc (string-append out "/share/doc/" ,name "-" ,version))
54 (source (assoc-ref %build-inputs "source")))
55 (with-directory-excursion source
56 (install-file "wyhash.h" include)
57 (install-file "LICENSE" doc)
58 (install-file "README.md" doc))
60 (home-page "https://github.com/wangyi-fudan/wyhash")
61 (synopsis "Embeddable hash function and random number generator")
62 (description "This package provides a portable hash function and random
63 number generator suitable for use in data structures. Provided by default in
64 Zig, V, and Nim programming language standard libraries.")
65 (license license:unlicense)))
70 ;; XXX Remove the 'fix-man-page-links phase when updating.
76 (url "https://github.com/Cyan4973/xxHash")
77 (commit (string-append "v" version))))
78 (file-name (git-file-name name version))
80 (base32 "1h6080lvcr5mpbvy4fhb4i7wvhpy72nrixk3djmpai4hxq41hsnr"))))
81 (build-system gnu-build-system)
84 #~(list #$(string-append "CC=" (cc-for-target))
85 #$(match (or (%current-target-system)
87 ;; Detect vector instruction set at run time.
88 ((or "i686-linux" "x86_64-linux") "DISPATCH=1")
90 "XXH_FORCE_MEMORY_ACCESS=1" ; improved performance with GCC
91 (string-append "prefix=" (assoc-ref %outputs "out")))
93 #~(modify-phases %standard-phases
94 (add-after 'unpack 'fix-man-page-links
95 ;; https://github.com/Cyan4973/xxHash/issues/647
97 (substitute* "Makefile"
98 (("ln -sf \\$\\(MAN\\)")
100 (delete 'configure)))) ; no configure script
101 (home-page "https://cyan4973.github.io/xxHash/")
102 (synopsis "Extremely fast hash algorithm")
104 "xxHash is an extremely fast non-cryptographic hash algorithm. It works
105 at speeds close to RAM limits, and comes in both 32- and 64-bit flavours.
106 The code is highly portable, and hashes of the same length are identical on all
107 platforms (both big and little endian).")
108 (license (list license:bsd-2 ; xxhash library (xxhash.[ch])
109 license:gpl2+)))) ; xxhsum.c
111 (define-public python-xxhash
113 (name "python-xxhash")
118 (uri (pypi-uri "xxhash" version))
121 "0jbvz19acznq00544gcsjg05fkvrmwbnwdfgrvwss3i1ys6avgmp"))))
122 (build-system python-build-system)
123 (home-page "https://github.com/ifduyue/python-xxhash")
124 (synopsis "Python binding for xxHash")
125 (description "This package provides Python bindings for the xxHash hash
127 (license license:bsd-3)))