1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2015, 2017, 2019, 2020, 2021 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, 2020 Marius Bakke <mbakke@fastmail.com>
6 ;;; Copyright © 2016, 2018, 2019, 2021 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 Nikita <nikita@n0.is>
11 ;;; Copyright © 2017, 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
12 ;;; Copyright © 2018 Joshua Sierles, Nextjournal <joshua@nextjournal.com>
13 ;;; Copyright © 2020 Martin Becze <mjbecze@riseup.net>
14 ;;; Copyright © 2020 Alexandros Theodotou <alex@zrythm.org>
16 ;;; This file is part of GNU Guix.
18 ;;; GNU Guix is free software; you can redistribute it and/or modify it
19 ;;; under the terms of the GNU General Public License as published by
20 ;;; the Free Software Foundation; either version 3 of the License, or (at
21 ;;; your option) any later version.
23 ;;; GNU Guix is distributed in the hope that it will be useful, but
24 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
25 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 ;;; GNU General Public License for more details.
28 ;;; You should have received a copy of the GNU General Public License
29 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
31 (define-module (gnu packages serialization)
32 #:use-module ((guix licenses) #:prefix license:)
33 #:use-module (guix packages)
34 #:use-module (guix download)
35 #:use-module (guix hg-download)
36 #:use-module (guix git-download)
37 #:use-module (guix utils)
38 #:use-module (guix build-system cmake)
39 #:use-module (guix build-system gnu)
40 #:use-module (guix build-system python)
41 #:use-module (gnu packages)
42 #:use-module (gnu packages autotools)
43 #:use-module (gnu packages boost)
44 #:use-module (gnu packages check)
45 #:use-module (gnu packages compression)
46 #:use-module (gnu packages cmake)
47 #:use-module (gnu packages cpp)
48 #:use-module (gnu packages databases)
49 #:use-module (gnu packages documentation)
50 #:use-module (gnu packages gcc)
51 #:use-module (gnu packages llvm)
52 #:use-module (gnu packages lua)
53 #:use-module (gnu packages pkg-config)
54 #:use-module (gnu packages python)
55 #:use-module (gnu packages python-science)
56 #:use-module (gnu packages python-xyz)
57 #:use-module (gnu packages perl))
59 (define-public avro-cpp-1.9
66 "https://archive.apache.org/dist/avro/avro-" version
67 "/avro-src-" version ".tar.gz"))
69 (base32 "0i3fpm7r72yw397qc8yw9ybzk2mxjkv0yk5hnn00ylc1wbd0np73"))))
70 (build-system cmake-build-system)
73 (modify-phases %standard-phases
74 (add-after 'unpack 'chdir
75 (lambda _ (chdir "lang/c++"))))))
79 (home-page "https://avro.apache.org/")
80 (synopsis "Data serialization system")
81 (description "Apache Avro is a data serialization system. Avro provides:
83 @item Rich data structures;
84 @item a compact, fast, binary data format;
85 @item a container file, to store persistent data;
86 @item remote procedure call (RPC); and
87 @item simple integration with dynamic languages.
90 Code generation is not required to read or write data files nor to use or
91 implement RPC protocols.")
92 (license license:asl2.0)))
94 (define-public avro-cpp-1.9-for-irods
96 (inherit avro-cpp-1.9)
97 (properties `((hidden? . #true)))
100 '("-DCMAKE_CXX_COMPILER=clang++"
101 "-DCMAKE_CXX_FLAGS=-stdlib=libc++"
102 "-DCMAKE_EXE_LINKER_FLAGS=-lc++abi -lz")
104 (modify-phases %standard-phases
105 (add-after 'unpack 'chdir
106 (lambda _ (chdir "lang/c++")))
107 (add-after 'set-paths 'adjust-CPLUS_INCLUDE_PATH
108 (lambda* (#:key inputs #:allow-other-keys)
109 (let ((gcc (assoc-ref inputs "gcc")))
110 (setenv "CPLUS_INCLUDE_PATH"
112 (cons* (search-input-directory inputs "include/c++/v1")
113 ;; Hide GCC's C++ headers so that they do not interfere with
114 ;; the Clang headers.
115 (delete (string-append gcc "/include/c++")
116 (string-split (getenv "CPLUS_INCLUDE_PATH")
120 "environment variable `CPLUS_INCLUDE_PATH' changed to ~a~%"
121 (getenv "CPLUS_INCLUDE_PATH"))))))))
123 `(("boost" ,boost-for-irods)
124 ("clang" ,clang-toolchain-6)
125 ("libcxx+libcxxabi" ,libcxx+libcxxabi-6)
126 ("libcxxabi" ,libcxxabi-6)
127 ("snappy" ,snappy-with-clang6)
130 (define-public cereal
138 (url "https://github.com/USCiLab/cereal")
139 (commit (string-append "v" version))))
140 (file-name (git-file-name name version))
143 "0hc8wh9dwpc1w1zf5lfss4vg5hmgpblqxbrpp1rggicpx9ar831p"))))
144 (build-system cmake-build-system)
146 `(;; The only included tests are portability tests requiring
147 ;; cross-compilation and boost. Since we are building cereal on more
148 ;; platforms anyway, there is no compelling reason to build the tests.
152 (modify-phases %standard-phases
156 (substitute* "doc/doxygen.in"
157 (("@CMAKE_CURRENT_BINARY_DIR@") ".")
158 (("@CMAKE_CURRENT_SOURCE_DIR@") "."))
159 (with-directory-excursion "doc"
160 (invoke "doxygen" "doxygen.in"))))
161 ;; There is no "install" target, so we have to provide our own
164 (lambda* (#:key outputs #:allow-other-keys)
165 (let* ((out (assoc-ref outputs "out"))
166 (doc (string-append out "/share/cereal/docs"))
167 (include (string-append out "/include/cereal")))
170 (copy-recursively "include/cereal" include)
171 (copy-recursively "doc/html" doc)))))))
173 `(("doxygen" ,doxygen)))
174 (home-page "https://uscilab.github.io/cereal/")
175 (synopsis "C++11 library for serialization")
177 "Cereal is a header-only C++11 serialization library. Cereal takes
178 arbitrary data types and reversibly turns them into different representations,
179 such as compact binary encodings, XML, or JSON.")
180 (license license:bsd-3)))
182 (define-public msgpack
191 "https://github.com/msgpack/msgpack-c/releases/download/"
192 "cpp-" version "/msgpack-" version ".tar.gz"))
194 '(let ((p (open-file "msgpack.pc.in" "a")))
196 (string-append "Requires: " "zlib" "\n") p)
197 (close-output-port p)
200 (base32 "0yzhq50ijvwrfkr97knhvn54lj3f4hr3zy39yq8wpf6xll94s4bf"))))
201 (build-system cmake-build-system)
203 `(("googletest" ,googletest-1.8)
204 ("pkg-config" ,pkg-config)))
206 `(("zlib" ,zlib))) ;; Msgpack installs two headers (zbuffer.h,
207 ;; zbuffer.hpp) which #include <zlib.h>. However, 'guix gc --references'
208 ;; does not detect a store reference to zlib since these headers are not
210 (home-page "https://www.msgpack.org")
211 (synopsis "Binary serialization library")
212 (description "Msgpack is a library for C/C++ that implements binary
214 (license license:boost1.0)))
216 (define-public libmpack
224 (url "https://github.com/tarruda/libmpack")
226 (file-name (git-file-name name version))
228 (base32 "0rai5djdkjz7bsn025k5489in7r1amagw1pib0z4qns6b52kiar2"))))
229 (build-system gnu-build-system)
231 `(#:test-target "test"
234 (string-append "PREFIX=" (assoc-ref %outputs "out")))
236 (modify-phases %standard-phases
237 (delete 'configure))))
239 `(("libtool" ,libtool)))
240 (home-page "https://github.com/tarruda/libmpack")
241 (synopsis "Small binary serialization library")
242 (description "Libmpack is a small binary serialization and RPC library
243 that implements both the msgpack and msgpack-rpc specifications.")
244 (license license:expat)))
246 (define-public lua-libmpack
247 (package (inherit libmpack)
248 (name "lua-libmpack")
254 (url "https://github.com/libmpack/libmpack-lua")
256 (file-name (git-file-name name version))
258 (base32 "1ijvzgq5hvib03w5rghv31wi7byamwg7qdx5pawvhvnflaii8ivw"))))
259 (build-system gnu-build-system)
261 `(;; FIXME: tests require "busted", which is not yet available in Guix.
265 (let* ((lua-version ,(package-version lua))
266 (lua-major+minor ,(version-major+minor (package-version lua))))
268 "FETCH=echo" ; don't fetch anything from the web
269 "UNTGZ=echo" ; and don't try to unpack it
271 (string-append "MPACK_LUA_VERSION=" lua-version)
272 (string-append "MPACK_LUA_VERSION_NOPATCH=" lua-major+minor)
273 (string-append "PREFIX="
274 (assoc-ref %outputs "out"))
275 (string-append "LUA_CMOD_INSTALLDIR="
276 (assoc-ref %outputs "out")
277 "/lib/lua/" lua-major+minor)))
279 (modify-phases %standard-phases
281 (add-after 'unpack 'unpack-mpack-sources
282 (lambda* (#:key inputs #:allow-other-keys)
283 ;; This is broken because mpack-src is not a file, but all
284 ;; prerequisites are added to the inputs of the gcc invocation.
285 (substitute* "Makefile"
286 (("\\$\\(MPACK\\): mpack-src") "$(MPACK): "))
287 (copy-recursively (assoc-ref inputs "libmpack")
293 `(("pkg-config" ,pkg-config)
294 ("libmpack" ,(package-source libmpack))))
295 (home-page "https://github.com/libmpack/libmpack-lua")
296 (synopsis "Lua bindings for the libmpack binary serialization library")))
298 (define-public lua5.1-libmpack
299 (package/inherit lua-libmpack
300 (name "lua5.1-libmpack")
302 (substitute-keyword-arguments (package-arguments lua-libmpack)
303 ((#:make-flags flags)
304 `(let* ((lua-version ,(package-version lua-5.1))
305 (lua-major+minor ,(version-major+minor (package-version lua-5.1))))
308 (string-append "MPACK_LUA_VERSION=" lua-version)
309 (string-append "MPACK_LUA_VERSION_NOPATCH=" lua-major+minor)
310 (string-append "PREFIX="
311 (assoc-ref %outputs "out"))
312 (string-append "LUA_CMOD_INSTALLDIR="
313 (assoc-ref %outputs "out")
314 "/lib/lua/" lua-major+minor))))))
316 `(("lua" ,lua-5.1)))))
318 (define-public lua5.2-libmpack
319 (package/inherit lua-libmpack
320 (name "lua5.2-libmpack")
322 (substitute-keyword-arguments (package-arguments lua-libmpack)
323 ((#:make-flags flags)
324 `(let* ((lua-version ,(package-version lua-5.2))
325 (lua-major+minor ,(version-major+minor (package-version lua-5.2))))
328 (string-append "MPACK_LUA_VERSION=" lua-version)
329 (string-append "MPACK_LUA_VERSION_NOPATCH=" lua-major+minor)
330 (string-append "PREFIX="
331 (assoc-ref %outputs "out"))
332 (string-append "LUA_CMOD_INSTALLDIR="
333 (assoc-ref %outputs "out")
334 "/lib/lua/" lua-major+minor))))))
336 `(("lua" ,lua-5.2)))))
338 (define-public libyaml
345 (uri (string-append "https://pyyaml.org/download/libyaml/yaml-"
349 "1x4fcw13r3lqy8ndydr3ili87wicplw2awbcv6r21qgyfndswhn6"))))
350 (build-system gnu-build-system)
352 '(#:configure-flags '("--disable-static")))
353 (home-page "https://pyyaml.org/wiki/LibYAML")
354 (synopsis "YAML 1.1 parser and emitter written in C")
356 "LibYAML is a YAML 1.1 parser and emitter written in C.")
357 (license license:expat)))
359 (define-public libyaml+static
362 (name "libyaml+static")
364 '(#:configure-flags '("--enable-static")))))
366 (define-public libcyaml
374 (url "https://github.com/tlsa/libcyaml")
375 (commit (string-append "v" version))))
376 (file-name (git-file-name name version))
377 (patches (search-patches "libcyaml-libyaml-compat.patch"))
379 (base32 "0428p0rwq71nhh5nzcbapsbrjxa0x5l6h6ns32nxv7j624f0zd93"))))
380 (build-system gnu-build-system)
383 (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
384 (string-append "CC=gcc"))
386 (modify-phases %standard-phases
387 (delete 'configure) ; no configure script
391 (invoke "make" "test"))))))
393 `(("libyaml" ,libyaml)))
395 `(("pkg-config" ,pkg-config)))
396 (synopsis "C library for reading and writing YAML")
398 "LibCYAML is a C library written in ISO C11 for reading and writing
399 structured YAML documents. The fundamental idea behind CYAML is to allow
400 applications to construct schemas which describe both the permissible
401 structure of the YAML documents to read/write, and the C data structure(s)
402 in which the loaded data is arranged in memory.")
403 (home-page "https://github.com/tlsa/libcyaml")
404 (license license:isc)))
406 (define-public yaml-cpp
414 (url "https://github.com/jbeder/yaml-cpp")
415 (commit (string-append "yaml-cpp-" version))))
416 (file-name (git-file-name name version))
418 (base32 "0ykkxzxcwwiv8l8r697gyqh1nl582krpvi7m7l6b40ijnk4pw30s"))))
419 (build-system cmake-build-system)
421 '(#:configure-flags '("-DYAML_BUILD_SHARED_LIBS=ON")))
423 `(("python" ,python)))
424 (home-page "https://github.com/jbeder/yaml-cpp")
425 (synopsis "YAML parser and emitter in C++")
426 (description "YAML parser and emitter in C++ matching the YAML 1.2 spec.")
427 (license license:bsd-3)))
429 (define-public jsoncpp
433 (home-page "https://github.com/open-source-parsers/jsoncpp")
436 (uri (git-reference (url home-page) (commit version)))
437 (file-name (git-file-name name version))
440 "0qnx5y6c90fphl9mj9d20j2dfgy6s5yr5l0xnzid0vh71zrp6jwv"))))
441 (build-system cmake-build-system)
443 `(#:configure-flags '("-DBUILD_SHARED_LIBS:BOOL=YES"
444 ,@(if (%current-target-system)
445 `("-DJSONCPP_WITH_POST_BUILD_UNITTEST=OFF")
447 ,@(if (%current-target-system)
449 `(#:cmake ,cmake-bootstrap))))
450 (synopsis "C++ library for interacting with JSON")
451 (description "JsonCpp is a C++ library that allows manipulating JSON values,
452 including serialization and deserialization to and from strings. It can also
453 preserve existing comment in unserialization/serialization steps, making
454 it a convenient format to store user input files.")
455 (license license:expat)))
457 ;; XXX: TODO(core-updates): Remove this package and apply the patch to the
458 ;; jsoncpp package. This patch fixes the package version declared in the
460 (define-public jsoncpp-with-pkg-version
465 (home-page "https://github.com/open-source-parsers/jsoncpp")
468 (uri (git-reference (url home-page) (commit version)))
469 (file-name (git-file-name name version))
472 "0qnx5y6c90fphl9mj9d20j2dfgy6s5yr5l0xnzid0vh71zrp6jwv"))
474 (search-patches "jsoncpp-pkg-config-version.patch"))))))
476 ;; Tensorflow does not build with jsoncpp 1.8.x. It is built with commit
477 ;; 4356d9bba191e1e16ce7a92073cbf3e63564e973, which lies between version 1.7.2
479 (define-public jsoncpp-for-tensorflow
480 (package (inherit jsoncpp)
486 (url "https://github.com/open-source-parsers/jsoncpp")
488 (file-name (git-file-name name version))
491 "1180ln8blrb0mwzpcf78k49hlki6di65q77rsvglf83kfcyh4d7z"))))))
493 (define-public capnproto
500 "https://capnproto.org/capnproto-c++-"
504 "03f1862ljdshg7d0rg3j7jzgm3ip55kzd2y91q7p0racax3hxx6i"))))
505 (build-system gnu-build-system)
508 (modify-phases %standard-phases
509 (add-before 'check 'do-not-require-/etc/services
511 ;; Workaround for test that tries to resolve port name from
512 ;; /etc/services, which is not present in build environment.
513 (substitute* "src/kj/async-io-test.c++" ((":http") ":80"))
515 (add-before 'check 'use-tmp-for-temporary-files
517 ;; Use /tmp for temporary files, as the default /var/tmp directory
519 (substitute* "src/kj/filesystem-disk-test.c++"
520 (("VAR\\_TMP \"/var/tmp\"")
523 (home-page "https://capnproto.org")
524 (synopsis "Capability-based RPC and serialization system")
526 "Cap'n Proto is a very fast data interchange format and capability-based
527 RPC system. Think JSON, except binary. Or think Protocol Buffers, except faster.")
528 (license license:expat)))
530 (define-public libbson
537 (uri (string-append "https://github.com/mongodb/libbson/releases/"
538 "download/" version "/libbson-" version ".tar.gz"))
541 "1fj4554msq0rrz14snbj908dzqj46gh7jg9w9j0akn2b7q911m5a"))))
542 (build-system gnu-build-system)
543 (native-inputs `(("perl" ,perl)))
544 (home-page "http://mongoc.org/libbson/current/index.html")
545 (synopsis "C BSON library")
546 (description "Libbson can create and parse BSON documents. It can also
547 convert JSON documents to BSON and the opposite. BSON stands for Binary JSON,
548 it is comparable to protobuf.")
549 (license license:asl2.0)))
551 (define-public python-ruamel.yaml
553 (name "python-ruamel.yaml")
558 (uri (pypi-uri "ruamel.yaml" version))
561 "0hm9yg785f46bkrgqknd6fdvmkby9dpzjnm0b63qf0i748acaj5v"))))
562 (build-system python-build-system)
564 `(("python-pytest" ,python-pytest)))
566 `(("python-ruamel.yaml.clib" ,python-ruamel.yaml.clib)))
568 `(;; TODO: Tests require packaging "ruamel.std.pathlib".
570 (home-page "https://sourceforge.net/projects/ruamel-yaml/")
571 (synopsis "YAML 1.2 parser/emitter")
573 "This package provides YAML parser/emitter that supports roundtrip
574 preservation of comments, seq/map flow style, and map key order. It
575 is a derivative of Kirill Simonov’s PyYAML 3.11. It supports YAML 1.2
576 and has round-trip loaders and dumpers. It supports comments. Block
577 style and key ordering are kept, so you can diff the source.")
578 (license license:expat)))
580 (define-public python-ruamel.yaml.clib
582 (name "python-ruamel.yaml.clib")
586 ;; pypi release code has cythonized code without corresponding source.
589 (url "http://hg.code.sf.net/p/ruamel-yaml-clib/code")
590 (changeset version)))
591 (file-name (string-append name "-" version "-checkout"))
594 "05m3y7pjfbaarqbbgw1k6gs6cnnmxnwadjipxvw1aaaqk3s236cs"))
595 (modules '((guix build utils)))
598 (delete-file "_ruamel_yaml.c")))))
599 (build-system python-build-system)
601 `(#:tests? #f ; This package is split from python-ruamel.yaml and
602 ; depends on modules from it for the test suite.
604 (modify-phases %standard-phases
605 (delete 'sanity-check) ; Depends on python-ruamel.yaml
606 (add-after 'unpack 'cythonize-code
608 (invoke "cython" "_ruamel_yaml.pyx"))))))
610 `(("python-cython" ,python-cython)))
611 (home-page "https://sourceforge.net/p/ruamel-yaml-clib/code/ci/default/tree")
612 (synopsis "C version of reader, parser and emitter for ruamel.yaml")
614 "This package provides a C version of the reader, parser and emitter for
615 @code{ruamel.yaml} derived from libyaml.")
616 (license license:expat)))
618 (define-public python-cbor
625 (uri (pypi-uri "cbor" version))
628 "1dmv163cnslyqccrybkxn0c9s1jk1mmafmgxv75iamnz5lk5l8hk"))))
629 (build-system python-build-system)
630 (home-page "https://bitbucket.org/bodhisnarkva/cbor")
631 (synopsis "Implementation of the Concise Binary Object Representation")
633 "Python-cbor provides an implementation of the Concise Binary Object
634 Representation (@dfn{CBOR}). CBOR is comparable to JSON, has a superset of
635 JSON's ability, but serializes to a binary format which is smaller and faster
636 to generate and parse. The two primary functions are @code{cbor.loads} and
638 (license license:asl2.0)))
640 (define-public flatbuffers
648 (url "https://github.com/google/flatbuffers")
649 (commit (string-append "v" version))))
650 (file-name (git-file-name name version))
653 "1zbf6bdpps8369r1ql00irxrp58jnalycc8jcapb8iqg654vlfz8"))))
654 (build-system cmake-build-system)
656 '(#:build-type "Release"
658 (list "-DFLATBUFFERS_BUILD_SHAREDLIB=ON"
659 (string-append "-DCMAKE_INSTALL_LIBDIR="
660 (assoc-ref %outputs "out") "/lib"))
662 (modify-phases %standard-phases
663 (add-after 'unpack 'make-writable
664 (lambda _ (for-each make-file-writable (find-files ".")))))))
665 (home-page "https://google.github.io/flatbuffers/")
666 (synopsis "Memory-efficient serialization library")
667 (description "FlatBuffers is a cross-platform serialization library for C++,
668 C#, C, Go, Java, JavaScript, PHP, and Python. It was originally created for
669 game development and other performance-critical applications.")
670 (license license:asl2.0)))
672 (define-public python-feather-format
674 (name "python-feather-format")
679 (uri (pypi-uri "feather-format" version))
682 "00w9hwz7sj3fkdjc378r066vdy6lpxmn6vfac3qx956k8lvpxxj5"))))
683 (build-system python-build-system)
685 `(("python-pandas" ,python-pandas)
686 ("python-pyarrow" ,python-pyarrow)))
687 (home-page "https://github.com/wesm/feather")
688 (synopsis "Python wrapper to the Feather file format")
689 (description "This package provides a Python wrapper library to the
690 Apache Arrow-based Feather binary columnar serialization data frame format.")
691 (license license:asl2.0)))