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))
42 (url "https://example.org") ;only hosted on Software Heritage
43 (commit "6adb53be8b8f9f2e4bbfc92d357eedeefb4c7430")))
44 (file-name (git-file-name name version))
47 "0a52g12d9sf9hhcyvwfd7xdazj2a9i9jh97cnlqf2ymvwnvjk1g0"))))
48 (build-system gnu-build-system)
49 (home-page "https://web.archive.org/web/20170502005430/http://home.gna.org/gdsl/")
50 (synopsis "Generic data structures library")
51 (description "The Generic Data Structures Library (GDSL) is a collection
52 of routines for generic data structures manipulation. It is a re-entrant
53 library fully written from scratch in pure ANSI C. It is designed to offer
54 for C programmers common data structures with powerful algorithms, and hidden
55 implementation. Available structures are lists, queues, stacks, hash tables,
56 binary trees, binary search trees, red-black trees, 2D arrays, permutations
58 (license license:gpl2+)))
67 (uri (string-append "https://github.com/s-yata/marisa-trie/files/"
68 "4832504/marisa-" version ".tar.gz"))
70 (base32 "1pk6wmi28pa8srb4szybrwfn71jldb61c5vgxsiayxcyg1ya4qqh"))))
71 (build-system gnu-build-system)
73 `(("autoconf" ,autoconf)
74 ("automake" ,automake)
75 ("libtool" ,libtool)))
76 (home-page "https://github.com/s-yata/marisa-trie")
77 (synopsis "Trie data structure C++ library")
78 (description "@acronym{MARISA, Matching Algorithm with Recursively
79 Implemented StorAge} is a static and space-efficient trie data structure C++
82 ;; Dual-licensed, according to docs/readme.en.html (source files lack
83 ;; copyright/license headers.)
84 (license (list license:bsd-2 license:lgpl2.1+))))
86 (define-public sparsehash
93 (url "https://github.com/sparsehash/sparsehash")
94 (commit (string-append name "-" version))))
95 (file-name (git-file-name name version))
98 "1pf1cjvcjdmb9cd6gcazz64x0cd2ndpwh6ql2hqpypjv725xwxy7"))))
99 (build-system gnu-build-system)
100 (synopsis "Memory-efficient hashtable implementations")
102 "This library contains several hash-map implementations, similar in API
103 to SGI's @code{hash_map} class, but with different performance
104 characteristics. @code{sparse_hash_map} uses very little space overhead, 1-2
105 bits per entry. @code{dense_hash_map} is very fast, particularly on lookup.
106 @code{sparse_hash_set} and @code{dense_hash_set} are the set versions of these
107 routines. All these implementation use a hashtable with internal quadratic
108 probing. This method is space-efficient -- there is no pointer overhead --
109 and time-efficient for good hash functions.")
110 (home-page "https://github.com/sparsehash/sparsehash")
111 (license license:bsd-3)))
113 (define-public ssdeep
120 (uri (string-append "https://github.com/ssdeep-project/ssdeep/"
121 "releases/download/release-" version "/"
122 "ssdeep-" version ".tar.gz"))
124 (base32 "04qkjc6kksxkv7xbnk32rwmf3a8czdv2vvrdzfs0kw06h73snbpz"))))
125 (build-system gnu-build-system)
128 (list "--disable-static")))
129 (home-page "https://ssdeep-project.github.io")
130 (synopsis "Context-triggered piecewise hashing algorithm")
131 (description "ssdeep computes and matches context triggered piecewise
132 hashes (CTPH), also called fuzzy checksums. It can identify similar files
133 that have sequences of identical bytes in the same order, even though bytes
134 in between these sequences may be different in both content and length.")
135 (license license:gpl2+)))
137 (define-public liburcu
143 (uri (string-append "https://www.lttng.org/files/urcu/"
144 "userspace-rcu-" version ".tar.bz2"))
147 "03nd1gy2c3fdb6xwdrd5lr1jcjxbzffqh3z91mzbjhjn6k8fmymv"))))
148 (build-system gnu-build-system)
150 `(("perl" ,perl))) ; for tests
151 (home-page "https://liburcu.org/")
152 (synopsis "User-space RCU data synchronisation library")
153 (description "liburcu is a user-space @dfn{Read-Copy-Update} (RCU) data
154 synchronisation library. It provides read-side access that scales linearly
155 with the number of cores. liburcu-cds provides efficient data structures
156 based on RCU and lock-free algorithms. These structures include hash tables,
157 queues, stacks, and doubly-linked lists.")
158 (license license:lgpl2.1+)))
160 (define-public uthash
168 (url "https://github.com/troydhanson/uthash")
169 (commit (string-append "v" version))))
170 (file-name (git-file-name name version))
172 (base32 "0k80bjbb6ss5wpmfmfji6xbyjm990hg9kcshwwnhdnh73vxkcd1m"))))
173 (build-system gnu-build-system)
180 (modify-phases %standard-phases
181 (delete 'configure) ; nothing to configure
182 (delete 'build) ; nothing to build
184 (lambda* (#:key make-flags #:allow-other-keys)
185 (with-directory-excursion "tests"
186 (apply invoke "make" make-flags))))
188 ;; There is no top-level Makefile to do this for us.
189 (lambda* (#:key outputs #:allow-other-keys)
190 (let* ((out (assoc-ref outputs "out"))
191 (doc (string-append out "/share/doc/" ,name "-" ,version))
192 (include (string-append out "/include")))
193 ;; Don't install HTML files: they're just the below .txt files
194 ;; dolled up, can be stale, and regeneration requires asciidoc.
195 (for-each (λ (file) (install-file file doc))
196 (find-files "doc" "\\.txt$"))
197 (for-each (λ (file) (install-file file include))
198 (find-files "src" "\\.h$"))
200 (home-page "https://troydhanson.github.io/uthash/")
202 "Hash tables, lists, and other data structures implemented as C macros")
204 "uthash implements a hash table and a few other basic data structures
205 as C preprocessor macros. It aims to be minimalistic and efficient: it's
206 around 1,000 lines of code which, being macros, inline automatically.
208 Unlike function calls with fixed prototypes, macros operate on untyped
209 arguments. Thus, they are able to work with any type of structure and key.
210 Any C structure can be stored in a hash table by adding @code{UT_hash_handle}
211 to the structure and choosing one or more fields to act as the key.")
212 (license license:bsd-2)))
214 (define-public sdsl-lite
220 (uri (string-append "https://github.com/simongog/sdsl-lite/"
221 "releases/download/v" version "/"
223 ".tar.gz.offline.install.gz"))
226 "1v86ivv3mmdy802i9xkjpxb4cggj3s27wb19ja4sw1klnivjj69g"))
227 (modules '((guix build utils)))
230 (delete-file-recursively "external") #t))
234 (uri "https://salsa.debian.org/science-team/libsdsl/raw/debian/2.1.1+dfsg-2/debian/patches/0001-Patch-cmake-files.patch")
235 (file-name "sdsl-lite-dont-use-bundled-libraries.patch")
238 "0m542xpys54bni29zibgrfpgpd0zgyny4h131virxsanixsbz52z")))))))
239 (build-system cmake-build-system)
242 (modify-phases %standard-phases
243 (add-after 'install 'install-static-library
244 (lambda* (#:key outputs #:allow-other-keys)
245 (let ((out (assoc-ref outputs "out")))
246 (copy-file "lib/libsdsl_static.a"
247 (string-append out "/lib/libsdsl.a")))
249 (add-after 'install 'install-pkgconfig-file
250 (lambda* (#:key outputs #:allow-other-keys)
251 (let* ((out (assoc-ref outputs "out"))
252 (lib (string-append out "/lib")))
253 (mkdir-p (string-append lib "/pkgconfig"))
254 (with-output-to-file (string-append lib "/pkgconfig/sdsl-lite.pc")
256 (format #t "prefix=~a~@
257 exec_prefix=${prefix}~@
258 libdir=${exec_prefix}/lib~@
259 includedir=${prefix}/include~@
264 Description: SDSL: Succinct Data Structure Library~@
265 Libs: -L${libdir} -lsdsl -ldivsufsort -ldivsufsort64~@
266 Cflags: -I${includedir}~%"
270 `(("libdivsufsort" ,libdivsufsort)))
271 (home-page "https://github.com/simongog/sdsl-lite")
272 (synopsis "Succinct data structure library")
273 (description "The Succinct Data Structure Library (SDSL) is a powerful and
274 flexible C++11 library implementing succinct data structures. In total, the
275 library contains the highlights of 40 research publications. Succinct data
276 structures can represent an object (such as a bitvector or a tree) in space
277 close to the information-theoretic lower bound of the object while supporting
278 operations of the original object efficiently. The theoretical time
279 complexity of an operation performed on the classical data structure and the
280 equivalent succinct data structure are (most of the time) identical.")
281 (license license:gpl3+)))
283 (define-public libdivsufsort
285 (name "libdivsufsort")
290 (url "https://github.com/y-256/libdivsufsort")
292 (file-name (git-file-name name version))
295 "0fgdz9fzihlvjjrxy01md1bv9vh12rkgkwbm90b1hj5xpbaqp7z2"))))
296 (build-system cmake-build-system)
298 '(#:tests? #f ; there are no tests
300 ;; Needed for rapmap and sailfish.
301 '("-DBUILD_DIVSUFSORT64=ON")))
302 (home-page "https://github.com/y-256/libdivsufsort")
303 (synopsis "Lightweight suffix-sorting library")
304 (description "libdivsufsort is a software library that implements a
305 lightweight suffix array construction algorithm. This library provides a
306 simple and an efficient C API to construct a suffix array and a
307 Burrows-Wheeler transformed string from a given string over a constant-size
308 alphabet. The algorithm runs in O(n log n) worst-case time using only 5n+O(1)
309 bytes of memory space, where n is the length of the string.")
310 (license license:expat)))
312 (define-public robin-map
319 (url "https://github.com/Tessil/robin-map")
320 (commit (string-append "v" version))))
321 (file-name (git-file-name name version))
324 "1li70vwsksva9c4yly90hjafgqfixi1g6d52qq9p6r60vqc4pkjj"))))
325 (build-system cmake-build-system)
327 `(("boost" ,boost))) ; needed for tests
330 (modify-phases %standard-phases
334 (with-directory-excursion "tests"
335 (invoke "cmake" "../../source/tests")
336 (invoke "cmake" "--build" ".")
337 (invoke "./tsl_robin_map_tests")))))))
338 (home-page "https://github.com/Tessil/robin-map")
339 (synopsis "C++ implementation of a fast hash map and hash set")
340 (description "The robin-map library is a C++ implementation of a fast hash
341 map and hash set using open-addressing and linear robin hood hashing with
342 backward shift deletion to resolve collisions.
344 Four classes are provided: tsl::robin_map, tsl::robin_set, tsl::robin_pg_map
345 and tsl::robin_pg_set. The first two are faster and use a power of two growth
346 policy, the last two use a prime growth policy instead and are able to cope
347 better with a poor hash function.")
348 (license license:expat)))