gnu: opencc: Unbundle rapidjson.
[jackhill/guix/guix.git] / gnu / packages / serialization.scm
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 Nils Gillmann <ng0@n0.is>
11 ;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
12 ;;; Copyright © 2018 Joshua Sierles, Nextjournal <joshua@nextjournal.com>
13 ;;;
14 ;;; This file is part of GNU Guix.
15 ;;;
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.
20 ;;;
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.
25 ;;;
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/>.
28
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 utils)
34 #:use-module (guix build-system cmake)
35 #:use-module (guix build-system gnu)
36 #:use-module (guix build-system python)
37 #:use-module (guix build-system r)
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 cran)
44 #:use-module (gnu packages databases)
45 #:use-module (gnu packages documentation)
46 #:use-module (gnu packages lua)
47 #:use-module (gnu packages pkg-config)
48 #:use-module (gnu packages python)
49 #:use-module (gnu packages perl)
50 #:use-module (gnu packages statistics))
51
52 (define-public cereal
53 (package
54 (name "cereal")
55 (version "1.2.1")
56 (source (origin
57 (method url-fetch)
58 (uri (string-append "https://github.com/USCiLab/cereal/archive/v"
59 version ".tar.gz"))
60 (file-name (string-append name "-" version ".tar.gz"))
61 (sha256
62 (base32
63 "0kj32h3j2128anig0g9gzw82kfyd5xqfkwq6vdyv900jx8i1qckx"))))
64 (build-system cmake-build-system)
65 (arguments
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.
69 #:tests? #f
70 #:out-of-source? #f
71 #:phases
72 (modify-phases %standard-phases
73 (delete 'configure)
74 (replace 'build
75 (lambda _
76 (substitute* "doc/doxygen.in"
77 (("@CMAKE_CURRENT_SOURCE_DIR@") "."))
78 (invoke "doxygen" "doc/doxygen.in")
79 #t))
80 ;; There is no "install" target, so we have to provide our own
81 ;; "install" phase.
82 (replace 'install
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")))
87 (mkdir-p doc)
88 (mkdir-p include)
89 (copy-recursively "include/cereal" include)
90 (copy-recursively "doc/html" doc))
91 #t)))))
92 (native-inputs
93 `(("doxygen" ,doxygen)))
94 (home-page "http://uscilab.github.io/cereal/")
95 (synopsis "C++11 library for serialization")
96 (description
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)))
101
102 (define-public msgpack
103 (package
104 (name "msgpack")
105 (version "1.4.2")
106 (source
107 (origin
108 (method url-fetch)
109 (uri
110 (string-append
111 "https://github.com/msgpack/msgpack-c/releases/download/"
112 "cpp-" version "/msgpack-" version ".tar.gz"))
113 (snippet
114 '(let ((p (open-file "msgpack.pc.in" "a")))
115 (display
116 (string-append "Requires: " "zlib" "\n") p)
117 (close-output-port p)
118 #t))
119 (sha256
120 (base32
121 "18hzmyfg3mvnp7ab03nqdzzvqagkl42gygjpi4zv4i7aca2dmwf0"))))
122 (build-system gnu-build-system)
123 (native-inputs
124 `(("googletest" ,googletest)
125 ("autoconf" ,autoconf)
126 ("automake" ,automake)
127 ("libtool" ,libtool)
128 ("pkg-config" ,pkg-config)))
129 (propagated-inputs
130 `(("zlib" ,zlib))) ;; Msgpack installs two headers (zbuffer.h,
131 ;; zbuffer.hpp) which #include <zlib.h>. However, 'guix gc --references'
132 ;; does not detect a store reference to zlib since these headers are not
133 ;; compiled.
134 (home-page "https://www.msgpack.org")
135 (synopsis "Binary serialization library")
136 (description "Msgpack is a library for C/C++ that implements binary
137 serialization.")
138 (license license:boost1.0)))
139
140 (define-public libmpack
141 (package
142 (name "libmpack")
143 (version "1.0.5")
144 (source (origin
145 (method url-fetch)
146 (uri (string-append "https://github.com/tarruda/libmpack/"
147 "archive/" version ".tar.gz"))
148 (file-name (string-append name "-" version ".tar.gz"))
149 (sha256
150 (base32
151 "0ml922gv8y99lbldqb9ykpjndla0hlprdjyl79yskkhwv2ai7sac"))))
152 (build-system gnu-build-system)
153 (arguments
154 `(#:test-target "test"
155 #:make-flags
156 (list "CC=gcc"
157 (string-append "PREFIX=" (assoc-ref %outputs "out")))
158 #:phases
159 (modify-phases %standard-phases
160 (delete 'configure))))
161 (native-inputs
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)))
168
169 (define-public lua-libmpack
170 (package (inherit libmpack)
171 (name "lua-libmpack")
172 (source (origin
173 (method url-fetch)
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"))
177 (sha256
178 (base32
179 "153zrrbyxhf71dgzjjhrk56rfwk3nisslpgcqyg44v8fnz1xpk6i"))))
180 (build-system gnu-build-system)
181 (arguments
182 `(;; FIXME: tests require "busted", which is not yet available in Guix.
183 #:tests? #f
184 #:test-target "test"
185 #:make-flags
186 (let* ((lua-version ,(package-version lua))
187 (lua-major+minor ,(version-major+minor (package-version lua))))
188 (list "CC=gcc"
189 "FETCH=echo" ; don't fetch anything from the web
190 "UNTGZ=echo" ; and don't try to unpack it
191 "USE_SYSTEM_LUA=yes"
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)))
199 #:phases
200 (modify-phases %standard-phases
201 (delete 'configure)
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"))))))))
212 (inputs
213 `(("lua" ,lua)))
214 (native-inputs
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")))
219
220 (define-public lua5.1-libmpack
221 (package (inherit lua-libmpack)
222 (name "lua5.1-libmpack")
223 (arguments
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))))
228 (list "CC=gcc"
229 "USE_SYSTEM_LUA=yes"
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))))))
237 (inputs
238 `(("lua" ,lua-5.1)))))
239
240 (define-public lua5.2-libmpack
241 (package (inherit lua-libmpack)
242 (name "lua5.2-libmpack")
243 (arguments
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))))
248 (list "CC=gcc"
249 "USE_SYSTEM_LUA=yes"
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))))))
257 (inputs
258 `(("lua" ,lua-5.2)))))
259
260 (define-public yaml-cpp
261 (package
262 (name "yaml-cpp")
263 (version "0.6.2")
264 (source (origin
265 (method url-fetch)
266 (uri (string-append
267 "https://github.com/jbeder/yaml-cpp/archive/"
268 "yaml-cpp-" version ".tar.gz"))
269 (sha256
270 (base32
271 "01gxn7kc8pzyh4aadjxxzq8cignmbwmm9rfrsmgqfg9w2q75dn74"))))
272 (build-system cmake-build-system)
273 (arguments
274 '(#:configure-flags '("-DBUILD_SHARED_LIBS=ON")))
275 (native-inputs
276 `(("python" ,python)))
277 (home-page "https://github.com/jbeder/yaml-cpp")
278 (synopsis "YAML parser and emitter in C++")
279 (description "YAML parser and emitter in C++ matching the YAML 1.2 spec.")
280 (license license:bsd-3)))
281
282 (define-public jsoncpp
283 (package
284 (name "jsoncpp")
285 (version "1.8.4")
286 (source (origin
287 (method url-fetch)
288 (uri (string-append
289 "https://github.com/open-source-parsers/jsoncpp/archive/"
290 version ".tar.gz"))
291 (file-name (string-append name "-" version ".tar.gz"))
292 (sha256
293 (base32
294 "1dpxk8hkni5dq4mdw8qbaj40jmid3a31d1gh8iqcnfwkw34ym7f4"))))
295 (build-system cmake-build-system)
296 (home-page "https://github.com/open-source-parsers/jsoncpp")
297 (arguments
298 `(#:configure-flags '("-DBUILD_SHARED_LIBS:BOOL=YES")))
299 (synopsis "C++ library for interacting with JSON")
300 (description "JsonCpp is a C++ library that allows manipulating JSON values,
301 including serialization and deserialization to and from strings. It can also
302 preserve existing comment in unserialization/serialization steps, making
303 it a convenient format to store user input files.")
304 (license license:expat)))
305
306 (define-public capnproto
307 (package
308 (name "capnproto")
309 (version "0.7.0")
310 (source (origin
311 (method url-fetch)
312 (uri (string-append
313 "https://capnproto.org/capnproto-c++-"
314 version ".tar.gz"))
315 (sha256
316 (base32
317 "0hfdnhlbskagzgvby8wy6lrxj53zfzpfqimbhga68c0ji2yw1969"))))
318 (build-system gnu-build-system)
319 (arguments
320 `(#:phases
321 (modify-phases %standard-phases
322 (add-before 'check 'do-not-require-/etc/services
323 (lambda _
324 ;; Workaround for test that tries to resolve port name from
325 ;; /etc/services, which is not present in build environment.
326 (substitute* "src/kj/async-io-test.c++" ((":http") ":80"))
327 #t))
328 (add-before 'check 'use-tmp-for-tempory-files
329 (lambda _
330 ;; Use /tmp for tempory files, as the default /var/tmp directory
331 ;; doesn't exist.
332 (substitute* "src/kj/filesystem-disk-test.c++"
333 (("VAR\\_TMP \"/var/tmp\"")
334 "VAR_TMP \"/tmp\""))
335 #t)))))
336 (home-page "https://capnproto.org")
337 (synopsis "Capability-based RPC and serialization system")
338 (description
339 "Cap'n Proto is a very fast data interchange format and capability-based
340 RPC system. Think JSON, except binary. Or think Protocol Buffers, except faster.")
341 (license license:expat)))
342
343 (define-public libbson
344 (package
345 (name "libbson")
346 (version "1.6.2")
347 (source
348 (origin
349 (method url-fetch)
350 (uri (string-append "https://github.com/mongodb/libbson/releases/"
351 "download/" version "/libbson-" version ".tar.gz"))
352 (sha256
353 (base32
354 "1fj4554msq0rrz14snbj908dzqj46gh7jg9w9j0akn2b7q911m5a"))))
355 (build-system gnu-build-system)
356 (native-inputs `(("perl" ,perl)))
357 (home-page "http://mongoc.org/libbson/current/index.html")
358 (synopsis "C BSON library")
359 (description "Libbson can create and parse BSON documents. It can also
360 convert JSON documents to BSON and the opposite. BSON stands for Binary JSON,
361 it is comparable to protobuf.")
362 (license license:asl2.0)))
363
364 (define-public nlohmann-json-cpp
365 (package
366 (name "nlohmann-json-cpp")
367 (version "2.1.1")
368 (source
369 (origin
370 (method url-fetch)
371 (uri (string-append "https://github.com/nlohmann/json/"
372 "archive/v" version ".tar.gz"))
373 (file-name (string-append name "-" version ".tar.gz"))
374 (sha256
375 (base32
376 "0lrh6cjd643c7kmvmwafbgq7dqj3b778483gjhjbvp6rc6z5xf2r"))))
377 (build-system cmake-build-system)
378 (home-page "https://nlohmann.github.io/json/")
379 (synopsis "JSON library for C++")
380 (description
381 "JSON library for C++ trying to accomplish “Intuitive syntax”,
382 “Trivial integration”, and “Serious testing”.
383 However, “Memory efficiency” and “Speed” have not been primary goals.")
384 (license license:expat)))
385
386 (define-public python-ruamel.yaml
387 (package
388 (name "python-ruamel.yaml")
389 (version "0.15.37")
390 (source
391 (origin
392 (method url-fetch)
393 (uri (pypi-uri "ruamel.yaml" version))
394 (sha256
395 (base32
396 "0629xzlwbddfwp8lkjz3mpvxhml9kx17cfs8aydzg55idzcl562h"))))
397 (build-system python-build-system)
398 (native-inputs
399 `(("python-pytest" ,python-pytest)))
400 (arguments
401 `(;; TODO: Tests require packaging "ruamel.std.pathlib".
402 #:tests? #f))
403 (home-page "https://bitbucket.org/ruamel/yaml")
404 (synopsis "YAML 1.2 parser/emitter")
405 (description
406 "This package provides YAML parser/emitter that supports roundtrip
407 preservation of comments, seq/map flow style, and map key order. It
408 is a derivative of Kirill Simonov’s PyYAML 3.11. It supports YAML 1.2
409 and has round-trip loaders and dumpers. It supports comments. Block
410 style and key ordering are kept, so you can diff the source.")
411 (license license:expat)))
412
413 (define-public python2-ruamel.yaml
414 (package-with-python2 python-ruamel.yaml))
415
416 (define-public python-cbor
417 (package
418 (name "python-cbor")
419 (version "1.0.0")
420 (source
421 (origin
422 (method url-fetch)
423 (uri (pypi-uri "cbor" version))
424 (sha256
425 (base32
426 "1dmv163cnslyqccrybkxn0c9s1jk1mmafmgxv75iamnz5lk5l8hk"))))
427 (build-system python-build-system)
428 (home-page "https://bitbucket.org/bodhisnarkva/cbor")
429 (synopsis "Implementation of the Concise Binary Object Representation")
430 (description
431 "Python-cbor provides an implementation of the Concise Binary Object
432 Representation (@dfn{CBOR}). CBOR is comparable to JSON, has a superset of
433 JSON's ability, but serializes to a binary format which is smaller and faster
434 to generate and parse. The two primary functions are @code{cbor.loads} and
435 @code{cbor.dumps}.")
436 (license license:asl2.0)))
437
438 (define-public flatbuffers
439 (package
440 (name "flatbuffers")
441 (version "1.10.0")
442 (source
443 (origin
444 (method url-fetch)
445 (uri (string-append "https://github.com/google/flatbuffers/archive/v"
446 version ".tar.gz"))
447 (file-name (string-append name "-" version ".tar.gz"))
448 (sha256
449 (base32
450 "0z4swldxs0s31hnkqdhsbfmc8vx3p7zsvmqaw4l31r2iikdy651p"))))
451 (build-system cmake-build-system)
452 (arguments
453 '(#:build-type "Release"
454 #:configure-flags
455 (list (string-append "-DCMAKE_INSTALL_LIBDIR="
456 (assoc-ref %outputs "out") "/lib"))))
457 (home-page "https://google.github.io/flatbuffers/")
458 (synopsis "Memory-efficient serialization library")
459 (description "FlatBuffers is a cross-platform serialization library for C++,
460 C#, C, Go, Java, JavaScript, PHP, and Python. It was originally created for
461 game development and other performance-critical applications.")
462 (license license:asl2.0)))
463
464 (define-public r-feather
465 (package
466 (name "r-feather")
467 (version "0.3.1")
468 (source
469 (origin
470 (method url-fetch)
471 (uri (cran-uri "feather" version))
472 (sha256
473 (base32
474 "1q6dbkfnkpnabq8lb6bm9ma44cfcghx2lm23pyk3vg7943wrn1pi"))))
475 (build-system r-build-system)
476 (propagated-inputs
477 `(("r-hms" ,r-hms)
478 ("r-rcpp" ,r-rcpp)
479 ("r-tibble" ,r-tibble)))
480 (home-page "https://github.com/wesm/feather")
481 (synopsis "R Bindings to the Feather API")
482 (description "Read and write feather files, a lightweight binary columnar
483 daa store designed for maximum speed.")
484 (license license:asl2.0)))
485
486 (define-public python-feather-format
487 (package
488 (name "python-feather-format")
489 (version "0.4.0")
490 (source
491 (origin
492 (method url-fetch)
493 (uri (pypi-uri "feather-format" version))
494 (sha256
495 (base32
496 "1adivm5w5ji4qv7hq7942vqlk8l2wgw87bdlsia771z14z3zp857"))))
497 (build-system python-build-system)
498 (propagated-inputs
499 `(("python-pandas" ,python-pandas)
500 ("python-pyarrow" ,python-pyarrow)))
501 (home-page "https://github.com/wesm/feather")
502 (synopsis "Python wrapper to the Feather file format")
503 (description "This package provides a Python wrapper library to the
504 Apache Arrow-based Feather binary columnar serialization data frame format.")
505 (license license:asl2.0)))
506
507 (define-public python2-feather-format
508 (package-with-python2 python-feather-format))