1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2015, 2017 Ricardo Wurmus <rekado@elephly.net>
3 ;;; Copyright © 2016 Lukas Gradl <lgradl@openmailbox.org>
4 ;;; Copyright © 2016 David Craven <david@craven.ch>
5 ;;; Copyright © 2016 Marius Bakke <mbakke@fastmail.com>
6 ;;; Copyright © 2016 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@infotropique.org>
12 ;;; This file is part of GNU Guix.
14 ;;; GNU Guix is free software; you can redistribute it and/or modify it
15 ;;; under the terms of the GNU General Public License as published by
16 ;;; the Free Software Foundation; either version 3 of the License, or (at
17 ;;; your option) any later version.
19 ;;; GNU Guix is distributed in the hope that it will be useful, but
20 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
21 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 ;;; GNU General Public License for more details.
24 ;;; You should have received a copy of the GNU General Public License
25 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
27 (define-module (gnu packages serialization)
28 #:use-module ((guix licenses) #:prefix license:)
29 #:use-module (guix packages)
30 #:use-module (guix download)
31 #:use-module (guix utils)
32 #:use-module (guix build-system cmake)
33 #:use-module (guix build-system gnu)
34 #:use-module (gnu packages)
35 #:use-module (gnu packages autotools)
36 #:use-module (gnu packages boost)
37 #:use-module (gnu packages check)
38 #:use-module (gnu packages compression)
39 #:use-module (gnu packages documentation)
40 #:use-module (gnu packages lua)
41 #:use-module (gnu packages pkg-config)
42 #:use-module (gnu packages python)
43 #:use-module (gnu packages perl)
44 #:use-module (guix build-system python))
52 (uri (string-append "https://github.com/USCiLab/cereal/archive/v"
54 (file-name (string-append name "-" version ".tar.gz"))
57 "0kj32h3j2128anig0g9gzw82kfyd5xqfkwq6vdyv900jx8i1qckx"))))
58 (build-system cmake-build-system)
60 `(;; The only included tests are portability tests requiring
61 ;; cross-compilation and boost. Since we are building cereal on more
62 ;; platforms anyway, there is no compelling reason to build the tests.
66 (modify-phases %standard-phases
70 (substitute* "doc/doxygen.in"
71 (("@CMAKE_CURRENT_SOURCE_DIR@") "."))
72 (zero? (system* "doxygen" "doc/doxygen.in"))))
73 ;; There is no "install" target, so we have to provide our own
76 (lambda* (#:key outputs #:allow-other-keys)
77 (let* ((out (assoc-ref outputs "out"))
78 (doc (string-append out "/share/cereal/docs"))
79 (include (string-append out "/include/cereal")))
82 (copy-recursively "include/cereal" include)
83 (copy-recursively "doc/html" doc))
86 `(("doxygen" ,doxygen)))
87 (home-page "http://uscilab.github.io/cereal/")
88 (synopsis "C++11 library for serialization")
90 "Cereal is a header-only C++11 serialization library. Cereal takes
91 arbitrary data types and reversibly turns them into different representations,
92 such as compact binary encodings, XML, or JSON.")
93 (license license:bsd-3)))
96 (define-public msgpack
105 "https://github.com/msgpack/msgpack-c/releases/download/"
106 "cpp-" version "/msgpack-" version ".tar.gz"))
108 '(let ((p (open-file "msgpack.pc.in" "a")))
111 (string-append "Requires: " "zlib" "\n") p)
112 (close-output-port p))))
115 "18hzmyfg3mvnp7ab03nqdzzvqagkl42gygjpi4zv4i7aca2dmwf0"))))
116 (build-system gnu-build-system)
118 `(("googletest" ,googletest)
119 ("autoconf" ,autoconf)
120 ("automake" ,automake)
122 ("pkg-config" ,pkg-config)))
124 `(("zlib" ,zlib))) ;; Msgpack installs two headers (zbuffer.h,
125 ;; zbuffer.hpp) which #include <zlib.h>. However, 'guix gc --references'
126 ;; does not detect a store reference to zlib since these headers are not
130 (modify-phases %standard-phases
131 (add-after 'unpack 'autoconf
133 (system* "autoreconf" "-vfi"))))))
134 (home-page "http://www.msgpack.org")
135 (synopsis "Binary serialization library")
136 (description "Msgpack is a library for C/C++ that implements binary
138 (license license:boost1.0)))
140 (define-public libmpack
146 (uri (string-append "https://github.com/tarruda/libmpack/"
147 "archive/" version ".tar.gz"))
148 (file-name (string-append name "-" version ".tar.gz"))
151 "0ml922gv8y99lbldqb9ykpjndla0hlprdjyl79yskkhwv2ai7sac"))))
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")
174 (uri (string-append "https://github.com/libmpack/libmpack-lua/"
175 "archive/" (package-version libmpack) ".tar.gz"))
176 (file-name (string-append name "-" (package-version libmpack) ".tar.gz"))
179 "153zrrbyxhf71dgzjjhrk56rfwk3nisslpgcqyg44v8fnz1xpk6i"))))
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 (mkdir-p "mpack-src")
209 (zero? (system* "tar" "-C" "mpack-src"
210 "--strip-components=1"
211 "-xvf" (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.2-libmpack
221 (package (inherit lua-libmpack)
222 (name "lua5.2-libmpack")
224 (substitute-keyword-arguments (package-arguments lua-libmpack)
225 ((#:make-flags flags)
226 `(let* ((lua-version ,(package-version lua-5.2))
227 (lua-major+minor ,(version-major+minor (package-version lua-5.2))))
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.2)))))
240 (define-public yaml-cpp
247 "https://github.com/jbeder/yaml-cpp/archive/"
248 "yaml-cpp-" version ".tar.gz"))
251 "1ck7jk0wjfigrf4cgcjqsir4yp1s6vamhhxhpsgfvs46pgm5pk6y"))))
252 (build-system cmake-build-system)
254 '(#:configure-flags '("-DBUILD_SHARED_LIBS=ON")))
258 `(("python" ,python)))
259 (home-page "https://github.com/jbeder/yaml-cpp")
260 (synopsis "YAML parser and emitter in C++")
261 (description "YAML parser and emitter in C++ matching the YAML 1.2 spec.")
262 (license license:bsd-3)))
264 (define-public jsoncpp
271 "https://github.com/open-source-parsers/jsoncpp/archive/"
273 (file-name (string-append name "-" version ".tar.gz"))
276 "1vwf0yrv5540ygfnxikirbs63awsdzn7dabkia3g0bnz43p5l7w1"))))
277 (build-system cmake-build-system)
278 (home-page "https://github.com/open-source-parsers/jsoncpp")
280 `(#:configure-flags '("-DBUILD_SHARED_LIBS:BOOL=YES")))
281 (synopsis "C++ library for interacting with JSON")
282 (description "JsonCpp is a C++ library that allows manipulating JSON values,
283 including serialization and deserialization to and from strings. It can also
284 preserve existing comment in unserialization/serialization steps, making
285 it a convenient format to store user input files.")
286 (license license:expat)))
288 (define-public capnproto
295 "https://capnproto.org/capnproto-c++-"
299 "010s9yhq4531wvdfrdf2477zswhck6cjfby79w73rff3v06090l0"))))
300 (build-system gnu-build-system)
303 (modify-phases %standard-phases
304 (add-before 'check 'do-not-require-/etc/services
306 ;; Workaround for test that tries to resolve port name from
307 ;; /etc/services, which is not present in build environment.
308 (substitute* "src/kj/async-io-test.c++" ((":http") ":80"))
310 (home-page "https://capnproto.org")
311 (synopsis "Capability-based RPC and serialization system")
313 "Cap'n Proto is a very fast data interchange format and capability-based
314 RPC system. Think JSON, except binary. Or think Protocol Buffers, except faster.")
315 (license license:expat)))
317 (define-public libbson
324 (uri (string-append "https://github.com/mongodb/libbson/releases/"
325 "download/" version "/libbson-" version ".tar.gz"))
328 "1fj4554msq0rrz14snbj908dzqj46gh7jg9w9j0akn2b7q911m5a"))))
329 (build-system gnu-build-system)
330 (native-inputs `(("perl" ,perl)))
331 (home-page "http://mongoc.org/libbson/current/index.html")
332 (synopsis "C BSON library")
333 (description "Libbson can create and parse BSON documents. It can also
334 convert JSON documents to BSON and the opposite. BSON stands for Binary JSON,
335 it is comparable to protobuf.")
336 (license license:asl2.0)))
338 (define-public nlohmann-json-cpp
340 (name "nlohmann-json-cpp")
345 (uri (string-append "https://github.com/nlohmann/json/"
346 "archive/v" version ".tar.gz"))
347 (file-name (string-append name "-" version ".tar.gz"))
350 "0lrh6cjd643c7kmvmwafbgq7dqj3b778483gjhjbvp6rc6z5xf2r"))))
351 (build-system cmake-build-system)
352 (home-page "https://nlohmann.github.io/json/")
353 (synopsis "JSON library for C++")
355 "JSON library for C++ trying to accomplish “Intuitive syntax”,
356 “Trivial integration”, and “Serious testing”.
357 However, “Memory efficiency” and “Speed” have not been primary goals.")
358 (license license:expat)))
360 (define-public python-ruamel.yaml
362 (name "python-ruamel.yaml")
367 (uri (pypi-uri "ruamel.yaml" version))
370 "1s4b0zwn9pkk4xxjhx77giyfddc738drd6vgraw6n2syvj03s31d"))))
371 (build-system python-build-system)
373 `(("python-pytest" ,python-pytest)))
375 `(;; TODO: Tests require packaging "ruamel.std.pathlib".
377 (home-page "https://bitbucket.org/ruamel/yaml")
378 (synopsis "YAML 1.2 parser/emitter")
380 "This package provides YAML parser/emitter that supports roundtrip
381 preservation of comments, seq/map flow style, and map key order. It
382 is a derivative of Kirill Simonov’s PyYAML 3.11. It supports YAML 1.2
383 and has round-trip loaders and dumpers. It supports comments. Block
384 style and key ordering are kept, so you can diff the source.")
385 (license license:expat)))
387 (define-public python2-ruamel.yaml
388 (package-with-python2 python-ruamel.yaml))
390 (define-public python-cbor
397 (uri (pypi-uri "cbor" version))
400 "1dmv163cnslyqccrybkxn0c9s1jk1mmafmgxv75iamnz5lk5l8hk"))))
401 (build-system python-build-system)
402 (home-page "https://bitbucket.org/bodhisnarkva/cbor")
403 (synopsis "Implementation of the Concise Binary Object Representation")
405 "Python-cbor provides an implementation of the Concise Binary Object
406 Representation (CBOR). CBOR is comparable to JSON, has a superset of JSON's
407 ability, but serializes to a binary format which is smaller and faster to
408 generate and parse. The two primary functions are @code{cbor.loads} and
410 (license license:asl2.0)))