Commit | Line | Data |
---|---|---|
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) | |
f9fe99b4 | 22 | #:use-module (guix gexp) |
cc17345d TGR |
23 | #:use-module ((guix licenses) #:prefix license:) |
24 | #:use-module (guix packages) | |
69a4494a | 25 | #:use-module (guix download) |
1bf1bda9 | 26 | #:use-module (guix git-download) |
9c1324a4 | 27 | #:use-module (guix build-system gnu) |
69a4494a | 28 | #:use-module (guix build-system python) |
4a829b2d | 29 | #:use-module (guix build-system trivial) |
1d25cfba TGR |
30 | #:use-module (guix utils) |
31 | #:use-module (ice-9 match)) | |
cc17345d | 32 | |
4a829b2d RP |
33 | (define-public wyhash |
34 | (package | |
35 | (name "wyhash") | |
36 | (version "5") | |
37 | (source (origin | |
38 | (method git-fetch) | |
39 | (uri (git-reference | |
40 | (url "https://github.com/wangyi-fudan/wyhash") | |
41 | (commit (string-append "wyhash_v" version)))) | |
42 | (file-name (git-file-name name version)) | |
43 | (sha256 | |
44 | (base32 "03ljs5iw9zrm3bydwggjvpwrcwmsd75h3dv1j4am4hw3h22cjdjc")))) | |
45 | (build-system trivial-build-system) ;; source-only package | |
46 | (arguments | |
47 | `(#:modules ((guix build utils)) | |
48 | #:builder | |
49 | (begin | |
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)) | |
59 | #t)))) | |
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))) | |
66 | ||
cc17345d TGR |
67 | (define-public xxhash |
68 | (package | |
69 | (name "xxhash") | |
7608d2d0 TGR |
70 | ;; XXX Remove the 'fix-man-page-links phase when updating. |
71 | (version "0.8.1") | |
cc17345d TGR |
72 | (source |
73 | (origin | |
1bf1bda9 TGR |
74 | (method git-fetch) |
75 | (uri (git-reference | |
76 | (url "https://github.com/Cyan4973/xxHash") | |
77 | (commit (string-append "v" version)))) | |
f1d4d79f | 78 | (file-name (git-file-name name version)) |
cc17345d | 79 | (sha256 |
7608d2d0 | 80 | (base32 "1h6080lvcr5mpbvy4fhb4i7wvhpy72nrixk3djmpai4hxq41hsnr")))) |
cc17345d TGR |
81 | (build-system gnu-build-system) |
82 | (arguments | |
f9fe99b4 TGR |
83 | (list #:make-flags |
84 | #~(list #$(string-append "CC=" (cc-for-target)) | |
85 | #$(match (or (%current-target-system) | |
86 | (%current-system)) | |
87 | ;; Detect vector instruction set at run time. | |
88 | ((or "i686-linux" "x86_64-linux") "DISPATCH=1") | |
89 | (_ "DISPATCH=0")) | |
90 | "XXH_FORCE_MEMORY_ACCESS=1" ; improved performance with GCC | |
91 | (string-append "prefix=" (assoc-ref %outputs "out"))) | |
92 | #:phases | |
93 | #~(modify-phases %standard-phases | |
94 | (add-after 'unpack 'fix-man-page-links | |
95 | ;; https://github.com/Cyan4973/xxHash/issues/647 | |
96 | (lambda _ | |
97 | (substitute* "Makefile" | |
98 | (("ln -sf \\$\\(MAN\\)") | |
99 | "ln -sf xxhsum.1")))) | |
100 | (delete 'configure)))) ; no configure script | |
cc17345d TGR |
101 | (home-page "https://cyan4973.github.io/xxHash/") |
102 | (synopsis "Extremely fast hash algorithm") | |
103 | (description | |
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 | |
69a4494a RW |
110 | |
111 | (define-public python-xxhash | |
112 | (package | |
113 | (name "python-xxhash") | |
114 | (version "2.0.2") | |
115 | (source | |
116 | (origin | |
117 | (method url-fetch) | |
118 | (uri (pypi-uri "xxhash" version)) | |
119 | (sha256 | |
120 | (base32 | |
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 | |
126 | algorithm.") | |
127 | (license license:bsd-3))) |