gnu: lua-libmpack: Update to 1.0.8.
[jackhill/guix/guix.git] / gnu / packages / serialization.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2015, 2017, 2019 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, 2018, 2019 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@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 git-download)
34 #:use-module (guix utils)
35 #:use-module (guix build-system cmake)
36 #:use-module (guix build-system gnu)
37 #:use-module (guix build-system python)
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 databases)
44 #:use-module (gnu packages documentation)
45 #:use-module (gnu packages lua)
46 #:use-module (gnu packages pkg-config)
47 #:use-module (gnu packages python)
48 #:use-module (gnu packages python-xyz)
49 #:use-module (gnu packages perl))
50
51 (define-public cereal
52 (package
53 (name "cereal")
54 (version "1.2.1")
55 (source (origin
56 (method url-fetch)
57 (uri (string-append "https://github.com/USCiLab/cereal/archive/v"
58 version ".tar.gz"))
59 (file-name (string-append name "-" version ".tar.gz"))
60 (sha256
61 (base32
62 "0kj32h3j2128anig0g9gzw82kfyd5xqfkwq6vdyv900jx8i1qckx"))))
63 (build-system cmake-build-system)
64 (arguments
65 `(;; The only included tests are portability tests requiring
66 ;; cross-compilation and boost. Since we are building cereal on more
67 ;; platforms anyway, there is no compelling reason to build the tests.
68 #:tests? #f
69 #:out-of-source? #f
70 #:phases
71 (modify-phases %standard-phases
72 (delete 'configure)
73 (replace 'build
74 (lambda _
75 (substitute* "doc/doxygen.in"
76 (("@CMAKE_CURRENT_SOURCE_DIR@") "."))
77 (invoke "doxygen" "doc/doxygen.in")
78 #t))
79 ;; There is no "install" target, so we have to provide our own
80 ;; "install" phase.
81 (replace 'install
82 (lambda* (#:key outputs #:allow-other-keys)
83 (let* ((out (assoc-ref outputs "out"))
84 (doc (string-append out "/share/cereal/docs"))
85 (include (string-append out "/include/cereal")))
86 (mkdir-p doc)
87 (mkdir-p include)
88 (copy-recursively "include/cereal" include)
89 (copy-recursively "doc/html" doc))
90 #t)))))
91 (native-inputs
92 `(("doxygen" ,doxygen)))
93 (home-page "http://uscilab.github.io/cereal/")
94 (synopsis "C++11 library for serialization")
95 (description
96 "Cereal is a header-only C++11 serialization library. Cereal takes
97 arbitrary data types and reversibly turns them into different representations,
98 such as compact binary encodings, XML, or JSON.")
99 (license license:bsd-3)))
100
101 (define-public msgpack
102 (package
103 (name "msgpack")
104 (version "1.4.2")
105 (source
106 (origin
107 (method url-fetch)
108 (uri
109 (string-append
110 "https://github.com/msgpack/msgpack-c/releases/download/"
111 "cpp-" version "/msgpack-" version ".tar.gz"))
112 (snippet
113 '(let ((p (open-file "msgpack.pc.in" "a")))
114 (display
115 (string-append "Requires: " "zlib" "\n") p)
116 (close-output-port p)
117 #t))
118 (sha256
119 (base32
120 "18hzmyfg3mvnp7ab03nqdzzvqagkl42gygjpi4zv4i7aca2dmwf0"))))
121 (build-system gnu-build-system)
122 (native-inputs
123 `(("googletest" ,googletest)
124 ("autoconf" ,autoconf)
125 ("automake" ,automake)
126 ("libtool" ,libtool)
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.
133 (home-page "https://www.msgpack.org")
134 (synopsis "Binary serialization library")
135 (description "Msgpack is a library for C/C++ that implements binary
136 serialization.")
137 (license license:boost1.0)))
138
139 (define-public libmpack
140 (package
141 (name "libmpack")
142 (version "1.0.5")
143 (source (origin
144 (method url-fetch)
145 (uri (string-append "https://github.com/tarruda/libmpack/"
146 "archive/" version ".tar.gz"))
147 (file-name (string-append name "-" version ".tar.gz"))
148 (sha256
149 (base32
150 "0ml922gv8y99lbldqb9ykpjndla0hlprdjyl79yskkhwv2ai7sac"))))
151 (build-system gnu-build-system)
152 (arguments
153 `(#:test-target "test"
154 #:make-flags
155 (list "CC=gcc"
156 (string-append "PREFIX=" (assoc-ref %outputs "out")))
157 #:phases
158 (modify-phases %standard-phases
159 (delete 'configure))))
160 (native-inputs
161 `(("libtool" ,libtool)))
162 (home-page "https://github.com/tarruda/libmpack")
163 (synopsis "Small binary serialization library")
164 (description "Libmpack is a small binary serialization and RPC library
165 that implements both the msgpack and msgpack-rpc specifications.")
166 (license license:expat)))
167
168 (define-public lua-libmpack
169 (package (inherit libmpack)
170 (name "lua-libmpack")
171 (version "1.0.8")
172 (source (origin
173 (method git-fetch)
174 (uri (git-reference
175 (url "https://github.com/libmpack/libmpack-lua")
176 (commit version)))
177 (file-name (git-file-name name version))
178 (sha256
179 (base32
180 "1ijvzgq5hvib03w5rghv31wi7byamwg7qdx5pawvhvnflaii8ivw"))))
181 (build-system gnu-build-system)
182 (arguments
183 `(;; FIXME: tests require "busted", which is not yet available in Guix.
184 #:tests? #f
185 #:test-target "test"
186 #:make-flags
187 (let* ((lua-version ,(package-version lua))
188 (lua-major+minor ,(version-major+minor (package-version lua))))
189 (list "CC=gcc"
190 "FETCH=echo" ; don't fetch anything from the web
191 "UNTGZ=echo" ; and don't try to unpack it
192 "USE_SYSTEM_LUA=yes"
193 (string-append "MPACK_LUA_VERSION=" lua-version)
194 (string-append "MPACK_LUA_VERSION_NOPATCH=" lua-major+minor)
195 (string-append "PREFIX="
196 (assoc-ref %outputs "out"))
197 (string-append "LUA_CMOD_INSTALLDIR="
198 (assoc-ref %outputs "out")
199 "/lib/lua/" lua-major+minor)))
200 #:phases
201 (modify-phases %standard-phases
202 (delete 'configure)
203 (add-after 'unpack 'unpack-mpack-sources
204 (lambda* (#:key inputs #:allow-other-keys)
205 ;; This is broken because mpack-src is not a file, but all
206 ;; prerequisites are added to the inputs of the gcc invocation.
207 (substitute* "Makefile"
208 (("\\$\\(MPACK\\): mpack-src") "$(MPACK): "))
209 (mkdir-p "mpack-src")
210 (zero? (system* "tar" "-C" "mpack-src"
211 "--strip-components=1"
212 "-xvf" (assoc-ref inputs "libmpack"))))))))
213 (inputs
214 `(("lua" ,lua)))
215 (native-inputs
216 `(("pkg-config" ,pkg-config)
217 ("libmpack" ,(package-source libmpack))))
218 (home-page "https://github.com/libmpack/libmpack-lua")
219 (synopsis "Lua bindings for the libmpack binary serialization library")))
220
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
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"
251 (string-append "MPACK_LUA_VERSION=" lua-version)
252 (string-append "MPACK_LUA_VERSION_NOPATCH=" lua-major+minor)
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
261 (define-public yaml-cpp
262 (package
263 (name "yaml-cpp")
264 (version "0.6.2")
265 (source (origin
266 (method url-fetch)
267 (uri (string-append
268 "https://github.com/jbeder/yaml-cpp/archive/"
269 "yaml-cpp-" version ".tar.gz"))
270 (sha256
271 (base32
272 "01gxn7kc8pzyh4aadjxxzq8cignmbwmm9rfrsmgqfg9w2q75dn74"))))
273 (build-system cmake-build-system)
274 (arguments
275 '(#:configure-flags '("-DBUILD_SHARED_LIBS=ON")
276 #:phases
277 (modify-phases %standard-phases
278 (add-after 'install 'dont-install-gtest-libraries
279 (lambda* (#:key outputs #:allow-other-keys)
280 (let ((out (assoc-ref outputs "out")))
281 (with-directory-excursion
282 (string-append out "/include")
283 (delete-file-recursively "gtest")
284 (delete-file-recursively "gmock"))
285 (with-directory-excursion
286 (string-append out "/lib")
287 (for-each (lambda (file)
288 (delete-file file))
289 '("libgmock.so" "libgmock_main.so"
290 "libgtest.so" "libgtest_main.so"))))
291 #t)))))
292 (native-inputs
293 `(("python" ,python)))
294 (home-page "https://github.com/jbeder/yaml-cpp")
295 (synopsis "YAML parser and emitter in C++")
296 (description "YAML parser and emitter in C++ matching the YAML 1.2 spec.")
297 (license license:bsd-3)))
298
299 (define-public jsoncpp
300 (package
301 (name "jsoncpp")
302 (version "1.9.0")
303 (home-page "https://github.com/open-source-parsers/jsoncpp")
304 (source (origin
305 (method git-fetch)
306 (uri (git-reference (url home-page) (commit version)))
307 (file-name (git-file-name name version))
308 (sha256
309 (base32
310 "10wnwlq92gp32f5p55kjcc12jfsl0yq6f2y4abb0si6wym12krw9"))))
311 (build-system cmake-build-system)
312 (arguments
313 `(#:configure-flags '("-DBUILD_SHARED_LIBS:BOOL=YES")))
314 (synopsis "C++ library for interacting with JSON")
315 (description "JsonCpp is a C++ library that allows manipulating JSON values,
316 including serialization and deserialization to and from strings. It can also
317 preserve existing comment in unserialization/serialization steps, making
318 it a convenient format to store user input files.")
319 (license license:expat)))
320
321 ;; Tensorflow does not build with jsoncpp 1.8.x. It is built with commit
322 ;; 4356d9bba191e1e16ce7a92073cbf3e63564e973, which lies between version 1.7.2
323 ;; and 1.7.3.
324 (define-public jsoncpp-for-tensorflow
325 (package (inherit jsoncpp)
326 (name "jsoncpp")
327 (version "1.7.3")
328 (source (origin
329 (method git-fetch)
330 (uri (git-reference
331 (url "https://github.com/open-source-parsers/jsoncpp.git")
332 (commit version)))
333 (file-name (git-file-name name version))
334 (sha256
335 (base32
336 "1180ln8blrb0mwzpcf78k49hlki6di65q77rsvglf83kfcyh4d7z"))))))
337
338 (define-public capnproto
339 (package
340 (name "capnproto")
341 (version "0.7.0")
342 (source (origin
343 (method url-fetch)
344 (uri (string-append
345 "https://capnproto.org/capnproto-c++-"
346 version ".tar.gz"))
347 (sha256
348 (base32
349 "0hfdnhlbskagzgvby8wy6lrxj53zfzpfqimbhga68c0ji2yw1969"))))
350 (build-system gnu-build-system)
351 (arguments
352 `(#:phases
353 (modify-phases %standard-phases
354 (add-before 'check 'do-not-require-/etc/services
355 (lambda _
356 ;; Workaround for test that tries to resolve port name from
357 ;; /etc/services, which is not present in build environment.
358 (substitute* "src/kj/async-io-test.c++" ((":http") ":80"))
359 #t))
360 (add-before 'check 'use-tmp-for-tempory-files
361 (lambda _
362 ;; Use /tmp for tempory files, as the default /var/tmp directory
363 ;; doesn't exist.
364 (substitute* "src/kj/filesystem-disk-test.c++"
365 (("VAR\\_TMP \"/var/tmp\"")
366 "VAR_TMP \"/tmp\""))
367 #t)))))
368 (home-page "https://capnproto.org")
369 (synopsis "Capability-based RPC and serialization system")
370 (description
371 "Cap'n Proto is a very fast data interchange format and capability-based
372 RPC system. Think JSON, except binary. Or think Protocol Buffers, except faster.")
373 (license license:expat)))
374
375 (define-public libbson
376 (package
377 (name "libbson")
378 (version "1.6.2")
379 (source
380 (origin
381 (method url-fetch)
382 (uri (string-append "https://github.com/mongodb/libbson/releases/"
383 "download/" version "/libbson-" version ".tar.gz"))
384 (sha256
385 (base32
386 "1fj4554msq0rrz14snbj908dzqj46gh7jg9w9j0akn2b7q911m5a"))))
387 (build-system gnu-build-system)
388 (native-inputs `(("perl" ,perl)))
389 (home-page "http://mongoc.org/libbson/current/index.html")
390 (synopsis "C BSON library")
391 (description "Libbson can create and parse BSON documents. It can also
392 convert JSON documents to BSON and the opposite. BSON stands for Binary JSON,
393 it is comparable to protobuf.")
394 (license license:asl2.0)))
395
396 (define-public nlohmann-json-cpp
397 (package
398 (name "nlohmann-json-cpp")
399 (version "2.1.1")
400 (source
401 (origin
402 (method url-fetch)
403 (uri (string-append "https://github.com/nlohmann/json/"
404 "archive/v" version ".tar.gz"))
405 (file-name (string-append name "-" version ".tar.gz"))
406 (sha256
407 (base32
408 "0lrh6cjd643c7kmvmwafbgq7dqj3b778483gjhjbvp6rc6z5xf2r"))))
409 (build-system cmake-build-system)
410 (home-page "https://nlohmann.github.io/json/")
411 (synopsis "JSON library for C++")
412 (description
413 "JSON library for C++ trying to accomplish “Intuitive syntax”,
414 “Trivial integration”, and “Serious testing”.
415 However, “Memory efficiency” and “Speed” have not been primary goals.")
416 (license license:expat)))
417
418 (define-public python-ruamel.yaml
419 (package
420 (name "python-ruamel.yaml")
421 (version "0.15.83")
422 (source
423 (origin
424 (method url-fetch)
425 (uri (pypi-uri "ruamel.yaml" version))
426 (sha256
427 (base32
428 "0p4i8ad28cbbbjja8b9274irkhnphhvhap3aym6yb8xfp1d72kpw"))))
429 (build-system python-build-system)
430 (native-inputs
431 `(("python-pytest" ,python-pytest)))
432 (arguments
433 `(;; TODO: Tests require packaging "ruamel.std.pathlib".
434 #:tests? #f))
435 (home-page "https://bitbucket.org/ruamel/yaml")
436 (synopsis "YAML 1.2 parser/emitter")
437 (description
438 "This package provides YAML parser/emitter that supports roundtrip
439 preservation of comments, seq/map flow style, and map key order. It
440 is a derivative of Kirill Simonov’s PyYAML 3.11. It supports YAML 1.2
441 and has round-trip loaders and dumpers. It supports comments. Block
442 style and key ordering are kept, so you can diff the source.")
443 (license license:expat)))
444
445 (define-public python2-ruamel.yaml
446 (package-with-python2 python-ruamel.yaml))
447
448 (define-public python-cbor
449 (package
450 (name "python-cbor")
451 (version "1.0.0")
452 (source
453 (origin
454 (method url-fetch)
455 (uri (pypi-uri "cbor" version))
456 (sha256
457 (base32
458 "1dmv163cnslyqccrybkxn0c9s1jk1mmafmgxv75iamnz5lk5l8hk"))))
459 (build-system python-build-system)
460 (home-page "https://bitbucket.org/bodhisnarkva/cbor")
461 (synopsis "Implementation of the Concise Binary Object Representation")
462 (description
463 "Python-cbor provides an implementation of the Concise Binary Object
464 Representation (@dfn{CBOR}). CBOR is comparable to JSON, has a superset of
465 JSON's ability, but serializes to a binary format which is smaller and faster
466 to generate and parse. The two primary functions are @code{cbor.loads} and
467 @code{cbor.dumps}.")
468 (license license:asl2.0)))
469
470 (define-public flatbuffers
471 (package
472 (name "flatbuffers")
473 (version "1.10.0")
474 (source
475 (origin
476 (method url-fetch)
477 (uri (string-append "https://github.com/google/flatbuffers/archive/v"
478 version ".tar.gz"))
479 (file-name (string-append name "-" version ".tar.gz"))
480 (sha256
481 (base32
482 "0z4swldxs0s31hnkqdhsbfmc8vx3p7zsvmqaw4l31r2iikdy651p"))))
483 (build-system cmake-build-system)
484 (arguments
485 '(#:build-type "Release"
486 #:configure-flags
487 (list (string-append "-DCMAKE_INSTALL_LIBDIR="
488 (assoc-ref %outputs "out") "/lib"))))
489 (home-page "https://google.github.io/flatbuffers/")
490 (synopsis "Memory-efficient serialization library")
491 (description "FlatBuffers is a cross-platform serialization library for C++,
492 C#, C, Go, Java, JavaScript, PHP, and Python. It was originally created for
493 game development and other performance-critical applications.")
494 (license license:asl2.0)))
495
496 (define-public python-feather-format
497 (package
498 (name "python-feather-format")
499 (version "0.4.0")
500 (source
501 (origin
502 (method url-fetch)
503 (uri (pypi-uri "feather-format" version))
504 (sha256
505 (base32
506 "1adivm5w5ji4qv7hq7942vqlk8l2wgw87bdlsia771z14z3zp857"))))
507 (build-system python-build-system)
508 (propagated-inputs
509 `(("python-pandas" ,python-pandas)
510 ("python-pyarrow" ,python-pyarrow)))
511 (home-page "https://github.com/wesm/feather")
512 (synopsis "Python wrapper to the Feather file format")
513 (description "This package provides a Python wrapper library to the
514 Apache Arrow-based Feather binary columnar serialization data frame format.")
515 (license license:asl2.0)))
516
517 (define-public python2-feather-format
518 (package-with-python2 python-feather-format))