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