gnu: lua-libmpack: Do not use unstable source tarball.
[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>
557d3328 5;;; Copyright © 2016 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>
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)
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)
8d4f34d6 43 #:use-module (gnu packages databases)
d1ef573d 44 #:use-module (gnu packages documentation)
8e664e7e 45 #:use-module (gnu packages lua)
f47dc8dd 46 #:use-module (gnu packages pkg-config)
9d625512 47 #:use-module (gnu packages python)
44d10b1f 48 #:use-module (gnu packages python-xyz)
60a166c6 49 #:use-module (gnu packages perl))
0149354d
RW
50
51(define-public cereal
52 (package
53 (name "cereal")
43593f5b 54 (version "1.2.1")
0149354d
RW
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
43593f5b 62 "0kj32h3j2128anig0g9gzw82kfyd5xqfkwq6vdyv900jx8i1qckx"))))
0149354d
RW
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@") "."))
35929375
TGR
77 (invoke "doxygen" "doc/doxygen.in")
78 #t))
0149354d
RW
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
97arbitrary data types and reversibly turns them into different representations,
98such as compact binary encodings, XML, or JSON.")
99 (license license:bsd-3)))
d1ef573d 100
d1ef573d
LG
101(define-public msgpack
102 (package
103 (name "msgpack")
e54ae862 104 (version "1.4.2")
d1ef573d
LG
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")))
6cbee49d
MW
114 (display
115 (string-append "Requires: " "zlib" "\n") p)
116 (close-output-port p)
117 #t))
d1ef573d
LG
118 (sha256
119 (base32
e54ae862 120 "18hzmyfg3mvnp7ab03nqdzzvqagkl42gygjpi4zv4i7aca2dmwf0"))))
d1ef573d
LG
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.
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")
c57e5fd0
RW
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
b5236121
LF
149 (base32
150 "0ml922gv8y99lbldqb9ykpjndla0hlprdjyl79yskkhwv2ai7sac"))))
c57e5fd0
RW
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
165that implements both the msgpack and msgpack-rpc specifications.")
166 (license license:expat)))
167
8e664e7e
RW
168(define-public lua-libmpack
169 (package (inherit libmpack)
170 (name "lua-libmpack")
7ec309af 171 (source (origin
2ec3df70
MB
172 (method git-fetch)
173 (uri (git-reference
174 (url "https://github.com/libmpack/libmpack-lua")
175 (commit (package-version libmpack))))
176 (file-name (git-file-name name (package-version libmpack)))
7ec309af
RW
177 (sha256
178 (base32
2ec3df70 179 "10zx4biyi9gmk90aa6674vvqsrz74jy74fxqlcrx66c8sl8yxr92"))))
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 273 (arguments
9a1ef44e
EF
274 '(#:configure-flags '("-DBUILD_SHARED_LIBS=ON")
275 #:phases
276 (modify-phases %standard-phases
277 (add-after 'install 'dont-install-gtest-libraries
278 (lambda* (#:key outputs #:allow-other-keys)
279 (let ((out (assoc-ref outputs "out")))
280 (with-directory-excursion
281 (string-append out "/include")
282 (delete-file-recursively "gtest")
283 (delete-file-recursively "gmock"))
284 (with-directory-excursion
285 (string-append out "/lib")
286 (for-each (lambda (file)
287 (delete-file file))
288 '("libgmock.so" "libgmock_main.so"
289 "libgtest.so" "libgtest_main.so"))))
290 #t)))))
f50f4ae4
DC
291 (native-inputs
292 `(("python" ,python)))
293 (home-page "https://github.com/jbeder/yaml-cpp")
294 (synopsis "YAML parser and emitter in C++")
295 (description "YAML parser and emitter in C++ matching the YAML 1.2 spec.")
296 (license license:bsd-3)))
cd131a76
DC
297
298(define-public jsoncpp
299 (package
300 (name "jsoncpp")
4ed252c3 301 (version "1.9.0")
f1818f96 302 (home-page "https://github.com/open-source-parsers/jsoncpp")
cd131a76 303 (source (origin
f1818f96
MB
304 (method git-fetch)
305 (uri (git-reference (url home-page) (commit version)))
306 (file-name (git-file-name name version))
cd131a76
DC
307 (sha256
308 (base32
4ed252c3 309 "10wnwlq92gp32f5p55kjcc12jfsl0yq6f2y4abb0si6wym12krw9"))))
cd131a76 310 (build-system cmake-build-system)
996f5ece
EB
311 (arguments
312 `(#:configure-flags '("-DBUILD_SHARED_LIBS:BOOL=YES")))
cd131a76
DC
313 (synopsis "C++ library for interacting with JSON")
314 (description "JsonCpp is a C++ library that allows manipulating JSON values,
315including serialization and deserialization to and from strings. It can also
316preserve existing comment in unserialization/serialization steps, making
317it a convenient format to store user input files.")
318 (license license:expat)))
557d3328 319
42ef29c8
RW
320;; Tensorflow does not build with jsoncpp 1.8.x. It is built with commit
321;; 4356d9bba191e1e16ce7a92073cbf3e63564e973, which lies between version 1.7.2
322;; and 1.7.3.
323(define-public jsoncpp-for-tensorflow
324 (package (inherit jsoncpp)
325 (name "jsoncpp")
326 (version "1.7.3")
327 (source (origin
328 (method git-fetch)
329 (uri (git-reference
330 (url "https://github.com/open-source-parsers/jsoncpp.git")
331 (commit version)))
332 (file-name (git-file-name name version))
333 (sha256
334 (base32
335 "1180ln8blrb0mwzpcf78k49hlki6di65q77rsvglf83kfcyh4d7z"))))))
336
557d3328
MB
337(define-public capnproto
338 (package
339 (name "capnproto")
9c5f4b82 340 (version "0.7.0")
557d3328
MB
341 (source (origin
342 (method url-fetch)
343 (uri (string-append
344 "https://capnproto.org/capnproto-c++-"
345 version ".tar.gz"))
346 (sha256
347 (base32
9c5f4b82 348 "0hfdnhlbskagzgvby8wy6lrxj53zfzpfqimbhga68c0ji2yw1969"))))
557d3328
MB
349 (build-system gnu-build-system)
350 (arguments
351 `(#:phases
352 (modify-phases %standard-phases
353 (add-before 'check 'do-not-require-/etc/services
354 (lambda _
355 ;; Workaround for test that tries to resolve port name from
356 ;; /etc/services, which is not present in build environment.
357 (substitute* "src/kj/async-io-test.c++" ((":http") ":80"))
9c5f4b82
CB
358 #t))
359 (add-before 'check 'use-tmp-for-tempory-files
360 (lambda _
361 ;; Use /tmp for tempory files, as the default /var/tmp directory
362 ;; doesn't exist.
363 (substitute* "src/kj/filesystem-disk-test.c++"
364 (("VAR\\_TMP \"/var/tmp\"")
365 "VAR_TMP \"/tmp\""))
557d3328
MB
366 #t)))))
367 (home-page "https://capnproto.org")
368 (synopsis "Capability-based RPC and serialization system")
369 (description
370 "Cap'n Proto is a very fast data interchange format and capability-based
371RPC system. Think JSON, except binary. Or think Protocol Buffers, except faster.")
372 (license license:expat)))
9d625512
CB
373
374(define-public libbson
375 (package
376 (name "libbson")
377 (version "1.6.2")
378 (source
379 (origin
380 (method url-fetch)
381 (uri (string-append "https://github.com/mongodb/libbson/releases/"
382 "download/" version "/libbson-" version ".tar.gz"))
383 (sha256
384 (base32
385 "1fj4554msq0rrz14snbj908dzqj46gh7jg9w9j0akn2b7q911m5a"))))
386 (build-system gnu-build-system)
387 (native-inputs `(("perl" ,perl)))
388 (home-page "http://mongoc.org/libbson/current/index.html")
389 (synopsis "C BSON library")
390 (description "Libbson can create and parse BSON documents. It can also
391convert JSON documents to BSON and the opposite. BSON stands for Binary JSON,
392it is comparable to protobuf.")
393 (license license:asl2.0)))
bf7c3699
GG
394
395(define-public nlohmann-json-cpp
396 (package
397 (name "nlohmann-json-cpp")
398 (version "2.1.1")
399 (source
400 (origin
401 (method url-fetch)
402 (uri (string-append "https://github.com/nlohmann/json/"
403 "archive/v" version ".tar.gz"))
404 (file-name (string-append name "-" version ".tar.gz"))
405 (sha256
406 (base32
407 "0lrh6cjd643c7kmvmwafbgq7dqj3b778483gjhjbvp6rc6z5xf2r"))))
408 (build-system cmake-build-system)
409 (home-page "https://nlohmann.github.io/json/")
410 (synopsis "JSON library for C++")
411 (description
412 "JSON library for C++ trying to accomplish “Intuitive syntax”,
413“Trivial integration”, and “Serious testing”.
414However, “Memory efficiency” and “Speed” have not been primary goals.")
415 (license license:expat)))
f38d54f0
MFM
416
417(define-public python-ruamel.yaml
418 (package
419 (name "python-ruamel.yaml")
f20cfa06 420 (version "0.15.83")
f38d54f0
MFM
421 (source
422 (origin
423 (method url-fetch)
424 (uri (pypi-uri "ruamel.yaml" version))
425 (sha256
426 (base32
f20cfa06 427 "0p4i8ad28cbbbjja8b9274irkhnphhvhap3aym6yb8xfp1d72kpw"))))
f38d54f0
MFM
428 (build-system python-build-system)
429 (native-inputs
430 `(("python-pytest" ,python-pytest)))
431 (arguments
432 `(;; TODO: Tests require packaging "ruamel.std.pathlib".
433 #:tests? #f))
434 (home-page "https://bitbucket.org/ruamel/yaml")
435 (synopsis "YAML 1.2 parser/emitter")
436 (description
437 "This package provides YAML parser/emitter that supports roundtrip
438preservation of comments, seq/map flow style, and map key order. It
439is a derivative of Kirill Simonov’s PyYAML 3.11. It supports YAML 1.2
440and has round-trip loaders and dumpers. It supports comments. Block
441style and key ordering are kept, so you can diff the source.")
442 (license license:expat)))
443
444(define-public python2-ruamel.yaml
445 (package-with-python2 python-ruamel.yaml))
7ae282fb 446
447(define-public python-cbor
448 (package
449 (name "python-cbor")
450 (version "1.0.0")
451 (source
452 (origin
453 (method url-fetch)
454 (uri (pypi-uri "cbor" version))
455 (sha256
456 (base32
457 "1dmv163cnslyqccrybkxn0c9s1jk1mmafmgxv75iamnz5lk5l8hk"))))
458 (build-system python-build-system)
459 (home-page "https://bitbucket.org/bodhisnarkva/cbor")
460 (synopsis "Implementation of the Concise Binary Object Representation")
461 (description
462 "Python-cbor provides an implementation of the Concise Binary Object
31af847b
TGR
463Representation (@dfn{CBOR}). CBOR is comparable to JSON, has a superset of
464JSON's ability, but serializes to a binary format which is smaller and faster
465to generate and parse. The two primary functions are @code{cbor.loads} and
7ae282fb 466@code{cbor.dumps}.")
467 (license license:asl2.0)))
04953dca
LF
468
469(define-public flatbuffers
470 (package
471 (name "flatbuffers")
429a332b 472 (version "1.10.0")
04953dca
LF
473 (source
474 (origin
475 (method url-fetch)
476 (uri (string-append "https://github.com/google/flatbuffers/archive/v"
477 version ".tar.gz"))
f5d4c46c 478 (file-name (string-append name "-" version ".tar.gz"))
04953dca
LF
479 (sha256
480 (base32
429a332b 481 "0z4swldxs0s31hnkqdhsbfmc8vx3p7zsvmqaw4l31r2iikdy651p"))))
04953dca
LF
482 (build-system cmake-build-system)
483 (arguments
3def739d
TGR
484 '(#:build-type "Release"
485 #:configure-flags
04953dca 486 (list (string-append "-DCMAKE_INSTALL_LIBDIR="
3def739d 487 (assoc-ref %outputs "out") "/lib"))))
04953dca
LF
488 (home-page "https://google.github.io/flatbuffers/")
489 (synopsis "Memory-efficient serialization library")
a8b12397 490 (description "FlatBuffers is a cross-platform serialization library for C++,
04953dca
LF
491C#, C, Go, Java, JavaScript, PHP, and Python. It was originally created for
492game development and other performance-critical applications.")
493 (license license:asl2.0)))
9f1c0e03 494
8d4f34d6
LF
495(define-public python-feather-format
496 (package
497 (name "python-feather-format")
498 (version "0.4.0")
499 (source
500 (origin
501 (method url-fetch)
502 (uri (pypi-uri "feather-format" version))
503 (sha256
504 (base32
505 "1adivm5w5ji4qv7hq7942vqlk8l2wgw87bdlsia771z14z3zp857"))))
506 (build-system python-build-system)
507 (propagated-inputs
508 `(("python-pandas" ,python-pandas)
509 ("python-pyarrow" ,python-pyarrow)))
510 (home-page "https://github.com/wesm/feather")
511 (synopsis "Python wrapper to the Feather file format")
512 (description "This package provides a Python wrapper library to the
513Apache Arrow-based Feather binary columnar serialization data frame format.")
514 (license license:asl2.0)))
515
516(define-public python2-feather-format
517 (package-with-python2 python-feather-format))