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 databases)
44 #:use-module (gnu packages documentation)
45 #:use-module (gnu packages gcc)
46 #:use-module (gnu packages lua)
47 #:use-module (gnu packages pkg-config)
48 #:use-module (gnu packages python)
49 #:use-module (gnu packages python-xyz)
50 #:use-module (gnu packages perl))
60 (url "https://github.com/USCiLab/cereal.git")
61 (commit (string-append "v" version))))
62 (file-name (git-file-name name version))
64 (base32 "1vxkrsnxkiblzi1z61vfix167c184fy868sgwj2dxxgbgjcq2nrh"))))
65 (build-system cmake-build-system)
67 `(;; The only included tests are portability tests requiring
68 ;; cross-compilation and boost. Since we are building cereal on more
69 ;; platforms anyway, there is no compelling reason to build the tests.
73 (modify-phases %standard-phases
77 (substitute* "doc/doxygen.in"
78 (("@CMAKE_CURRENT_SOURCE_DIR@") "."))
79 (invoke "doxygen" "doc/doxygen.in")
81 ;; There is no "install" target, so we have to provide our own
84 (lambda* (#:key outputs #:allow-other-keys)
85 (let* ((out (assoc-ref outputs "out"))
86 (doc (string-append out "/share/cereal/docs"))
87 (include (string-append out "/include/cereal")))
90 (copy-recursively "include/cereal" include)
91 (copy-recursively "doc/html" doc))
94 `(("doxygen" ,doxygen)))
95 (home-page "http://uscilab.github.io/cereal/")
96 (synopsis "C++11 library for serialization")
98 "Cereal is a header-only C++11 serialization library. Cereal takes
99 arbitrary data types and reversibly turns them into different representations,
100 such as compact binary encodings, XML, or JSON.")
101 (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")))
117 (string-append "Requires: " "zlib" "\n") p)
118 (close-output-port p)
122 "1zhsap7d9zqdm9h1qnpaw78v1sh3rx2if7gk4dszs5m3cg1jiapv"))))
123 (build-system cmake-build-system)
125 `(("googletest" ,googletest)
126 ("pkg-config" ,pkg-config)))
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
132 (home-page "https://www.msgpack.org")
133 (synopsis "Binary serialization library")
134 (description "Msgpack is a library for C/C++ that implements binary
136 (license license:boost1.0)))
138 (define-public libmpack
146 (url "https://github.com/tarruda/libmpack.git")
148 (file-name (git-file-name name version))
150 (base32 "0rai5djdkjz7bsn025k5489in7r1amagw1pib0z4qns6b52kiar2"))))
151 (build-system gnu-build-system)
153 `(#:test-target "test"
156 (string-append "PREFIX=" (assoc-ref %outputs "out")))
158 (modify-phases %standard-phases
159 (delete 'configure))))
161 `(("libtool" ,libtool)))
162 (home-page "https://github.com/tarruda/libmpack")
163 (synopsis "Small binary serialization library")
164 (description "Libmpack is a small binary serialization and RPC library
165 that implements both the msgpack and msgpack-rpc specifications.")
166 (license license:expat)))
168 (define-public lua-libmpack
169 (package (inherit libmpack)
170 (name "lua-libmpack")
176 (url "https://github.com/libmpack/libmpack-lua.git")
178 (file-name (git-file-name name version))
180 (base32 "1ijvzgq5hvib03w5rghv31wi7byamwg7qdx5pawvhvnflaii8ivw"))))
181 (build-system gnu-build-system)
183 `(;; FIXME: tests require "busted", which is not yet available in Guix.
187 (let* ((lua-version ,(package-version lua))
188 (lua-major+minor ,(version-major+minor (package-version lua))))
190 "FETCH=echo" ; don't fetch anything from the web
191 "UNTGZ=echo" ; and don't try to unpack it
193 (string-append "MPACK_LUA_VERSION=" lua-version)
194 (string-append "MPACK_LUA_VERSION_NOPATCH=" lua-major+minor)
195 (string-append "PREFIX="
196 (assoc-ref %outputs "out"))
197 (string-append "LUA_CMOD_INSTALLDIR="
198 (assoc-ref %outputs "out")
199 "/lib/lua/" lua-major+minor)))
201 (modify-phases %standard-phases
203 (add-after 'unpack 'unpack-mpack-sources
204 (lambda* (#:key inputs #:allow-other-keys)
205 ;; This is broken because mpack-src is not a file, but all
206 ;; prerequisites are added to the inputs of the gcc invocation.
207 (substitute* "Makefile"
208 (("\\$\\(MPACK\\): mpack-src") "$(MPACK): "))
209 (copy-recursively (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 (modify-phases %standard-phases
277 (add-after 'install 'dont-install-gtest-libraries
278 (lambda* (#:key outputs #:allow-other-keys)
279 (let ((out (assoc-ref outputs "out")))
280 (with-directory-excursion
281 (string-append out "/include")
282 (delete-file-recursively "gtest")
283 (delete-file-recursively "gmock"))
284 (with-directory-excursion
285 (string-append out "/lib")
286 (for-each (lambda (file)
288 '("libgmock.so" "libgmock_main.so"
289 "libgtest.so" "libgtest_main.so"))))
292 `(("python" ,python)))
293 (home-page "https://github.com/jbeder/yaml-cpp")
294 (synopsis "YAML parser and emitter in C++")
295 (description "YAML parser and emitter in C++ matching the YAML 1.2 spec.")
296 (license license:bsd-3)))
298 (define-public jsoncpp
302 (home-page "https://github.com/open-source-parsers/jsoncpp")
305 (uri (git-reference (url home-page) (commit version)))
306 (file-name (git-file-name name version))
309 "00g356iv3kcp0gadj7gbyzf9jn9avvx9vxbxc7c2i5nnry8z72wj"))))
310 (build-system cmake-build-system)
312 `(#:configure-flags '("-DBUILD_SHARED_LIBS:BOOL=YES")))
313 (synopsis "C++ library for interacting with JSON")
314 (description "JsonCpp is a C++ library that allows manipulating JSON values,
315 including serialization and deserialization to and from strings. It can also
316 preserve existing comment in unserialization/serialization steps, making
317 it a convenient format to store user input files.")
318 (license license:expat)))
320 ;; Tensorflow does not build with jsoncpp 1.8.x. It is built with commit
321 ;; 4356d9bba191e1e16ce7a92073cbf3e63564e973, which lies between version 1.7.2
323 (define-public jsoncpp-for-tensorflow
324 (package (inherit jsoncpp)
330 (url "https://github.com/open-source-parsers/jsoncpp.git")
332 (file-name (git-file-name name version))
335 "1180ln8blrb0mwzpcf78k49hlki6di65q77rsvglf83kfcyh4d7z"))))))
337 (define-public capnproto
344 "https://capnproto.org/capnproto-c++-"
348 "0hfdnhlbskagzgvby8wy6lrxj53zfzpfqimbhga68c0ji2yw1969"))))
349 (build-system gnu-build-system)
352 (modify-phases %standard-phases
353 (add-before 'check 'do-not-require-/etc/services
355 ;; Workaround for test that tries to resolve port name from
356 ;; /etc/services, which is not present in build environment.
357 (substitute* "src/kj/async-io-test.c++" ((":http") ":80"))
359 (add-before 'check 'use-tmp-for-tempory-files
361 ;; Use /tmp for tempory files, as the default /var/tmp directory
363 (substitute* "src/kj/filesystem-disk-test.c++"
364 (("VAR\\_TMP \"/var/tmp\"")
367 (home-page "https://capnproto.org")
368 (synopsis "Capability-based RPC and serialization system")
370 "Cap'n Proto is a very fast data interchange format and capability-based
371 RPC system. Think JSON, except binary. Or think Protocol Buffers, except faster.")
372 (license license:expat)))
374 (define-public libbson
381 (uri (string-append "https://github.com/mongodb/libbson/releases/"
382 "download/" version "/libbson-" version ".tar.gz"))
385 "1fj4554msq0rrz14snbj908dzqj46gh7jg9w9j0akn2b7q911m5a"))))
386 (build-system gnu-build-system)
387 (native-inputs `(("perl" ,perl)))
388 (home-page "http://mongoc.org/libbson/current/index.html")
389 (synopsis "C BSON library")
390 (description "Libbson can create and parse BSON documents. It can also
391 convert JSON documents to BSON and the opposite. BSON stands for Binary JSON,
392 it is comparable to protobuf.")
393 (license license:asl2.0)))
395 (define-public nlohmann-json-cpp
397 (name "nlohmann-json-cpp")
402 (url "https://github.com/nlohmann/json.git")
403 (commit (string-append "v" version))))
404 (file-name (git-file-name name version))
407 "0v7xih4zjixxxfvkfbs7a8j9qcvpwlsv4vrkbyns3hc7b44nb8ap"))))
408 (build-system cmake-build-system)
410 ;; Integer overflow tests like those from
411 ;; <https://github.com/nlohmann/json/issues/1447> fail when building with
412 ;; gcc@5. Thus, build with a newer GCC.
415 '(#:phases (modify-phases %standard-phases
416 (add-before 'build 'unset-path-variables
418 (unsetenv "C_INCLUDE_PATH")
419 (unsetenv "CPLUS_INCLUDE_PATH")
421 (home-page "https://nlohmann.github.io/json/")
422 (synopsis "JSON library for C++")
424 "JSON library for C++ trying to accomplish “Intuitive syntax”,
425 “Trivial integration”, and “Serious testing”.
426 However, “Memory efficiency” and “Speed” have not been primary goals.")
427 (license license:expat)))
429 (define-public python-ruamel.yaml
431 (name "python-ruamel.yaml")
436 (uri (pypi-uri "ruamel.yaml" version))
439 "0p4i8ad28cbbbjja8b9274irkhnphhvhap3aym6yb8xfp1d72kpw"))))
440 (build-system python-build-system)
442 `(("python-pytest" ,python-pytest)))
444 `(;; TODO: Tests require packaging "ruamel.std.pathlib".
446 (home-page "https://bitbucket.org/ruamel/yaml")
447 (synopsis "YAML 1.2 parser/emitter")
449 "This package provides YAML parser/emitter that supports roundtrip
450 preservation of comments, seq/map flow style, and map key order. It
451 is a derivative of Kirill Simonov’s PyYAML 3.11. It supports YAML 1.2
452 and has round-trip loaders and dumpers. It supports comments. Block
453 style and key ordering are kept, so you can diff the source.")
454 (license license:expat)))
456 (define-public python2-ruamel.yaml
457 (package-with-python2 python-ruamel.yaml))
459 (define-public python-cbor
466 (uri (pypi-uri "cbor" version))
469 "1dmv163cnslyqccrybkxn0c9s1jk1mmafmgxv75iamnz5lk5l8hk"))))
470 (build-system python-build-system)
471 (home-page "https://bitbucket.org/bodhisnarkva/cbor")
472 (synopsis "Implementation of the Concise Binary Object Representation")
474 "Python-cbor provides an implementation of the Concise Binary Object
475 Representation (@dfn{CBOR}). CBOR is comparable to JSON, has a superset of
476 JSON's ability, but serializes to a binary format which is smaller and faster
477 to generate and parse. The two primary functions are @code{cbor.loads} and
479 (license license:asl2.0)))
481 (define-public flatbuffers
488 (uri (string-append "https://github.com/google/flatbuffers/archive/v"
490 (file-name (string-append name "-" version ".tar.gz"))
493 "0z4swldxs0s31hnkqdhsbfmc8vx3p7zsvmqaw4l31r2iikdy651p"))))
494 (build-system cmake-build-system)
496 '(#:build-type "Release"
498 (list (string-append "-DCMAKE_INSTALL_LIBDIR="
499 (assoc-ref %outputs "out") "/lib"))))
500 (home-page "https://google.github.io/flatbuffers/")
501 (synopsis "Memory-efficient serialization library")
502 (description "FlatBuffers is a cross-platform serialization library for C++,
503 C#, C, Go, Java, JavaScript, PHP, and Python. It was originally created for
504 game development and other performance-critical applications.")
505 (license license:asl2.0)))
507 (define-public python-feather-format
509 (name "python-feather-format")
514 (uri (pypi-uri "feather-format" version))
517 "1adivm5w5ji4qv7hq7942vqlk8l2wgw87bdlsia771z14z3zp857"))))
518 (build-system python-build-system)
520 `(("python-pandas" ,python-pandas)
521 ("python-pyarrow" ,python-pyarrow)))
522 (home-page "https://github.com/wesm/feather")
523 (synopsis "Python wrapper to the Feather file format")
524 (description "This package provides a Python wrapper library to the
525 Apache Arrow-based Feather binary columnar serialization data frame format.")
526 (license license:asl2.0)))