gnu: sxiv: Install icons.
[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, 2020 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.4")
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 "1pf1cjvcjdmb9cd6gcazz64x0cd2ndpwh6ql2hqpypjv725xwxy7"))))
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 (add-after 'install 'install-pkgconfig-file
248 (lambda* (#:key outputs #:allow-other-keys)
249 (let* ((out (assoc-ref outputs "out"))
250 (lib (string-append out "/lib")))
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))))))
267 (native-inputs
268 `(("libdivsufsort" ,libdivsufsort)))
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
272 flexible C++11 library implementing succinct data structures. In total, the
273 library contains the highlights of 40 research publications. Succinct data
274 structures can represent an object (such as a bitvector or a tree) in space
275 close to the information-theoretic lower bound of the object while supporting
276 operations of the original object efficiently. The theoretical time
277 complexity of an operation performed on the classical data structure and the
278 equivalent succinct data structure are (most of the time) identical.")
279 (license license:gpl3+)))
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
288 (url "https://github.com/y-256/libdivsufsort")
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
303 lightweight suffix array construction algorithm. This library provides a
304 simple and an efficient C API to construct a suffix array and a
305 Burrows-Wheeler transformed string from a given string over a constant-size
306 alphabet. The algorithm runs in O(n log n) worst-case time using only 5n+O(1)
307 bytes of memory space, where n is the length of the string.")
308 (license license:expat)))
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
339 map and hash set using open-addressing and linear robin hood hashing with
340 backward shift deletion to resolve collisions.
341
342 Four classes are provided: tsl::robin_map, tsl::robin_set, tsl::robin_pg_map
343 and tsl::robin_pg_set. The first two are faster and use a power of two growth
344 policy, the last two use a prime growth policy instead and are able to cope
345 better with a poor hash function.")
346 (license license:expat)))