gnu: gdsl: Replace 'url-fetch' by 'git-fetch'.
[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, 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>
7 ;;;
8 ;;; This file is part of GNU Guix.
9 ;;;
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.
14 ;;;
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.
19 ;;;
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/>.
22
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))
34
35 (define-public gdsl
36 (package
37 (name "gdsl")
38 (version "1.8")
39 (source (origin
40 (method git-fetch)
41 (uri (git-reference
42 (url "https://example.org") ;only hosted on Software Heritage
43 (commit "6adb53be8b8f9f2e4bbfc92d357eedeefb4c7430")))
44 (file-name (git-file-name name version))
45 (sha256
46 (base32
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
57 and heaps.")
58 (license license:gpl2+)))
59
60 (define-public marisa
61 (package
62 (name "marisa")
63 (version "0.2.6")
64 (source
65 (origin
66 (method url-fetch)
67 (uri (string-append "https://github.com/s-yata/marisa-trie/files/"
68 "4832504/marisa-" version ".tar.gz"))
69 (sha256
70 (base32 "1pk6wmi28pa8srb4szybrwfn71jldb61c5vgxsiayxcyg1ya4qqh"))))
71 (build-system gnu-build-system)
72 (native-inputs
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++
80 library.")
81
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+))))
85
86 (define-public sparsehash
87 (package
88 (name "sparsehash")
89 (version "2.0.4")
90 (source (origin
91 (method git-fetch)
92 (uri (git-reference
93 (url "https://github.com/sparsehash/sparsehash")
94 (commit (string-append name "-" version))))
95 (file-name (git-file-name name version))
96 (sha256
97 (base32
98 "1pf1cjvcjdmb9cd6gcazz64x0cd2ndpwh6ql2hqpypjv725xwxy7"))))
99 (build-system gnu-build-system)
100 (synopsis "Memory-efficient hashtable implementations")
101 (description
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)))
112
113 (define-public ssdeep
114 (package
115 (name "ssdeep")
116 (version "2.14.1")
117 (source
118 (origin
119 (method url-fetch)
120 (uri (string-append "https://github.com/ssdeep-project/ssdeep/"
121 "releases/download/release-" version "/"
122 "ssdeep-" version ".tar.gz"))
123 (sha256
124 (base32 "04qkjc6kksxkv7xbnk32rwmf3a8czdv2vvrdzfs0kw06h73snbpz"))))
125 (build-system gnu-build-system)
126 (arguments
127 `(#:configure-flags
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+)))
136
137 (define-public liburcu
138 (package
139 (name "liburcu")
140 (version "0.12.1")
141 (source (origin
142 (method url-fetch)
143 (uri (string-append "https://www.lttng.org/files/urcu/"
144 "userspace-rcu-" version ".tar.bz2"))
145 (sha256
146 (base32
147 "03nd1gy2c3fdb6xwdrd5lr1jcjxbzffqh3z91mzbjhjn6k8fmymv"))))
148 (build-system gnu-build-system)
149 (native-inputs
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+)))
159
160 (define-public uthash
161 (package
162 (name "uthash")
163 (version "2.1.0")
164 (source
165 (origin
166 (method git-fetch)
167 (uri (git-reference
168 (url "https://github.com/troydhanson/uthash")
169 (commit (string-append "v" version))))
170 (file-name (git-file-name name version))
171 (sha256
172 (base32 "0k80bjbb6ss5wpmfmfji6xbyjm990hg9kcshwwnhdnh73vxkcd1m"))))
173 (build-system gnu-build-system)
174 (native-inputs
175 `(("perl" ,perl)))
176 (arguments
177 `(#:make-flags
178 (list "CC=gcc")
179 #:phases
180 (modify-phases %standard-phases
181 (delete 'configure) ; nothing to configure
182 (delete 'build) ; nothing to build
183 (replace 'check
184 (lambda* (#:key make-flags #:allow-other-keys)
185 (with-directory-excursion "tests"
186 (apply invoke "make" make-flags))))
187 (replace 'install
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$"))
199 #t))))))
200 (home-page "https://troydhanson.github.io/uthash/")
201 (synopsis
202 "Hash tables, lists, and other data structures implemented as C macros")
203 (description
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.
207
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)))
213
214 (define-public sdsl-lite
215 (package
216 (name "sdsl-lite")
217 (version "2.1.1")
218 (source (origin
219 (method url-fetch)
220 (uri (string-append "https://github.com/simongog/sdsl-lite/"
221 "releases/download/v" version "/"
222 "sdsl-lite-" version
223 ".tar.gz.offline.install.gz"))
224 (sha256
225 (base32
226 "1v86ivv3mmdy802i9xkjpxb4cggj3s27wb19ja4sw1klnivjj69g"))
227 (modules '((guix build utils)))
228 (snippet
229 '(begin
230 (delete-file-recursively "external") #t))
231 (patches
232 (list (origin
233 (method url-fetch)
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")
236 (sha256
237 (base32
238 "0m542xpys54bni29zibgrfpgpd0zgyny4h131virxsanixsbz52z")))))))
239 (build-system cmake-build-system)
240 (arguments
241 `(#:phases
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")))
248 #t))
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")
255 (lambda _
256 (format #t "prefix=~a~@
257 exec_prefix=${prefix}~@
258 libdir=${exec_prefix}/lib~@
259 includedir=${prefix}/include~@
260 ~@
261 ~@
262 Name: sdsl~@
263 Version: ~a~@
264 Description: SDSL: Succinct Data Structure Library~@
265 Libs: -L${libdir} -lsdsl -ldivsufsort -ldivsufsort64~@
266 Cflags: -I${includedir}~%"
267 out ,version)))
268 #t))))))
269 (native-inputs
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+)))
282
283 (define-public libdivsufsort
284 (package
285 (name "libdivsufsort")
286 (version "2.0.1")
287 (source (origin
288 (method git-fetch)
289 (uri (git-reference
290 (url "https://github.com/y-256/libdivsufsort")
291 (commit version)))
292 (file-name (git-file-name name version))
293 (sha256
294 (base32
295 "0fgdz9fzihlvjjrxy01md1bv9vh12rkgkwbm90b1hj5xpbaqp7z2"))))
296 (build-system cmake-build-system)
297 (arguments
298 '(#:tests? #f ; there are no tests
299 #:configure-flags
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)))
311
312 (define-public robin-map
313 (package
314 (name "robin-map")
315 (version "0.6.3")
316 (source (origin
317 (method git-fetch)
318 (uri (git-reference
319 (url "https://github.com/Tessil/robin-map")
320 (commit (string-append "v" version))))
321 (file-name (git-file-name name version))
322 (sha256
323 (base32
324 "1li70vwsksva9c4yly90hjafgqfixi1g6d52qq9p6r60vqc4pkjj"))))
325 (build-system cmake-build-system)
326 (native-inputs
327 `(("boost" ,boost))) ; needed for tests
328 (arguments
329 `(#:phases
330 (modify-phases %standard-phases
331 (replace 'check
332 (lambda _
333 (mkdir "tests")
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.
343
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)))