gnu: Add external-program.
[jackhill/guix/guix.git] / gnu / packages / serialization.scm
CommitLineData
0149354d 1;;; GNU Guix --- Functional package management for GNU
42ef29c8 2;;; Copyright © 2015, 2017, 2019 Ricardo Wurmus <rekado@elephly.net>
d1ef573d 3;;; Copyright © 2016 Lukas Gradl <lgradl@openmailbox.org>
f50f4ae4 4;;; Copyright © 2016 David Craven <david@craven.ch>
cdc07e68 5;;; Copyright © 2016, 2019 Marius Bakke <mbakke@fastmail.com>
f20cfa06 6;;; Copyright © 2016, 2018, 2019 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>
47956fa0 10;;; Copyright © 2017 ng0 <ng0@n0.is>
d7885bbf 11;;; Copyright © 2017, 2018, 2019 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)
42ef29c8 33 #:use-module (guix git-download)
8e664e7e 34 #:use-module (guix utils)
0149354d 35 #:use-module (guix build-system cmake)
d1ef573d 36 #:use-module (guix build-system gnu)
9f1c0e03 37 #:use-module (guix build-system python)
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)
936aa052 43 #:use-module (gnu packages cpp)
8d4f34d6 44 #:use-module (gnu packages databases)
d1ef573d 45 #:use-module (gnu packages documentation)
af632c6b 46 #:use-module (gnu packages gcc)
8e664e7e 47 #:use-module (gnu packages lua)
f47dc8dd 48 #:use-module (gnu packages pkg-config)
9d625512 49 #:use-module (gnu packages python)
312ec128 50 #:use-module (gnu packages python-science)
44d10b1f 51 #:use-module (gnu packages python-xyz)
60a166c6 52 #:use-module (gnu packages perl))
0149354d
RW
53
54(define-public cereal
55 (package
56 (name "cereal")
43593f5b 57 (version "1.2.1")
0300085c
TGR
58 (source
59 (origin
60 (method git-fetch)
61 (uri (git-reference
62 (url "https://github.com/USCiLab/cereal.git")
63 (commit (string-append "v" version))))
64 (file-name (git-file-name name version))
65 (sha256
66 (base32 "1vxkrsnxkiblzi1z61vfix167c184fy868sgwj2dxxgbgjcq2nrh"))))
0149354d
RW
67 (build-system cmake-build-system)
68 (arguments
69 `(;; The only included tests are portability tests requiring
70 ;; cross-compilation and boost. Since we are building cereal on more
71 ;; platforms anyway, there is no compelling reason to build the tests.
72 #:tests? #f
73 #:out-of-source? #f
74 #:phases
75 (modify-phases %standard-phases
76 (delete 'configure)
77 (replace 'build
78 (lambda _
79 (substitute* "doc/doxygen.in"
80 (("@CMAKE_CURRENT_SOURCE_DIR@") "."))
35929375
TGR
81 (invoke "doxygen" "doc/doxygen.in")
82 #t))
0149354d
RW
83 ;; There is no "install" target, so we have to provide our own
84 ;; "install" phase.
85 (replace 'install
86 (lambda* (#:key outputs #:allow-other-keys)
87 (let* ((out (assoc-ref outputs "out"))
88 (doc (string-append out "/share/cereal/docs"))
89 (include (string-append out "/include/cereal")))
90 (mkdir-p doc)
91 (mkdir-p include)
92 (copy-recursively "include/cereal" include)
93 (copy-recursively "doc/html" doc))
94 #t)))))
95 (native-inputs
96 `(("doxygen" ,doxygen)))
97 (home-page "http://uscilab.github.io/cereal/")
98 (synopsis "C++11 library for serialization")
99 (description
100 "Cereal is a header-only C++11 serialization library. Cereal takes
101arbitrary data types and reversibly turns them into different representations,
102such as compact binary encodings, XML, or JSON.")
103 (license license:bsd-3)))
d1ef573d 104
d1ef573d
LG
105(define-public msgpack
106 (package
107 (name "msgpack")
8dac8f11 108 (version "3.2.1")
d1ef573d
LG
109 (source
110 (origin
111 (method url-fetch)
112 (uri
113 (string-append
114 "https://github.com/msgpack/msgpack-c/releases/download/"
115 "cpp-" version "/msgpack-" version ".tar.gz"))
116 (snippet
117 '(let ((p (open-file "msgpack.pc.in" "a")))
6cbee49d
MW
118 (display
119 (string-append "Requires: " "zlib" "\n") p)
120 (close-output-port p)
121 #t))
d1ef573d 122 (sha256
8dac8f11 123 (base32 "1ljqmgscdb0f8w8kx2lnswnisyxchcmijbjbmswkv0g187bvqg23"))))
cdc07e68 124 (build-system cmake-build-system)
d1ef573d
LG
125 (native-inputs
126 `(("googletest" ,googletest)
d1ef573d
LG
127 ("pkg-config" ,pkg-config)))
128 (propagated-inputs
129 `(("zlib" ,zlib))) ;; Msgpack installs two headers (zbuffer.h,
130 ;; zbuffer.hpp) which #include <zlib.h>. However, 'guix gc --references'
131 ;; does not detect a store reference to zlib since these headers are not
132 ;; compiled.
fe0523d4 133 (home-page "https://www.msgpack.org")
d1ef573d
LG
134 (synopsis "Binary serialization library")
135 (description "Msgpack is a library for C/C++ that implements binary
136serialization.")
137 (license license:boost1.0)))
f50f4ae4 138
c57e5fd0
RW
139(define-public libmpack
140 (package
141 (name "libmpack")
b5236121 142 (version "1.0.5")
d7885bbf
TGR
143 (source
144 (origin
145 (method git-fetch)
146 (uri (git-reference
147 (url "https://github.com/tarruda/libmpack.git")
148 (commit version)))
149 (file-name (git-file-name name version))
150 (sha256
151 (base32 "0rai5djdkjz7bsn025k5489in7r1amagw1pib0z4qns6b52kiar2"))))
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")
adad147b 172 (version "1.0.8")
9fde2268
TGR
173 (source
174 (origin
175 (method git-fetch)
176 (uri (git-reference
177 (url "https://github.com/libmpack/libmpack-lua.git")
3acd85ac
TGR
178 (commit version)))
179 (file-name (git-file-name name version))
9fde2268 180 (sha256
3acd85ac 181 (base32 "1ijvzgq5hvib03w5rghv31wi7byamwg7qdx5pawvhvnflaii8ivw"))))
8e664e7e
RW
182 (build-system gnu-build-system)
183 (arguments
184 `(;; FIXME: tests require "busted", which is not yet available in Guix.
185 #:tests? #f
186 #:test-target "test"
187 #:make-flags
188 (let* ((lua-version ,(package-version lua))
189 (lua-major+minor ,(version-major+minor (package-version lua))))
190 (list "CC=gcc"
7ec309af
RW
191 "FETCH=echo" ; don't fetch anything from the web
192 "UNTGZ=echo" ; and don't try to unpack it
8e664e7e 193 "USE_SYSTEM_LUA=yes"
7ec309af
RW
194 (string-append "MPACK_LUA_VERSION=" lua-version)
195 (string-append "MPACK_LUA_VERSION_NOPATCH=" lua-major+minor)
8e664e7e
RW
196 (string-append "PREFIX="
197 (assoc-ref %outputs "out"))
198 (string-append "LUA_CMOD_INSTALLDIR="
199 (assoc-ref %outputs "out")
7ec309af 200 "/lib/lua/" lua-major+minor)))
8e664e7e
RW
201 #:phases
202 (modify-phases %standard-phases
203 (delete 'configure)
7ec309af
RW
204 (add-after 'unpack 'unpack-mpack-sources
205 (lambda* (#:key inputs #:allow-other-keys)
206 ;; This is broken because mpack-src is not a file, but all
207 ;; prerequisites are added to the inputs of the gcc invocation.
208 (substitute* "Makefile"
209 (("\\$\\(MPACK\\): mpack-src") "$(MPACK): "))
d7885bbf
TGR
210 (copy-recursively (assoc-ref inputs "libmpack")
211 "mpack-src")
212 #t)))))
8e664e7e
RW
213 (inputs
214 `(("lua" ,lua)))
215 (native-inputs
7ec309af
RW
216 `(("pkg-config" ,pkg-config)
217 ("libmpack" ,(package-source libmpack))))
218 (home-page "https://github.com/libmpack/libmpack-lua")
8e664e7e
RW
219 (synopsis "Lua bindings for the libmpack binary serialization library")))
220
01a0a0c4
H
221(define-public lua5.1-libmpack
222 (package (inherit lua-libmpack)
223 (name "lua5.1-libmpack")
224 (arguments
225 (substitute-keyword-arguments (package-arguments lua-libmpack)
226 ((#:make-flags flags)
227 `(let* ((lua-version ,(package-version lua-5.1))
228 (lua-major+minor ,(version-major+minor (package-version lua-5.1))))
229 (list "CC=gcc"
230 "USE_SYSTEM_LUA=yes"
231 (string-append "MPACK_LUA_VERSION=" lua-version)
232 (string-append "MPACK_LUA_VERSION_NOPATCH=" lua-major+minor)
233 (string-append "PREFIX="
234 (assoc-ref %outputs "out"))
235 (string-append "LUA_CMOD_INSTALLDIR="
236 (assoc-ref %outputs "out")
237 "/lib/lua/" lua-major+minor))))))
238 (inputs
239 `(("lua" ,lua-5.1)))))
240
369ee96b
RW
241(define-public lua5.2-libmpack
242 (package (inherit lua-libmpack)
243 (name "lua5.2-libmpack")
244 (arguments
245 (substitute-keyword-arguments (package-arguments lua-libmpack)
246 ((#:make-flags flags)
247 `(let* ((lua-version ,(package-version lua-5.2))
248 (lua-major+minor ,(version-major+minor (package-version lua-5.2))))
249 (list "CC=gcc"
250 "USE_SYSTEM_LUA=yes"
0cdc3343
RW
251 (string-append "MPACK_LUA_VERSION=" lua-version)
252 (string-append "MPACK_LUA_VERSION_NOPATCH=" lua-major+minor)
369ee96b
RW
253 (string-append "PREFIX="
254 (assoc-ref %outputs "out"))
255 (string-append "LUA_CMOD_INSTALLDIR="
256 (assoc-ref %outputs "out")
257 "/lib/lua/" lua-major+minor))))))
258 (inputs
259 `(("lua" ,lua-5.2)))))
260
f50f4ae4
DC
261(define-public yaml-cpp
262 (package
263 (name "yaml-cpp")
2acbc174 264 (version "0.6.3")
417b07ab
TGR
265 (source
266 (origin
267 (method git-fetch)
268 (uri (git-reference
269 (url "https://github.com/jbeder/yaml-cpp.git")
270 (commit (string-append "yaml-cpp-" version))))
271 (file-name (git-file-name name version))
272 (sha256
273 (base32 "0ykkxzxcwwiv8l8r697gyqh1nl582krpvi7m7l6b40ijnk4pw30s"))))
f50f4ae4 274 (build-system cmake-build-system)
0577a3fd 275 (arguments
2acbc174 276 '(#:configure-flags '("-DYAML_BUILD_SHARED_LIBS=ON")))
f50f4ae4
DC
277 (native-inputs
278 `(("python" ,python)))
279 (home-page "https://github.com/jbeder/yaml-cpp")
280 (synopsis "YAML parser and emitter in C++")
281 (description "YAML parser and emitter in C++ matching the YAML 1.2 spec.")
282 (license license:bsd-3)))
cd131a76
DC
283
284(define-public jsoncpp
285 (package
286 (name "jsoncpp")
d9580a26 287 (version "1.9.2")
f1818f96 288 (home-page "https://github.com/open-source-parsers/jsoncpp")
cd131a76 289 (source (origin
f1818f96
MB
290 (method git-fetch)
291 (uri (git-reference (url home-page) (commit version)))
292 (file-name (git-file-name name version))
cd131a76
DC
293 (sha256
294 (base32
d9580a26 295 "037d1b1qdmn3rksmn1j71j26bv4hkjv7sn7da261k853xb5899sg"))))
cd131a76 296 (build-system cmake-build-system)
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 305
42ef29c8
RW
306;; Tensorflow does not build with jsoncpp 1.8.x. It is built with commit
307;; 4356d9bba191e1e16ce7a92073cbf3e63564e973, which lies between version 1.7.2
308;; and 1.7.3.
309(define-public jsoncpp-for-tensorflow
310 (package (inherit jsoncpp)
311 (name "jsoncpp")
312 (version "1.7.3")
313 (source (origin
314 (method git-fetch)
315 (uri (git-reference
316 (url "https://github.com/open-source-parsers/jsoncpp.git")
317 (commit version)))
318 (file-name (git-file-name name version))
319 (sha256
320 (base32
321 "1180ln8blrb0mwzpcf78k49hlki6di65q77rsvglf83kfcyh4d7z"))))))
322
557d3328
MB
323(define-public capnproto
324 (package
325 (name "capnproto")
9c5f4b82 326 (version "0.7.0")
557d3328
MB
327 (source (origin
328 (method url-fetch)
329 (uri (string-append
330 "https://capnproto.org/capnproto-c++-"
331 version ".tar.gz"))
332 (sha256
333 (base32
9c5f4b82 334 "0hfdnhlbskagzgvby8wy6lrxj53zfzpfqimbhga68c0ji2yw1969"))))
557d3328
MB
335 (build-system gnu-build-system)
336 (arguments
337 `(#:phases
338 (modify-phases %standard-phases
339 (add-before 'check 'do-not-require-/etc/services
340 (lambda _
341 ;; Workaround for test that tries to resolve port name from
342 ;; /etc/services, which is not present in build environment.
343 (substitute* "src/kj/async-io-test.c++" ((":http") ":80"))
9c5f4b82
CB
344 #t))
345 (add-before 'check 'use-tmp-for-tempory-files
346 (lambda _
347 ;; Use /tmp for tempory files, as the default /var/tmp directory
348 ;; doesn't exist.
349 (substitute* "src/kj/filesystem-disk-test.c++"
350 (("VAR\\_TMP \"/var/tmp\"")
351 "VAR_TMP \"/tmp\""))
557d3328
MB
352 #t)))))
353 (home-page "https://capnproto.org")
354 (synopsis "Capability-based RPC and serialization system")
355 (description
356 "Cap'n Proto is a very fast data interchange format and capability-based
357RPC system. Think JSON, except binary. Or think Protocol Buffers, except faster.")
358 (license license:expat)))
9d625512
CB
359
360(define-public libbson
361 (package
362 (name "libbson")
363 (version "1.6.2")
364 (source
365 (origin
366 (method url-fetch)
367 (uri (string-append "https://github.com/mongodb/libbson/releases/"
368 "download/" version "/libbson-" version ".tar.gz"))
369 (sha256
370 (base32
371 "1fj4554msq0rrz14snbj908dzqj46gh7jg9w9j0akn2b7q911m5a"))))
372 (build-system gnu-build-system)
373 (native-inputs `(("perl" ,perl)))
374 (home-page "http://mongoc.org/libbson/current/index.html")
375 (synopsis "C BSON library")
376 (description "Libbson can create and parse BSON documents. It can also
377convert JSON documents to BSON and the opposite. BSON stands for Binary JSON,
378it is comparable to protobuf.")
379 (license license:asl2.0)))
bf7c3699 380
f38d54f0
MFM
381(define-public python-ruamel.yaml
382 (package
383 (name "python-ruamel.yaml")
f20cfa06 384 (version "0.15.83")
f38d54f0
MFM
385 (source
386 (origin
387 (method url-fetch)
388 (uri (pypi-uri "ruamel.yaml" version))
389 (sha256
390 (base32
f20cfa06 391 "0p4i8ad28cbbbjja8b9274irkhnphhvhap3aym6yb8xfp1d72kpw"))))
f38d54f0
MFM
392 (build-system python-build-system)
393 (native-inputs
394 `(("python-pytest" ,python-pytest)))
395 (arguments
396 `(;; TODO: Tests require packaging "ruamel.std.pathlib".
397 #:tests? #f))
398 (home-page "https://bitbucket.org/ruamel/yaml")
399 (synopsis "YAML 1.2 parser/emitter")
400 (description
401 "This package provides YAML parser/emitter that supports roundtrip
402preservation of comments, seq/map flow style, and map key order. It
403is a derivative of Kirill Simonov’s PyYAML 3.11. It supports YAML 1.2
404and has round-trip loaders and dumpers. It supports comments. Block
405style and key ordering are kept, so you can diff the source.")
406 (license license:expat)))
407
408(define-public python2-ruamel.yaml
409 (package-with-python2 python-ruamel.yaml))
7ae282fb 410
411(define-public python-cbor
412 (package
413 (name "python-cbor")
414 (version "1.0.0")
415 (source
416 (origin
417 (method url-fetch)
418 (uri (pypi-uri "cbor" version))
419 (sha256
420 (base32
421 "1dmv163cnslyqccrybkxn0c9s1jk1mmafmgxv75iamnz5lk5l8hk"))))
422 (build-system python-build-system)
423 (home-page "https://bitbucket.org/bodhisnarkva/cbor")
424 (synopsis "Implementation of the Concise Binary Object Representation")
425 (description
426 "Python-cbor provides an implementation of the Concise Binary Object
31af847b
TGR
427Representation (@dfn{CBOR}). CBOR is comparable to JSON, has a superset of
428JSON's ability, but serializes to a binary format which is smaller and faster
429to generate and parse. The two primary functions are @code{cbor.loads} and
7ae282fb 430@code{cbor.dumps}.")
431 (license license:asl2.0)))
04953dca
LF
432
433(define-public flatbuffers
434 (package
435 (name "flatbuffers")
429a332b 436 (version "1.10.0")
04953dca
LF
437 (source
438 (origin
439 (method url-fetch)
440 (uri (string-append "https://github.com/google/flatbuffers/archive/v"
441 version ".tar.gz"))
f5d4c46c 442 (file-name (string-append name "-" version ".tar.gz"))
04953dca
LF
443 (sha256
444 (base32
429a332b 445 "0z4swldxs0s31hnkqdhsbfmc8vx3p7zsvmqaw4l31r2iikdy651p"))))
04953dca
LF
446 (build-system cmake-build-system)
447 (arguments
3def739d
TGR
448 '(#:build-type "Release"
449 #:configure-flags
04953dca 450 (list (string-append "-DCMAKE_INSTALL_LIBDIR="
3def739d 451 (assoc-ref %outputs "out") "/lib"))))
04953dca
LF
452 (home-page "https://google.github.io/flatbuffers/")
453 (synopsis "Memory-efficient serialization library")
a8b12397 454 (description "FlatBuffers is a cross-platform serialization library for C++,
04953dca
LF
455C#, C, Go, Java, JavaScript, PHP, and Python. It was originally created for
456game development and other performance-critical applications.")
457 (license license:asl2.0)))
9f1c0e03 458
8d4f34d6
LF
459(define-public python-feather-format
460 (package
461 (name "python-feather-format")
462 (version "0.4.0")
463 (source
464 (origin
465 (method url-fetch)
466 (uri (pypi-uri "feather-format" version))
467 (sha256
468 (base32
469 "1adivm5w5ji4qv7hq7942vqlk8l2wgw87bdlsia771z14z3zp857"))))
470 (build-system python-build-system)
471 (propagated-inputs
472 `(("python-pandas" ,python-pandas)
473 ("python-pyarrow" ,python-pyarrow)))
474 (home-page "https://github.com/wesm/feather")
475 (synopsis "Python wrapper to the Feather file format")
476 (description "This package provides a Python wrapper library to the
477Apache Arrow-based Feather binary columnar serialization data frame format.")
478 (license license:asl2.0)))