gnu: ruby-pandoc-ruby: Use pandoc instead of ghc-pandoc.
[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>
ab15bbea 5;;; Copyright © 2019, 2020 Efraim Flashner <efraim@flashner.co.il>
5eb97480 6;;; Copyright © 2020 Mark H Weaver <mhw@netris.org>
f7f55db8
RW
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)
9b26efdd 25 #:use-module (gnu packages autotools)
5eb97480 26 #:use-module (gnu packages boost)
754667f0 27 #:use-module (gnu packages perl)
f7f55db8
RW
28 #:use-module ((guix licenses) #:prefix license:)
29 #:use-module (guix packages)
30 #:use-module (guix download)
d1293d42 31 #:use-module (guix git-download)
ad6f1330 32 #:use-module (guix build-system cmake)
f7f55db8
RW
33 #:use-module (guix build-system gnu))
34
b4464d38
RW
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
50of routines for generic data structures manipulation. It is a re-entrant
51library fully written from scratch in pure ANSI C. It is designed to offer
52for C programmers common data structures with powerful algorithms, and hidden
53implementation. Available structures are lists, queues, stacks, hash tables,
54binary trees, binary search trees, red-black trees, 2D arrays, permutations
55and heaps.")
56 (license license:gpl2+)))
57
9d466489
MP
58(define-public marisa
59 (package
60 (name "marisa")
9b26efdd 61 (version "0.2.6")
9d466489
MP
62 (source
63 (origin
64 (method url-fetch)
9b26efdd
TGR
65 (uri (string-append "https://github.com/s-yata/marisa-trie/files/"
66 "4832504/marisa-" version ".tar.gz"))
9d466489 67 (sha256
9b26efdd 68 (base32 "1pk6wmi28pa8srb4szybrwfn71jldb61c5vgxsiayxcyg1ya4qqh"))))
9d466489 69 (build-system gnu-build-system)
9b26efdd
TGR
70 (native-inputs
71 `(("autoconf" ,autoconf)
72 ("automake" ,automake)
73 ("libtool" ,libtool)))
9d466489
MP
74 (home-page "https://github.com/s-yata/marisa-trie")
75 (synopsis "Trie data structure C++ library")
c47485b2
TGR
76 (description "@acronym{MARISA, Matching Algorithm with Recursively
77Implemented StorAge} is a static and space-efficient trie data structure C++
9d466489
MP
78library.")
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
f7f55db8
RW
84(define-public sparsehash
85 (package
86 (name "sparsehash")
907d5ed1 87 (version "2.0.4")
f7f55db8 88 (source (origin
fea30e12
EF
89 (method git-fetch)
90 (uri (git-reference
b0e7b699 91 (url "https://github.com/sparsehash/sparsehash")
fea30e12
EF
92 (commit (string-append name "-" version))))
93 (file-name (git-file-name name version))
f7f55db8
RW
94 (sha256
95 (base32
907d5ed1 96 "1pf1cjvcjdmb9cd6gcazz64x0cd2ndpwh6ql2hqpypjv725xwxy7"))))
f7f55db8
RW
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
101to SGI's @code{hash_map} class, but with different performance
102characteristics. @code{sparse_hash_map} uses very little space overhead, 1-2
d1e4ad1b 103bits per entry. @code{dense_hash_map} is very fast, particularly on lookup.
f7f55db8
RW
104@code{sparse_hash_set} and @code{dense_hash_set} are the set versions of these
105routines. All these implementation use a hashtable with internal quadratic
106probing. This method is space-efficient -- there is no pointer overhead --
107and time-efficient for good hash functions.")
108 (home-page "https://github.com/sparsehash/sparsehash")
109 (license license:bsd-3)))
592ccdd3
TGR
110
111(define-public ssdeep
112 (package
113 (name "ssdeep")
ffd57da1
TGR
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"))))
592ccdd3 123 (build-system gnu-build-system)
6be0d9f4
TGR
124 (arguments
125 `(#:configure-flags
126 (list "--disable-static")))
73e560bc 127 (home-page "https://ssdeep-project.github.io")
592ccdd3
TGR
128 (synopsis "Context-triggered piecewise hashing algorithm")
129 (description "ssdeep computes and matches context triggered piecewise
130hashes (CTPH), also called fuzzy checksums. It can identify similar files
131that have sequences of identical bytes in the same order, even though bytes
132in between these sequences may be different in both content and length.")
133 (license license:gpl2+)))
754667f0
TGR
134
135(define-public liburcu
136 (package
137 (name "liburcu")
0fb2bc83 138 (version "0.12.1")
754667f0
TGR
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
0fb2bc83 145 "03nd1gy2c3fdb6xwdrd5lr1jcjxbzffqh3z91mzbjhjn6k8fmymv"))))
754667f0
TGR
146 (build-system gnu-build-system)
147 (native-inputs
148 `(("perl" ,perl))) ; for tests
4dfda8dc 149 (home-page "https://liburcu.org/")
754667f0
TGR
150 (synopsis "User-space RCU data synchronisation library")
151 (description "liburcu is a user-space @dfn{Read-Copy-Update} (RCU) data
152synchronisation library. It provides read-side access that scales linearly
153with the number of cores. liburcu-cds provides efficient data structures
154based on RCU and lock-free algorithms. These structures include hash tables,
155queues, stacks, and doubly-linked lists.")
156 (license license:lgpl2.1+)))
cc3ac162
TGR
157
158(define-public uthash
159 (package
160 (name "uthash")
e5d193da 161 (version "2.1.0")
cc3ac162
TGR
162 (source
163 (origin
d1293d42
RW
164 (method git-fetch)
165 (uri (git-reference
b0e7b699 166 (url "https://github.com/troydhanson/uthash")
d1293d42
RW
167 (commit (string-append "v" version))))
168 (file-name (git-file-name name version))
cc3ac162 169 (sha256
e5d193da 170 (base32 "0k80bjbb6ss5wpmfmfji6xbyjm990hg9kcshwwnhdnh73vxkcd1m"))))
cc3ac162
TGR
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"
c9e75159 184 (apply invoke "make" make-flags))))
cc3ac162
TGR
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"))
6655e2e2 189 (doc (string-append out "/share/doc/" ,name "-" ,version))
cc3ac162
TGR
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
203as C preprocessor macros. It aims to be minimalistic and efficient: it's
204around 1,000 lines of code which, being macros, inline automatically.
205
206Unlike function calls with fixed prototypes, macros operate on untyped
207arguments. Thus, they are able to work with any type of structure and key.
208Any C structure can be stored in a hash table by adding @code{UT_hash_handle}
209to the structure and choosing one or more fields to act as the key.")
210 (license license:bsd-2)))
ad6f1330
RW
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
aca2bf51
EF
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")))))))
ad6f1330 237 (build-system cmake-build-system)
aca2bf51 238 (arguments
ab15bbea 239 `(#:phases
aca2bf51
EF
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")))
ab15bbea
EF
246 #t))
247 (add-after 'install 'install-pkgconfig-file
248 (lambda* (#:key outputs #:allow-other-keys)
a6b72a0f
EF
249 (let* ((out (assoc-ref outputs "out"))
250 (lib (string-append out "/lib")))
ab15bbea
EF
251 (mkdir-p (string-append lib "/pkgconfig"))
252 (with-output-to-file (string-append lib "/pkgconfig/sdsl-lite.pc")
253 (lambda _
254 (format #t "prefix=~a~@
255 exec_prefix=${prefix}~@
256 libdir=${exec_prefix}/lib~@
257 includedir=${prefix}/include~@
258 ~@
259 ~@
260 Name: sdsl~@
261 Version: ~a~@
262 Description: SDSL: Succinct Data Structure Library~@
263 Libs: -L${libdir} -lsdsl -ldivsufsort -ldivsufsort64~@
264 Cflags: -I${includedir}~%"
265 out ,version)))
266 #t))))))
aca2bf51
EF
267 (native-inputs
268 `(("libdivsufsort" ,libdivsufsort)))
ad6f1330
RW
269 (home-page "https://github.com/simongog/sdsl-lite")
270 (synopsis "Succinct data structure library")
271 (description "The Succinct Data Structure Library (SDSL) is a powerful and
272flexible C++11 library implementing succinct data structures. In total, the
273library contains the highlights of 40 research publications. Succinct data
274structures can represent an object (such as a bitvector or a tree) in space
275close to the information-theoretic lower bound of the object while supporting
276operations of the original object efficiently. The theoretical time
277complexity of an operation performed on the classical data structure and the
278equivalent succinct data structure are (most of the time) identical.")
279 (license license:gpl3+)))
3546771c
EF
280
281(define-public libdivsufsort
282 (package
283 (name "libdivsufsort")
284 (version "2.0.1")
285 (source (origin
286 (method git-fetch)
287 (uri (git-reference
b0e7b699 288 (url "https://github.com/y-256/libdivsufsort")
3546771c
EF
289 (commit version)))
290 (file-name (git-file-name name version))
291 (sha256
292 (base32
293 "0fgdz9fzihlvjjrxy01md1bv9vh12rkgkwbm90b1hj5xpbaqp7z2"))))
294 (build-system cmake-build-system)
295 (arguments
296 '(#:tests? #f ; there are no tests
297 #:configure-flags
298 ;; Needed for rapmap and sailfish.
299 '("-DBUILD_DIVSUFSORT64=ON")))
300 (home-page "https://github.com/y-256/libdivsufsort")
301 (synopsis "Lightweight suffix-sorting library")
302 (description "libdivsufsort is a software library that implements a
303lightweight suffix array construction algorithm. This library provides a
304simple and an efficient C API to construct a suffix array and a
305Burrows-Wheeler transformed string from a given string over a constant-size
306alphabet. The algorithm runs in O(n log n) worst-case time using only 5n+O(1)
307bytes of memory space, where n is the length of the string.")
308 (license license:expat)))
5eb97480
MW
309
310(define-public robin-map
311 (package
312 (name "robin-map")
313 (version "0.6.3")
314 (source (origin
315 (method git-fetch)
316 (uri (git-reference
317 (url "https://github.com/Tessil/robin-map")
318 (commit (string-append "v" version))))
319 (file-name (git-file-name name version))
320 (sha256
321 (base32
322 "1li70vwsksva9c4yly90hjafgqfixi1g6d52qq9p6r60vqc4pkjj"))))
323 (build-system cmake-build-system)
324 (native-inputs
325 `(("boost" ,boost))) ; needed for tests
326 (arguments
327 `(#:phases
328 (modify-phases %standard-phases
329 (replace 'check
330 (lambda _
331 (mkdir "tests")
332 (with-directory-excursion "tests"
333 (invoke "cmake" "../../source/tests")
334 (invoke "cmake" "--build" ".")
335 (invoke "./tsl_robin_map_tests")))))))
336 (home-page "https://github.com/Tessil/robin-map")
337 (synopsis "C++ implementation of a fast hash map and hash set")
338 (description "The robin-map library is a C++ implementation of a fast hash
339map and hash set using open-addressing and linear robin hood hashing with
340backward shift deletion to resolve collisions.
341
342Four classes are provided: tsl::robin_map, tsl::robin_set, tsl::robin_pg_map
343and tsl::robin_pg_set. The first two are faster and use a power of two growth
344policy, the last two use a prime growth policy instead and are able to cope
345better with a poor hash function.")
346 (license license:expat)))