gnu: emacs-svg-icon: Fix grammar.
[jackhill/guix/guix.git] / gnu / packages / datastructures.scm
CommitLineData
f7f55db8 1;;; GNU Guix --- Functional package management for GNU
3546771c 2;;; Copyright © 2015, 2016, 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
10e318bd 3;;; Copyright © 2016, 2017, 2019–2021 Tobias Geerinckx-Rice <me@tobias.gr>
9d466489 4;;; Copyright © 2018 Meiyo Peng <meiyo.peng@gmail.com>
ab15bbea 5;;; Copyright © 2019, 2020 Efraim Flashner <efraim@flashner.co.il>
5eb97480 6;;; Copyright © 2020 Mark H Weaver <mhw@netris.org>
0d59aecf 7;;; Copyright © 2020 Marius Bakke <marius@gnu.org>
f7f55db8
RW
8;;;
9;;; This file is part of GNU Guix.
10;;;
11;;; GNU Guix is free software; you can redistribute it and/or modify it
12;;; under the terms of the GNU General Public License as published by
13;;; the Free Software Foundation; either version 3 of the License, or (at
14;;; your option) any later version.
15;;;
16;;; GNU Guix is distributed in the hope that it will be useful, but
17;;; WITHOUT ANY WARRANTY; without even the implied warranty of
18;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19;;; GNU General Public License for more details.
20;;;
21;;; You should have received a copy of the GNU General Public License
22;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
23
24(define-module (gnu packages datastructures)
25 #:use-module (gnu packages)
9b26efdd 26 #:use-module (gnu packages autotools)
5eb97480 27 #:use-module (gnu packages boost)
0d59aecf 28 #:use-module (gnu packages build-tools) ;for meson-0.55
754667f0 29 #:use-module (gnu packages perl)
f7f55db8
RW
30 #:use-module ((guix licenses) #:prefix license:)
31 #:use-module (guix packages)
32 #:use-module (guix download)
d1293d42 33 #:use-module (guix git-download)
ad6f1330 34 #:use-module (guix build-system cmake)
0d59aecf
MB
35 #:use-module (guix build-system gnu)
36 #:use-module (guix build-system meson))
f7f55db8 37
b4464d38
RW
38(define-public gdsl
39 (package
40 (name "gdsl")
41 (version "1.8")
42 (source (origin
74cb33c2 43 (method git-fetch)
44 (uri (git-reference
45 (url "https://example.org") ;only hosted on Software Heritage
46 (commit "6adb53be8b8f9f2e4bbfc92d357eedeefb4c7430")))
47 (file-name (git-file-name name version))
b4464d38
RW
48 (sha256
49 (base32
74cb33c2 50 "0a52g12d9sf9hhcyvwfd7xdazj2a9i9jh97cnlqf2ymvwnvjk1g0"))))
b4464d38 51 (build-system gnu-build-system)
74cb33c2 52 (home-page "https://web.archive.org/web/20170502005430/http://home.gna.org/gdsl/")
b4464d38
RW
53 (synopsis "Generic data structures library")
54 (description "The Generic Data Structures Library (GDSL) is a collection
55of routines for generic data structures manipulation. It is a re-entrant
56library fully written from scratch in pure ANSI C. It is designed to offer
57for C programmers common data structures with powerful algorithms, and hidden
58implementation. Available structures are lists, queues, stacks, hash tables,
59binary trees, binary search trees, red-black trees, 2D arrays, permutations
60and heaps.")
61 (license license:gpl2+)))
62
9d466489
MP
63(define-public marisa
64 (package
65 (name "marisa")
9b26efdd 66 (version "0.2.6")
9d466489
MP
67 (source
68 (origin
69 (method url-fetch)
9b26efdd
TGR
70 (uri (string-append "https://github.com/s-yata/marisa-trie/files/"
71 "4832504/marisa-" version ".tar.gz"))
9d466489 72 (sha256
9b26efdd 73 (base32 "1pk6wmi28pa8srb4szybrwfn71jldb61c5vgxsiayxcyg1ya4qqh"))))
9d466489 74 (build-system gnu-build-system)
9b26efdd
TGR
75 (native-inputs
76 `(("autoconf" ,autoconf)
77 ("automake" ,automake)
78 ("libtool" ,libtool)))
9d466489
MP
79 (home-page "https://github.com/s-yata/marisa-trie")
80 (synopsis "Trie data structure C++ library")
c47485b2
TGR
81 (description "@acronym{MARISA, Matching Algorithm with Recursively
82Implemented StorAge} is a static and space-efficient trie data structure C++
9d466489
MP
83library.")
84
85 ;; Dual-licensed, according to docs/readme.en.html (source files lack
86 ;; copyright/license headers.)
87 (license (list license:bsd-2 license:lgpl2.1+))))
88
f7f55db8
RW
89(define-public sparsehash
90 (package
91 (name "sparsehash")
907d5ed1 92 (version "2.0.4")
f7f55db8 93 (source (origin
fea30e12
EF
94 (method git-fetch)
95 (uri (git-reference
b0e7b699 96 (url "https://github.com/sparsehash/sparsehash")
fea30e12
EF
97 (commit (string-append name "-" version))))
98 (file-name (git-file-name name version))
f7f55db8
RW
99 (sha256
100 (base32
907d5ed1 101 "1pf1cjvcjdmb9cd6gcazz64x0cd2ndpwh6ql2hqpypjv725xwxy7"))))
f7f55db8
RW
102 (build-system gnu-build-system)
103 (synopsis "Memory-efficient hashtable implementations")
104 (description
105 "This library contains several hash-map implementations, similar in API
106to SGI's @code{hash_map} class, but with different performance
107characteristics. @code{sparse_hash_map} uses very little space overhead, 1-2
d1e4ad1b 108bits per entry. @code{dense_hash_map} is very fast, particularly on lookup.
f7f55db8
RW
109@code{sparse_hash_set} and @code{dense_hash_set} are the set versions of these
110routines. All these implementation use a hashtable with internal quadratic
111probing. This method is space-efficient -- there is no pointer overhead --
112and time-efficient for good hash functions.")
113 (home-page "https://github.com/sparsehash/sparsehash")
114 (license license:bsd-3)))
592ccdd3
TGR
115
116(define-public ssdeep
117 (package
118 (name "ssdeep")
ffd57da1
TGR
119 (version "2.14.1")
120 (source
121 (origin
122 (method url-fetch)
123 (uri (string-append "https://github.com/ssdeep-project/ssdeep/"
124 "releases/download/release-" version "/"
125 "ssdeep-" version ".tar.gz"))
126 (sha256
127 (base32 "04qkjc6kksxkv7xbnk32rwmf3a8czdv2vvrdzfs0kw06h73snbpz"))))
592ccdd3 128 (build-system gnu-build-system)
6be0d9f4
TGR
129 (arguments
130 `(#:configure-flags
131 (list "--disable-static")))
73e560bc 132 (home-page "https://ssdeep-project.github.io")
592ccdd3
TGR
133 (synopsis "Context-triggered piecewise hashing algorithm")
134 (description "ssdeep computes and matches context triggered piecewise
135hashes (CTPH), also called fuzzy checksums. It can identify similar files
136that have sequences of identical bytes in the same order, even though bytes
137in between these sequences may be different in both content and length.")
138 (license license:gpl2+)))
754667f0
TGR
139
140(define-public liburcu
141 (package
142 (name "liburcu")
467f7919 143 (version "0.12.2")
754667f0
TGR
144 (source (origin
145 (method url-fetch)
146 (uri (string-append "https://www.lttng.org/files/urcu/"
147 "userspace-rcu-" version ".tar.bz2"))
148 (sha256
149 (base32
467f7919 150 "0yx69kbx9zd6ayjzvwvglilhdnirq4f1x1sdv33jy8bc9wgc3vsf"))))
754667f0
TGR
151 (build-system gnu-build-system)
152 (native-inputs
153 `(("perl" ,perl))) ; for tests
4dfda8dc 154 (home-page "https://liburcu.org/")
754667f0
TGR
155 (synopsis "User-space RCU data synchronisation library")
156 (description "liburcu is a user-space @dfn{Read-Copy-Update} (RCU) data
157synchronisation library. It provides read-side access that scales linearly
158with the number of cores. liburcu-cds provides efficient data structures
159based on RCU and lock-free algorithms. These structures include hash tables,
160queues, stacks, and doubly-linked lists.")
161 (license license:lgpl2.1+)))
cc3ac162
TGR
162
163(define-public uthash
164 (package
165 (name "uthash")
e5d193da 166 (version "2.1.0")
cc3ac162
TGR
167 (source
168 (origin
d1293d42
RW
169 (method git-fetch)
170 (uri (git-reference
b0e7b699 171 (url "https://github.com/troydhanson/uthash")
d1293d42
RW
172 (commit (string-append "v" version))))
173 (file-name (git-file-name name version))
cc3ac162 174 (sha256
e5d193da 175 (base32 "0k80bjbb6ss5wpmfmfji6xbyjm990hg9kcshwwnhdnh73vxkcd1m"))))
cc3ac162
TGR
176 (build-system gnu-build-system)
177 (native-inputs
178 `(("perl" ,perl)))
179 (arguments
180 `(#:make-flags
181 (list "CC=gcc")
182 #:phases
183 (modify-phases %standard-phases
184 (delete 'configure) ; nothing to configure
185 (delete 'build) ; nothing to build
186 (replace 'check
187 (lambda* (#:key make-flags #:allow-other-keys)
188 (with-directory-excursion "tests"
c9e75159 189 (apply invoke "make" make-flags))))
cc3ac162
TGR
190 (replace 'install
191 ;; There is no top-level Makefile to do this for us.
192 (lambda* (#:key outputs #:allow-other-keys)
193 (let* ((out (assoc-ref outputs "out"))
6655e2e2 194 (doc (string-append out "/share/doc/" ,name "-" ,version))
cc3ac162
TGR
195 (include (string-append out "/include")))
196 ;; Don't install HTML files: they're just the below .txt files
197 ;; dolled up, can be stale, and regeneration requires asciidoc.
198 (for-each (λ (file) (install-file file doc))
199 (find-files "doc" "\\.txt$"))
200 (for-each (λ (file) (install-file file include))
201 (find-files "src" "\\.h$"))
202 #t))))))
203 (home-page "https://troydhanson.github.io/uthash/")
204 (synopsis
205 "Hash tables, lists, and other data structures implemented as C macros")
206 (description
207 "uthash implements a hash table and a few other basic data structures
208as C preprocessor macros. It aims to be minimalistic and efficient: it's
209around 1,000 lines of code which, being macros, inline automatically.
210
211Unlike function calls with fixed prototypes, macros operate on untyped
212arguments. Thus, they are able to work with any type of structure and key.
213Any C structure can be stored in a hash table by adding @code{UT_hash_handle}
214to the structure and choosing one or more fields to act as the key.")
215 (license license:bsd-2)))
ad6f1330
RW
216
217(define-public sdsl-lite
218 (package
219 (name "sdsl-lite")
220 (version "2.1.1")
221 (source (origin
222 (method url-fetch)
223 (uri (string-append "https://github.com/simongog/sdsl-lite/"
224 "releases/download/v" version "/"
225 "sdsl-lite-" version
226 ".tar.gz.offline.install.gz"))
227 (sha256
228 (base32
aca2bf51
EF
229 "1v86ivv3mmdy802i9xkjpxb4cggj3s27wb19ja4sw1klnivjj69g"))
230 (modules '((guix build utils)))
231 (snippet
232 '(begin
233 (delete-file-recursively "external") #t))
234 (patches
235 (list (origin
236 (method url-fetch)
237 (uri "https://salsa.debian.org/science-team/libsdsl/raw/debian/2.1.1+dfsg-2/debian/patches/0001-Patch-cmake-files.patch")
238 (file-name "sdsl-lite-dont-use-bundled-libraries.patch")
239 (sha256
240 (base32
241 "0m542xpys54bni29zibgrfpgpd0zgyny4h131virxsanixsbz52z")))))))
ad6f1330 242 (build-system cmake-build-system)
aca2bf51 243 (arguments
ab15bbea 244 `(#:phases
aca2bf51
EF
245 (modify-phases %standard-phases
246 (add-after 'install 'install-static-library
247 (lambda* (#:key outputs #:allow-other-keys)
248 (let ((out (assoc-ref outputs "out")))
249 (copy-file "lib/libsdsl_static.a"
250 (string-append out "/lib/libsdsl.a")))
ab15bbea
EF
251 #t))
252 (add-after 'install 'install-pkgconfig-file
253 (lambda* (#:key outputs #:allow-other-keys)
a6b72a0f
EF
254 (let* ((out (assoc-ref outputs "out"))
255 (lib (string-append out "/lib")))
ab15bbea
EF
256 (mkdir-p (string-append lib "/pkgconfig"))
257 (with-output-to-file (string-append lib "/pkgconfig/sdsl-lite.pc")
258 (lambda _
259 (format #t "prefix=~a~@
260 exec_prefix=${prefix}~@
261 libdir=${exec_prefix}/lib~@
262 includedir=${prefix}/include~@
263 ~@
264 ~@
265 Name: sdsl~@
266 Version: ~a~@
267 Description: SDSL: Succinct Data Structure Library~@
268 Libs: -L${libdir} -lsdsl -ldivsufsort -ldivsufsort64~@
269 Cflags: -I${includedir}~%"
270 out ,version)))
271 #t))))))
aca2bf51
EF
272 (native-inputs
273 `(("libdivsufsort" ,libdivsufsort)))
ad6f1330
RW
274 (home-page "https://github.com/simongog/sdsl-lite")
275 (synopsis "Succinct data structure library")
276 (description "The Succinct Data Structure Library (SDSL) is a powerful and
277flexible C++11 library implementing succinct data structures. In total, the
278library contains the highlights of 40 research publications. Succinct data
279structures can represent an object (such as a bitvector or a tree) in space
280close to the information-theoretic lower bound of the object while supporting
281operations of the original object efficiently. The theoretical time
282complexity of an operation performed on the classical data structure and the
283equivalent succinct data structure are (most of the time) identical.")
284 (license license:gpl3+)))
3546771c 285
0d59aecf
MB
286(define-public tllist
287 (package
288 (name "tllist")
10e318bd 289 (version "1.0.5")
0d59aecf
MB
290 (home-page "https://codeberg.org/dnkl/tllist")
291 (source (origin
292 (method git-fetch)
293 (uri (git-reference (url home-page) (commit version)))
294 (file-name (git-file-name name version))
295 (sha256
296 (base32
10e318bd 297 "061mkg6hc9x89zya3bw18ymxlzd8fbhjipxpva8x01lh2vp1d4f0"))))
0d59aecf
MB
298 (build-system meson-build-system)
299 (arguments
300 `(#:meson ,meson-0.55))
301 (synopsis "Typed link list for C")
302 (description
303 "@code{tllist} is a @dfn{typed linked list} C header file only library
304implemented using pre-processor macros. It supports primitive data types as
305well as aggregated ones such as structs, enums and unions.")
306 (license license:expat)))
307
3546771c
EF
308(define-public libdivsufsort
309 (package
310 (name "libdivsufsort")
311 (version "2.0.1")
312 (source (origin
313 (method git-fetch)
314 (uri (git-reference
b0e7b699 315 (url "https://github.com/y-256/libdivsufsort")
3546771c
EF
316 (commit version)))
317 (file-name (git-file-name name version))
318 (sha256
319 (base32
320 "0fgdz9fzihlvjjrxy01md1bv9vh12rkgkwbm90b1hj5xpbaqp7z2"))))
321 (build-system cmake-build-system)
322 (arguments
323 '(#:tests? #f ; there are no tests
324 #:configure-flags
325 ;; Needed for rapmap and sailfish.
326 '("-DBUILD_DIVSUFSORT64=ON")))
327 (home-page "https://github.com/y-256/libdivsufsort")
328 (synopsis "Lightweight suffix-sorting library")
329 (description "libdivsufsort is a software library that implements a
330lightweight suffix array construction algorithm. This library provides a
331simple and an efficient C API to construct a suffix array and a
332Burrows-Wheeler transformed string from a given string over a constant-size
333alphabet. The algorithm runs in O(n log n) worst-case time using only 5n+O(1)
334bytes of memory space, where n is the length of the string.")
335 (license license:expat)))
5eb97480
MW
336
337(define-public robin-map
338 (package
339 (name "robin-map")
340 (version "0.6.3")
341 (source (origin
342 (method git-fetch)
343 (uri (git-reference
344 (url "https://github.com/Tessil/robin-map")
345 (commit (string-append "v" version))))
346 (file-name (git-file-name name version))
347 (sha256
348 (base32
349 "1li70vwsksva9c4yly90hjafgqfixi1g6d52qq9p6r60vqc4pkjj"))))
350 (build-system cmake-build-system)
351 (native-inputs
352 `(("boost" ,boost))) ; needed for tests
353 (arguments
354 `(#:phases
355 (modify-phases %standard-phases
356 (replace 'check
357 (lambda _
358 (mkdir "tests")
359 (with-directory-excursion "tests"
360 (invoke "cmake" "../../source/tests")
361 (invoke "cmake" "--build" ".")
362 (invoke "./tsl_robin_map_tests")))))))
363 (home-page "https://github.com/Tessil/robin-map")
364 (synopsis "C++ implementation of a fast hash map and hash set")
365 (description "The robin-map library is a C++ implementation of a fast hash
366map and hash set using open-addressing and linear robin hood hashing with
367backward shift deletion to resolve collisions.
368
369Four classes are provided: tsl::robin_map, tsl::robin_set, tsl::robin_pg_map
370and tsl::robin_pg_set. The first two are faster and use a power of two growth
371policy, the last two use a prime growth policy instead and are able to cope
372better with a poor hash function.")
373 (license license:expat)))