1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2015, 2017 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 Efraim Flashner <efraim@flashner.co.il>
8 ;;; This file is part of GNU Guix.
10 ;;; GNU Guix is free software; you can redistribute it and/or modify it
11 ;;; under the terms of the GNU General Public License as published by
12 ;;; the Free Software Foundation; either version 3 of the License, or (at
13 ;;; your option) any later version.
15 ;;; GNU Guix is distributed in the hope that it will be useful, but
16 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;;; GNU General Public License for more details.
20 ;;; You should have received a copy of the GNU General Public License
21 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
23 (define-module (gnu packages serialization)
24 #:use-module ((guix licenses) #:prefix license:)
25 #:use-module (guix packages)
26 #:use-module (guix download)
27 #:use-module (guix utils)
28 #:use-module (guix build-system cmake)
29 #:use-module (guix build-system gnu)
30 #:use-module (gnu packages)
31 #:use-module (gnu packages autotools)
32 #:use-module (gnu packages boost)
33 #:use-module (gnu packages check)
34 #:use-module (gnu packages compression)
35 #:use-module (gnu packages documentation)
36 #:use-module (gnu packages lua)
37 #:use-module (gnu packages pkg-config)
38 #:use-module (gnu packages python))
46 (uri (string-append "https://github.com/USCiLab/cereal/archive/v"
48 (file-name (string-append name "-" version ".tar.gz"))
51 "0kj32h3j2128anig0g9gzw82kfyd5xqfkwq6vdyv900jx8i1qckx"))))
52 (build-system cmake-build-system)
54 `(;; The only included tests are portability tests requiring
55 ;; cross-compilation and boost. Since we are building cereal on more
56 ;; platforms anyway, there is no compelling reason to build the tests.
60 (modify-phases %standard-phases
64 (substitute* "doc/doxygen.in"
65 (("@CMAKE_CURRENT_SOURCE_DIR@") "."))
66 (zero? (system* "doxygen" "doc/doxygen.in"))))
67 ;; There is no "install" target, so we have to provide our own
70 (lambda* (#:key outputs #:allow-other-keys)
71 (let* ((out (assoc-ref outputs "out"))
72 (doc (string-append out "/share/cereal/docs"))
73 (include (string-append out "/include/cereal")))
76 (copy-recursively "include/cereal" include)
77 (copy-recursively "doc/html" doc))
80 `(("doxygen" ,doxygen)))
81 (home-page "http://uscilab.github.io/cereal/")
82 (synopsis "C++11 library for serialization")
84 "Cereal is a header-only C++11 serialization library. Cereal takes
85 arbitrary data types and reversibly turns them into different representations,
86 such as compact binary encodings, XML, or JSON.")
87 (license license:bsd-3)))
90 (define-public msgpack
99 "https://github.com/msgpack/msgpack-c/releases/download/"
100 "cpp-" version "/msgpack-" version ".tar.gz"))
102 '(let ((p (open-file "msgpack.pc.in" "a")))
105 (string-append "Requires: " "zlib" "\n") p)
106 (close-output-port p))))
109 "0bpjfh9vz0n2k93mph3x15clmigkgs223xfn8h12ymrh5gsi5ica"))))
110 (build-system gnu-build-system)
112 `(("googletest" ,googletest)
113 ("autoconf" ,autoconf)
114 ("automake" ,automake)
116 ("pkg-config" ,pkg-config)))
118 `(("zlib" ,zlib))) ;; Msgpack installs two headers (zbuffer.h,
119 ;; zbuffer.hpp) which #include <zlib.h>. However, 'guix gc --references'
120 ;; does not detect a store reference to zlib since these headers are not
124 (modify-phases %standard-phases
125 (add-before 'configure 'autoconf
127 (system* "autoreconf" "-vfi"))))))
128 (home-page "http://www.msgpack.org")
129 (synopsis "Binary serialization library")
130 (description "Msgpack is a library for C/C++ that implements binary
132 (license license:boost1.0)))
134 (define-public libmpack
140 (uri (string-append "https://github.com/tarruda/libmpack/"
141 "archive/" version ".tar.gz"))
142 (file-name (string-append name "-" version ".tar.gz"))
144 (base32 "08kfdl55yf66xk57aqsbf8n45f2jsw2v7qwnaan08ciim77j3sv5"))))
145 (build-system gnu-build-system)
147 `(#:test-target "test"
150 (string-append "PREFIX=" (assoc-ref %outputs "out")))
152 (modify-phases %standard-phases
153 (delete 'configure))))
155 `(("libtool" ,libtool)))
156 (home-page "https://github.com/tarruda/libmpack")
157 (synopsis "Small binary serialization library")
158 (description "Libmpack is a small binary serialization and RPC library
159 that implements both the msgpack and msgpack-rpc specifications.")
160 (license license:expat)))
162 (define-public lua-libmpack
163 (package (inherit libmpack)
164 (name "lua-libmpack")
165 (build-system gnu-build-system)
167 `(;; FIXME: tests require "busted", which is not yet available in Guix.
171 (let* ((lua-version ,(package-version lua))
172 (lua-major+minor ,(version-major+minor (package-version lua))))
175 (string-append "LUA_VERSION=" lua-version)
176 (string-append "LUA_VERSION_MAJ_MIN=" lua-major+minor)
177 (string-append "PREFIX="
178 (assoc-ref %outputs "out"))
179 (string-append "LUA_CMOD_INSTALLDIR="
180 (assoc-ref %outputs "out")
181 "/lib/lua/" lua-major+minor)
182 ;; This is unnecessary as of upstream commit 02886c13ff8a2,
183 ;; which is not part of the current release.
184 "CFLAGS=-DLUA_C89_NUMBERS -fPIC"))
186 (modify-phases %standard-phases
188 (add-after 'unpack 'chdir
189 (lambda _ (chdir "binding/lua") #t)))))
193 `(("pkg-config" ,pkg-config)))
194 (synopsis "Lua bindings for the libmpack binary serialization library")))
196 (define-public lua5.2-libmpack
197 (package (inherit lua-libmpack)
198 (name "lua5.2-libmpack")
200 (substitute-keyword-arguments (package-arguments lua-libmpack)
201 ((#:make-flags flags)
202 `(let* ((lua-version ,(package-version lua-5.2))
203 (lua-major+minor ,(version-major+minor (package-version lua-5.2))))
206 (string-append "LUA_VERSION=" lua-version)
207 (string-append "LUA_VERSION_MAJ_MIN=" lua-major+minor)
208 (string-append "PREFIX="
209 (assoc-ref %outputs "out"))
210 (string-append "LUA_CMOD_INSTALLDIR="
211 (assoc-ref %outputs "out")
212 "/lib/lua/" lua-major+minor))))))
214 `(("lua" ,lua-5.2)))))
216 (define-public yaml-cpp
223 "https://github.com/jbeder/yaml-cpp/archive/"
224 "yaml-cpp-" version ".tar.gz"))
227 "1vk6pjh0f5k6jwk2sszb9z5169whmiha9ainbdpa1arxlkq7v3b6"))))
228 (build-system cmake-build-system)
232 `(("python" ,python)))
233 (home-page "https://github.com/jbeder/yaml-cpp")
234 (synopsis "YAML parser and emitter in C++")
235 (description "YAML parser and emitter in C++ matching the YAML 1.2 spec.")
236 (license license:bsd-3)))
238 (define-public jsoncpp
245 "https://github.com/open-source-parsers/jsoncpp/archive/"
247 (file-name (string-append name "-" version ".tar.gz"))
250 "1g35ci93s03wph4kabi46iz42wgyfbn2763cklf15h7hrdi29ssx"))))
251 (build-system cmake-build-system)
252 (home-page "https://github.com/open-source-parsers/jsoncpp")
254 `(#:configure-flags '("-DBUILD_SHARED_LIBS:BOOL=YES")))
255 (synopsis "C++ library for interacting with JSON")
256 (description "JsonCpp is a C++ library that allows manipulating JSON values,
257 including serialization and deserialization to and from strings. It can also
258 preserve existing comment in unserialization/serialization steps, making
259 it a convenient format to store user input files.")
260 (license license:expat)))
262 (define-public capnproto
269 "https://capnproto.org/capnproto-c++-"
273 "1yvaadhgakskqq5wpv53hd6fc3pp17mrdldw4i5cvgck4iwprcfd"))))
274 (build-system gnu-build-system)
277 (modify-phases %standard-phases
278 (add-before 'check 'do-not-require-/etc/services
280 ;; Workaround for test that tries to resolve port name from
281 ;; /etc/services, which is not present in build environment.
282 (substitute* "src/kj/async-io-test.c++" ((":http") ":80"))
284 (home-page "https://capnproto.org")
285 (synopsis "Capability-based RPC and serialization system")
287 "Cap'n Proto is a very fast data interchange format and capability-based
288 RPC system. Think JSON, except binary. Or think Protocol Buffers, except faster.")
289 (license license:expat)))