gnu: opencc: Unbundle rapidjson.
[jackhill/guix/guix.git] / gnu / packages / serialization.scm
CommitLineData
0149354d 1;;; GNU Guix --- Functional package management for GNU
c57e5fd0 2;;; Copyright © 2015, 2017 Ricardo Wurmus <rekado@elephly.net>
d1ef573d 3;;; Copyright © 2016 Lukas Gradl <lgradl@openmailbox.org>
f50f4ae4 4;;; Copyright © 2016 David Craven <david@craven.ch>
557d3328 5;;; Copyright © 2016 Marius Bakke <mbakke@fastmail.com>
43593f5b 6;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
9d625512 7;;; Copyright © 2017 Corentin Bocquillon <corentin@nybble.fr>
bf7c3699 8;;; Copyright © 2017 Gregor Giesen <giesen@zaehlwerk.net>
f38d54f0 9;;; Copyright © 2017 Frederick M. Muriithi <fredmanglis@gmail.com>
4a78fd46 10;;; Copyright © 2017 Nils Gillmann <ng0@n0.is>
3def739d 11;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
04953dca 12;;; Copyright © 2018 Joshua Sierles, Nextjournal <joshua@nextjournal.com>
0149354d
RW
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)
8e664e7e 33 #:use-module (guix utils)
0149354d 34 #:use-module (guix build-system cmake)
d1ef573d 35 #:use-module (guix build-system gnu)
9f1c0e03
LF
36 #:use-module (guix build-system python)
37 #:use-module (guix build-system r)
0149354d 38 #:use-module (gnu packages)
d1ef573d 39 #:use-module (gnu packages autotools)
f50f4ae4 40 #:use-module (gnu packages boost)
d1ef573d
LG
41 #:use-module (gnu packages check)
42 #:use-module (gnu packages compression)
9f1c0e03 43 #:use-module (gnu packages cran)
8d4f34d6 44 #:use-module (gnu packages databases)
d1ef573d 45 #:use-module (gnu packages documentation)
8e664e7e 46 #:use-module (gnu packages lua)
f47dc8dd 47 #:use-module (gnu packages pkg-config)
9d625512 48 #:use-module (gnu packages python)
f38d54f0 49 #:use-module (gnu packages perl)
9f1c0e03 50 #:use-module (gnu packages statistics))
0149354d
RW
51
52(define-public cereal
53 (package
54 (name "cereal")
43593f5b 55 (version "1.2.1")
0149354d
RW
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
43593f5b 63 "0kj32h3j2128anig0g9gzw82kfyd5xqfkwq6vdyv900jx8i1qckx"))))
0149354d
RW
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@") "."))
35929375
TGR
78 (invoke "doxygen" "doc/doxygen.in")
79 #t))
0149354d
RW
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
98arbitrary data types and reversibly turns them into different representations,
99such as compact binary encodings, XML, or JSON.")
100 (license license:bsd-3)))
d1ef573d 101
d1ef573d
LG
102(define-public msgpack
103 (package
104 (name "msgpack")
e54ae862 105 (version "1.4.2")
d1ef573d
LG
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")))
6cbee49d
MW
115 (display
116 (string-append "Requires: " "zlib" "\n") p)
117 (close-output-port p)
118 #t))
d1ef573d
LG
119 (sha256
120 (base32
e54ae862 121 "18hzmyfg3mvnp7ab03nqdzzvqagkl42gygjpi4zv4i7aca2dmwf0"))))
d1ef573d
LG
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.
fe0523d4 134 (home-page "https://www.msgpack.org")
d1ef573d
LG
135 (synopsis "Binary serialization library")
136 (description "Msgpack is a library for C/C++ that implements binary
137serialization.")
138 (license license:boost1.0)))
f50f4ae4 139
c57e5fd0
RW
140(define-public libmpack
141 (package
142 (name "libmpack")
b5236121 143 (version "1.0.5")
c57e5fd0
RW
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
b5236121
LF
150 (base32
151 "0ml922gv8y99lbldqb9ykpjndla0hlprdjyl79yskkhwv2ai7sac"))))
c57e5fd0
RW
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
166that implements both the msgpack and msgpack-rpc specifications.")
167 (license license:expat)))
168
8e664e7e
RW
169(define-public lua-libmpack
170 (package (inherit libmpack)
171 (name "lua-libmpack")
7ec309af
RW
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"))))
8e664e7e
RW
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"
7ec309af
RW
189 "FETCH=echo" ; don't fetch anything from the web
190 "UNTGZ=echo" ; and don't try to unpack it
8e664e7e 191 "USE_SYSTEM_LUA=yes"
7ec309af
RW
192 (string-append "MPACK_LUA_VERSION=" lua-version)
193 (string-append "MPACK_LUA_VERSION_NOPATCH=" lua-major+minor)
8e664e7e
RW
194 (string-append "PREFIX="
195 (assoc-ref %outputs "out"))
196 (string-append "LUA_CMOD_INSTALLDIR="
197 (assoc-ref %outputs "out")
7ec309af 198 "/lib/lua/" lua-major+minor)))
8e664e7e
RW
199 #:phases
200 (modify-phases %standard-phases
201 (delete 'configure)
7ec309af
RW
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"))))))))
8e664e7e
RW
212 (inputs
213 `(("lua" ,lua)))
214 (native-inputs
7ec309af
RW
215 `(("pkg-config" ,pkg-config)
216 ("libmpack" ,(package-source libmpack))))
217 (home-page "https://github.com/libmpack/libmpack-lua")
8e664e7e
RW
218 (synopsis "Lua bindings for the libmpack binary serialization library")))
219
01a0a0c4
H
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
369ee96b
RW
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"
0cdc3343
RW
250 (string-append "MPACK_LUA_VERSION=" lua-version)
251 (string-append "MPACK_LUA_VERSION_NOPATCH=" lua-major+minor)
369ee96b
RW
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
f50f4ae4
DC
260(define-public yaml-cpp
261 (package
262 (name "yaml-cpp")
942cf159 263 (version "0.6.2")
f50f4ae4
DC
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
942cf159 271 "01gxn7kc8pzyh4aadjxxzq8cignmbwmm9rfrsmgqfg9w2q75dn74"))))
f50f4ae4 272 (build-system cmake-build-system)
0577a3fd
CB
273 (arguments
274 '(#:configure-flags '("-DBUILD_SHARED_LIBS=ON")))
f50f4ae4
DC
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)))
cd131a76
DC
281
282(define-public jsoncpp
283 (package
284 (name "jsoncpp")
e1c08dcc 285 (version "1.8.4")
cd131a76
DC
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
e1c08dcc 294 "1dpxk8hkni5dq4mdw8qbaj40jmid3a31d1gh8iqcnfwkw34ym7f4"))))
cd131a76
DC
295 (build-system cmake-build-system)
296 (home-page "https://github.com/open-source-parsers/jsoncpp")
996f5ece
EB
297 (arguments
298 `(#:configure-flags '("-DBUILD_SHARED_LIBS:BOOL=YES")))
cd131a76
DC
299 (synopsis "C++ library for interacting with JSON")
300 (description "JsonCpp is a C++ library that allows manipulating JSON values,
301including serialization and deserialization to and from strings. It can also
302preserve existing comment in unserialization/serialization steps, making
303it a convenient format to store user input files.")
304 (license license:expat)))
557d3328
MB
305
306(define-public capnproto
307 (package
308 (name "capnproto")
9c5f4b82 309 (version "0.7.0")
557d3328
MB
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
9c5f4b82 317 "0hfdnhlbskagzgvby8wy6lrxj53zfzpfqimbhga68c0ji2yw1969"))))
557d3328
MB
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"))
9c5f4b82
CB
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\""))
557d3328
MB
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
340RPC system. Think JSON, except binary. Or think Protocol Buffers, except faster.")
341 (license license:expat)))
9d625512
CB
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
360convert JSON documents to BSON and the opposite. BSON stands for Binary JSON,
361it is comparable to protobuf.")
362 (license license:asl2.0)))
bf7c3699
GG
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”.
383However, “Memory efficiency” and “Speed” have not been primary goals.")
384 (license license:expat)))
f38d54f0
MFM
385
386(define-public python-ruamel.yaml
387 (package
388 (name "python-ruamel.yaml")
95e5aed0 389 (version "0.15.37")
f38d54f0
MFM
390 (source
391 (origin
392 (method url-fetch)
393 (uri (pypi-uri "ruamel.yaml" version))
394 (sha256
395 (base32
95e5aed0 396 "0629xzlwbddfwp8lkjz3mpvxhml9kx17cfs8aydzg55idzcl562h"))))
f38d54f0
MFM
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
407preservation of comments, seq/map flow style, and map key order. It
408is a derivative of Kirill Simonov’s PyYAML 3.11. It supports YAML 1.2
409and has round-trip loaders and dumpers. It supports comments. Block
410style 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))
7ae282fb 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
31af847b
TGR
432Representation (@dfn{CBOR}). CBOR is comparable to JSON, has a superset of
433JSON's ability, but serializes to a binary format which is smaller and faster
434to generate and parse. The two primary functions are @code{cbor.loads} and
7ae282fb 435@code{cbor.dumps}.")
436 (license license:asl2.0)))
04953dca
LF
437
438(define-public flatbuffers
439 (package
440 (name "flatbuffers")
429a332b 441 (version "1.10.0")
04953dca
LF
442 (source
443 (origin
444 (method url-fetch)
445 (uri (string-append "https://github.com/google/flatbuffers/archive/v"
446 version ".tar.gz"))
f5d4c46c 447 (file-name (string-append name "-" version ".tar.gz"))
04953dca
LF
448 (sha256
449 (base32
429a332b 450 "0z4swldxs0s31hnkqdhsbfmc8vx3p7zsvmqaw4l31r2iikdy651p"))))
04953dca
LF
451 (build-system cmake-build-system)
452 (arguments
3def739d
TGR
453 '(#:build-type "Release"
454 #:configure-flags
04953dca 455 (list (string-append "-DCMAKE_INSTALL_LIBDIR="
3def739d 456 (assoc-ref %outputs "out") "/lib"))))
04953dca
LF
457 (home-page "https://google.github.io/flatbuffers/")
458 (synopsis "Memory-efficient serialization library")
a8b12397 459 (description "FlatBuffers is a cross-platform serialization library for C++,
04953dca
LF
460C#, C, Go, Java, JavaScript, PHP, and Python. It was originally created for
461game development and other performance-critical applications.")
462 (license license:asl2.0)))
9f1c0e03
LF
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
483daa store designed for maximum speed.")
484 (license license:asl2.0)))
8d4f34d6
LF
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
504Apache 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))