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>
8 ;;; This file is part of GNU Guix.
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.
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.
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/>.
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))
41 (uri (string-append "http://download.gna.org/gdsl/"
42 "gdsl-" version ".tar.gz"))
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
56 (license license:gpl2+)))
65 (uri (string-append "https://github.com/s-yata/marisa-trie/files/"
66 "4832504/marisa-" version ".tar.gz"))
68 (base32 "1pk6wmi28pa8srb4szybrwfn71jldb61c5vgxsiayxcyg1ya4qqh"))))
69 (build-system gnu-build-system)
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++
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+))))
84 (define-public sparsehash
91 (url "https://github.com/sparsehash/sparsehash")
92 (commit (string-append name "-" version))))
93 (file-name (git-file-name name version))
96 "1pf1cjvcjdmb9cd6gcazz64x0cd2ndpwh6ql2hqpypjv725xwxy7"))))
97 (build-system gnu-build-system)
98 (synopsis "Memory-efficient hashtable implementations")
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)))
111 (define-public ssdeep
118 (uri (string-append "https://github.com/ssdeep-project/ssdeep/"
119 "releases/download/release-" version "/"
120 "ssdeep-" version ".tar.gz"))
122 (base32 "04qkjc6kksxkv7xbnk32rwmf3a8czdv2vvrdzfs0kw06h73snbpz"))))
123 (build-system gnu-build-system)
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+)))
135 (define-public liburcu
141 (uri (string-append "https://www.lttng.org/files/urcu/"
142 "userspace-rcu-" version ".tar.bz2"))
145 "03nd1gy2c3fdb6xwdrd5lr1jcjxbzffqh3z91mzbjhjn6k8fmymv"))))
146 (build-system gnu-build-system)
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+)))
158 (define-public uthash
166 (url "https://github.com/troydhanson/uthash")
167 (commit (string-append "v" version))))
168 (file-name (git-file-name name version))
170 (base32 "0k80bjbb6ss5wpmfmfji6xbyjm990hg9kcshwwnhdnh73vxkcd1m"))))
171 (build-system gnu-build-system)
178 (modify-phases %standard-phases
179 (delete 'configure) ; nothing to configure
180 (delete 'build) ; nothing to build
182 (lambda* (#:key make-flags #:allow-other-keys)
183 (with-directory-excursion "tests"
184 (apply invoke "make" make-flags))))
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$"))
198 (home-page "https://troydhanson.github.io/uthash/")
200 "Hash tables, lists, and other data structures implemented as C macros")
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.
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)))
212 (define-public sdsl-lite
218 (uri (string-append "https://github.com/simongog/sdsl-lite/"
219 "releases/download/v" version "/"
221 ".tar.gz.offline.install.gz"))
224 "1v86ivv3mmdy802i9xkjpxb4cggj3s27wb19ja4sw1klnivjj69g"))
225 (modules '((guix build utils)))
228 (delete-file-recursively "external") #t))
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")
236 "0m542xpys54bni29zibgrfpgpd0zgyny4h131virxsanixsbz52z")))))))
237 (build-system cmake-build-system)
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")))
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")
254 (format #t "prefix=~a~@
255 exec_prefix=${prefix}~@
256 libdir=${exec_prefix}/lib~@
257 includedir=${prefix}/include~@
262 Description: SDSL: Succinct Data Structure Library~@
263 Libs: -L${libdir} -lsdsl -ldivsufsort -ldivsufsort64~@
264 Cflags: -I${includedir}~%"
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+)))
281 (define-public libdivsufsort
283 (name "libdivsufsort")
288 (url "https://github.com/y-256/libdivsufsort")
290 (file-name (git-file-name name version))
293 "0fgdz9fzihlvjjrxy01md1bv9vh12rkgkwbm90b1hj5xpbaqp7z2"))))
294 (build-system cmake-build-system)
296 '(#:tests? #f ; there are no tests
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)))
310 (define-public robin-map
317 (url "https://github.com/Tessil/robin-map")
318 (commit (string-append "v" version))))
319 (file-name (git-file-name name version))
322 "1li70vwsksva9c4yly90hjafgqfixi1g6d52qq9p6r60vqc4pkjj"))))
323 (build-system cmake-build-system)
325 `(("boost" ,boost))) ; needed for tests
328 (modify-phases %standard-phases
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.
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)))