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))
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 "1zhsap7d9zqdm9h1qnpaw78v1sh3rx2if7gk4dszs5m3cg1jiapv"))))
122 (build-system cmake-build-system)
124 `(("googletest" ,googletest)
125 ("pkg-config" ,pkg-config)))
127 `(("zlib" ,zlib))) ;; Msgpack installs two headers (zbuffer.h,
128 ;; zbuffer.hpp) which #include <zlib.h>. However, 'guix gc --references'
129 ;; does not detect a store reference to zlib since these headers are not
131 (home-page "https://www.msgpack.org")
132 (synopsis "Binary serialization library")
133 (description "Msgpack is a library for C/C++ that implements binary
135 (license license:boost1.0)))
137 (define-public libmpack
145 (url "https://github.com/tarruda/libmpack.git")
147 (file-name (git-file-name name version))
149 (base32 "0rai5djdkjz7bsn025k5489in7r1amagw1pib0z4qns6b52kiar2"))))
150 (build-system gnu-build-system)
152 `(#:test-target "test"
155 (string-append "PREFIX=" (assoc-ref %outputs "out")))
157 (modify-phases %standard-phases
158 (delete 'configure))))
160 `(("libtool" ,libtool)))
161 (home-page "https://github.com/tarruda/libmpack")
162 (synopsis "Small binary serialization library")
163 (description "Libmpack is a small binary serialization and RPC library
164 that implements both the msgpack and msgpack-rpc specifications.")
165 (license license:expat)))
167 (define-public lua-libmpack
168 (package (inherit libmpack)
169 (name "lua-libmpack")
175 (url "https://github.com/libmpack/libmpack-lua.git")
177 (file-name (git-file-name name version))
179 (base32 "1ijvzgq5hvib03w5rghv31wi7byamwg7qdx5pawvhvnflaii8ivw"))))
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 (copy-recursively (assoc-ref inputs "libmpack")
214 `(("pkg-config" ,pkg-config)
215 ("libmpack" ,(package-source libmpack))))
216 (home-page "https://github.com/libmpack/libmpack-lua")
217 (synopsis "Lua bindings for the libmpack binary serialization library")))
219 (define-public lua5.1-libmpack
220 (package (inherit lua-libmpack)
221 (name "lua5.1-libmpack")
223 (substitute-keyword-arguments (package-arguments lua-libmpack)
224 ((#:make-flags flags)
225 `(let* ((lua-version ,(package-version lua-5.1))
226 (lua-major+minor ,(version-major+minor (package-version lua-5.1))))
229 (string-append "MPACK_LUA_VERSION=" lua-version)
230 (string-append "MPACK_LUA_VERSION_NOPATCH=" lua-major+minor)
231 (string-append "PREFIX="
232 (assoc-ref %outputs "out"))
233 (string-append "LUA_CMOD_INSTALLDIR="
234 (assoc-ref %outputs "out")
235 "/lib/lua/" lua-major+minor))))))
237 `(("lua" ,lua-5.1)))))
239 (define-public lua5.2-libmpack
240 (package (inherit lua-libmpack)
241 (name "lua5.2-libmpack")
243 (substitute-keyword-arguments (package-arguments lua-libmpack)
244 ((#:make-flags flags)
245 `(let* ((lua-version ,(package-version lua-5.2))
246 (lua-major+minor ,(version-major+minor (package-version lua-5.2))))
249 (string-append "MPACK_LUA_VERSION=" lua-version)
250 (string-append "MPACK_LUA_VERSION_NOPATCH=" lua-major+minor)
251 (string-append "PREFIX="
252 (assoc-ref %outputs "out"))
253 (string-append "LUA_CMOD_INSTALLDIR="
254 (assoc-ref %outputs "out")
255 "/lib/lua/" lua-major+minor))))))
257 `(("lua" ,lua-5.2)))))
259 (define-public yaml-cpp
266 "https://github.com/jbeder/yaml-cpp/archive/"
267 "yaml-cpp-" version ".tar.gz"))
270 "01gxn7kc8pzyh4aadjxxzq8cignmbwmm9rfrsmgqfg9w2q75dn74"))))
271 (build-system cmake-build-system)
273 '(#:configure-flags '("-DBUILD_SHARED_LIBS=ON")
275 (modify-phases %standard-phases
276 (add-after 'install 'dont-install-gtest-libraries
277 (lambda* (#:key outputs #:allow-other-keys)
278 (let ((out (assoc-ref outputs "out")))
279 (with-directory-excursion
280 (string-append out "/include")
281 (delete-file-recursively "gtest")
282 (delete-file-recursively "gmock"))
283 (with-directory-excursion
284 (string-append out "/lib")
285 (for-each (lambda (file)
287 '("libgmock.so" "libgmock_main.so"
288 "libgtest.so" "libgtest_main.so"))))
291 `(("python" ,python)))
292 (home-page "https://github.com/jbeder/yaml-cpp")
293 (synopsis "YAML parser and emitter in C++")
294 (description "YAML parser and emitter in C++ matching the YAML 1.2 spec.")
295 (license license:bsd-3)))
297 (define-public jsoncpp
301 (home-page "https://github.com/open-source-parsers/jsoncpp")
304 (uri (git-reference (url home-page) (commit version)))
305 (file-name (git-file-name name version))
308 "00g356iv3kcp0gadj7gbyzf9jn9avvx9vxbxc7c2i5nnry8z72wj"))))
309 (build-system cmake-build-system)
311 `(#:configure-flags '("-DBUILD_SHARED_LIBS:BOOL=YES")))
312 (synopsis "C++ library for interacting with JSON")
313 (description "JsonCpp is a C++ library that allows manipulating JSON values,
314 including serialization and deserialization to and from strings. It can also
315 preserve existing comment in unserialization/serialization steps, making
316 it a convenient format to store user input files.")
317 (license license:expat)))
319 ;; Tensorflow does not build with jsoncpp 1.8.x. It is built with commit
320 ;; 4356d9bba191e1e16ce7a92073cbf3e63564e973, which lies between version 1.7.2
322 (define-public jsoncpp-for-tensorflow
323 (package (inherit jsoncpp)
329 (url "https://github.com/open-source-parsers/jsoncpp.git")
331 (file-name (git-file-name name version))
334 "1180ln8blrb0mwzpcf78k49hlki6di65q77rsvglf83kfcyh4d7z"))))))
336 (define-public capnproto
343 "https://capnproto.org/capnproto-c++-"
347 "0hfdnhlbskagzgvby8wy6lrxj53zfzpfqimbhga68c0ji2yw1969"))))
348 (build-system gnu-build-system)
351 (modify-phases %standard-phases
352 (add-before 'check 'do-not-require-/etc/services
354 ;; Workaround for test that tries to resolve port name from
355 ;; /etc/services, which is not present in build environment.
356 (substitute* "src/kj/async-io-test.c++" ((":http") ":80"))
358 (add-before 'check 'use-tmp-for-tempory-files
360 ;; Use /tmp for tempory files, as the default /var/tmp directory
362 (substitute* "src/kj/filesystem-disk-test.c++"
363 (("VAR\\_TMP \"/var/tmp\"")
366 (home-page "https://capnproto.org")
367 (synopsis "Capability-based RPC and serialization system")
369 "Cap'n Proto is a very fast data interchange format and capability-based
370 RPC system. Think JSON, except binary. Or think Protocol Buffers, except faster.")
371 (license license:expat)))
373 (define-public libbson
380 (uri (string-append "https://github.com/mongodb/libbson/releases/"
381 "download/" version "/libbson-" version ".tar.gz"))
384 "1fj4554msq0rrz14snbj908dzqj46gh7jg9w9j0akn2b7q911m5a"))))
385 (build-system gnu-build-system)
386 (native-inputs `(("perl" ,perl)))
387 (home-page "http://mongoc.org/libbson/current/index.html")
388 (synopsis "C BSON library")
389 (description "Libbson can create and parse BSON documents. It can also
390 convert JSON documents to BSON and the opposite. BSON stands for Binary JSON,
391 it is comparable to protobuf.")
392 (license license:asl2.0)))
394 (define-public nlohmann-json-cpp
396 (name "nlohmann-json-cpp")
401 (url "https://github.com/nlohmann/json.git")
402 (commit (string-append "v" version))))
403 (file-name (git-file-name name version))
406 "0v7xih4zjixxxfvkfbs7a8j9qcvpwlsv4vrkbyns3hc7b44nb8ap"))))
407 (build-system cmake-build-system)
409 ;; Integer overflow tests like those from
410 ;; <https://github.com/nlohmann/json/issues/1447> fail when building with
411 ;; gcc@5. Thus, build with a newer GCC.
414 '(#:phases (modify-phases %standard-phases
415 (add-before 'build 'unset-path-variables
417 (unsetenv "C_INCLUDE_PATH")
418 (unsetenv "CPLUS_INCLUDE_PATH")
420 (home-page "https://nlohmann.github.io/json/")
421 (synopsis "JSON library for C++")
423 "JSON library for C++ trying to accomplish “Intuitive syntax”,
424 “Trivial integration”, and “Serious testing”.
425 However, “Memory efficiency” and “Speed” have not been primary goals.")
426 (license license:expat)))
428 (define-public python-ruamel.yaml
430 (name "python-ruamel.yaml")
435 (uri (pypi-uri "ruamel.yaml" version))
438 "0p4i8ad28cbbbjja8b9274irkhnphhvhap3aym6yb8xfp1d72kpw"))))
439 (build-system python-build-system)
441 `(("python-pytest" ,python-pytest)))
443 `(;; TODO: Tests require packaging "ruamel.std.pathlib".
445 (home-page "https://bitbucket.org/ruamel/yaml")
446 (synopsis "YAML 1.2 parser/emitter")
448 "This package provides YAML parser/emitter that supports roundtrip
449 preservation of comments, seq/map flow style, and map key order. It
450 is a derivative of Kirill Simonov’s PyYAML 3.11. It supports YAML 1.2
451 and has round-trip loaders and dumpers. It supports comments. Block
452 style and key ordering are kept, so you can diff the source.")
453 (license license:expat)))
455 (define-public python2-ruamel.yaml
456 (package-with-python2 python-ruamel.yaml))
458 (define-public python-cbor
465 (uri (pypi-uri "cbor" version))
468 "1dmv163cnslyqccrybkxn0c9s1jk1mmafmgxv75iamnz5lk5l8hk"))))
469 (build-system python-build-system)
470 (home-page "https://bitbucket.org/bodhisnarkva/cbor")
471 (synopsis "Implementation of the Concise Binary Object Representation")
473 "Python-cbor provides an implementation of the Concise Binary Object
474 Representation (@dfn{CBOR}). CBOR is comparable to JSON, has a superset of
475 JSON's ability, but serializes to a binary format which is smaller and faster
476 to generate and parse. The two primary functions are @code{cbor.loads} and
478 (license license:asl2.0)))
480 (define-public flatbuffers
487 (uri (string-append "https://github.com/google/flatbuffers/archive/v"
489 (file-name (string-append name "-" version ".tar.gz"))
492 "0z4swldxs0s31hnkqdhsbfmc8vx3p7zsvmqaw4l31r2iikdy651p"))))
493 (build-system cmake-build-system)
495 '(#:build-type "Release"
497 (list (string-append "-DCMAKE_INSTALL_LIBDIR="
498 (assoc-ref %outputs "out") "/lib"))))
499 (home-page "https://google.github.io/flatbuffers/")
500 (synopsis "Memory-efficient serialization library")
501 (description "FlatBuffers is a cross-platform serialization library for C++,
502 C#, C, Go, Java, JavaScript, PHP, and Python. It was originally created for
503 game development and other performance-critical applications.")
504 (license license:asl2.0)))
506 (define-public python-feather-format
508 (name "python-feather-format")
513 (uri (pypi-uri "feather-format" version))
516 "1adivm5w5ji4qv7hq7942vqlk8l2wgw87bdlsia771z14z3zp857"))))
517 (build-system python-build-system)
519 `(("python-pandas" ,python-pandas)
520 ("python-pyarrow" ,python-pyarrow)))
521 (home-page "https://github.com/wesm/feather")
522 (synopsis "Python wrapper to the Feather file format")
523 (description "This package provides a Python wrapper library to the
524 Apache Arrow-based Feather binary columnar serialization data frame format.")
525 (license license:asl2.0)))
527 (define-public python2-feather-format
528 (package-with-python2 python-feather-format))