Merge branch 'staging' into core-updates
[jackhill/guix/guix.git] / gnu / packages / serialization.scm
CommitLineData
0149354d 1;;; GNU Guix --- Functional package management for GNU
c57e5fd0 2;;; Copyright © 2015, 2017 Ricardo Wurmus <rekado@elephly.net>
d1ef573d 3;;; Copyright © 2016 Lukas Gradl <lgradl@openmailbox.org>
f50f4ae4 4;;; Copyright © 2016 David Craven <david@craven.ch>
557d3328 5;;; Copyright © 2016 Marius Bakke <mbakke@fastmail.com>
f20cfa06 6;;; Copyright © 2016, 2018, 2019 Efraim Flashner <efraim@flashner.co.il>
9d625512 7;;; Copyright © 2017 Corentin Bocquillon <corentin@nybble.fr>
bf7c3699 8;;; Copyright © 2017 Gregor Giesen <giesen@zaehlwerk.net>
f38d54f0 9;;; Copyright © 2017 Frederick M. Muriithi <fredmanglis@gmail.com>
47956fa0 10;;; Copyright © 2017 ng0 <ng0@n0.is>
3def739d 11;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
04953dca 12;;; Copyright © 2018 Joshua Sierles, Nextjournal <joshua@nextjournal.com>
0149354d
RW
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)
8e664e7e 33 #:use-module (guix utils)
0149354d 34 #:use-module (guix build-system cmake)
d1ef573d 35 #:use-module (guix build-system gnu)
9f1c0e03 36 #:use-module (guix build-system python)
0149354d 37 #:use-module (gnu packages)
d1ef573d 38 #:use-module (gnu packages autotools)
f50f4ae4 39 #:use-module (gnu packages boost)
d1ef573d
LG
40 #:use-module (gnu packages check)
41 #:use-module (gnu packages compression)
8d4f34d6 42 #:use-module (gnu packages databases)
d1ef573d 43 #:use-module (gnu packages documentation)
8e664e7e 44 #:use-module (gnu packages lua)
f47dc8dd 45 #:use-module (gnu packages pkg-config)
9d625512 46 #:use-module (gnu packages python)
44d10b1f 47 #:use-module (gnu packages python-xyz)
60a166c6 48 #:use-module (gnu packages perl))
0149354d
RW
49
50(define-public cereal
51 (package
52 (name "cereal")
43593f5b 53 (version "1.2.1")
0149354d
RW
54 (source (origin
55 (method url-fetch)
56 (uri (string-append "https://github.com/USCiLab/cereal/archive/v"
57 version ".tar.gz"))
58 (file-name (string-append name "-" version ".tar.gz"))
59 (sha256
60 (base32
43593f5b 61 "0kj32h3j2128anig0g9gzw82kfyd5xqfkwq6vdyv900jx8i1qckx"))))
0149354d
RW
62 (build-system cmake-build-system)
63 (arguments
64 `(;; The only included tests are portability tests requiring
65 ;; cross-compilation and boost. Since we are building cereal on more
66 ;; platforms anyway, there is no compelling reason to build the tests.
67 #:tests? #f
68 #:out-of-source? #f
69 #:phases
70 (modify-phases %standard-phases
71 (delete 'configure)
72 (replace 'build
73 (lambda _
74 (substitute* "doc/doxygen.in"
75 (("@CMAKE_CURRENT_SOURCE_DIR@") "."))
35929375
TGR
76 (invoke "doxygen" "doc/doxygen.in")
77 #t))
0149354d
RW
78 ;; There is no "install" target, so we have to provide our own
79 ;; "install" phase.
80 (replace 'install
81 (lambda* (#:key outputs #:allow-other-keys)
82 (let* ((out (assoc-ref outputs "out"))
83 (doc (string-append out "/share/cereal/docs"))
84 (include (string-append out "/include/cereal")))
85 (mkdir-p doc)
86 (mkdir-p include)
87 (copy-recursively "include/cereal" include)
88 (copy-recursively "doc/html" doc))
89 #t)))))
90 (native-inputs
91 `(("doxygen" ,doxygen)))
92 (home-page "http://uscilab.github.io/cereal/")
93 (synopsis "C++11 library for serialization")
94 (description
95 "Cereal is a header-only C++11 serialization library. Cereal takes
96arbitrary data types and reversibly turns them into different representations,
97such as compact binary encodings, XML, or JSON.")
98 (license license:bsd-3)))
d1ef573d 99
d1ef573d
LG
100(define-public msgpack
101 (package
102 (name "msgpack")
e54ae862 103 (version "1.4.2")
d1ef573d
LG
104 (source
105 (origin
106 (method url-fetch)
107 (uri
108 (string-append
109 "https://github.com/msgpack/msgpack-c/releases/download/"
110 "cpp-" version "/msgpack-" version ".tar.gz"))
111 (snippet
112 '(let ((p (open-file "msgpack.pc.in" "a")))
6cbee49d
MW
113 (display
114 (string-append "Requires: " "zlib" "\n") p)
115 (close-output-port p)
116 #t))
d1ef573d
LG
117 (sha256
118 (base32
e54ae862 119 "18hzmyfg3mvnp7ab03nqdzzvqagkl42gygjpi4zv4i7aca2dmwf0"))))
d1ef573d
LG
120 (build-system gnu-build-system)
121 (native-inputs
122 `(("googletest" ,googletest)
123 ("autoconf" ,autoconf)
124 ("automake" ,automake)
125 ("libtool" ,libtool)
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.
fe0523d4 132 (home-page "https://www.msgpack.org")
d1ef573d
LG
133 (synopsis "Binary serialization library")
134 (description "Msgpack is a library for C/C++ that implements binary
135serialization.")
136 (license license:boost1.0)))
f50f4ae4 137
c57e5fd0
RW
138(define-public libmpack
139 (package
140 (name "libmpack")
b5236121 141 (version "1.0.5")
c57e5fd0
RW
142 (source (origin
143 (method url-fetch)
144 (uri (string-append "https://github.com/tarruda/libmpack/"
145 "archive/" version ".tar.gz"))
146 (file-name (string-append name "-" version ".tar.gz"))
147 (sha256
b5236121
LF
148 (base32
149 "0ml922gv8y99lbldqb9ykpjndla0hlprdjyl79yskkhwv2ai7sac"))))
c57e5fd0
RW
150 (build-system gnu-build-system)
151 (arguments
152 `(#:test-target "test"
153 #:make-flags
154 (list "CC=gcc"
155 (string-append "PREFIX=" (assoc-ref %outputs "out")))
156 #:phases
157 (modify-phases %standard-phases
158 (delete 'configure))))
159 (native-inputs
160 `(("libtool" ,libtool)))
161 (home-page "https://github.com/tarruda/libmpack")
162 (synopsis "Small binary serialization library")
163 (description "Libmpack is a small binary serialization and RPC library
164that implements both the msgpack and msgpack-rpc specifications.")
165 (license license:expat)))
166
8e664e7e
RW
167(define-public lua-libmpack
168 (package (inherit libmpack)
169 (name "lua-libmpack")
7ec309af
RW
170 (source (origin
171 (method url-fetch)
172 (uri (string-append "https://github.com/libmpack/libmpack-lua/"
173 "archive/" (package-version libmpack) ".tar.gz"))
174 (file-name (string-append name "-" (package-version libmpack) ".tar.gz"))
175 (sha256
176 (base32
177 "153zrrbyxhf71dgzjjhrk56rfwk3nisslpgcqyg44v8fnz1xpk6i"))))
8e664e7e
RW
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"
7ec309af
RW
187 "FETCH=echo" ; don't fetch anything from the web
188 "UNTGZ=echo" ; and don't try to unpack it
8e664e7e 189 "USE_SYSTEM_LUA=yes"
7ec309af
RW
190 (string-append "MPACK_LUA_VERSION=" lua-version)
191 (string-append "MPACK_LUA_VERSION_NOPATCH=" lua-major+minor)
8e664e7e
RW
192 (string-append "PREFIX="
193 (assoc-ref %outputs "out"))
194 (string-append "LUA_CMOD_INSTALLDIR="
195 (assoc-ref %outputs "out")
7ec309af 196 "/lib/lua/" lua-major+minor)))
8e664e7e
RW
197 #:phases
198 (modify-phases %standard-phases
199 (delete 'configure)
7ec309af
RW
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"))))))))
8e664e7e
RW
210 (inputs
211 `(("lua" ,lua)))
212 (native-inputs
7ec309af
RW
213 `(("pkg-config" ,pkg-config)
214 ("libmpack" ,(package-source libmpack))))
215 (home-page "https://github.com/libmpack/libmpack-lua")
8e664e7e
RW
216 (synopsis "Lua bindings for the libmpack binary serialization library")))
217
01a0a0c4
H
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
369ee96b
RW
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"
0cdc3343
RW
248 (string-append "MPACK_LUA_VERSION=" lua-version)
249 (string-append "MPACK_LUA_VERSION_NOPATCH=" lua-major+minor)
369ee96b
RW
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
f50f4ae4
DC
258(define-public yaml-cpp
259 (package
260 (name "yaml-cpp")
942cf159 261 (version "0.6.2")
f50f4ae4
DC
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
942cf159 269 "01gxn7kc8pzyh4aadjxxzq8cignmbwmm9rfrsmgqfg9w2q75dn74"))))
f50f4ae4 270 (build-system cmake-build-system)
0577a3fd 271 (arguments
9a1ef44e
EF
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)))))
f50f4ae4
DC
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)))
cd131a76
DC
295
296(define-public jsoncpp
297 (package
298 (name "jsoncpp")
e1c08dcc 299 (version "1.8.4")
cd131a76
DC
300 (source (origin
301 (method url-fetch)
302 (uri (string-append
303 "https://github.com/open-source-parsers/jsoncpp/archive/"
304 version ".tar.gz"))
305 (file-name (string-append name "-" version ".tar.gz"))
306 (sha256
307 (base32
e1c08dcc 308 "1dpxk8hkni5dq4mdw8qbaj40jmid3a31d1gh8iqcnfwkw34ym7f4"))))
cd131a76
DC
309 (build-system cmake-build-system)
310 (home-page "https://github.com/open-source-parsers/jsoncpp")
996f5ece
EB
311 (arguments
312 `(#:configure-flags '("-DBUILD_SHARED_LIBS:BOOL=YES")))
cd131a76
DC
313 (synopsis "C++ library for interacting with JSON")
314 (description "JsonCpp is a C++ library that allows manipulating JSON values,
315including serialization and deserialization to and from strings. It can also
316preserve existing comment in unserialization/serialization steps, making
317it a convenient format to store user input files.")
318 (license license:expat)))
557d3328
MB
319
320(define-public capnproto
321 (package
322 (name "capnproto")
9c5f4b82 323 (version "0.7.0")
557d3328
MB
324 (source (origin
325 (method url-fetch)
326 (uri (string-append
327 "https://capnproto.org/capnproto-c++-"
328 version ".tar.gz"))
329 (sha256
330 (base32
9c5f4b82 331 "0hfdnhlbskagzgvby8wy6lrxj53zfzpfqimbhga68c0ji2yw1969"))))
557d3328
MB
332 (build-system gnu-build-system)
333 (arguments
334 `(#:phases
335 (modify-phases %standard-phases
336 (add-before 'check 'do-not-require-/etc/services
337 (lambda _
338 ;; Workaround for test that tries to resolve port name from
339 ;; /etc/services, which is not present in build environment.
340 (substitute* "src/kj/async-io-test.c++" ((":http") ":80"))
9c5f4b82
CB
341 #t))
342 (add-before 'check 'use-tmp-for-tempory-files
343 (lambda _
344 ;; Use /tmp for tempory files, as the default /var/tmp directory
345 ;; doesn't exist.
346 (substitute* "src/kj/filesystem-disk-test.c++"
347 (("VAR\\_TMP \"/var/tmp\"")
348 "VAR_TMP \"/tmp\""))
557d3328
MB
349 #t)))))
350 (home-page "https://capnproto.org")
351 (synopsis "Capability-based RPC and serialization system")
352 (description
353 "Cap'n Proto is a very fast data interchange format and capability-based
354RPC system. Think JSON, except binary. Or think Protocol Buffers, except faster.")
355 (license license:expat)))
9d625512
CB
356
357(define-public libbson
358 (package
359 (name "libbson")
360 (version "1.6.2")
361 (source
362 (origin
363 (method url-fetch)
364 (uri (string-append "https://github.com/mongodb/libbson/releases/"
365 "download/" version "/libbson-" version ".tar.gz"))
366 (sha256
367 (base32
368 "1fj4554msq0rrz14snbj908dzqj46gh7jg9w9j0akn2b7q911m5a"))))
369 (build-system gnu-build-system)
370 (native-inputs `(("perl" ,perl)))
371 (home-page "http://mongoc.org/libbson/current/index.html")
372 (synopsis "C BSON library")
373 (description "Libbson can create and parse BSON documents. It can also
374convert JSON documents to BSON and the opposite. BSON stands for Binary JSON,
375it is comparable to protobuf.")
376 (license license:asl2.0)))
bf7c3699
GG
377
378(define-public nlohmann-json-cpp
379 (package
380 (name "nlohmann-json-cpp")
381 (version "2.1.1")
382 (source
383 (origin
384 (method url-fetch)
385 (uri (string-append "https://github.com/nlohmann/json/"
386 "archive/v" version ".tar.gz"))
387 (file-name (string-append name "-" version ".tar.gz"))
388 (sha256
389 (base32
390 "0lrh6cjd643c7kmvmwafbgq7dqj3b778483gjhjbvp6rc6z5xf2r"))))
391 (build-system cmake-build-system)
392 (home-page "https://nlohmann.github.io/json/")
393 (synopsis "JSON library for C++")
394 (description
395 "JSON library for C++ trying to accomplish “Intuitive syntax”,
396“Trivial integration”, and “Serious testing”.
397However, “Memory efficiency” and “Speed” have not been primary goals.")
398 (license license:expat)))
f38d54f0
MFM
399
400(define-public python-ruamel.yaml
401 (package
402 (name "python-ruamel.yaml")
f20cfa06 403 (version "0.15.83")
f38d54f0
MFM
404 (source
405 (origin
406 (method url-fetch)
407 (uri (pypi-uri "ruamel.yaml" version))
408 (sha256
409 (base32
f20cfa06 410 "0p4i8ad28cbbbjja8b9274irkhnphhvhap3aym6yb8xfp1d72kpw"))))
f38d54f0
MFM
411 (build-system python-build-system)
412 (native-inputs
413 `(("python-pytest" ,python-pytest)))
414 (arguments
415 `(;; TODO: Tests require packaging "ruamel.std.pathlib".
416 #:tests? #f))
417 (home-page "https://bitbucket.org/ruamel/yaml")
418 (synopsis "YAML 1.2 parser/emitter")
419 (description
420 "This package provides YAML parser/emitter that supports roundtrip
421preservation of comments, seq/map flow style, and map key order. It
422is a derivative of Kirill Simonov’s PyYAML 3.11. It supports YAML 1.2
423and has round-trip loaders and dumpers. It supports comments. Block
424style and key ordering are kept, so you can diff the source.")
425 (license license:expat)))
426
427(define-public python2-ruamel.yaml
428 (package-with-python2 python-ruamel.yaml))
7ae282fb 429
430(define-public python-cbor
431 (package
432 (name "python-cbor")
433 (version "1.0.0")
434 (source
435 (origin
436 (method url-fetch)
437 (uri (pypi-uri "cbor" version))
438 (sha256
439 (base32
440 "1dmv163cnslyqccrybkxn0c9s1jk1mmafmgxv75iamnz5lk5l8hk"))))
441 (build-system python-build-system)
442 (home-page "https://bitbucket.org/bodhisnarkva/cbor")
443 (synopsis "Implementation of the Concise Binary Object Representation")
444 (description
445 "Python-cbor provides an implementation of the Concise Binary Object
31af847b
TGR
446Representation (@dfn{CBOR}). CBOR is comparable to JSON, has a superset of
447JSON's ability, but serializes to a binary format which is smaller and faster
448to generate and parse. The two primary functions are @code{cbor.loads} and
7ae282fb 449@code{cbor.dumps}.")
450 (license license:asl2.0)))
04953dca
LF
451
452(define-public flatbuffers
453 (package
454 (name "flatbuffers")
429a332b 455 (version "1.10.0")
04953dca
LF
456 (source
457 (origin
458 (method url-fetch)
459 (uri (string-append "https://github.com/google/flatbuffers/archive/v"
460 version ".tar.gz"))
f5d4c46c 461 (file-name (string-append name "-" version ".tar.gz"))
04953dca
LF
462 (sha256
463 (base32
429a332b 464 "0z4swldxs0s31hnkqdhsbfmc8vx3p7zsvmqaw4l31r2iikdy651p"))))
04953dca
LF
465 (build-system cmake-build-system)
466 (arguments
3def739d
TGR
467 '(#:build-type "Release"
468 #:configure-flags
04953dca 469 (list (string-append "-DCMAKE_INSTALL_LIBDIR="
3def739d 470 (assoc-ref %outputs "out") "/lib"))))
04953dca
LF
471 (home-page "https://google.github.io/flatbuffers/")
472 (synopsis "Memory-efficient serialization library")
a8b12397 473 (description "FlatBuffers is a cross-platform serialization library for C++,
04953dca
LF
474C#, C, Go, Java, JavaScript, PHP, and Python. It was originally created for
475game development and other performance-critical applications.")
476 (license license:asl2.0)))
9f1c0e03 477
8d4f34d6
LF
478(define-public python-feather-format
479 (package
480 (name "python-feather-format")
481 (version "0.4.0")
482 (source
483 (origin
484 (method url-fetch)
485 (uri (pypi-uri "feather-format" version))
486 (sha256
487 (base32
488 "1adivm5w5ji4qv7hq7942vqlk8l2wgw87bdlsia771z14z3zp857"))))
489 (build-system python-build-system)
490 (propagated-inputs
491 `(("python-pandas" ,python-pandas)
492 ("python-pyarrow" ,python-pyarrow)))
493 (home-page "https://github.com/wesm/feather")
494 (synopsis "Python wrapper to the Feather file format")
495 (description "This package provides a Python wrapper library to the
496Apache Arrow-based Feather binary columnar serialization data frame format.")
497 (license license:asl2.0)))
498
499(define-public python2-feather-format
500 (package-with-python2 python-feather-format))