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