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