gnu: libretro-lowresnx: Update to 1.2.
[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–2021 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 ;;; Copyright © 2020 Marius Bakke <marius@gnu.org>
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)
26 #:use-module (gnu packages autotools)
27 #:use-module (gnu packages boost)
28 #:use-module (gnu packages build-tools) ;for meson-0.55
29 #:use-module (gnu packages perl)
30 #:use-module ((guix licenses) #:prefix license:)
31 #:use-module (guix packages)
32 #:use-module (guix download)
33 #:use-module (guix git-download)
34 #:use-module (guix build-system cmake)
35 #:use-module (guix build-system gnu)
36 #:use-module (guix build-system meson))
37
38 (define-public gdsl
39 (package
40 (name "gdsl")
41 (version "1.8")
42 (source (origin
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))
48 (sha256
49 (base32
50 "0a52g12d9sf9hhcyvwfd7xdazj2a9i9jh97cnlqf2ymvwnvjk1g0"))))
51 (build-system gnu-build-system)
52 (home-page "https://web.archive.org/web/20170502005430/http://home.gna.org/gdsl/")
53 (synopsis "Generic data structures library")
54 (description "The Generic Data Structures Library (GDSL) is a collection
55 of routines for generic data structures manipulation. It is a re-entrant
56 library fully written from scratch in pure ANSI C. It is designed to offer
57 for C programmers common data structures with powerful algorithms, and hidden
58 implementation. Available structures are lists, queues, stacks, hash tables,
59 binary trees, binary search trees, red-black trees, 2D arrays, permutations
60 and heaps.")
61 (license license:gpl2+)))
62
63 (define-public marisa
64 (package
65 (name "marisa")
66 (version "0.2.6")
67 (source
68 (origin
69 (method url-fetch)
70 (uri (string-append "https://github.com/s-yata/marisa-trie/files/"
71 "4832504/marisa-" version ".tar.gz"))
72 (sha256
73 (base32 "1pk6wmi28pa8srb4szybrwfn71jldb61c5vgxsiayxcyg1ya4qqh"))))
74 (build-system gnu-build-system)
75 (native-inputs
76 `(("autoconf" ,autoconf)
77 ("automake" ,automake)
78 ("libtool" ,libtool)))
79 (home-page "https://github.com/s-yata/marisa-trie")
80 (synopsis "Trie data structure C++ library")
81 (description "@acronym{MARISA, Matching Algorithm with Recursively
82 Implemented StorAge} is a static and space-efficient trie data structure C++
83 library.")
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
89 (define-public sparsehash
90 (package
91 (name "sparsehash")
92 (version "2.0.4")
93 (source (origin
94 (method git-fetch)
95 (uri (git-reference
96 (url "https://github.com/sparsehash/sparsehash")
97 (commit (string-append name "-" version))))
98 (file-name (git-file-name name version))
99 (sha256
100 (base32
101 "1pf1cjvcjdmb9cd6gcazz64x0cd2ndpwh6ql2hqpypjv725xwxy7"))))
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
106 to SGI's @code{hash_map} class, but with different performance
107 characteristics. @code{sparse_hash_map} uses very little space overhead, 1-2
108 bits per entry. @code{dense_hash_map} is very fast, particularly on lookup.
109 @code{sparse_hash_set} and @code{dense_hash_set} are the set versions of these
110 routines. All these implementation use a hashtable with internal quadratic
111 probing. This method is space-efficient -- there is no pointer overhead --
112 and time-efficient for good hash functions.")
113 (home-page "https://github.com/sparsehash/sparsehash")
114 (license license:bsd-3)))
115
116 (define-public ssdeep
117 (package
118 (name "ssdeep")
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"))))
128 (build-system gnu-build-system)
129 (arguments
130 `(#:configure-flags
131 (list "--disable-static")))
132 (home-page "https://ssdeep-project.github.io")
133 (synopsis "Context-triggered piecewise hashing algorithm")
134 (description "ssdeep computes and matches context triggered piecewise
135 hashes (CTPH), also called fuzzy checksums. It can identify similar files
136 that have sequences of identical bytes in the same order, even though bytes
137 in between these sequences may be different in both content and length.")
138 (license license:gpl2+)))
139
140 (define-public liburcu
141 (package
142 (name "liburcu")
143 (version "0.12.2")
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
150 "0yx69kbx9zd6ayjzvwvglilhdnirq4f1x1sdv33jy8bc9wgc3vsf"))))
151 (build-system gnu-build-system)
152 (native-inputs
153 `(("perl" ,perl))) ; for tests
154 (home-page "https://liburcu.org/")
155 (synopsis "User-space RCU data synchronisation library")
156 (description "liburcu is a user-space @dfn{Read-Copy-Update} (RCU) data
157 synchronisation library. It provides read-side access that scales linearly
158 with the number of cores. liburcu-cds provides efficient data structures
159 based on RCU and lock-free algorithms. These structures include hash tables,
160 queues, stacks, and doubly-linked lists.")
161 (license license:lgpl2.1+)))
162
163 (define-public uthash
164 (package
165 (name "uthash")
166 (version "2.1.0")
167 (source
168 (origin
169 (method git-fetch)
170 (uri (git-reference
171 (url "https://github.com/troydhanson/uthash")
172 (commit (string-append "v" version))))
173 (file-name (git-file-name name version))
174 (sha256
175 (base32 "0k80bjbb6ss5wpmfmfji6xbyjm990hg9kcshwwnhdnh73vxkcd1m"))))
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"
189 (apply invoke "make" make-flags))))
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"))
194 (doc (string-append out "/share/doc/" ,name "-" ,version))
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
208 as C preprocessor macros. It aims to be minimalistic and efficient: it's
209 around 1,000 lines of code which, being macros, inline automatically.
210
211 Unlike function calls with fixed prototypes, macros operate on untyped
212 arguments. Thus, they are able to work with any type of structure and key.
213 Any C structure can be stored in a hash table by adding @code{UT_hash_handle}
214 to the structure and choosing one or more fields to act as the key.")
215 (license license:bsd-2)))
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
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")))))))
242 (build-system cmake-build-system)
243 (arguments
244 `(#:phases
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")))
251 #t))
252 (add-after 'install 'install-pkgconfig-file
253 (lambda* (#:key outputs #:allow-other-keys)
254 (let* ((out (assoc-ref outputs "out"))
255 (lib (string-append out "/lib")))
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))))))
272 (native-inputs
273 `(("libdivsufsort" ,libdivsufsort)))
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
277 flexible C++11 library implementing succinct data structures. In total, the
278 library contains the highlights of 40 research publications. Succinct data
279 structures can represent an object (such as a bitvector or a tree) in space
280 close to the information-theoretic lower bound of the object while supporting
281 operations of the original object efficiently. The theoretical time
282 complexity of an operation performed on the classical data structure and the
283 equivalent succinct data structure are (most of the time) identical.")
284 (license license:gpl3+)))
285
286 (define-public tllist
287 (package
288 (name "tllist")
289 (version "1.0.5")
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
297 "061mkg6hc9x89zya3bw18ymxlzd8fbhjipxpva8x01lh2vp1d4f0"))))
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
304 implemented using pre-processor macros. It supports primitive data types as
305 well as aggregated ones such as structs, enums and unions.")
306 (license license:expat)))
307
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
315 (url "https://github.com/y-256/libdivsufsort")
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
330 lightweight suffix array construction algorithm. This library provides a
331 simple and an efficient C API to construct a suffix array and a
332 Burrows-Wheeler transformed string from a given string over a constant-size
333 alphabet. The algorithm runs in O(n log n) worst-case time using only 5n+O(1)
334 bytes of memory space, where n is the length of the string.")
335 (license license:expat)))
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
366 map and hash set using open-addressing and linear robin hood hashing with
367 backward shift deletion to resolve collisions.
368
369 Four classes are provided: tsl::robin_map, tsl::robin_set, tsl::robin_pg_map
370 and tsl::robin_pg_set. The first two are faster and use a power of two growth
371 policy, the last two use a prime growth policy instead and are able to cope
372 better with a poor hash function.")
373 (license license:expat)))