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>
9 ;;; This file is part of GNU Guix.
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.
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.
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/>.
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))
45 (url "https://example.org") ;only hosted on Software Heritage
46 (commit "6adb53be8b8f9f2e4bbfc92d357eedeefb4c7430")))
47 (file-name (git-file-name name version))
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
61 (license license:gpl2+)))
70 (uri (string-append "https://github.com/s-yata/marisa-trie/files/"
71 "4832504/marisa-" version ".tar.gz"))
73 (base32 "1pk6wmi28pa8srb4szybrwfn71jldb61c5vgxsiayxcyg1ya4qqh"))))
74 (build-system gnu-build-system)
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++
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+))))
89 (define-public sparsehash
96 (url "https://github.com/sparsehash/sparsehash")
97 (commit (string-append name "-" version))))
98 (file-name (git-file-name name version))
101 "1pf1cjvcjdmb9cd6gcazz64x0cd2ndpwh6ql2hqpypjv725xwxy7"))))
102 (build-system gnu-build-system)
103 (synopsis "Memory-efficient hashtable implementations")
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)))
116 (define-public ssdeep
123 (uri (string-append "https://github.com/ssdeep-project/ssdeep/"
124 "releases/download/release-" version "/"
125 "ssdeep-" version ".tar.gz"))
127 (base32 "04qkjc6kksxkv7xbnk32rwmf3a8czdv2vvrdzfs0kw06h73snbpz"))))
128 (build-system gnu-build-system)
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+)))
140 (define-public liburcu
146 (uri (string-append "https://www.lttng.org/files/urcu/"
147 "userspace-rcu-" version ".tar.bz2"))
150 "0yx69kbx9zd6ayjzvwvglilhdnirq4f1x1sdv33jy8bc9wgc3vsf"))))
151 (build-system gnu-build-system)
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+)))
163 (define-public uthash
171 (url "https://github.com/troydhanson/uthash")
172 (commit (string-append "v" version))))
173 (file-name (git-file-name name version))
175 (base32 "0k80bjbb6ss5wpmfmfji6xbyjm990hg9kcshwwnhdnh73vxkcd1m"))))
176 (build-system gnu-build-system)
183 (modify-phases %standard-phases
184 (delete 'configure) ; nothing to configure
185 (delete 'build) ; nothing to build
187 (lambda* (#:key make-flags #:allow-other-keys)
188 (with-directory-excursion "tests"
189 (apply invoke "make" make-flags))))
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$"))
203 (home-page "https://troydhanson.github.io/uthash/")
205 "Hash tables, lists, and other data structures implemented as C macros")
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.
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)))
217 (define-public sdsl-lite
223 (uri (string-append "https://github.com/simongog/sdsl-lite/"
224 "releases/download/v" version "/"
226 ".tar.gz.offline.install.gz"))
229 "1v86ivv3mmdy802i9xkjpxb4cggj3s27wb19ja4sw1klnivjj69g"))
230 (modules '((guix build utils)))
233 (delete-file-recursively "external") #t))
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")
241 "0m542xpys54bni29zibgrfpgpd0zgyny4h131virxsanixsbz52z")))))))
242 (build-system cmake-build-system)
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")))
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")
259 (format #t "prefix=~a~@
260 exec_prefix=${prefix}~@
261 libdir=${exec_prefix}/lib~@
262 includedir=${prefix}/include~@
267 Description: SDSL: Succinct Data Structure Library~@
268 Libs: -L${libdir} -lsdsl -ldivsufsort -ldivsufsort64~@
269 Cflags: -I${includedir}~%"
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+)))
286 (define-public tllist
290 (home-page "https://codeberg.org/dnkl/tllist")
293 (uri (git-reference (url home-page) (commit version)))
294 (file-name (git-file-name name version))
297 "061mkg6hc9x89zya3bw18ymxlzd8fbhjipxpva8x01lh2vp1d4f0"))))
298 (build-system meson-build-system)
300 `(#:meson ,meson-0.55))
301 (synopsis "Typed link list for C")
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)))
308 (define-public libdivsufsort
310 (name "libdivsufsort")
315 (url "https://github.com/y-256/libdivsufsort")
317 (file-name (git-file-name name version))
320 "0fgdz9fzihlvjjrxy01md1bv9vh12rkgkwbm90b1hj5xpbaqp7z2"))))
321 (build-system cmake-build-system)
323 '(#:tests? #f ; there are no tests
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)))
337 (define-public robin-map
344 (url "https://github.com/Tessil/robin-map")
345 (commit (string-append "v" version))))
346 (file-name (git-file-name name version))
349 "1li70vwsksva9c4yly90hjafgqfixi1g6d52qq9p6r60vqc4pkjj"))))
350 (build-system cmake-build-system)
352 `(("boost" ,boost))) ; needed for tests
355 (modify-phases %standard-phases
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.
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)))