Patchwork [2/3] gnu: Add murmur-hash.

login
register
mail settings
Submitter Ben Woodcroft
Date June 17, 2016, 1:23 a.m.
Message ID <1466126601-30932-3-git-send-email-donttrustben@gmail.com>
Download mbox | patch
Permalink /patch/13145/
State New
Headers show

Comments

Ben Woodcroft - June 17, 2016, 1:23 a.m.
* gnu/packages/textutils.scm (murmur-hash): New variable.
---
 gnu/packages/textutils.scm | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

Patch

diff --git a/gnu/packages/textutils.scm b/gnu/packages/textutils.scm
index ebcf4b9..ce83c4d 100644
--- a/gnu/packages/textutils.scm
+++ b/gnu/packages/textutils.scm
@@ -373,3 +373,42 @@  runs Word\".")
     (description "UTF8-CPP is a C++ library for handling UTF-8 encoded text
 in a portable way.")
     (license license:boost1.0)))
+
+(define-public murmur-hash
+  ;; There are no releases so package directly from a git commit.
+  (let ((commit "61a0530f28277f2e850bfc39600ce61d02b518de"))
+    (package
+      (name "murmur-hash")
+      (version (string-append "0-1." (string-take commit 7)))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/aappleby/smhasher.git")
+                      (commit commit)))
+                (file-name (string-append name "-" version ".tar.gz"))
+                (sha256
+                 (base32
+                  "1hasigzz5dyx8dzf1arzwahhph2p4vnsq32wlyh99nga2z4hd8si"))))
+      (build-system gnu-build-system)
+      (arguments
+       `(#:phases
+         (modify-phases %standard-phases
+           (delete 'configure)
+           (delete 'build)
+           (delete 'check)
+           (replace 'install
+             (lambda* (#:key outputs #:allow-other-keys)
+               (with-directory-excursion "src"
+                 (let ((out (string-append
+                             (assoc-ref outputs "out")
+                             "/include")))
+                   (install-file "MurmurHash3.cpp" out)
+                   (install-file "MurmurHash3.h" out)))
+               #t)))))
+      (home-page "https://github.com/aappleby/smhasher")
+      (synopsis "Non-cryptographic hash function for lookup")
+      (description
+       "MurmurHash is a non-cryptographic hash function suitable for general
+hash-based lookup.  The name comes from two basic operations, multiply (MU)
+and rotate (R), used in its inner loop.")
+      (license license:public-domain))))