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, 2019 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 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 cpp)
44 #:use-module (gnu packages databases)
45 #:use-module (gnu packages documentation)
46 #:use-module (gnu packages gcc)
47 #:use-module (gnu packages lua)
48 #:use-module (gnu packages pkg-config)
49 #:use-module (gnu packages python)
50 #:use-module (gnu packages python-science)
51 #:use-module (gnu packages python-xyz)
52 #:use-module (gnu packages perl))
62 (url "https://github.com/USCiLab/cereal.git")
63 (commit (string-append "v" version))))
64 (file-name (git-file-name name version))
66 (base32 "1vxkrsnxkiblzi1z61vfix167c184fy868sgwj2dxxgbgjcq2nrh"))))
67 (build-system cmake-build-system)
69 `(;; The only included tests are portability tests requiring
70 ;; cross-compilation and boost. Since we are building cereal on more
71 ;; platforms anyway, there is no compelling reason to build the tests.
75 (modify-phases %standard-phases
79 (substitute* "doc/doxygen.in"
80 (("@CMAKE_CURRENT_SOURCE_DIR@") "."))
81 (invoke "doxygen" "doc/doxygen.in")
83 ;; There is no "install" target, so we have to provide our own
86 (lambda* (#:key outputs #:allow-other-keys)
87 (let* ((out (assoc-ref outputs "out"))
88 (doc (string-append out "/share/cereal/docs"))
89 (include (string-append out "/include/cereal")))
92 (copy-recursively "include/cereal" include)
93 (copy-recursively "doc/html" doc))
96 `(("doxygen" ,doxygen)))
97 (home-page "http://uscilab.github.io/cereal/")
98 (synopsis "C++11 library for serialization")
100 "Cereal is a header-only C++11 serialization library. Cereal takes
101 arbitrary data types and reversibly turns them into different representations,
102 such as compact binary encodings, XML, or JSON.")
103 (license license:bsd-3)))
105 (define-public msgpack
114 "https://github.com/msgpack/msgpack-c/releases/download/"
115 "cpp-" version "/msgpack-" version ".tar.gz"))
117 '(let ((p (open-file "msgpack.pc.in" "a")))
119 (string-append "Requires: " "zlib" "\n") p)
120 (close-output-port p)
123 (base32 "1ljqmgscdb0f8w8kx2lnswnisyxchcmijbjbmswkv0g187bvqg23"))))
124 (build-system cmake-build-system)
126 `(("googletest" ,googletest)
127 ("pkg-config" ,pkg-config)))
129 `(("zlib" ,zlib))) ;; Msgpack installs two headers (zbuffer.h,
130 ;; zbuffer.hpp) which #include <zlib.h>. However, 'guix gc --references'
131 ;; does not detect a store reference to zlib since these headers are not
133 (home-page "https://www.msgpack.org")
134 (synopsis "Binary serialization library")
135 (description "Msgpack is a library for C/C++ that implements binary
137 (license license:boost1.0)))
139 (define-public libmpack
147 (url "https://github.com/tarruda/libmpack.git")
149 (file-name (git-file-name name version))
151 (base32 "0rai5djdkjz7bsn025k5489in7r1amagw1pib0z4qns6b52kiar2"))))
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")
177 (url "https://github.com/libmpack/libmpack-lua.git")
179 (file-name (git-file-name name version))
181 (base32 "1ijvzgq5hvib03w5rghv31wi7byamwg7qdx5pawvhvnflaii8ivw"))))
182 (build-system gnu-build-system)
184 `(;; FIXME: tests require "busted", which is not yet available in Guix.
188 (let* ((lua-version ,(package-version lua))
189 (lua-major+minor ,(version-major+minor (package-version lua))))
191 "FETCH=echo" ; don't fetch anything from the web
192 "UNTGZ=echo" ; and don't try to unpack it
194 (string-append "MPACK_LUA_VERSION=" lua-version)
195 (string-append "MPACK_LUA_VERSION_NOPATCH=" lua-major+minor)
196 (string-append "PREFIX="
197 (assoc-ref %outputs "out"))
198 (string-append "LUA_CMOD_INSTALLDIR="
199 (assoc-ref %outputs "out")
200 "/lib/lua/" lua-major+minor)))
202 (modify-phases %standard-phases
204 (add-after 'unpack 'unpack-mpack-sources
205 (lambda* (#:key inputs #:allow-other-keys)
206 ;; This is broken because mpack-src is not a file, but all
207 ;; prerequisites are added to the inputs of the gcc invocation.
208 (substitute* "Makefile"
209 (("\\$\\(MPACK\\): mpack-src") "$(MPACK): "))
210 (copy-recursively (assoc-ref inputs "libmpack")
216 `(("pkg-config" ,pkg-config)
217 ("libmpack" ,(package-source libmpack))))
218 (home-page "https://github.com/libmpack/libmpack-lua")
219 (synopsis "Lua bindings for the libmpack binary serialization library")))
221 (define-public lua5.1-libmpack
222 (package (inherit lua-libmpack)
223 (name "lua5.1-libmpack")
225 (substitute-keyword-arguments (package-arguments lua-libmpack)
226 ((#:make-flags flags)
227 `(let* ((lua-version ,(package-version lua-5.1))
228 (lua-major+minor ,(version-major+minor (package-version lua-5.1))))
231 (string-append "MPACK_LUA_VERSION=" lua-version)
232 (string-append "MPACK_LUA_VERSION_NOPATCH=" lua-major+minor)
233 (string-append "PREFIX="
234 (assoc-ref %outputs "out"))
235 (string-append "LUA_CMOD_INSTALLDIR="
236 (assoc-ref %outputs "out")
237 "/lib/lua/" lua-major+minor))))))
239 `(("lua" ,lua-5.1)))))
241 (define-public lua5.2-libmpack
242 (package (inherit lua-libmpack)
243 (name "lua5.2-libmpack")
245 (substitute-keyword-arguments (package-arguments lua-libmpack)
246 ((#:make-flags flags)
247 `(let* ((lua-version ,(package-version lua-5.2))
248 (lua-major+minor ,(version-major+minor (package-version lua-5.2))))
251 (string-append "MPACK_LUA_VERSION=" lua-version)
252 (string-append "MPACK_LUA_VERSION_NOPATCH=" lua-major+minor)
253 (string-append "PREFIX="
254 (assoc-ref %outputs "out"))
255 (string-append "LUA_CMOD_INSTALLDIR="
256 (assoc-ref %outputs "out")
257 "/lib/lua/" lua-major+minor))))))
259 `(("lua" ,lua-5.2)))))
261 (define-public yaml-cpp
269 (url "https://github.com/jbeder/yaml-cpp.git")
270 (commit (string-append "yaml-cpp-" version))))
271 (file-name (git-file-name name version))
273 (base32 "0ykkxzxcwwiv8l8r697gyqh1nl582krpvi7m7l6b40ijnk4pw30s"))))
274 (build-system cmake-build-system)
276 '(#:configure-flags '("-DYAML_BUILD_SHARED_LIBS=ON")))
278 `(("python" ,python)))
279 (home-page "https://github.com/jbeder/yaml-cpp")
280 (synopsis "YAML parser and emitter in C++")
281 (description "YAML parser and emitter in C++ matching the YAML 1.2 spec.")
282 (license license:bsd-3)))
284 (define-public jsoncpp
288 (home-page "https://github.com/open-source-parsers/jsoncpp")
291 (uri (git-reference (url home-page) (commit version)))
292 (file-name (git-file-name name version))
295 "037d1b1qdmn3rksmn1j71j26bv4hkjv7sn7da261k853xb5899sg"))))
296 (build-system cmake-build-system)
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 ;; Tensorflow does not build with jsoncpp 1.8.x. It is built with commit
307 ;; 4356d9bba191e1e16ce7a92073cbf3e63564e973, which lies between version 1.7.2
309 (define-public jsoncpp-for-tensorflow
310 (package (inherit jsoncpp)
316 (url "https://github.com/open-source-parsers/jsoncpp.git")
318 (file-name (git-file-name name version))
321 "1180ln8blrb0mwzpcf78k49hlki6di65q77rsvglf83kfcyh4d7z"))))))
323 (define-public capnproto
330 "https://capnproto.org/capnproto-c++-"
334 "0hfdnhlbskagzgvby8wy6lrxj53zfzpfqimbhga68c0ji2yw1969"))))
335 (build-system gnu-build-system)
338 (modify-phases %standard-phases
339 (add-before 'check 'do-not-require-/etc/services
341 ;; Workaround for test that tries to resolve port name from
342 ;; /etc/services, which is not present in build environment.
343 (substitute* "src/kj/async-io-test.c++" ((":http") ":80"))
345 (add-before 'check 'use-tmp-for-tempory-files
347 ;; Use /tmp for tempory files, as the default /var/tmp directory
349 (substitute* "src/kj/filesystem-disk-test.c++"
350 (("VAR\\_TMP \"/var/tmp\"")
353 (home-page "https://capnproto.org")
354 (synopsis "Capability-based RPC and serialization system")
356 "Cap'n Proto is a very fast data interchange format and capability-based
357 RPC system. Think JSON, except binary. Or think Protocol Buffers, except faster.")
358 (license license:expat)))
360 (define-public libbson
367 (uri (string-append "https://github.com/mongodb/libbson/releases/"
368 "download/" version "/libbson-" version ".tar.gz"))
371 "1fj4554msq0rrz14snbj908dzqj46gh7jg9w9j0akn2b7q911m5a"))))
372 (build-system gnu-build-system)
373 (native-inputs `(("perl" ,perl)))
374 (home-page "http://mongoc.org/libbson/current/index.html")
375 (synopsis "C BSON library")
376 (description "Libbson can create and parse BSON documents. It can also
377 convert JSON documents to BSON and the opposite. BSON stands for Binary JSON,
378 it is comparable to protobuf.")
379 (license license:asl2.0)))
381 (define-public python-ruamel.yaml
383 (name "python-ruamel.yaml")
388 (uri (pypi-uri "ruamel.yaml" version))
391 "0p4i8ad28cbbbjja8b9274irkhnphhvhap3aym6yb8xfp1d72kpw"))))
392 (build-system python-build-system)
394 `(("python-pytest" ,python-pytest)))
396 `(;; TODO: Tests require packaging "ruamel.std.pathlib".
398 (home-page "https://bitbucket.org/ruamel/yaml")
399 (synopsis "YAML 1.2 parser/emitter")
401 "This package provides YAML parser/emitter that supports roundtrip
402 preservation of comments, seq/map flow style, and map key order. It
403 is a derivative of Kirill Simonov’s PyYAML 3.11. It supports YAML 1.2
404 and has round-trip loaders and dumpers. It supports comments. Block
405 style and key ordering are kept, so you can diff the source.")
406 (license license:expat)))
408 (define-public python2-ruamel.yaml
409 (package-with-python2 python-ruamel.yaml))
411 (define-public python-cbor
418 (uri (pypi-uri "cbor" version))
421 "1dmv163cnslyqccrybkxn0c9s1jk1mmafmgxv75iamnz5lk5l8hk"))))
422 (build-system python-build-system)
423 (home-page "https://bitbucket.org/bodhisnarkva/cbor")
424 (synopsis "Implementation of the Concise Binary Object Representation")
426 "Python-cbor provides an implementation of the Concise Binary Object
427 Representation (@dfn{CBOR}). CBOR is comparable to JSON, has a superset of
428 JSON's ability, but serializes to a binary format which is smaller and faster
429 to generate and parse. The two primary functions are @code{cbor.loads} and
431 (license license:asl2.0)))
433 (define-public flatbuffers
440 (uri (string-append "https://github.com/google/flatbuffers/archive/v"
442 (file-name (string-append name "-" version ".tar.gz"))
445 "0z4swldxs0s31hnkqdhsbfmc8vx3p7zsvmqaw4l31r2iikdy651p"))))
446 (build-system cmake-build-system)
448 '(#:build-type "Release"
450 (list (string-append "-DCMAKE_INSTALL_LIBDIR="
451 (assoc-ref %outputs "out") "/lib"))))
452 (home-page "https://google.github.io/flatbuffers/")
453 (synopsis "Memory-efficient serialization library")
454 (description "FlatBuffers is a cross-platform serialization library for C++,
455 C#, C, Go, Java, JavaScript, PHP, and Python. It was originally created for
456 game development and other performance-critical applications.")
457 (license license:asl2.0)))
459 (define-public python-feather-format
461 (name "python-feather-format")
466 (uri (pypi-uri "feather-format" version))
469 "1adivm5w5ji4qv7hq7942vqlk8l2wgw87bdlsia771z14z3zp857"))))
470 (build-system python-build-system)
472 `(("python-pandas" ,python-pandas)
473 ("python-pyarrow" ,python-pyarrow)))
474 (home-page "https://github.com/wesm/feather")
475 (synopsis "Python wrapper to the Feather file format")
476 (description "This package provides a Python wrapper library to the
477 Apache Arrow-based Feather binary columnar serialization data frame format.")
478 (license license:asl2.0)))