diff mbox series

[bug#69103] gnu: Add stringzilla.

Message ID 1d1a44107760fab61928be251e22d16e958c64b0.1707839329.git.paul@apatience.com
State New
Headers show
Series [bug#69103] gnu: Add stringzilla. | expand

Commit Message

Paul A. Patience Feb. 13, 2024, 3:49 p.m. UTC
* gnu/packages/c.scm (stringzilla): New variable.

Change-Id: Ie84b126f8245f6ba8f1cc9ee56cc025b5181c3af
---
 gnu/packages/c.scm | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)


base-commit: 570ef13a87bb54d3410c431700ba78316a2641e2
diff mbox series

Patch

diff --git a/gnu/packages/c.scm b/gnu/packages/c.scm
index 1346605c71..742fe0a40a 100644
--- a/gnu/packages/c.scm
+++ b/gnu/packages/c.scm
@@ -21,6 +21,7 @@ 
 ;;; Copyright © 2023 zamfofex <zamfofex@twdb.moe>
 ;;; Copyright © 2023 Foundation Devices, Inc. <hello@foundationdevices.com>
 ;;; Copyright © 2023 David Elsing <david.elsing@posteo.net>
+;;; Copyright © 2024 Paul A. Patience <paul@apatience.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -1462,6 +1463,44 @@  (define-public utf8-h
 string.h, but with a utf8* prefix instead of the str* prefix.")
       (license license:unlicense))))
 
+(define-public stringzilla
+  (package
+    (name "stringzilla")
+    (version "3.0.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/ashvardanian/StringZilla")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "15gvbhya3q1bjidnjgbd59jgf8pj3mykp5l1d46p5k3lwr67m1iw"))))
+    (build-system cmake-build-system)
+    (arguments
+     (list #:configure-flags
+           #~(list "-DSTRINGZILLA_INSTALL=ON"
+                   (string-append "-DSTRINGZILLA_INCLUDE_INSTALL_DIR="
+                                  #$output "/include")
+                   ;; One fails, another takes very long.
+                   "-DSTRINGZILLA_BUILD_BENCHMARK=OFF"
+                   ;; Header-only; the shared library is not installed.
+                   "-DSTRINGZILLA_BUILD_SHARED=OFF")
+           #:phases
+           #~(modify-phases %standard-phases
+               ;; AVX512 support can be disabled by defining SZ_USE_X86_AVX512
+               ;; to 0 before including the header.
+               (add-after 'unpack 'skip-failing-test
+                 (lambda _
+                   (substitute* "CMakeLists.txt"
+                     (("^ *define_launcher\\(.*_avx512 .*") "")))))))
+    (home-page "https://github.com/ashvardanian/StringZilla")
+    (synopsis "C/C++ header-only string library using SIMD and SWAR")
+    (description "StringZilla is a C/C++ header-only string library which
+relies on SIMD and SWAR.  It implements string search, edit distances,
+sorting, lazy ranges, hashes and fingerprints.")
+    (license (list license:asl2.0 license:bsd-3)))) ; readme says dual-licensed
+
 (define-public utest-h
   ;; The latest commit is used as there is no release.
   (let ((commit   "54458e248f875f1a51f0af8bec8ca6ae7761b9d1")