digest.scm 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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>
  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. (define-module (gnu packages digest)
  21. #:use-module (guix gexp)
  22. #:use-module ((guix licenses) #:prefix license:)
  23. #:use-module (guix packages)
  24. #:use-module (guix download)
  25. #:use-module (guix git-download)
  26. #:use-module (guix build-system gnu)
  27. #:use-module (guix build-system python)
  28. #:use-module (guix build-system trivial)
  29. #:use-module (guix utils)
  30. #:use-module (ice-9 match))
  31. (define-public wyhash
  32. (package
  33. (name "wyhash")
  34. (version "5")
  35. (source (origin
  36. (method git-fetch)
  37. (uri (git-reference
  38. (url "https://github.com/wangyi-fudan/wyhash")
  39. (commit (string-append "wyhash_v" version))))
  40. (file-name (git-file-name name version))
  41. (sha256
  42. (base32 "03ljs5iw9zrm3bydwggjvpwrcwmsd75h3dv1j4am4hw3h22cjdjc"))))
  43. (build-system trivial-build-system) ;; source-only package
  44. (arguments
  45. `(#:modules ((guix build utils))
  46. #:builder
  47. (begin
  48. (use-modules (guix build utils))
  49. (let* ((out (string-append (assoc-ref %outputs "out")))
  50. (include (string-append out "/include"))
  51. (doc (string-append out "/share/doc/" ,name "-" ,version))
  52. (source (assoc-ref %build-inputs "source")))
  53. (with-directory-excursion source
  54. (install-file "wyhash.h" include)
  55. (install-file "LICENSE" doc)
  56. (install-file "README.md" doc))
  57. #t))))
  58. (home-page "https://github.com/wangyi-fudan/wyhash")
  59. (synopsis "Embeddable hash function and random number generator")
  60. (description "This package provides a portable hash function and random
  61. number generator suitable for use in data structures. Provided by default in
  62. Zig, V, and Nim programming language standard libraries.")
  63. (license license:unlicense)))
  64. (define-public xxhash
  65. (package
  66. (name "xxhash")
  67. ;; XXX Remove the 'fix-man-page-links phase when updating.
  68. (version "0.8.1")
  69. (source
  70. (origin
  71. (method git-fetch)
  72. (uri (git-reference
  73. (url "https://github.com/Cyan4973/xxHash")
  74. (commit (string-append "v" version))))
  75. (file-name (git-file-name name version))
  76. (sha256
  77. (base32 "1h6080lvcr5mpbvy4fhb4i7wvhpy72nrixk3djmpai4hxq41hsnr"))))
  78. (build-system gnu-build-system)
  79. (arguments
  80. (list #:make-flags
  81. #~(list #$(string-append "CC=" (cc-for-target))
  82. #$(match (or (%current-target-system)
  83. (%current-system))
  84. ;; Detect vector instruction set at run time.
  85. ((or "i686-linux" "x86_64-linux") "DISPATCH=1")
  86. (_ "DISPATCH=0"))
  87. "XXH_FORCE_MEMORY_ACCESS=1" ; improved performance with GCC
  88. (string-append "prefix=" (assoc-ref %outputs "out")))
  89. #:phases
  90. #~(modify-phases %standard-phases
  91. (add-after 'unpack 'fix-man-page-links
  92. ;; https://github.com/Cyan4973/xxHash/issues/647
  93. (lambda _
  94. (substitute* "Makefile"
  95. (("ln -sf \\$\\(MAN\\)")
  96. "ln -sf xxhsum.1"))))
  97. (delete 'configure)))) ; no configure script
  98. (home-page "https://cyan4973.github.io/xxHash/")
  99. (synopsis "Extremely fast hash algorithm")
  100. (description
  101. "xxHash is an extremely fast non-cryptographic hash algorithm. It works
  102. at speeds close to RAM limits, and comes in both 32- and 64-bit flavours.
  103. The code is highly portable, and hashes of the same length are identical on all
  104. platforms (both big and little endian).")
  105. (license (list license:bsd-2 ; xxhash library (xxhash.[ch])
  106. license:gpl2+)))) ; xxhsum.c
  107. (define-public python-xxhash
  108. (package
  109. (name "python-xxhash")
  110. (version "2.0.2")
  111. (source
  112. (origin
  113. (method url-fetch)
  114. (uri (pypi-uri "xxhash" version))
  115. (sha256
  116. (base32
  117. "0jbvz19acznq00544gcsjg05fkvrmwbnwdfgrvwss3i1ys6avgmp"))))
  118. (build-system python-build-system)
  119. (home-page "https://github.com/ifduyue/python-xxhash")
  120. (synopsis "Python binding for xxHash")
  121. (description "This package provides Python bindings for the xxHash hash
  122. algorithm.")
  123. (license license:bsd-3)))