1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2015, 2016, 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
3 ;;; Copyright © 2016, 2017, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
4 ;;; Copyright © 2018 Meiyo Peng <meiyo.peng@gmail.com>
5 ;;; Copyright © 2019 Efraim Flashner <efraim@flashner.co.il>
7 ;;; This file is part of GNU Guix.
9 ;;; GNU Guix is free software; you can redistribute it and/or modify it
10 ;;; under the terms of the GNU General Public License as published by
11 ;;; the Free Software Foundation; either version 3 of the License, or (at
12 ;;; your option) any later version.
14 ;;; GNU Guix is distributed in the hope that it will be useful, but
15 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;;; GNU General Public License for more details.
19 ;;; You should have received a copy of the GNU General Public License
20 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
22 (define-module (gnu packages datastructures)
23 #:use-module (gnu packages)
24 #:use-module (gnu packages perl)
25 #:use-module ((guix licenses) #:prefix license:)
26 #:use-module (guix packages)
27 #:use-module (guix download)
28 #:use-module (guix git-download)
29 #:use-module (guix build-system cmake)
30 #:use-module (guix build-system gnu))
38 (uri (string-append "http://download.gna.org/gdsl/"
39 "gdsl-" version ".tar.gz"))
42 "1v64jvlnj8jfpphphgjgb36p0kv50kwfyqncf0y12f16v8ydyiaw"))))
43 (build-system gnu-build-system)
44 (home-page "http://home.gna.org/gdsl/")
45 (synopsis "Generic data structures library")
46 (description "The Generic Data Structures Library (GDSL) is a collection
47 of routines for generic data structures manipulation. It is a re-entrant
48 library fully written from scratch in pure ANSI C. It is designed to offer
49 for C programmers common data structures with powerful algorithms, and hidden
50 implementation. Available structures are lists, queues, stacks, hash tables,
51 binary trees, binary search trees, red-black trees, 2D arrays, permutations
53 (license license:gpl2+)))
62 (uri (string-append "https://github.com/s-yata/marisa-trie"
63 "/releases/download/v" version "/" name "-"
66 (base32 "19ifrcmnbr9whaaf4ly3s9ndyiq9sjqhnfkrxbz9zsb44w2n36hf"))))
67 (build-system gnu-build-system)
68 (home-page "https://github.com/s-yata/marisa-trie")
69 (synopsis "Trie data structure C++ library")
70 (description "Matching Algorithm with Recursively Implemented
71 StorAge (MARISA) is a static and space-efficient trie data structure C++
74 ;; Dual-licensed, according to docs/readme.en.html (source files lack
75 ;; copyright/license headers.)
76 (license (list license:bsd-2 license:lgpl2.1+))))
78 (define-public sparsehash
85 (url "https://github.com/sparsehash/sparsehash.git")
86 (commit (string-append name "-" version))))
87 (file-name (git-file-name name version))
90 "0m3f0cnpnpf6aak52wn8xbrrdw8p0yhq8csgc8nlvf9zp8c402na"))))
91 (build-system gnu-build-system)
92 (synopsis "Memory-efficient hashtable implementations")
94 "This library contains several hash-map implementations, similar in API
95 to SGI's @code{hash_map} class, but with different performance
96 characteristics. @code{sparse_hash_map} uses very little space overhead, 1-2
97 bits per entry. @code{dense_hash_map} is very fast, particularly on lookup.
98 @code{sparse_hash_set} and @code{dense_hash_set} are the set versions of these
99 routines. All these implementation use a hashtable with internal quadratic
100 probing. This method is space-efficient -- there is no pointer overhead --
101 and time-efficient for good hash functions.")
102 (home-page "https://github.com/sparsehash/sparsehash")
103 (license license:bsd-3)))
105 (define-public ssdeep
111 (uri (string-append "mirror://sourceforge/ssdeep/"
113 name "-" version ".tar.gz"))
116 "1igqy0j7jrklb8fdlrm6ald4cyl1fda5ipfl8crzyl6bax2ajk3f"))))
117 (build-system gnu-build-system)
118 (home-page "http://ssdeep.sourceforge.net")
119 (synopsis "Context-triggered piecewise hashing algorithm")
120 (description "ssdeep computes and matches context triggered piecewise
121 hashes (CTPH), also called fuzzy checksums. It can identify similar files
122 that have sequences of identical bytes in the same order, even though bytes
123 in between these sequences may be different in both content and length.")
124 (license license:gpl2+)))
126 (define-public liburcu
132 (uri (string-append "https://www.lttng.org/files/urcu/"
133 "userspace-rcu-" version ".tar.bz2"))
136 "0l1kxgzch4m8fxiz2hc8fwg56hrvzzspp7n0svnl7i7iycdrgfcj"))))
137 (build-system gnu-build-system)
139 `(("perl" ,perl))) ; for tests
140 (home-page "https://liburcu.org/")
141 (synopsis "User-space RCU data synchronisation library")
142 (description "liburcu is a user-space @dfn{Read-Copy-Update} (RCU) data
143 synchronisation library. It provides read-side access that scales linearly
144 with the number of cores. liburcu-cds provides efficient data structures
145 based on RCU and lock-free algorithms. These structures include hash tables,
146 queues, stacks, and doubly-linked lists.")
147 (license license:lgpl2.1+)))
149 (define-public uthash
157 (url "https://github.com/troydhanson/uthash.git")
158 (commit (string-append "v" version))))
159 (file-name (git-file-name name version))
162 "0kslz8k6lssh7fl7ayzwlj62p0asxs3dq03357ls5ywjad238gqg"))))
163 (build-system gnu-build-system)
170 (modify-phases %standard-phases
171 (delete 'configure) ; nothing to configure
172 (delete 'build) ; nothing to build
174 (lambda* (#:key make-flags #:allow-other-keys)
175 (with-directory-excursion "tests"
176 (apply invoke "make" make-flags))))
178 ;; There is no top-level Makefile to do this for us.
179 (lambda* (#:key outputs #:allow-other-keys)
180 (let* ((out (assoc-ref outputs "out"))
181 (doc (string-append out "/share/doc/" ,name))
182 (include (string-append out "/include")))
183 ;; Don't install HTML files: they're just the below .txt files
184 ;; dolled up, can be stale, and regeneration requires asciidoc.
185 (for-each (λ (file) (install-file file doc))
186 (find-files "doc" "\\.txt$"))
187 (for-each (λ (file) (install-file file include))
188 (find-files "src" "\\.h$"))
190 (home-page "https://troydhanson.github.io/uthash/")
192 "Hash tables, lists, and other data structures implemented as C macros")
194 "uthash implements a hash table and a few other basic data structures
195 as C preprocessor macros. It aims to be minimalistic and efficient: it's
196 around 1,000 lines of code which, being macros, inline automatically.
198 Unlike function calls with fixed prototypes, macros operate on untyped
199 arguments. Thus, they are able to work with any type of structure and key.
200 Any C structure can be stored in a hash table by adding @code{UT_hash_handle}
201 to the structure and choosing one or more fields to act as the key.")
202 (license license:bsd-2)))
204 (define-public sdsl-lite
210 (uri (string-append "https://github.com/simongog/sdsl-lite/"
211 "releases/download/v" version "/"
213 ".tar.gz.offline.install.gz"))
216 "1v86ivv3mmdy802i9xkjpxb4cggj3s27wb19ja4sw1klnivjj69g"))
217 (modules '((guix build utils)))
220 (delete-file-recursively "external") #t))
224 (uri "https://salsa.debian.org/science-team/libsdsl/raw/debian/2.1.1+dfsg-2/debian/patches/0001-Patch-cmake-files.patch")
225 (file-name "sdsl-lite-dont-use-bundled-libraries.patch")
228 "0m542xpys54bni29zibgrfpgpd0zgyny4h131virxsanixsbz52z")))))))
229 (build-system cmake-build-system)
232 (modify-phases %standard-phases
233 (add-after 'install 'install-static-library
234 (lambda* (#:key outputs #:allow-other-keys)
235 (let ((out (assoc-ref outputs "out")))
236 (copy-file "lib/libsdsl_static.a"
237 (string-append out "/lib/libsdsl.a")))
240 `(("libdivsufsort" ,libdivsufsort)))
241 (home-page "https://github.com/simongog/sdsl-lite")
242 (synopsis "Succinct data structure library")
243 (description "The Succinct Data Structure Library (SDSL) is a powerful and
244 flexible C++11 library implementing succinct data structures. In total, the
245 library contains the highlights of 40 research publications. Succinct data
246 structures can represent an object (such as a bitvector or a tree) in space
247 close to the information-theoretic lower bound of the object while supporting
248 operations of the original object efficiently. The theoretical time
249 complexity of an operation performed on the classical data structure and the
250 equivalent succinct data structure are (most of the time) identical.")
251 (license license:gpl3+)))
253 (define-public libdivsufsort
255 (name "libdivsufsort")
260 (url "https://github.com/y-256/libdivsufsort.git")
262 (file-name (git-file-name name version))
265 "0fgdz9fzihlvjjrxy01md1bv9vh12rkgkwbm90b1hj5xpbaqp7z2"))))
266 (build-system cmake-build-system)
268 '(#:tests? #f ; there are no tests
270 ;; Needed for rapmap and sailfish.
271 '("-DBUILD_DIVSUFSORT64=ON")))
272 (home-page "https://github.com/y-256/libdivsufsort")
273 (synopsis "Lightweight suffix-sorting library")
274 (description "libdivsufsort is a software library that implements a
275 lightweight suffix array construction algorithm. This library provides a
276 simple and an efficient C API to construct a suffix array and a
277 Burrows-Wheeler transformed string from a given string over a constant-size
278 alphabet. The algorithm runs in O(n log n) worst-case time using only 5n+O(1)
279 bytes of memory space, where n is the length of the string.")
280 (license license:expat)))