gnu: Remove python2-feather-format.
[jackhill/guix/guix.git] / gnu / packages / serialization.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2015, 2017, 2019 Ricardo Wurmus <rekado@elephly.net>
3 ;;; Copyright © 2016 Lukas Gradl <lgradl@openmailbox.org>
4 ;;; Copyright © 2016 David Craven <david@craven.ch>
5 ;;; Copyright © 2016, 2019 Marius Bakke <mbakke@fastmail.com>
6 ;;; Copyright © 2016, 2018, 2019 Efraim Flashner <efraim@flashner.co.il>
7 ;;; Copyright © 2017 Corentin Bocquillon <corentin@nybble.fr>
8 ;;; Copyright © 2017 Gregor Giesen <giesen@zaehlwerk.net>
9 ;;; Copyright © 2017 Frederick M. Muriithi <fredmanglis@gmail.com>
10 ;;; Copyright © 2017 ng0 <ng0@n0.is>
11 ;;; Copyright © 2017, 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
12 ;;; Copyright © 2018 Joshua Sierles, Nextjournal <joshua@nextjournal.com>
13 ;;;
14 ;;; This file is part of GNU Guix.
15 ;;;
16 ;;; GNU Guix is free software; you can redistribute it and/or modify it
17 ;;; under the terms of the GNU General Public License as published by
18 ;;; the Free Software Foundation; either version 3 of the License, or (at
19 ;;; your option) any later version.
20 ;;;
21 ;;; GNU Guix is distributed in the hope that it will be useful, but
22 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
23 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 ;;; GNU General Public License for more details.
25 ;;;
26 ;;; You should have received a copy of the GNU General Public License
27 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
28
29 (define-module (gnu packages serialization)
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 utils)
35 #:use-module (guix build-system cmake)
36 #:use-module (guix build-system gnu)
37 #:use-module (guix build-system python)
38 #:use-module (gnu packages)
39 #:use-module (gnu packages autotools)
40 #:use-module (gnu packages boost)
41 #:use-module (gnu packages check)
42 #:use-module (gnu packages compression)
43 #:use-module (gnu packages databases)
44 #:use-module (gnu packages documentation)
45 #:use-module (gnu packages gcc)
46 #:use-module (gnu packages lua)
47 #:use-module (gnu packages pkg-config)
48 #:use-module (gnu packages python)
49 #:use-module (gnu packages python-xyz)
50 #:use-module (gnu packages perl))
51
52 (define-public cereal
53 (package
54 (name "cereal")
55 (version "1.2.1")
56 (source
57 (origin
58 (method git-fetch)
59 (uri (git-reference
60 (url "https://github.com/USCiLab/cereal.git")
61 (commit (string-append "v" version))))
62 (file-name (git-file-name name version))
63 (sha256
64 (base32 "1vxkrsnxkiblzi1z61vfix167c184fy868sgwj2dxxgbgjcq2nrh"))))
65 (build-system cmake-build-system)
66 (arguments
67 `(;; The only included tests are portability tests requiring
68 ;; cross-compilation and boost. Since we are building cereal on more
69 ;; platforms anyway, there is no compelling reason to build the tests.
70 #:tests? #f
71 #:out-of-source? #f
72 #:phases
73 (modify-phases %standard-phases
74 (delete 'configure)
75 (replace 'build
76 (lambda _
77 (substitute* "doc/doxygen.in"
78 (("@CMAKE_CURRENT_SOURCE_DIR@") "."))
79 (invoke "doxygen" "doc/doxygen.in")
80 #t))
81 ;; There is no "install" target, so we have to provide our own
82 ;; "install" phase.
83 (replace 'install
84 (lambda* (#:key outputs #:allow-other-keys)
85 (let* ((out (assoc-ref outputs "out"))
86 (doc (string-append out "/share/cereal/docs"))
87 (include (string-append out "/include/cereal")))
88 (mkdir-p doc)
89 (mkdir-p include)
90 (copy-recursively "include/cereal" include)
91 (copy-recursively "doc/html" doc))
92 #t)))))
93 (native-inputs
94 `(("doxygen" ,doxygen)))
95 (home-page "http://uscilab.github.io/cereal/")
96 (synopsis "C++11 library for serialization")
97 (description
98 "Cereal is a header-only C++11 serialization library. Cereal takes
99 arbitrary data types and reversibly turns them into different representations,
100 such as compact binary encodings, XML, or JSON.")
101 (license license:bsd-3)))
102
103 (define-public msgpack
104 (package
105 (name "msgpack")
106 (version "3.2.0")
107 (source
108 (origin
109 (method url-fetch)
110 (uri
111 (string-append
112 "https://github.com/msgpack/msgpack-c/releases/download/"
113 "cpp-" version "/msgpack-" version ".tar.gz"))
114 (snippet
115 '(let ((p (open-file "msgpack.pc.in" "a")))
116 (display
117 (string-append "Requires: " "zlib" "\n") p)
118 (close-output-port p)
119 #t))
120 (sha256
121 (base32
122 "1zhsap7d9zqdm9h1qnpaw78v1sh3rx2if7gk4dszs5m3cg1jiapv"))))
123 (build-system cmake-build-system)
124 (native-inputs
125 `(("googletest" ,googletest)
126 ("pkg-config" ,pkg-config)))
127 (propagated-inputs
128 `(("zlib" ,zlib))) ;; Msgpack installs two headers (zbuffer.h,
129 ;; zbuffer.hpp) which #include <zlib.h>. However, 'guix gc --references'
130 ;; does not detect a store reference to zlib since these headers are not
131 ;; compiled.
132 (home-page "https://www.msgpack.org")
133 (synopsis "Binary serialization library")
134 (description "Msgpack is a library for C/C++ that implements binary
135 serialization.")
136 (license license:boost1.0)))
137
138 (define-public libmpack
139 (package
140 (name "libmpack")
141 (version "1.0.5")
142 (source
143 (origin
144 (method git-fetch)
145 (uri (git-reference
146 (url "https://github.com/tarruda/libmpack.git")
147 (commit version)))
148 (file-name (git-file-name name version))
149 (sha256
150 (base32 "0rai5djdkjz7bsn025k5489in7r1amagw1pib0z4qns6b52kiar2"))))
151 (build-system gnu-build-system)
152 (arguments
153 `(#:test-target "test"
154 #:make-flags
155 (list "CC=gcc"
156 (string-append "PREFIX=" (assoc-ref %outputs "out")))
157 #:phases
158 (modify-phases %standard-phases
159 (delete 'configure))))
160 (native-inputs
161 `(("libtool" ,libtool)))
162 (home-page "https://github.com/tarruda/libmpack")
163 (synopsis "Small binary serialization library")
164 (description "Libmpack is a small binary serialization and RPC library
165 that implements both the msgpack and msgpack-rpc specifications.")
166 (license license:expat)))
167
168 (define-public lua-libmpack
169 (package (inherit libmpack)
170 (name "lua-libmpack")
171 (version "1.0.8")
172 (source
173 (origin
174 (method git-fetch)
175 (uri (git-reference
176 (url "https://github.com/libmpack/libmpack-lua.git")
177 (commit version)))
178 (file-name (git-file-name name version))
179 (sha256
180 (base32 "1ijvzgq5hvib03w5rghv31wi7byamwg7qdx5pawvhvnflaii8ivw"))))
181 (build-system gnu-build-system)
182 (arguments
183 `(;; FIXME: tests require "busted", which is not yet available in Guix.
184 #:tests? #f
185 #:test-target "test"
186 #:make-flags
187 (let* ((lua-version ,(package-version lua))
188 (lua-major+minor ,(version-major+minor (package-version lua))))
189 (list "CC=gcc"
190 "FETCH=echo" ; don't fetch anything from the web
191 "UNTGZ=echo" ; and don't try to unpack it
192 "USE_SYSTEM_LUA=yes"
193 (string-append "MPACK_LUA_VERSION=" lua-version)
194 (string-append "MPACK_LUA_VERSION_NOPATCH=" lua-major+minor)
195 (string-append "PREFIX="
196 (assoc-ref %outputs "out"))
197 (string-append "LUA_CMOD_INSTALLDIR="
198 (assoc-ref %outputs "out")
199 "/lib/lua/" lua-major+minor)))
200 #:phases
201 (modify-phases %standard-phases
202 (delete 'configure)
203 (add-after 'unpack 'unpack-mpack-sources
204 (lambda* (#:key inputs #:allow-other-keys)
205 ;; This is broken because mpack-src is not a file, but all
206 ;; prerequisites are added to the inputs of the gcc invocation.
207 (substitute* "Makefile"
208 (("\\$\\(MPACK\\): mpack-src") "$(MPACK): "))
209 (copy-recursively (assoc-ref inputs "libmpack")
210 "mpack-src")
211 #t)))))
212 (inputs
213 `(("lua" ,lua)))
214 (native-inputs
215 `(("pkg-config" ,pkg-config)
216 ("libmpack" ,(package-source libmpack))))
217 (home-page "https://github.com/libmpack/libmpack-lua")
218 (synopsis "Lua bindings for the libmpack binary serialization library")))
219
220 (define-public lua5.1-libmpack
221 (package (inherit lua-libmpack)
222 (name "lua5.1-libmpack")
223 (arguments
224 (substitute-keyword-arguments (package-arguments lua-libmpack)
225 ((#:make-flags flags)
226 `(let* ((lua-version ,(package-version lua-5.1))
227 (lua-major+minor ,(version-major+minor (package-version lua-5.1))))
228 (list "CC=gcc"
229 "USE_SYSTEM_LUA=yes"
230 (string-append "MPACK_LUA_VERSION=" lua-version)
231 (string-append "MPACK_LUA_VERSION_NOPATCH=" lua-major+minor)
232 (string-append "PREFIX="
233 (assoc-ref %outputs "out"))
234 (string-append "LUA_CMOD_INSTALLDIR="
235 (assoc-ref %outputs "out")
236 "/lib/lua/" lua-major+minor))))))
237 (inputs
238 `(("lua" ,lua-5.1)))))
239
240 (define-public lua5.2-libmpack
241 (package (inherit lua-libmpack)
242 (name "lua5.2-libmpack")
243 (arguments
244 (substitute-keyword-arguments (package-arguments lua-libmpack)
245 ((#:make-flags flags)
246 `(let* ((lua-version ,(package-version lua-5.2))
247 (lua-major+minor ,(version-major+minor (package-version lua-5.2))))
248 (list "CC=gcc"
249 "USE_SYSTEM_LUA=yes"
250 (string-append "MPACK_LUA_VERSION=" lua-version)
251 (string-append "MPACK_LUA_VERSION_NOPATCH=" lua-major+minor)
252 (string-append "PREFIX="
253 (assoc-ref %outputs "out"))
254 (string-append "LUA_CMOD_INSTALLDIR="
255 (assoc-ref %outputs "out")
256 "/lib/lua/" lua-major+minor))))))
257 (inputs
258 `(("lua" ,lua-5.2)))))
259
260 (define-public yaml-cpp
261 (package
262 (name "yaml-cpp")
263 (version "0.6.2")
264 (source (origin
265 (method url-fetch)
266 (uri (string-append
267 "https://github.com/jbeder/yaml-cpp/archive/"
268 "yaml-cpp-" version ".tar.gz"))
269 (sha256
270 (base32
271 "01gxn7kc8pzyh4aadjxxzq8cignmbwmm9rfrsmgqfg9w2q75dn74"))))
272 (build-system cmake-build-system)
273 (arguments
274 '(#:configure-flags '("-DBUILD_SHARED_LIBS=ON")
275 #:phases
276 (modify-phases %standard-phases
277 (add-after 'install 'dont-install-gtest-libraries
278 (lambda* (#:key outputs #:allow-other-keys)
279 (let ((out (assoc-ref outputs "out")))
280 (with-directory-excursion
281 (string-append out "/include")
282 (delete-file-recursively "gtest")
283 (delete-file-recursively "gmock"))
284 (with-directory-excursion
285 (string-append out "/lib")
286 (for-each (lambda (file)
287 (delete-file file))
288 '("libgmock.so" "libgmock_main.so"
289 "libgtest.so" "libgtest_main.so"))))
290 #t)))))
291 (native-inputs
292 `(("python" ,python)))
293 (home-page "https://github.com/jbeder/yaml-cpp")
294 (synopsis "YAML parser and emitter in C++")
295 (description "YAML parser and emitter in C++ matching the YAML 1.2 spec.")
296 (license license:bsd-3)))
297
298 (define-public jsoncpp
299 (package
300 (name "jsoncpp")
301 (version "1.9.1")
302 (home-page "https://github.com/open-source-parsers/jsoncpp")
303 (source (origin
304 (method git-fetch)
305 (uri (git-reference (url home-page) (commit version)))
306 (file-name (git-file-name name version))
307 (sha256
308 (base32
309 "00g356iv3kcp0gadj7gbyzf9jn9avvx9vxbxc7c2i5nnry8z72wj"))))
310 (build-system cmake-build-system)
311 (arguments
312 `(#:configure-flags '("-DBUILD_SHARED_LIBS:BOOL=YES")))
313 (synopsis "C++ library for interacting with JSON")
314 (description "JsonCpp is a C++ library that allows manipulating JSON values,
315 including serialization and deserialization to and from strings. It can also
316 preserve existing comment in unserialization/serialization steps, making
317 it a convenient format to store user input files.")
318 (license license:expat)))
319
320 ;; Tensorflow does not build with jsoncpp 1.8.x. It is built with commit
321 ;; 4356d9bba191e1e16ce7a92073cbf3e63564e973, which lies between version 1.7.2
322 ;; and 1.7.3.
323 (define-public jsoncpp-for-tensorflow
324 (package (inherit jsoncpp)
325 (name "jsoncpp")
326 (version "1.7.3")
327 (source (origin
328 (method git-fetch)
329 (uri (git-reference
330 (url "https://github.com/open-source-parsers/jsoncpp.git")
331 (commit version)))
332 (file-name (git-file-name name version))
333 (sha256
334 (base32
335 "1180ln8blrb0mwzpcf78k49hlki6di65q77rsvglf83kfcyh4d7z"))))))
336
337 (define-public capnproto
338 (package
339 (name "capnproto")
340 (version "0.7.0")
341 (source (origin
342 (method url-fetch)
343 (uri (string-append
344 "https://capnproto.org/capnproto-c++-"
345 version ".tar.gz"))
346 (sha256
347 (base32
348 "0hfdnhlbskagzgvby8wy6lrxj53zfzpfqimbhga68c0ji2yw1969"))))
349 (build-system gnu-build-system)
350 (arguments
351 `(#:phases
352 (modify-phases %standard-phases
353 (add-before 'check 'do-not-require-/etc/services
354 (lambda _
355 ;; Workaround for test that tries to resolve port name from
356 ;; /etc/services, which is not present in build environment.
357 (substitute* "src/kj/async-io-test.c++" ((":http") ":80"))
358 #t))
359 (add-before 'check 'use-tmp-for-tempory-files
360 (lambda _
361 ;; Use /tmp for tempory files, as the default /var/tmp directory
362 ;; doesn't exist.
363 (substitute* "src/kj/filesystem-disk-test.c++"
364 (("VAR\\_TMP \"/var/tmp\"")
365 "VAR_TMP \"/tmp\""))
366 #t)))))
367 (home-page "https://capnproto.org")
368 (synopsis "Capability-based RPC and serialization system")
369 (description
370 "Cap'n Proto is a very fast data interchange format and capability-based
371 RPC system. Think JSON, except binary. Or think Protocol Buffers, except faster.")
372 (license license:expat)))
373
374 (define-public libbson
375 (package
376 (name "libbson")
377 (version "1.6.2")
378 (source
379 (origin
380 (method url-fetch)
381 (uri (string-append "https://github.com/mongodb/libbson/releases/"
382 "download/" version "/libbson-" version ".tar.gz"))
383 (sha256
384 (base32
385 "1fj4554msq0rrz14snbj908dzqj46gh7jg9w9j0akn2b7q911m5a"))))
386 (build-system gnu-build-system)
387 (native-inputs `(("perl" ,perl)))
388 (home-page "http://mongoc.org/libbson/current/index.html")
389 (synopsis "C BSON library")
390 (description "Libbson can create and parse BSON documents. It can also
391 convert JSON documents to BSON and the opposite. BSON stands for Binary JSON,
392 it is comparable to protobuf.")
393 (license license:asl2.0)))
394
395 (define-public nlohmann-json-cpp
396 (package
397 (name "nlohmann-json-cpp")
398 (version "3.7.0")
399 (source (origin
400 (method git-fetch)
401 (uri (git-reference
402 (url "https://github.com/nlohmann/json.git")
403 (commit (string-append "v" version))))
404 (file-name (git-file-name name version))
405 (sha256
406 (base32
407 "0v7xih4zjixxxfvkfbs7a8j9qcvpwlsv4vrkbyns3hc7b44nb8ap"))))
408 (build-system cmake-build-system)
409 (native-inputs
410 ;; Integer overflow tests like those from
411 ;; <https://github.com/nlohmann/json/issues/1447> fail when building with
412 ;; gcc@5. Thus, build with a newer GCC.
413 `(("gcc" ,gcc-9)))
414 (arguments
415 '(#:phases (modify-phases %standard-phases
416 (add-before 'build 'unset-path-variables
417 (lambda _
418 (unsetenv "C_INCLUDE_PATH")
419 (unsetenv "CPLUS_INCLUDE_PATH")
420 #t)))))
421 (home-page "https://nlohmann.github.io/json/")
422 (synopsis "JSON library for C++")
423 (description
424 "JSON library for C++ trying to accomplish “Intuitive syntax”,
425 “Trivial integration”, and “Serious testing”.
426 However, “Memory efficiency” and “Speed” have not been primary goals.")
427 (license license:expat)))
428
429 (define-public python-ruamel.yaml
430 (package
431 (name "python-ruamel.yaml")
432 (version "0.15.83")
433 (source
434 (origin
435 (method url-fetch)
436 (uri (pypi-uri "ruamel.yaml" version))
437 (sha256
438 (base32
439 "0p4i8ad28cbbbjja8b9274irkhnphhvhap3aym6yb8xfp1d72kpw"))))
440 (build-system python-build-system)
441 (native-inputs
442 `(("python-pytest" ,python-pytest)))
443 (arguments
444 `(;; TODO: Tests require packaging "ruamel.std.pathlib".
445 #:tests? #f))
446 (home-page "https://bitbucket.org/ruamel/yaml")
447 (synopsis "YAML 1.2 parser/emitter")
448 (description
449 "This package provides YAML parser/emitter that supports roundtrip
450 preservation of comments, seq/map flow style, and map key order. It
451 is a derivative of Kirill Simonov’s PyYAML 3.11. It supports YAML 1.2
452 and has round-trip loaders and dumpers. It supports comments. Block
453 style and key ordering are kept, so you can diff the source.")
454 (license license:expat)))
455
456 (define-public python2-ruamel.yaml
457 (package-with-python2 python-ruamel.yaml))
458
459 (define-public python-cbor
460 (package
461 (name "python-cbor")
462 (version "1.0.0")
463 (source
464 (origin
465 (method url-fetch)
466 (uri (pypi-uri "cbor" version))
467 (sha256
468 (base32
469 "1dmv163cnslyqccrybkxn0c9s1jk1mmafmgxv75iamnz5lk5l8hk"))))
470 (build-system python-build-system)
471 (home-page "https://bitbucket.org/bodhisnarkva/cbor")
472 (synopsis "Implementation of the Concise Binary Object Representation")
473 (description
474 "Python-cbor provides an implementation of the Concise Binary Object
475 Representation (@dfn{CBOR}). CBOR is comparable to JSON, has a superset of
476 JSON's ability, but serializes to a binary format which is smaller and faster
477 to generate and parse. The two primary functions are @code{cbor.loads} and
478 @code{cbor.dumps}.")
479 (license license:asl2.0)))
480
481 (define-public flatbuffers
482 (package
483 (name "flatbuffers")
484 (version "1.10.0")
485 (source
486 (origin
487 (method url-fetch)
488 (uri (string-append "https://github.com/google/flatbuffers/archive/v"
489 version ".tar.gz"))
490 (file-name (string-append name "-" version ".tar.gz"))
491 (sha256
492 (base32
493 "0z4swldxs0s31hnkqdhsbfmc8vx3p7zsvmqaw4l31r2iikdy651p"))))
494 (build-system cmake-build-system)
495 (arguments
496 '(#:build-type "Release"
497 #:configure-flags
498 (list (string-append "-DCMAKE_INSTALL_LIBDIR="
499 (assoc-ref %outputs "out") "/lib"))))
500 (home-page "https://google.github.io/flatbuffers/")
501 (synopsis "Memory-efficient serialization library")
502 (description "FlatBuffers is a cross-platform serialization library for C++,
503 C#, C, Go, Java, JavaScript, PHP, and Python. It was originally created for
504 game development and other performance-critical applications.")
505 (license license:asl2.0)))
506
507 (define-public python-feather-format
508 (package
509 (name "python-feather-format")
510 (version "0.4.0")
511 (source
512 (origin
513 (method url-fetch)
514 (uri (pypi-uri "feather-format" version))
515 (sha256
516 (base32
517 "1adivm5w5ji4qv7hq7942vqlk8l2wgw87bdlsia771z14z3zp857"))))
518 (build-system python-build-system)
519 (propagated-inputs
520 `(("python-pandas" ,python-pandas)
521 ("python-pyarrow" ,python-pyarrow)))
522 (home-page "https://github.com/wesm/feather")
523 (synopsis "Python wrapper to the Feather file format")
524 (description "This package provides a Python wrapper library to the
525 Apache Arrow-based Feather binary columnar serialization data frame format.")
526 (license license:asl2.0)))