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