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 copy)
40 #:use-module (guix build-system gnu)
41 #:use-module (guix build-system python)
42 #:use-module (gnu packages)
43 #:use-module (gnu packages autotools)
44 #:use-module (gnu packages base)
45 #:use-module (gnu packages bash)
46 #:use-module (gnu packages boost)
47 #:use-module (gnu packages check)
48 #:use-module (gnu packages compression)
49 #:use-module (gnu packages cmake)
50 #:use-module (gnu packages cpp)
51 #:use-module (gnu packages databases)
52 #:use-module (gnu packages documentation)
53 #:use-module (gnu packages gcc)
54 #:use-module (gnu packages llvm)
55 #:use-module (gnu packages lua)
56 #:use-module (gnu packages pkg-config)
57 #:use-module (gnu packages python)
58 #:use-module (gnu packages python-science)
59 #:use-module (gnu packages python-xyz)
60 #:use-module (gnu packages perl))
62 (define-public avro-cpp-1.9
69 "https://archive.apache.org/dist/avro/avro-" version
70 "/avro-src-" version ".tar.gz"))
72 (base32 "0i3fpm7r72yw397qc8yw9ybzk2mxjkv0yk5hnn00ylc1wbd0np73"))))
73 (build-system cmake-build-system)
76 (modify-phases %standard-phases
77 (add-after 'unpack 'chdir
78 (lambda _ (chdir "lang/c++"))))))
82 (home-page "https://avro.apache.org/")
83 (synopsis "Data serialization system")
84 (description "Apache Avro is a data serialization system. Avro provides:
86 @item Rich data structures;
87 @item a compact, fast, binary data format;
88 @item a container file, to store persistent data;
89 @item remote procedure call (RPC); and
90 @item simple integration with dynamic languages.
93 Code generation is not required to read or write data files nor to use or
94 implement RPC protocols.")
95 (license license:asl2.0)))
97 (define-public avro-cpp-1.9-for-irods
99 (inherit avro-cpp-1.9)
100 (properties `((hidden? . #true)))
103 '("-DCMAKE_CXX_COMPILER=clang++"
104 "-DCMAKE_CXX_FLAGS=-stdlib=libc++"
105 "-DCMAKE_EXE_LINKER_FLAGS=-lc++abi -lz")
107 (modify-phases %standard-phases
108 (add-after 'unpack 'chdir
109 (lambda _ (chdir "lang/c++")))
110 (add-after 'set-paths 'adjust-CPLUS_INCLUDE_PATH
111 (lambda* (#:key inputs #:allow-other-keys)
112 (let ((gcc (assoc-ref inputs "gcc")))
113 (setenv "CPLUS_INCLUDE_PATH"
115 (cons* (search-input-directory inputs "include/c++/v1")
116 ;; Hide GCC's C++ headers so that they do not interfere with
117 ;; the Clang headers.
118 (delete (string-append gcc "/include/c++")
119 (string-split (getenv "CPLUS_INCLUDE_PATH")
123 "environment variable `CPLUS_INCLUDE_PATH' changed to ~a~%"
124 (getenv "CPLUS_INCLUDE_PATH"))))))))
126 `(("boost" ,boost-for-irods)
127 ("clang" ,clang-toolchain-6)
128 ("libcxx+libcxxabi" ,libcxx+libcxxabi-6)
129 ("libcxxabi" ,libcxxabi-6)
130 ("snappy" ,snappy-with-clang6)
133 (define-public cereal
141 (url "https://github.com/USCiLab/cereal")
142 (commit (string-append "v" version))))
143 (file-name (git-file-name name version))
146 "0hc8wh9dwpc1w1zf5lfss4vg5hmgpblqxbrpp1rggicpx9ar831p"))))
147 (build-system cmake-build-system)
149 `(#:configure-flags '("-DSKIP_PORTABILITY_TEST=ON")
151 (modify-phases %standard-phases
152 (add-before 'configure 'skip-sandbox
154 (substitute* "CMakeLists.txt"
155 (("add_subdirectory\\(sandbox\\)") ""))))
156 (add-after 'install 'install-doc
158 (let ((doc (string-append %output "/share/doc/html")))
159 (invoke "make" "doc")
161 (copy-recursively "doc/html" doc)))))))
163 `(("doxygen" ,doxygen)))
164 (home-page "https://uscilab.github.io/cereal/")
165 (synopsis "C++11 library for serialization")
167 "Cereal is a header-only C++11 serialization library. Cereal takes
168 arbitrary data types and reversibly turns them into different representations,
169 such as compact binary encodings, XML, or JSON.")
170 (license license:bsd-3)))
172 (define-public msgpack
181 "https://github.com/msgpack/msgpack-c/releases/download/"
182 "cpp-" version "/msgpack-" version ".tar.gz"))
184 '(let ((p (open-file "msgpack.pc.in" "a")))
186 (string-append "Requires: " "zlib" "\n") p)
187 (close-output-port p)
190 (base32 "0yzhq50ijvwrfkr97knhvn54lj3f4hr3zy39yq8wpf6xll94s4bf"))))
191 (build-system cmake-build-system)
193 `(("googletest" ,googletest-1.8)
194 ("pkg-config" ,pkg-config)))
196 `(("zlib" ,zlib))) ;; Msgpack installs two headers (zbuffer.h,
197 ;; zbuffer.hpp) which #include <zlib.h>. However, 'guix gc --references'
198 ;; does not detect a store reference to zlib since these headers are not
200 (home-page "https://www.msgpack.org")
201 (synopsis "Binary serialization library")
202 (description "Msgpack is a library for C/C++ that implements binary
204 (license license:boost1.0)))
206 (define-public libmpack
214 (url "https://github.com/tarruda/libmpack")
216 (file-name (git-file-name name version))
218 (base32 "0rai5djdkjz7bsn025k5489in7r1amagw1pib0z4qns6b52kiar2"))))
219 (build-system gnu-build-system)
221 `(#:test-target "test"
224 (string-append "PREFIX=" (assoc-ref %outputs "out")))
226 (modify-phases %standard-phases
227 (delete 'configure))))
229 `(("libtool" ,libtool)))
230 (home-page "https://github.com/tarruda/libmpack")
231 (synopsis "Small binary serialization library")
232 (description "Libmpack is a small binary serialization and RPC library
233 that implements both the msgpack and msgpack-rpc specifications.")
234 (license license:expat)))
236 (define-public lua-libmpack
237 (package (inherit libmpack)
238 (name "lua-libmpack")
244 (url "https://github.com/libmpack/libmpack-lua")
246 (file-name (git-file-name name version))
248 (base32 "1ijvzgq5hvib03w5rghv31wi7byamwg7qdx5pawvhvnflaii8ivw"))))
249 (build-system gnu-build-system)
251 `(;; FIXME: tests require "busted", which is not yet available in Guix.
255 (let* ((lua-version ,(package-version lua))
256 (lua-major+minor ,(version-major+minor (package-version lua))))
258 "FETCH=echo" ; don't fetch anything from the web
259 "UNTGZ=echo" ; and don't try to unpack it
261 (string-append "MPACK_LUA_VERSION=" lua-version)
262 (string-append "MPACK_LUA_VERSION_NOPATCH=" lua-major+minor)
263 (string-append "PREFIX="
264 (assoc-ref %outputs "out"))
265 (string-append "LUA_CMOD_INSTALLDIR="
266 (assoc-ref %outputs "out")
267 "/lib/lua/" lua-major+minor)))
269 (modify-phases %standard-phases
271 (add-after 'unpack 'unpack-mpack-sources
272 (lambda* (#:key inputs #:allow-other-keys)
273 ;; This is broken because mpack-src is not a file, but all
274 ;; prerequisites are added to the inputs of the gcc invocation.
275 (substitute* "Makefile"
276 (("\\$\\(MPACK\\): mpack-src") "$(MPACK): "))
277 (copy-recursively (assoc-ref inputs "libmpack")
283 `(("pkg-config" ,pkg-config)
284 ("libmpack" ,(package-source libmpack))))
285 (home-page "https://github.com/libmpack/libmpack-lua")
286 (synopsis "Lua bindings for the libmpack binary serialization library")))
288 (define-public lua5.1-libmpack
289 (package/inherit lua-libmpack
290 (name "lua5.1-libmpack")
292 (substitute-keyword-arguments (package-arguments lua-libmpack)
293 ((#:make-flags flags)
294 `(let* ((lua-version ,(package-version lua-5.1))
295 (lua-major+minor ,(version-major+minor (package-version lua-5.1))))
298 (string-append "MPACK_LUA_VERSION=" lua-version)
299 (string-append "MPACK_LUA_VERSION_NOPATCH=" lua-major+minor)
300 (string-append "PREFIX="
301 (assoc-ref %outputs "out"))
302 (string-append "LUA_CMOD_INSTALLDIR="
303 (assoc-ref %outputs "out")
304 "/lib/lua/" lua-major+minor))))))
306 `(("lua" ,lua-5.1)))))
308 (define-public lua5.2-libmpack
309 (package/inherit lua-libmpack
310 (name "lua5.2-libmpack")
312 (substitute-keyword-arguments (package-arguments lua-libmpack)
313 ((#:make-flags flags)
314 `(let* ((lua-version ,(package-version lua-5.2))
315 (lua-major+minor ,(version-major+minor (package-version lua-5.2))))
318 (string-append "MPACK_LUA_VERSION=" lua-version)
319 (string-append "MPACK_LUA_VERSION_NOPATCH=" lua-major+minor)
320 (string-append "PREFIX="
321 (assoc-ref %outputs "out"))
322 (string-append "LUA_CMOD_INSTALLDIR="
323 (assoc-ref %outputs "out")
324 "/lib/lua/" lua-major+minor))))))
326 `(("lua" ,lua-5.2)))))
328 (define-public libyaml
335 (uri (string-append "https://pyyaml.org/download/libyaml/yaml-"
339 "1x4fcw13r3lqy8ndydr3ili87wicplw2awbcv6r21qgyfndswhn6"))))
340 (build-system gnu-build-system)
342 '(#:configure-flags '("--disable-static")))
343 (home-page "https://pyyaml.org/wiki/LibYAML")
344 (synopsis "YAML 1.1 parser and emitter written in C")
346 "LibYAML is a YAML 1.1 parser and emitter written in C.")
347 (license license:expat)))
349 (define-public libyaml+static
352 (name "libyaml+static")
354 '(#:configure-flags '("--enable-static")))))
356 (define-public libcyaml
364 (url "https://github.com/tlsa/libcyaml")
365 (commit (string-append "v" version))))
366 (file-name (git-file-name name version))
367 (patches (search-patches "libcyaml-libyaml-compat.patch"))
369 (base32 "0428p0rwq71nhh5nzcbapsbrjxa0x5l6h6ns32nxv7j624f0zd93"))))
370 (build-system gnu-build-system)
373 (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
374 (string-append "CC=gcc"))
376 (modify-phases %standard-phases
377 (delete 'configure) ; no configure script
381 (invoke "make" "test"))))))
383 `(("libyaml" ,libyaml)))
385 `(("pkg-config" ,pkg-config)))
386 (synopsis "C library for reading and writing YAML")
388 "LibCYAML is a C library written in ISO C11 for reading and writing
389 structured YAML documents. The fundamental idea behind CYAML is to allow
390 applications to construct schemas which describe both the permissible
391 structure of the YAML documents to read/write, and the C data structure(s)
392 in which the loaded data is arranged in memory.")
393 (home-page "https://github.com/tlsa/libcyaml")
394 (license license:isc)))
396 (define-public yaml-cpp
404 (url "https://github.com/jbeder/yaml-cpp")
405 (commit (string-append "yaml-cpp-" version))))
406 (file-name (git-file-name name version))
408 (base32 "0ykkxzxcwwiv8l8r697gyqh1nl582krpvi7m7l6b40ijnk4pw30s"))))
409 (build-system cmake-build-system)
411 '(#:configure-flags '("-DYAML_BUILD_SHARED_LIBS=ON")))
413 `(("python" ,python)))
414 (home-page "https://github.com/jbeder/yaml-cpp")
415 (synopsis "YAML parser and emitter in C++")
416 (description "YAML parser and emitter in C++ matching the YAML 1.2 spec.")
417 (license license:bsd-3)))
419 (define-public jsoncpp
423 (home-page "https://github.com/open-source-parsers/jsoncpp")
426 (uri (git-reference (url home-page) (commit version)))
427 (file-name (git-file-name name version))
430 "0qnx5y6c90fphl9mj9d20j2dfgy6s5yr5l0xnzid0vh71zrp6jwv"))))
431 (build-system cmake-build-system)
433 `(#:configure-flags '("-DBUILD_SHARED_LIBS:BOOL=YES"
434 ,@(if (%current-target-system)
435 `("-DJSONCPP_WITH_POST_BUILD_UNITTEST=OFF")
437 ,@(if (%current-target-system)
439 `(#:cmake ,cmake-bootstrap))))
440 (synopsis "C++ library for interacting with JSON")
441 (description "JsonCpp is a C++ library that allows manipulating JSON values,
442 including serialization and deserialization to and from strings. It can also
443 preserve existing comment in unserialization/serialization steps, making
444 it a convenient format to store user input files.")
445 (license license:expat)))
447 ;; XXX: TODO(core-updates): Remove this package and apply the patch to the
448 ;; jsoncpp package. This patch fixes the package version declared in the
450 (define-public jsoncpp-with-pkg-version
455 (home-page "https://github.com/open-source-parsers/jsoncpp")
458 (uri (git-reference (url home-page) (commit version)))
459 (file-name (git-file-name name version))
462 "0qnx5y6c90fphl9mj9d20j2dfgy6s5yr5l0xnzid0vh71zrp6jwv"))
464 (search-patches "jsoncpp-pkg-config-version.patch"))))))
466 ;; Tensorflow does not build with jsoncpp 1.8.x. It is built with commit
467 ;; 4356d9bba191e1e16ce7a92073cbf3e63564e973, which lies between version 1.7.2
469 (define-public jsoncpp-for-tensorflow
470 (package (inherit jsoncpp)
476 (url "https://github.com/open-source-parsers/jsoncpp")
478 (file-name (git-file-name name version))
481 "1180ln8blrb0mwzpcf78k49hlki6di65q77rsvglf83kfcyh4d7z"))))))
483 (define-public json.sh
484 (let ((commit "0d5e5c77365f63809bf6e77ef44a1f34b0e05840") ;no releases
488 (version (git-version "0.0.0" revision commit))
493 (url "https://github.com/dominictarr/JSON.sh")
495 (file-name (git-file-name name version))
498 "14lxvp5xbdk0dcwkjbdp098z1108j8z48zaibndh4i731kkcz43i"))))
499 (build-system copy-build-system)
501 `(#:install-plan '(("JSON.sh" "bin/"))
503 (modify-phases %standard-phases
504 (add-before 'install 'check
505 (lambda* (#:key tests? #:allow-other-keys)
506 (when tests? (invoke "./all-tests.sh"))
508 (add-after 'install 'wrap-program
509 (lambda* (#:key inputs outputs #:allow-other-keys)
510 (wrap-program (string-append (assoc-ref outputs "out") "/bin/JSON.sh")
513 (map (lambda (in) (string-append (assoc-ref inputs in) "/bin"))
518 `(("bash-minimal" ,bash-minimal)
521 (synopsis "Pipeable JSON parser written in shell")
523 "This package provides a JSON parser written in shell, compatible with
524 ash, Bash, Dash and Zsh. Pipe JSON to it, and it traverses the JSON objects
525 and prints out the path to the current object (as a JSON array) and then the
526 object, without whitespace.")
527 (home-page "https://github.com/dominictarr/JSON.sh")
528 (license (list license:expat license:asl2.0))))) ;dual-licensed
530 (define-public capnproto
537 "https://capnproto.org/capnproto-c++-"
541 "03f1862ljdshg7d0rg3j7jzgm3ip55kzd2y91q7p0racax3hxx6i"))))
542 (build-system gnu-build-system)
545 (modify-phases %standard-phases
546 (add-before 'check 'do-not-require-/etc/services
548 ;; Workaround for test that tries to resolve port name from
549 ;; /etc/services, which is not present in build environment.
550 (substitute* "src/kj/async-io-test.c++" ((":http") ":80"))
552 (add-before 'check 'use-tmp-for-temporary-files
554 ;; Use /tmp for temporary files, as the default /var/tmp directory
556 (substitute* "src/kj/filesystem-disk-test.c++"
557 (("VAR\\_TMP \"/var/tmp\"")
560 (home-page "https://capnproto.org")
561 (synopsis "Capability-based RPC and serialization system")
563 "Cap'n Proto is a very fast data interchange format and capability-based
564 RPC system. Think JSON, except binary. Or think Protocol Buffers, except faster.")
565 (license license:expat)))
567 (define-public libbson
574 (uri (string-append "https://github.com/mongodb/libbson/releases/"
575 "download/" version "/libbson-" version ".tar.gz"))
578 "1fj4554msq0rrz14snbj908dzqj46gh7jg9w9j0akn2b7q911m5a"))))
579 (build-system gnu-build-system)
580 (native-inputs `(("perl" ,perl)))
581 (home-page "http://mongoc.org/libbson/current/index.html")
582 (synopsis "C BSON library")
583 (description "Libbson can create and parse BSON documents. It can also
584 convert JSON documents to BSON and the opposite. BSON stands for Binary JSON,
585 it is comparable to protobuf.")
586 (license license:asl2.0)))
588 (define-public python-ruamel.yaml
590 (name "python-ruamel.yaml")
595 (uri (pypi-uri "ruamel.yaml" version))
598 "0hm9yg785f46bkrgqknd6fdvmkby9dpzjnm0b63qf0i748acaj5v"))))
599 (build-system python-build-system)
601 `(("python-pytest" ,python-pytest)))
603 `(("python-ruamel.yaml.clib" ,python-ruamel.yaml.clib)))
605 `(;; TODO: Tests require packaging "ruamel.std.pathlib".
607 (home-page "https://sourceforge.net/projects/ruamel-yaml/")
608 (synopsis "YAML 1.2 parser/emitter")
610 "This package provides YAML parser/emitter that supports roundtrip
611 preservation of comments, seq/map flow style, and map key order. It
612 is a derivative of Kirill Simonov’s PyYAML 3.11. It supports YAML 1.2
613 and has round-trip loaders and dumpers. It supports comments. Block
614 style and key ordering are kept, so you can diff the source.")
615 (license license:expat)))
617 (define-public python-ruamel.yaml.clib
619 (name "python-ruamel.yaml.clib")
623 ;; pypi release code has cythonized code without corresponding source.
626 (url "http://hg.code.sf.net/p/ruamel-yaml-clib/code")
627 (changeset version)))
628 (file-name (string-append name "-" version "-checkout"))
631 "05m3y7pjfbaarqbbgw1k6gs6cnnmxnwadjipxvw1aaaqk3s236cs"))
632 (modules '((guix build utils)))
635 (delete-file "_ruamel_yaml.c")))))
636 (build-system python-build-system)
638 `(#:tests? #f ; This package is split from python-ruamel.yaml and
639 ; depends on modules from it for the test suite.
641 (modify-phases %standard-phases
642 (delete 'sanity-check) ; Depends on python-ruamel.yaml
643 (add-after 'unpack 'cythonize-code
645 (invoke "cython" "_ruamel_yaml.pyx"))))))
647 `(("python-cython" ,python-cython)))
648 (home-page "https://sourceforge.net/p/ruamel-yaml-clib/code/ci/default/tree")
649 (synopsis "C version of reader, parser and emitter for ruamel.yaml")
651 "This package provides a C version of the reader, parser and emitter for
652 @code{ruamel.yaml} derived from libyaml.")
653 (license license:expat)))
655 (define-public python-cbor
662 (uri (pypi-uri "cbor" version))
665 "1dmv163cnslyqccrybkxn0c9s1jk1mmafmgxv75iamnz5lk5l8hk"))))
666 (build-system python-build-system)
667 (home-page "https://bitbucket.org/bodhisnarkva/cbor")
668 (synopsis "Implementation of the Concise Binary Object Representation")
670 "Python-cbor provides an implementation of the Concise Binary Object
671 Representation (@dfn{CBOR}). CBOR is comparable to JSON, has a superset of
672 JSON's ability, but serializes to a binary format which is smaller and faster
673 to generate and parse. The two primary functions are @code{cbor.loads} and
675 (license license:asl2.0)))
677 (define-public flatbuffers
685 (url "https://github.com/google/flatbuffers")
686 (commit (string-append "v" version))))
687 (file-name (git-file-name name version))
690 "1zbf6bdpps8369r1ql00irxrp58jnalycc8jcapb8iqg654vlfz8"))))
691 (build-system cmake-build-system)
693 '(#:build-type "Release"
695 (list "-DFLATBUFFERS_BUILD_SHAREDLIB=ON"
696 (string-append "-DCMAKE_INSTALL_LIBDIR="
697 (assoc-ref %outputs "out") "/lib"))
699 (modify-phases %standard-phases
700 (add-after 'unpack 'make-writable
701 (lambda _ (for-each make-file-writable (find-files ".")))))))
702 (home-page "https://google.github.io/flatbuffers/")
703 (synopsis "Memory-efficient serialization library")
704 (description "FlatBuffers is a cross-platform serialization library for C++,
705 C#, C, Go, Java, JavaScript, PHP, and Python. It was originally created for
706 game development and other performance-critical applications.")
707 (license license:asl2.0)))
709 (define-public python-feather-format
711 (name "python-feather-format")
716 (uri (pypi-uri "feather-format" version))
719 "00w9hwz7sj3fkdjc378r066vdy6lpxmn6vfac3qx956k8lvpxxj5"))))
720 (build-system python-build-system)
722 `(("python-pandas" ,python-pandas)
723 ("python-pyarrow" ,python-pyarrow)))
724 (home-page "https://github.com/wesm/feather")
725 (synopsis "Python wrapper to the Feather file format")
726 (description "This package provides a Python wrapper library to the
727 Apache Arrow-based Feather binary columnar serialization data frame format.")
728 (license license:asl2.0)))