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>
14 ;;; This file is part of GNU Guix.
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.
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.
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/>.
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))
58 (uri (string-append "https://github.com/USCiLab/cereal/archive/v"
60 (file-name (string-append name "-" version ".tar.gz"))
63 "0kj32h3j2128anig0g9gzw82kfyd5xqfkwq6vdyv900jx8i1qckx"))))
64 (build-system cmake-build-system)
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.
72 (modify-phases %standard-phases
76 (substitute* "doc/doxygen.in"
77 (("@CMAKE_CURRENT_SOURCE_DIR@") "."))
78 (invoke "doxygen" "doc/doxygen.in")
80 ;; There is no "install" target, so we have to provide our own
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")))
89 (copy-recursively "include/cereal" include)
90 (copy-recursively "doc/html" doc))
93 `(("doxygen" ,doxygen)))
94 (home-page "http://uscilab.github.io/cereal/")
95 (synopsis "C++11 library for serialization")
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)))
103 (define-public msgpack
112 "https://github.com/msgpack/msgpack-c/releases/download/"
113 "cpp-" version "/msgpack-" version ".tar.gz"))
115 '(let ((p (open-file "msgpack.pc.in" "a")))
118 (string-append "Requires: " "zlib" "\n") p)
119 (close-output-port p))))
122 "18hzmyfg3mvnp7ab03nqdzzvqagkl42gygjpi4zv4i7aca2dmwf0"))))
123 (build-system gnu-build-system)
125 `(("googletest" ,googletest)
126 ("autoconf" ,autoconf)
127 ("automake" ,automake)
129 ("pkg-config" ,pkg-config)))
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
137 (modify-phases %standard-phases
138 (add-after 'unpack 'autoconf
140 (invoke "autoreconf" "-vfi")
142 (home-page "https://www.msgpack.org")
143 (synopsis "Binary serialization library")
144 (description "Msgpack is a library for C/C++ that implements binary
146 (license license:boost1.0)))
148 (define-public libmpack
154 (uri (string-append "https://github.com/tarruda/libmpack/"
155 "archive/" version ".tar.gz"))
156 (file-name (string-append name "-" version ".tar.gz"))
159 "0ml922gv8y99lbldqb9ykpjndla0hlprdjyl79yskkhwv2ai7sac"))))
160 (build-system gnu-build-system)
162 `(#:test-target "test"
165 (string-append "PREFIX=" (assoc-ref %outputs "out")))
167 (modify-phases %standard-phases
168 (delete 'configure))))
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)))
177 (define-public lua-libmpack
178 (package (inherit libmpack)
179 (name "lua-libmpack")
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"))
187 "153zrrbyxhf71dgzjjhrk56rfwk3nisslpgcqyg44v8fnz1xpk6i"))))
188 (build-system gnu-build-system)
190 `(;; FIXME: tests require "busted", which is not yet available in Guix.
194 (let* ((lua-version ,(package-version lua))
195 (lua-major+minor ,(version-major+minor (package-version lua))))
197 "FETCH=echo" ; don't fetch anything from the web
198 "UNTGZ=echo" ; and don't try to unpack it
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)))
208 (modify-phases %standard-phases
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"))))))))
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")))
228 (define-public lua5.2-libmpack
229 (package (inherit lua-libmpack)
230 (name "lua5.2-libmpack")
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))))
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))))))
246 `(("lua" ,lua-5.2)))))
248 (define-public yaml-cpp
255 "https://github.com/jbeder/yaml-cpp/archive/"
256 "yaml-cpp-" version ".tar.gz"))
259 "01gxn7kc8pzyh4aadjxxzq8cignmbwmm9rfrsmgqfg9w2q75dn74"))))
260 (build-system cmake-build-system)
262 '(#:configure-flags '("-DBUILD_SHARED_LIBS=ON")))
264 `(("python" ,python)))
265 (home-page "https://github.com/jbeder/yaml-cpp")
266 (synopsis "YAML parser and emitter in C++")
267 (description "YAML parser and emitter in C++ matching the YAML 1.2 spec.")
268 (license license:bsd-3)))
270 (define-public jsoncpp
277 "https://github.com/open-source-parsers/jsoncpp/archive/"
279 (file-name (string-append name "-" version ".tar.gz"))
282 "1dpxk8hkni5dq4mdw8qbaj40jmid3a31d1gh8iqcnfwkw34ym7f4"))))
283 (build-system cmake-build-system)
284 (home-page "https://github.com/open-source-parsers/jsoncpp")
286 `(#:configure-flags '("-DBUILD_SHARED_LIBS:BOOL=YES")))
287 (synopsis "C++ library for interacting with JSON")
288 (description "JsonCpp is a C++ library that allows manipulating JSON values,
289 including serialization and deserialization to and from strings. It can also
290 preserve existing comment in unserialization/serialization steps, making
291 it a convenient format to store user input files.")
292 (license license:expat)))
294 (define-public capnproto
301 "https://capnproto.org/capnproto-c++-"
305 "010s9yhq4531wvdfrdf2477zswhck6cjfby79w73rff3v06090l0"))))
306 (build-system gnu-build-system)
309 (modify-phases %standard-phases
310 (add-before 'check 'do-not-require-/etc/services
312 ;; Workaround for test that tries to resolve port name from
313 ;; /etc/services, which is not present in build environment.
314 (substitute* "src/kj/async-io-test.c++" ((":http") ":80"))
316 (home-page "https://capnproto.org")
317 (synopsis "Capability-based RPC and serialization system")
319 "Cap'n Proto is a very fast data interchange format and capability-based
320 RPC system. Think JSON, except binary. Or think Protocol Buffers, except faster.")
321 (license license:expat)))
323 (define-public libbson
330 (uri (string-append "https://github.com/mongodb/libbson/releases/"
331 "download/" version "/libbson-" version ".tar.gz"))
334 "1fj4554msq0rrz14snbj908dzqj46gh7jg9w9j0akn2b7q911m5a"))))
335 (build-system gnu-build-system)
336 (native-inputs `(("perl" ,perl)))
337 (home-page "http://mongoc.org/libbson/current/index.html")
338 (synopsis "C BSON library")
339 (description "Libbson can create and parse BSON documents. It can also
340 convert JSON documents to BSON and the opposite. BSON stands for Binary JSON,
341 it is comparable to protobuf.")
342 (license license:asl2.0)))
344 (define-public nlohmann-json-cpp
346 (name "nlohmann-json-cpp")
351 (uri (string-append "https://github.com/nlohmann/json/"
352 "archive/v" version ".tar.gz"))
353 (file-name (string-append name "-" version ".tar.gz"))
356 "0lrh6cjd643c7kmvmwafbgq7dqj3b778483gjhjbvp6rc6z5xf2r"))))
357 (build-system cmake-build-system)
358 (home-page "https://nlohmann.github.io/json/")
359 (synopsis "JSON library for C++")
361 "JSON library for C++ trying to accomplish “Intuitive syntax”,
362 “Trivial integration”, and “Serious testing”.
363 However, “Memory efficiency” and “Speed” have not been primary goals.")
364 (license license:expat)))
366 (define-public python-ruamel.yaml
368 (name "python-ruamel.yaml")
373 (uri (pypi-uri "ruamel.yaml" version))
376 "0629xzlwbddfwp8lkjz3mpvxhml9kx17cfs8aydzg55idzcl562h"))))
377 (build-system python-build-system)
379 `(("python-pytest" ,python-pytest)))
381 `(;; TODO: Tests require packaging "ruamel.std.pathlib".
383 (home-page "https://bitbucket.org/ruamel/yaml")
384 (synopsis "YAML 1.2 parser/emitter")
386 "This package provides YAML parser/emitter that supports roundtrip
387 preservation of comments, seq/map flow style, and map key order. It
388 is a derivative of Kirill Simonov’s PyYAML 3.11. It supports YAML 1.2
389 and has round-trip loaders and dumpers. It supports comments. Block
390 style and key ordering are kept, so you can diff the source.")
391 (license license:expat)))
393 (define-public python2-ruamel.yaml
394 (package-with-python2 python-ruamel.yaml))
396 (define-public python-cbor
403 (uri (pypi-uri "cbor" version))
406 "1dmv163cnslyqccrybkxn0c9s1jk1mmafmgxv75iamnz5lk5l8hk"))))
407 (build-system python-build-system)
408 (home-page "https://bitbucket.org/bodhisnarkva/cbor")
409 (synopsis "Implementation of the Concise Binary Object Representation")
411 "Python-cbor provides an implementation of the Concise Binary Object
412 Representation (@dfn{CBOR}). CBOR is comparable to JSON, has a superset of
413 JSON's ability, but serializes to a binary format which is smaller and faster
414 to generate and parse. The two primary functions are @code{cbor.loads} and
416 (license license:asl2.0)))
418 (define-public flatbuffers
425 (uri (string-append "https://github.com/google/flatbuffers/archive/v"
429 "1qs7sa9q4q6hs12yp875lvrv6393178qcmqs1ziwmjk088g4k9aw"))))
430 (build-system cmake-build-system)
432 '(#:build-type "Release"
434 (list (string-append "-DCMAKE_INSTALL_LIBDIR="
435 (assoc-ref %outputs "out") "/lib"))))
436 (home-page "https://google.github.io/flatbuffers/")
437 (synopsis "Memory-efficient serialization library")
438 (description "FlatBuffers is a cross platform serialization library for C++,
439 C#, C, Go, Java, JavaScript, PHP, and Python. It was originally created for
440 game development and other performance-critical applications.")
441 (license license:asl2.0)))
443 (define-public r-feather
450 (uri (cran-uri "feather" version))
453 "1q6dbkfnkpnabq8lb6bm9ma44cfcghx2lm23pyk3vg7943wrn1pi"))))
454 (build-system r-build-system)
458 ("r-tibble" ,r-tibble)))
459 (home-page "https://github.com/wesm/feather")
460 (synopsis "R Bindings to the Feather API")
461 (description "Read and write feather files, a lightweight binary columnar
462 daa store designed for maximum speed.")
463 (license license:asl2.0)))
465 (define-public python-feather-format
467 (name "python-feather-format")
472 (uri (pypi-uri "feather-format" version))
475 "1adivm5w5ji4qv7hq7942vqlk8l2wgw87bdlsia771z14z3zp857"))))
476 (build-system python-build-system)
478 `(("python-pandas" ,python-pandas)
479 ("python-pyarrow" ,python-pyarrow)))
480 (home-page "https://github.com/wesm/feather")
481 (synopsis "Python wrapper to the Feather file format")
482 (description "This package provides a Python wrapper library to the
483 Apache Arrow-based Feather binary columnar serialization data frame format.")
484 (license license:asl2.0)))
486 (define-public python2-feather-format
487 (package-with-python2 python-feather-format))