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)))
102 (define-public msgpack
111 "https://github.com/msgpack/msgpack-c/releases/download/"
112 "cpp-" version "/msgpack-" version ".tar.gz"))
114 '(let ((p (open-file "msgpack.pc.in" "a")))
116 (string-append "Requires: " "zlib" "\n") p)
117 (close-output-port p)
121 "18hzmyfg3mvnp7ab03nqdzzvqagkl42gygjpi4zv4i7aca2dmwf0"))))
122 (build-system gnu-build-system)
124 `(("googletest" ,googletest)
125 ("autoconf" ,autoconf)
126 ("automake" ,automake)
128 ("pkg-config" ,pkg-config)))
130 `(("zlib" ,zlib))) ;; Msgpack installs two headers (zbuffer.h,
131 ;; zbuffer.hpp) which #include <zlib.h>. However, 'guix gc --references'
132 ;; does not detect a store reference to zlib since these headers are not
134 (home-page "https://www.msgpack.org")
135 (synopsis "Binary serialization library")
136 (description "Msgpack is a library for C/C++ that implements binary
138 (license license:boost1.0)))
140 (define-public libmpack
146 (uri (string-append "https://github.com/tarruda/libmpack/"
147 "archive/" version ".tar.gz"))
148 (file-name (string-append name "-" version ".tar.gz"))
151 "0ml922gv8y99lbldqb9ykpjndla0hlprdjyl79yskkhwv2ai7sac"))))
152 (build-system gnu-build-system)
154 `(#:test-target "test"
157 (string-append "PREFIX=" (assoc-ref %outputs "out")))
159 (modify-phases %standard-phases
160 (delete 'configure))))
162 `(("libtool" ,libtool)))
163 (home-page "https://github.com/tarruda/libmpack")
164 (synopsis "Small binary serialization library")
165 (description "Libmpack is a small binary serialization and RPC library
166 that implements both the msgpack and msgpack-rpc specifications.")
167 (license license:expat)))
169 (define-public lua-libmpack
170 (package (inherit libmpack)
171 (name "lua-libmpack")
174 (uri (string-append "https://github.com/libmpack/libmpack-lua/"
175 "archive/" (package-version libmpack) ".tar.gz"))
176 (file-name (string-append name "-" (package-version libmpack) ".tar.gz"))
179 "153zrrbyxhf71dgzjjhrk56rfwk3nisslpgcqyg44v8fnz1xpk6i"))))
180 (build-system gnu-build-system)
182 `(;; FIXME: tests require "busted", which is not yet available in Guix.
186 (let* ((lua-version ,(package-version lua))
187 (lua-major+minor ,(version-major+minor (package-version lua))))
189 "FETCH=echo" ; don't fetch anything from the web
190 "UNTGZ=echo" ; and don't try to unpack it
192 (string-append "MPACK_LUA_VERSION=" lua-version)
193 (string-append "MPACK_LUA_VERSION_NOPATCH=" lua-major+minor)
194 (string-append "PREFIX="
195 (assoc-ref %outputs "out"))
196 (string-append "LUA_CMOD_INSTALLDIR="
197 (assoc-ref %outputs "out")
198 "/lib/lua/" lua-major+minor)))
200 (modify-phases %standard-phases
202 (add-after 'unpack 'unpack-mpack-sources
203 (lambda* (#:key inputs #:allow-other-keys)
204 ;; This is broken because mpack-src is not a file, but all
205 ;; prerequisites are added to the inputs of the gcc invocation.
206 (substitute* "Makefile"
207 (("\\$\\(MPACK\\): mpack-src") "$(MPACK): "))
208 (mkdir-p "mpack-src")
209 (zero? (system* "tar" "-C" "mpack-src"
210 "--strip-components=1"
211 "-xvf" (assoc-ref inputs "libmpack"))))))))
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")))
220 (define-public lua5.1-libmpack
221 (package (inherit lua-libmpack)
222 (name "lua5.1-libmpack")
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))))
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))))))
238 `(("lua" ,lua-5.1)))))
240 (define-public lua5.2-libmpack
241 (package (inherit lua-libmpack)
242 (name "lua5.2-libmpack")
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))))
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))))))
258 `(("lua" ,lua-5.2)))))
260 (define-public yaml-cpp
267 "https://github.com/jbeder/yaml-cpp/archive/"
268 "yaml-cpp-" version ".tar.gz"))
271 "01gxn7kc8pzyh4aadjxxzq8cignmbwmm9rfrsmgqfg9w2q75dn74"))))
272 (build-system cmake-build-system)
274 '(#:configure-flags '("-DBUILD_SHARED_LIBS=ON")))
276 `(("python" ,python)))
277 (home-page "https://github.com/jbeder/yaml-cpp")
278 (synopsis "YAML parser and emitter in C++")
279 (description "YAML parser and emitter in C++ matching the YAML 1.2 spec.")
280 (license license:bsd-3)))
282 (define-public jsoncpp
289 "https://github.com/open-source-parsers/jsoncpp/archive/"
291 (file-name (string-append name "-" version ".tar.gz"))
294 "1dpxk8hkni5dq4mdw8qbaj40jmid3a31d1gh8iqcnfwkw34ym7f4"))))
295 (build-system cmake-build-system)
296 (home-page "https://github.com/open-source-parsers/jsoncpp")
298 `(#:configure-flags '("-DBUILD_SHARED_LIBS:BOOL=YES")))
299 (synopsis "C++ library for interacting with JSON")
300 (description "JsonCpp is a C++ library that allows manipulating JSON values,
301 including serialization and deserialization to and from strings. It can also
302 preserve existing comment in unserialization/serialization steps, making
303 it a convenient format to store user input files.")
304 (license license:expat)))
306 (define-public capnproto
313 "https://capnproto.org/capnproto-c++-"
317 "0hfdnhlbskagzgvby8wy6lrxj53zfzpfqimbhga68c0ji2yw1969"))))
318 (build-system gnu-build-system)
321 (modify-phases %standard-phases
322 (add-before 'check 'do-not-require-/etc/services
324 ;; Workaround for test that tries to resolve port name from
325 ;; /etc/services, which is not present in build environment.
326 (substitute* "src/kj/async-io-test.c++" ((":http") ":80"))
328 (add-before 'check 'use-tmp-for-tempory-files
330 ;; Use /tmp for tempory files, as the default /var/tmp directory
332 (substitute* "src/kj/filesystem-disk-test.c++"
333 (("VAR\\_TMP \"/var/tmp\"")
336 (home-page "https://capnproto.org")
337 (synopsis "Capability-based RPC and serialization system")
339 "Cap'n Proto is a very fast data interchange format and capability-based
340 RPC system. Think JSON, except binary. Or think Protocol Buffers, except faster.")
341 (license license:expat)))
343 (define-public libbson
350 (uri (string-append "https://github.com/mongodb/libbson/releases/"
351 "download/" version "/libbson-" version ".tar.gz"))
354 "1fj4554msq0rrz14snbj908dzqj46gh7jg9w9j0akn2b7q911m5a"))))
355 (build-system gnu-build-system)
356 (native-inputs `(("perl" ,perl)))
357 (home-page "http://mongoc.org/libbson/current/index.html")
358 (synopsis "C BSON library")
359 (description "Libbson can create and parse BSON documents. It can also
360 convert JSON documents to BSON and the opposite. BSON stands for Binary JSON,
361 it is comparable to protobuf.")
362 (license license:asl2.0)))
364 (define-public nlohmann-json-cpp
366 (name "nlohmann-json-cpp")
371 (uri (string-append "https://github.com/nlohmann/json/"
372 "archive/v" version ".tar.gz"))
373 (file-name (string-append name "-" version ".tar.gz"))
376 "0lrh6cjd643c7kmvmwafbgq7dqj3b778483gjhjbvp6rc6z5xf2r"))))
377 (build-system cmake-build-system)
378 (home-page "https://nlohmann.github.io/json/")
379 (synopsis "JSON library for C++")
381 "JSON library for C++ trying to accomplish “Intuitive syntax”,
382 “Trivial integration”, and “Serious testing”.
383 However, “Memory efficiency” and “Speed” have not been primary goals.")
384 (license license:expat)))
386 (define-public python-ruamel.yaml
388 (name "python-ruamel.yaml")
393 (uri (pypi-uri "ruamel.yaml" version))
396 "0629xzlwbddfwp8lkjz3mpvxhml9kx17cfs8aydzg55idzcl562h"))))
397 (build-system python-build-system)
399 `(("python-pytest" ,python-pytest)))
401 `(;; TODO: Tests require packaging "ruamel.std.pathlib".
403 (home-page "https://bitbucket.org/ruamel/yaml")
404 (synopsis "YAML 1.2 parser/emitter")
406 "This package provides YAML parser/emitter that supports roundtrip
407 preservation of comments, seq/map flow style, and map key order. It
408 is a derivative of Kirill Simonov’s PyYAML 3.11. It supports YAML 1.2
409 and has round-trip loaders and dumpers. It supports comments. Block
410 style and key ordering are kept, so you can diff the source.")
411 (license license:expat)))
413 (define-public python2-ruamel.yaml
414 (package-with-python2 python-ruamel.yaml))
416 (define-public python-cbor
423 (uri (pypi-uri "cbor" version))
426 "1dmv163cnslyqccrybkxn0c9s1jk1mmafmgxv75iamnz5lk5l8hk"))))
427 (build-system python-build-system)
428 (home-page "https://bitbucket.org/bodhisnarkva/cbor")
429 (synopsis "Implementation of the Concise Binary Object Representation")
431 "Python-cbor provides an implementation of the Concise Binary Object
432 Representation (@dfn{CBOR}). CBOR is comparable to JSON, has a superset of
433 JSON's ability, but serializes to a binary format which is smaller and faster
434 to generate and parse. The two primary functions are @code{cbor.loads} and
436 (license license:asl2.0)))
438 (define-public flatbuffers
445 (uri (string-append "https://github.com/google/flatbuffers/archive/v"
447 (file-name (string-append name "-" version ".tar.gz"))
450 "0z4swldxs0s31hnkqdhsbfmc8vx3p7zsvmqaw4l31r2iikdy651p"))))
451 (build-system cmake-build-system)
453 '(#:build-type "Release"
455 (list (string-append "-DCMAKE_INSTALL_LIBDIR="
456 (assoc-ref %outputs "out") "/lib"))))
457 (home-page "https://google.github.io/flatbuffers/")
458 (synopsis "Memory-efficient serialization library")
459 (description "FlatBuffers is a cross-platform serialization library for C++,
460 C#, C, Go, Java, JavaScript, PHP, and Python. It was originally created for
461 game development and other performance-critical applications.")
462 (license license:asl2.0)))
464 (define-public r-feather
471 (uri (cran-uri "feather" version))
474 "1q6dbkfnkpnabq8lb6bm9ma44cfcghx2lm23pyk3vg7943wrn1pi"))))
475 (build-system r-build-system)
479 ("r-tibble" ,r-tibble)))
480 (home-page "https://github.com/wesm/feather")
481 (synopsis "R Bindings to the Feather API")
482 (description "Read and write feather files, a lightweight binary columnar
483 daa store designed for maximum speed.")
484 (license license:asl2.0)))
486 (define-public python-feather-format
488 (name "python-feather-format")
493 (uri (pypi-uri "feather-format" version))
496 "1adivm5w5ji4qv7hq7942vqlk8l2wgw87bdlsia771z14z3zp857"))))
497 (build-system python-build-system)
499 `(("python-pandas" ,python-pandas)
500 ("python-pyarrow" ,python-pyarrow)))
501 (home-page "https://github.com/wesm/feather")
502 (synopsis "Python wrapper to the Feather file format")
503 (description "This package provides a Python wrapper library to the
504 Apache Arrow-based Feather binary columnar serialization data frame format.")
505 (license license:asl2.0)))
507 (define-public python2-feather-format
508 (package-with-python2 python-feather-format))