gnu: msgpack: Update phase style.
[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>
7ae282fb 10;;; Copyright © 2017 ng0 <ng0@infotropique.org>
becee9e3 11;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr>
0149354d
RW
12;;;
13;;; This file is part of GNU Guix.
14;;;
15;;; GNU Guix is free software; you can redistribute it and/or modify it
16;;; under the terms of the GNU General Public License as published by
17;;; the Free Software Foundation; either version 3 of the License, or (at
18;;; your option) any later version.
19;;;
20;;; GNU Guix is distributed in the hope that it will be useful, but
21;;; WITHOUT ANY WARRANTY; without even the implied warranty of
22;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23;;; GNU General Public License for more details.
24;;;
25;;; You should have received a copy of the GNU General Public License
26;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
27
28(define-module (gnu packages serialization)
29 #:use-module ((guix licenses) #:prefix license:)
30 #:use-module (guix packages)
31 #:use-module (guix download)
8e664e7e 32 #:use-module (guix utils)
0149354d 33 #:use-module (guix build-system cmake)
d1ef573d 34 #:use-module (guix build-system gnu)
0149354d 35 #:use-module (gnu packages)
d1ef573d 36 #:use-module (gnu packages autotools)
f50f4ae4 37 #:use-module (gnu packages boost)
d1ef573d
LG
38 #:use-module (gnu packages check)
39 #:use-module (gnu packages compression)
40 #:use-module (gnu packages documentation)
8e664e7e 41 #:use-module (gnu packages lua)
f47dc8dd 42 #:use-module (gnu packages pkg-config)
9d625512 43 #:use-module (gnu packages python)
f38d54f0
MFM
44 #:use-module (gnu packages perl)
45 #:use-module (guix build-system python))
0149354d
RW
46
47(define-public cereal
48 (package
49 (name "cereal")
43593f5b 50 (version "1.2.1")
0149354d
RW
51 (source (origin
52 (method url-fetch)
53 (uri (string-append "https://github.com/USCiLab/cereal/archive/v"
54 version ".tar.gz"))
55 (file-name (string-append name "-" version ".tar.gz"))
56 (sha256
57 (base32
43593f5b 58 "0kj32h3j2128anig0g9gzw82kfyd5xqfkwq6vdyv900jx8i1qckx"))))
0149354d
RW
59 (build-system cmake-build-system)
60 (arguments
61 `(;; The only included tests are portability tests requiring
62 ;; cross-compilation and boost. Since we are building cereal on more
63 ;; platforms anyway, there is no compelling reason to build the tests.
64 #:tests? #f
65 #:out-of-source? #f
66 #:phases
67 (modify-phases %standard-phases
68 (delete 'configure)
69 (replace 'build
70 (lambda _
71 (substitute* "doc/doxygen.in"
72 (("@CMAKE_CURRENT_SOURCE_DIR@") "."))
73 (zero? (system* "doxygen" "doc/doxygen.in"))))
74 ;; There is no "install" target, so we have to provide our own
75 ;; "install" phase.
76 (replace 'install
77 (lambda* (#:key outputs #:allow-other-keys)
78 (let* ((out (assoc-ref outputs "out"))
79 (doc (string-append out "/share/cereal/docs"))
80 (include (string-append out "/include/cereal")))
81 (mkdir-p doc)
82 (mkdir-p include)
83 (copy-recursively "include/cereal" include)
84 (copy-recursively "doc/html" doc))
85 #t)))))
86 (native-inputs
87 `(("doxygen" ,doxygen)))
88 (home-page "http://uscilab.github.io/cereal/")
89 (synopsis "C++11 library for serialization")
90 (description
91 "Cereal is a header-only C++11 serialization library. Cereal takes
92arbitrary data types and reversibly turns them into different representations,
93such as compact binary encodings, XML, or JSON.")
94 (license license:bsd-3)))
d1ef573d
LG
95
96
97(define-public msgpack
98 (package
99 (name "msgpack")
e54ae862 100 (version "1.4.2")
d1ef573d
LG
101 (source
102 (origin
103 (method url-fetch)
104 (uri
105 (string-append
106 "https://github.com/msgpack/msgpack-c/releases/download/"
107 "cpp-" version "/msgpack-" version ".tar.gz"))
108 (snippet
109 '(let ((p (open-file "msgpack.pc.in" "a")))
110 (begin
111 (display
112 (string-append "Requires: " "zlib" "\n") p)
113 (close-output-port p))))
114 (sha256
115 (base32
e54ae862 116 "18hzmyfg3mvnp7ab03nqdzzvqagkl42gygjpi4zv4i7aca2dmwf0"))))
d1ef573d
LG
117 (build-system gnu-build-system)
118 (native-inputs
119 `(("googletest" ,googletest)
120 ("autoconf" ,autoconf)
121 ("automake" ,automake)
122 ("libtool" ,libtool)
123 ("pkg-config" ,pkg-config)))
124 (propagated-inputs
125 `(("zlib" ,zlib))) ;; Msgpack installs two headers (zbuffer.h,
126 ;; zbuffer.hpp) which #include <zlib.h>. However, 'guix gc --references'
127 ;; does not detect a store reference to zlib since these headers are not
128 ;; compiled.
129 (arguments
130 `(#:phases
131 (modify-phases %standard-phases
d10092b8 132 (add-after 'unpack 'autoconf
d1ef573d 133 (lambda _
778fb47b
TGR
134 (invoke "autoreconf" "-vfi")
135 #t)))))
fe0523d4 136 (home-page "https://www.msgpack.org")
d1ef573d
LG
137 (synopsis "Binary serialization library")
138 (description "Msgpack is a library for C/C++ that implements binary
139serialization.")
140 (license license:boost1.0)))
f50f4ae4 141
c57e5fd0
RW
142(define-public libmpack
143 (package
144 (name "libmpack")
b5236121 145 (version "1.0.5")
c57e5fd0
RW
146 (source (origin
147 (method url-fetch)
148 (uri (string-append "https://github.com/tarruda/libmpack/"
149 "archive/" version ".tar.gz"))
150 (file-name (string-append name "-" version ".tar.gz"))
151 (sha256
b5236121
LF
152 (base32
153 "0ml922gv8y99lbldqb9ykpjndla0hlprdjyl79yskkhwv2ai7sac"))))
c57e5fd0
RW
154 (build-system gnu-build-system)
155 (arguments
156 `(#:test-target "test"
157 #:make-flags
158 (list "CC=gcc"
159 (string-append "PREFIX=" (assoc-ref %outputs "out")))
160 #:phases
161 (modify-phases %standard-phases
162 (delete 'configure))))
163 (native-inputs
164 `(("libtool" ,libtool)))
165 (home-page "https://github.com/tarruda/libmpack")
166 (synopsis "Small binary serialization library")
167 (description "Libmpack is a small binary serialization and RPC library
168that implements both the msgpack and msgpack-rpc specifications.")
169 (license license:expat)))
170
8e664e7e
RW
171(define-public lua-libmpack
172 (package (inherit libmpack)
173 (name "lua-libmpack")
7ec309af
RW
174 (source (origin
175 (method url-fetch)
176 (uri (string-append "https://github.com/libmpack/libmpack-lua/"
177 "archive/" (package-version libmpack) ".tar.gz"))
178 (file-name (string-append name "-" (package-version libmpack) ".tar.gz"))
179 (sha256
180 (base32
181 "153zrrbyxhf71dgzjjhrk56rfwk3nisslpgcqyg44v8fnz1xpk6i"))))
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): "))
210 (mkdir-p "mpack-src")
211 (zero? (system* "tar" "-C" "mpack-src"
212 "--strip-components=1"
213 "-xvf" (assoc-ref inputs "libmpack"))))))))
8e664e7e
RW
214 (inputs
215 `(("lua" ,lua)))
216 (native-inputs
7ec309af
RW
217 `(("pkg-config" ,pkg-config)
218 ("libmpack" ,(package-source libmpack))))
219 (home-page "https://github.com/libmpack/libmpack-lua")
8e664e7e
RW
220 (synopsis "Lua bindings for the libmpack binary serialization library")))
221
369ee96b
RW
222(define-public lua5.2-libmpack
223 (package (inherit lua-libmpack)
224 (name "lua5.2-libmpack")
225 (arguments
226 (substitute-keyword-arguments (package-arguments lua-libmpack)
227 ((#:make-flags flags)
228 `(let* ((lua-version ,(package-version lua-5.2))
229 (lua-major+minor ,(version-major+minor (package-version lua-5.2))))
230 (list "CC=gcc"
231 "USE_SYSTEM_LUA=yes"
0cdc3343
RW
232 (string-append "MPACK_LUA_VERSION=" lua-version)
233 (string-append "MPACK_LUA_VERSION_NOPATCH=" lua-major+minor)
369ee96b
RW
234 (string-append "PREFIX="
235 (assoc-ref %outputs "out"))
236 (string-append "LUA_CMOD_INSTALLDIR="
237 (assoc-ref %outputs "out")
238 "/lib/lua/" lua-major+minor))))))
239 (inputs
240 `(("lua" ,lua-5.2)))))
241
f50f4ae4
DC
242(define-public yaml-cpp
243 (package
244 (name "yaml-cpp")
245 (version "0.5.3")
246 (source (origin
247 (method url-fetch)
248 (uri (string-append
249 "https://github.com/jbeder/yaml-cpp/archive/"
250 "yaml-cpp-" version ".tar.gz"))
251 (sha256
252 (base32
fd75eb6c 253 "1ck7jk0wjfigrf4cgcjqsir4yp1s6vamhhxhpsgfvs46pgm5pk6y"))))
f50f4ae4 254 (build-system cmake-build-system)
0577a3fd
CB
255 (arguments
256 '(#:configure-flags '("-DBUILD_SHARED_LIBS=ON")))
f50f4ae4
DC
257 (inputs
258 `(("boost" ,boost)))
259 (native-inputs
260 `(("python" ,python)))
261 (home-page "https://github.com/jbeder/yaml-cpp")
262 (synopsis "YAML parser and emitter in C++")
263 (description "YAML parser and emitter in C++ matching the YAML 1.2 spec.")
264 (license license:bsd-3)))
cd131a76
DC
265
266(define-public jsoncpp
267 (package
268 (name "jsoncpp")
e1c08dcc 269 (version "1.8.4")
cd131a76
DC
270 (source (origin
271 (method url-fetch)
272 (uri (string-append
273 "https://github.com/open-source-parsers/jsoncpp/archive/"
274 version ".tar.gz"))
275 (file-name (string-append name "-" version ".tar.gz"))
276 (sha256
277 (base32
e1c08dcc 278 "1dpxk8hkni5dq4mdw8qbaj40jmid3a31d1gh8iqcnfwkw34ym7f4"))))
cd131a76
DC
279 (build-system cmake-build-system)
280 (home-page "https://github.com/open-source-parsers/jsoncpp")
996f5ece
EB
281 (arguments
282 `(#:configure-flags '("-DBUILD_SHARED_LIBS:BOOL=YES")))
cd131a76
DC
283 (synopsis "C++ library for interacting with JSON")
284 (description "JsonCpp is a C++ library that allows manipulating JSON values,
285including serialization and deserialization to and from strings. It can also
286preserve existing comment in unserialization/serialization steps, making
287it a convenient format to store user input files.")
288 (license license:expat)))
557d3328
MB
289
290(define-public capnproto
291 (package
292 (name "capnproto")
0866dd46 293 (version "0.6.1")
557d3328
MB
294 (source (origin
295 (method url-fetch)
296 (uri (string-append
297 "https://capnproto.org/capnproto-c++-"
298 version ".tar.gz"))
299 (sha256
300 (base32
0866dd46 301 "010s9yhq4531wvdfrdf2477zswhck6cjfby79w73rff3v06090l0"))))
557d3328
MB
302 (build-system gnu-build-system)
303 (arguments
304 `(#:phases
305 (modify-phases %standard-phases
306 (add-before 'check 'do-not-require-/etc/services
307 (lambda _
308 ;; Workaround for test that tries to resolve port name from
309 ;; /etc/services, which is not present in build environment.
310 (substitute* "src/kj/async-io-test.c++" ((":http") ":80"))
311 #t)))))
312 (home-page "https://capnproto.org")
313 (synopsis "Capability-based RPC and serialization system")
314 (description
315 "Cap'n Proto is a very fast data interchange format and capability-based
316RPC system. Think JSON, except binary. Or think Protocol Buffers, except faster.")
317 (license license:expat)))
9d625512
CB
318
319(define-public libbson
320 (package
321 (name "libbson")
322 (version "1.6.2")
323 (source
324 (origin
325 (method url-fetch)
326 (uri (string-append "https://github.com/mongodb/libbson/releases/"
327 "download/" version "/libbson-" version ".tar.gz"))
328 (sha256
329 (base32
330 "1fj4554msq0rrz14snbj908dzqj46gh7jg9w9j0akn2b7q911m5a"))))
331 (build-system gnu-build-system)
332 (native-inputs `(("perl" ,perl)))
333 (home-page "http://mongoc.org/libbson/current/index.html")
334 (synopsis "C BSON library")
335 (description "Libbson can create and parse BSON documents. It can also
336convert JSON documents to BSON and the opposite. BSON stands for Binary JSON,
337it is comparable to protobuf.")
338 (license license:asl2.0)))
bf7c3699
GG
339
340(define-public nlohmann-json-cpp
341 (package
342 (name "nlohmann-json-cpp")
343 (version "2.1.1")
344 (source
345 (origin
346 (method url-fetch)
347 (uri (string-append "https://github.com/nlohmann/json/"
348 "archive/v" version ".tar.gz"))
349 (file-name (string-append name "-" version ".tar.gz"))
350 (sha256
351 (base32
352 "0lrh6cjd643c7kmvmwafbgq7dqj3b778483gjhjbvp6rc6z5xf2r"))))
353 (build-system cmake-build-system)
354 (home-page "https://nlohmann.github.io/json/")
355 (synopsis "JSON library for C++")
356 (description
357 "JSON library for C++ trying to accomplish “Intuitive syntax”,
358“Trivial integration”, and “Serious testing”.
359However, “Memory efficiency” and “Speed” have not been primary goals.")
360 (license license:expat)))
f38d54f0
MFM
361
362(define-public python-ruamel.yaml
363 (package
364 (name "python-ruamel.yaml")
becee9e3 365 (version "0.15.35")
f38d54f0
MFM
366 (source
367 (origin
368 (method url-fetch)
369 (uri (pypi-uri "ruamel.yaml" version))
370 (sha256
371 (base32
becee9e3 372 "0xggyfaj6vprggahf7cq8kp9j79rb7hn8ndk3bxj2sxvwhhliiwd"))))
f38d54f0
MFM
373 (build-system python-build-system)
374 (native-inputs
375 `(("python-pytest" ,python-pytest)))
376 (arguments
377 `(;; TODO: Tests require packaging "ruamel.std.pathlib".
378 #:tests? #f))
379 (home-page "https://bitbucket.org/ruamel/yaml")
380 (synopsis "YAML 1.2 parser/emitter")
381 (description
382 "This package provides YAML parser/emitter that supports roundtrip
383preservation of comments, seq/map flow style, and map key order. It
384is a derivative of Kirill Simonov’s PyYAML 3.11. It supports YAML 1.2
385and has round-trip loaders and dumpers. It supports comments. Block
386style and key ordering are kept, so you can diff the source.")
387 (license license:expat)))
388
389(define-public python2-ruamel.yaml
390 (package-with-python2 python-ruamel.yaml))
7ae282fb 391
392(define-public python-cbor
393 (package
394 (name "python-cbor")
395 (version "1.0.0")
396 (source
397 (origin
398 (method url-fetch)
399 (uri (pypi-uri "cbor" version))
400 (sha256
401 (base32
402 "1dmv163cnslyqccrybkxn0c9s1jk1mmafmgxv75iamnz5lk5l8hk"))))
403 (build-system python-build-system)
404 (home-page "https://bitbucket.org/bodhisnarkva/cbor")
405 (synopsis "Implementation of the Concise Binary Object Representation")
406 (description
407 "Python-cbor provides an implementation of the Concise Binary Object
31af847b
TGR
408Representation (@dfn{CBOR}). CBOR is comparable to JSON, has a superset of
409JSON's ability, but serializes to a binary format which is smaller and faster
410to generate and parse. The two primary functions are @code{cbor.loads} and
7ae282fb 411@code{cbor.dumps}.")
412 (license license:asl2.0)))