Merge branch 'staging' into core-updates
[jackhill/guix/guix.git] / gnu / packages / protobuf.scm
CommitLineData
14d17788
LC
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2014 Ludovic Courtès <ludo@gnu.org>
8d63ddda
DP
3;;; Copyright © 2016 Daniel Pimentel <d4n1@d4n1.org>
4;;; Copyright © 2016 Leo Famulari <leo@famulari.name>
1eeae57b 5;;; Copyright © 2017, 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
599d0190 6;;; Copyright © 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
14d17788
LC
7;;;
8;;; This file is part of GNU Guix.
9;;;
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.
14;;;
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.
19;;;
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/>.
22
23(define-module (gnu packages protobuf)
24 #:use-module (guix packages)
25 #:use-module (guix download)
dc8621a2
TGR
26 #:use-module (guix git-download)
27 #:use-module (guix build-system cmake)
14d17788 28 #:use-module (guix build-system gnu)
8d63ddda 29 #:use-module (guix build-system python)
d78bfd27 30 #:use-module (guix build-system emacs)
7e685dee 31 #:use-module ((guix licenses) #:prefix license:)
8d63ddda
DP
32 #:use-module (gnu packages compression)
33 #:use-module (gnu packages gcc)
7d9935b4 34 #:use-module (gnu packages libevent)
bfd07331 35 #:use-module (gnu packages pkg-config)
44d10b1f
RW
36 #:use-module (gnu packages python)
37 #:use-module (gnu packages python-xyz))
14d17788 38
7d9935b4
TGR
39(define-public fstrm
40 (package
41 (name "fstrm")
42 (version "0.3.2")
43 (source
44 (origin
45 (method url-fetch)
46 (uri (string-append "https://dl.farsightsecurity.com/dist/" name "/"
47 name "-" version ".tar.gz"))
48 (sha256
49 (base32
50 "1i9y8a1712aj80p5a1kcp378bnjrg3s2127q7304hklhmjcrjl1d"))))
51 (build-system gnu-build-system)
52 (native-inputs
53 `(("pkg-config" ,pkg-config)))
54 (inputs
55 `(("libevent" ,libevent)))
56 (home-page "https://github.com/farsightsec/fstrm")
57 (synopsis "Implementation of the Frame Streams data transport protocol")
58 (description
59 "fstrm is an optimised implementation of Frame Streams as a C library and
60several tools built on top of it.
61
62@dfn{Frame Streams} is a light-weight, binary-clean protocol that allows for
63the transport of arbitrarily-encoded data payload sequences with minimal
64framing overhead---just four bytes per data frame. It does not specify an
65encoding format for these data frames and can be used with any data
66serialisation format that produces byte sequences, such as Protocol Buffers,
67XML, JSON, MessagePack, YAML, etc.
68
69Frame Streams can be used either as a streaming transport over a reliable byte
70stream socket (TCP sockets, TLS connections, @code{AF_UNIX} sockets, etc.) for
71data in motion, or as a file format for data at rest.")
7e685dee
TGR
72 (license (list license:asl2.0
73 (license:non-copyleft #f "See libmy/argv*")))))
7d9935b4 74
14d17788
LC
75(define-public protobuf
76 (package
77 (name "protobuf")
b506b98e 78 (version "3.10.1")
14d17788
LC
79 (source (origin
80 (method url-fetch)
de30a6e0 81 (uri (string-append "https://github.com/google/protobuf/releases/"
dd12d4aa
RW
82 "download/v" version "/protobuf-cpp-"
83 version ".tar.gz"))
14d17788
LC
84 (sha256
85 (base32
b506b98e 86 "16xrclp3xw4hzni1h53px9s99657hs5790726lchm3hrvsyyabp8"))))
14d17788
LC
87 (build-system gnu-build-system)
88 (inputs `(("zlib" ,zlib)))
ffe7eee5
TGR
89 (outputs (list "out"
90 "static")) ; ~12 MiB of .a files
91 (arguments
92 `(#:phases
93 (modify-phases %standard-phases
94 (add-after 'install 'move-static-libraries
95 (lambda* (#:key outputs #:allow-other-keys)
96 ;; Move static libraries to the "static" output.
97 (let* ((out (assoc-ref outputs "out"))
98 (lib (string-append out "/lib"))
99 (static (assoc-ref outputs "static"))
100 (slib (string-append static "/lib")))
101 (mkdir-p slib)
102 (for-each (lambda (file)
103 (install-file file slib)
104 (delete-file file))
105 (find-files lib "\\.a$"))
106 #t))))))
3b0ac795 107 (home-page "https://github.com/google/protobuf")
14d17788
LC
108 (synopsis "Data encoding for remote procedure calls (RPCs)")
109 (description
110 "Protocol Buffers are a way of encoding structured data in an efficient
111yet extensible format. Google uses Protocol Buffers for almost all of its
112internal RPC protocols and file formats.")
7e685dee 113 (license license:bsd-3)))
8d63ddda 114
7373eb83
MB
115;; Tensorflow requires version 3.6 specifically.
116(define-public protobuf-3.6
117 (package/inherit protobuf
c22c803e
RW
118 (version "3.6.1")
119 (source (origin
120 (method url-fetch)
121 (uri (string-append "https://github.com/google/protobuf/releases/"
122 "download/v" version "/protobuf-cpp-"
123 version ".tar.gz"))
124 (sha256
125 (base32
126 "0a955bz59ihrb5wg7dwi12xajdi5pmz4bl0g147rbdwv393jwwxk"))))))
127
7373eb83
MB
128;; The 3.5 series are the last versions that do not require C++ 11.
129(define-public protobuf-3.5
130 (package/inherit
131 protobuf
132 (version "3.5.1")
133 (source (origin
134 (method url-fetch)
135 (uri (string-append "https://github.com/google/protobuf/releases/"
136 "download/v" version "/protobuf-cpp-"
137 version ".tar.gz"))
138 (sha256
139 (base32
140 "14j0427ykjzrd9a66c2mpk0sjcccjlsx6q8ww6hzwb6sha3vm3f2"))))))
141
fa9ac83e
TGR
142;; XXX Remove this old version when no other packages depend on it.
143(define-public protobuf-2
144 (package (inherit protobuf)
145 (version "2.6.1")
146 (source (origin
147 (method url-fetch)
148 (uri (string-append "https://github.com/google/protobuf/releases/"
149 "download/v" version "/protobuf-"
150 version ".tar.bz2"))
151 (sha256
152 (base32
153 "040rcs9fpv4bslhiy43v7dcrzakz4vwwpyqg4jp8bn24sl95ci7f"))))))
154
bfd07331
RW
155(define-public protobuf-c
156 (package
157 (name "protobuf-c")
bd121370 158 (version "1.3.2")
bfd07331
RW
159 (source (origin
160 (method url-fetch)
161 (uri (string-append "https://github.com/protobuf-c/protobuf-c/"
162 "releases/download/v" version
163 "/protobuf-c-" version ".tar.gz"))
164 (sha256
165 (base32
bd121370 166 "0x4ybd9rfd878p2imz0hb8zxfd7l60vbdw7cg84dnysr9kqm3wjk"))))
bfd07331
RW
167 (build-system gnu-build-system)
168 (inputs `(("protobuf" ,protobuf)))
169 (native-inputs `(("pkg-config" ,pkg-config)))
170 (home-page "https://github.com/protobuf-c/protobuf-c")
171 (synopsis "Protocol Buffers implementation in C")
172 (description
173 "This is protobuf-c, a C implementation of the Google Protocol Buffers
174data serialization format. It includes @code{libprotobuf-c}, a pure C library
175that implements protobuf encoding and decoding, and @code{protoc-c}, a code
176generator that converts Protocol Buffer @code{.proto} files to C descriptor
177code.")
7e685dee 178 (license license:bsd-2)))
bfd07331 179
dc8621a2
TGR
180(define-public protozero
181 (package
182 (name "protozero")
599d0190 183 (version "1.6.8")
dc8621a2
TGR
184 (source
185 (origin
186 (method git-fetch)
187 (uri (git-reference
188 (url "https://github.com/mapbox/protozero.git")
189 (commit (string-append "v" version))))
190 (file-name (git-file-name name version))
191 (sha256
599d0190 192 (base32 "1hfijpfylf1c71wa3mk70gjc88b6k1q7cxb87cwqdflw5q2x8ma6"))))
dc8621a2
TGR
193 (build-system cmake-build-system)
194 (home-page "https://github.com/mapbox/protozero")
195 (synopsis "Minimalistic protocol buffer decoder and encoder in C++")
196 (description "Protozero is a minimalistic protocol buffer decoder and
197encoder in C++. The developer using protozero has to manually translate the
198@file{.proto} description into code.")
199 (license (list
200 license:asl2.0 ; for folly
201 license:bsd-2))))
202
8d63ddda
DP
203(define-public python-protobuf
204 (package
205 (name "python-protobuf")
7373eb83 206 (version "3.10.0")
8d63ddda
DP
207 (source
208 (origin
209 (method url-fetch)
210 (uri (pypi-uri "protobuf" version))
211 (sha256
212 (base32
7373eb83 213 "1zjq3qi0wgqi0fwxgqlgwvj9ri1m4kmnz3jnpd803lqc5k0vb0yv"))))
8d63ddda 214 (build-system python-build-system)
f22efa01 215 (propagated-inputs
8d63ddda
DP
216 `(("python-six" ,python-six)))
217 (home-page "https://github.com/google/protobuf")
218 (synopsis "Protocol buffers is a data interchange format")
219 (description
220 "Protocol buffers are a language-neutral, platform-neutral extensible
221mechanism for serializing structured data.")
7e685dee 222 (license license:bsd-3)))
8d63ddda
DP
223
224(define-public python2-protobuf
5c31f4aa 225 (package-with-python2 python-protobuf))
d78bfd27 226
7373eb83
MB
227;; For tensorflow.
228(define-public python-protobuf-3.6
229 (package/inherit python-protobuf
1eeae57b 230 (name "python-protobuf")
7373eb83 231 (version (package-version protobuf-3.6) )
1eeae57b
RW
232 (source
233 (origin
234 (method url-fetch)
235 (uri (pypi-uri "protobuf" version))
236 (sha256
237 (base32
238 "04bqb12smlckzmgkj6vgmpbr3cby0n6726cmz33bqr7kn1vb728l"))))))
239
d78bfd27
CZ
240(define-public emacs-protobuf-mode
241 (package
242 (name "emacs-protobuf-mode")
243 (version (package-version protobuf))
244 (source (package-source protobuf))
245 (build-system emacs-build-system)
246 (arguments
247 `(#:phases
248 (modify-phases %standard-phases
63edbb65 249 (add-before 'add-source-to-load-path 'change-working-directory
d78bfd27
CZ
250 (lambda _ (chdir "editors") #t)))))
251 (home-page "https://github.com/protocolbuffers/protobuf")
252 (synopsis "Protocol buffers major mode for Emacs")
253 (description
254 "This package provides an Emacs major mode for editing Protocol Buffer
255source files.")
256 (license license:bsd-3)))