gnu: facter: Update to 4.0.33.
[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>
d59c84f5 7;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
ba4d96d2 8;;; Copyright © 2020 Vinicius Monego <monego@posteo.net>
14d17788
LC
9;;;
10;;; This file is part of GNU Guix.
11;;;
12;;; GNU Guix is free software; you can redistribute it and/or modify it
13;;; under the terms of the GNU General Public License as published by
14;;; the Free Software Foundation; either version 3 of the License, or (at
15;;; your option) any later version.
16;;;
17;;; GNU Guix is distributed in the hope that it will be useful, but
18;;; WITHOUT ANY WARRANTY; without even the implied warranty of
19;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20;;; GNU General Public License for more details.
21;;;
22;;; You should have received a copy of the GNU General Public License
23;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
24
25(define-module (gnu packages protobuf)
26 #:use-module (guix packages)
27 #:use-module (guix download)
dc8621a2
TGR
28 #:use-module (guix git-download)
29 #:use-module (guix build-system cmake)
14d17788 30 #:use-module (guix build-system gnu)
8d63ddda 31 #:use-module (guix build-system python)
d78bfd27 32 #:use-module (guix build-system emacs)
d59c84f5 33 #:use-module (guix build-system ruby)
7e685dee 34 #:use-module ((guix licenses) #:prefix license:)
8d63ddda
DP
35 #:use-module (gnu packages compression)
36 #:use-module (gnu packages gcc)
7d9935b4 37 #:use-module (gnu packages libevent)
bfd07331 38 #:use-module (gnu packages pkg-config)
44d10b1f 39 #:use-module (gnu packages python)
d59c84f5
MC
40 #:use-module (gnu packages python-xyz)
41 #:use-module (gnu packages ruby))
14d17788 42
7d9935b4
TGR
43(define-public fstrm
44 (package
45 (name "fstrm")
46 (version "0.3.2")
47 (source
48 (origin
49 (method url-fetch)
50 (uri (string-append "https://dl.farsightsecurity.com/dist/" name "/"
51 name "-" version ".tar.gz"))
52 (sha256
53 (base32
54 "1i9y8a1712aj80p5a1kcp378bnjrg3s2127q7304hklhmjcrjl1d"))))
55 (build-system gnu-build-system)
56 (native-inputs
57 `(("pkg-config" ,pkg-config)))
58 (inputs
59 `(("libevent" ,libevent)))
60 (home-page "https://github.com/farsightsec/fstrm")
61 (synopsis "Implementation of the Frame Streams data transport protocol")
62 (description
63 "fstrm is an optimised implementation of Frame Streams as a C library and
64several tools built on top of it.
65
66@dfn{Frame Streams} is a light-weight, binary-clean protocol that allows for
67the transport of arbitrarily-encoded data payload sequences with minimal
68framing overhead---just four bytes per data frame. It does not specify an
69encoding format for these data frames and can be used with any data
70serialisation format that produces byte sequences, such as Protocol Buffers,
71XML, JSON, MessagePack, YAML, etc.
72
73Frame Streams can be used either as a streaming transport over a reliable byte
74stream socket (TCP sockets, TLS connections, @code{AF_UNIX} sockets, etc.) for
75data in motion, or as a file format for data at rest.")
7e685dee
TGR
76 (license (list license:asl2.0
77 (license:non-copyleft #f "See libmy/argv*")))))
7d9935b4 78
14d17788
LC
79(define-public protobuf
80 (package
81 (name "protobuf")
7af2b55d 82 (version "3.12.3")
14d17788
LC
83 (source (origin
84 (method url-fetch)
de30a6e0 85 (uri (string-append "https://github.com/google/protobuf/releases/"
dd12d4aa
RW
86 "download/v" version "/protobuf-cpp-"
87 version ".tar.gz"))
14d17788
LC
88 (sha256
89 (base32
7af2b55d 90 "0s29dj8l9j6jk04im3ivcji1x9jm42fwjmwcmli0smz0m337xyaf"))))
14d17788
LC
91 (build-system gnu-build-system)
92 (inputs `(("zlib" ,zlib)))
ffe7eee5
TGR
93 (outputs (list "out"
94 "static")) ; ~12 MiB of .a files
95 (arguments
96 `(#:phases
97 (modify-phases %standard-phases
98 (add-after 'install 'move-static-libraries
99 (lambda* (#:key outputs #:allow-other-keys)
100 ;; Move static libraries to the "static" output.
101 (let* ((out (assoc-ref outputs "out"))
102 (lib (string-append out "/lib"))
103 (static (assoc-ref outputs "static"))
104 (slib (string-append static "/lib")))
105 (mkdir-p slib)
106 (for-each (lambda (file)
107 (install-file file slib)
108 (delete-file file))
109 (find-files lib "\\.a$"))
110 #t))))))
3b0ac795 111 (home-page "https://github.com/google/protobuf")
14d17788
LC
112 (synopsis "Data encoding for remote procedure calls (RPCs)")
113 (description
114 "Protocol Buffers are a way of encoding structured data in an efficient
115yet extensible format. Google uses Protocol Buffers for almost all of its
116internal RPC protocols and file formats.")
7e685dee 117 (license license:bsd-3)))
8d63ddda 118
7373eb83
MB
119;; Tensorflow requires version 3.6 specifically.
120(define-public protobuf-3.6
121 (package/inherit protobuf
c22c803e
RW
122 (version "3.6.1")
123 (source (origin
124 (method url-fetch)
125 (uri (string-append "https://github.com/google/protobuf/releases/"
126 "download/v" version "/protobuf-cpp-"
127 version ".tar.gz"))
128 (sha256
129 (base32
130 "0a955bz59ihrb5wg7dwi12xajdi5pmz4bl0g147rbdwv393jwwxk"))))))
131
7373eb83
MB
132;; The 3.5 series are the last versions that do not require C++ 11.
133(define-public protobuf-3.5
134 (package/inherit
135 protobuf
136 (version "3.5.1")
137 (source (origin
138 (method url-fetch)
139 (uri (string-append "https://github.com/google/protobuf/releases/"
140 "download/v" version "/protobuf-cpp-"
141 version ".tar.gz"))
142 (sha256
143 (base32
144 "14j0427ykjzrd9a66c2mpk0sjcccjlsx6q8ww6hzwb6sha3vm3f2"))))))
145
fa9ac83e
TGR
146;; XXX Remove this old version when no other packages depend on it.
147(define-public protobuf-2
148 (package (inherit protobuf)
149 (version "2.6.1")
150 (source (origin
151 (method url-fetch)
152 (uri (string-append "https://github.com/google/protobuf/releases/"
153 "download/v" version "/protobuf-"
154 version ".tar.bz2"))
155 (sha256
156 (base32
157 "040rcs9fpv4bslhiy43v7dcrzakz4vwwpyqg4jp8bn24sl95ci7f"))))))
158
bfd07331
RW
159(define-public protobuf-c
160 (package
161 (name "protobuf-c")
bd121370 162 (version "1.3.2")
bfd07331
RW
163 (source (origin
164 (method url-fetch)
165 (uri (string-append "https://github.com/protobuf-c/protobuf-c/"
166 "releases/download/v" version
167 "/protobuf-c-" version ".tar.gz"))
168 (sha256
169 (base32
bd121370 170 "0x4ybd9rfd878p2imz0hb8zxfd7l60vbdw7cg84dnysr9kqm3wjk"))))
bfd07331
RW
171 (build-system gnu-build-system)
172 (inputs `(("protobuf" ,protobuf)))
173 (native-inputs `(("pkg-config" ,pkg-config)))
174 (home-page "https://github.com/protobuf-c/protobuf-c")
175 (synopsis "Protocol Buffers implementation in C")
176 (description
177 "This is protobuf-c, a C implementation of the Google Protocol Buffers
178data serialization format. It includes @code{libprotobuf-c}, a pure C library
179that implements protobuf encoding and decoding, and @code{protoc-c}, a code
180generator that converts Protocol Buffer @code{.proto} files to C descriptor
181code.")
7e685dee 182 (license license:bsd-2)))
bfd07331 183
dc8621a2
TGR
184(define-public protozero
185 (package
186 (name "protozero")
599d0190 187 (version "1.6.8")
dc8621a2
TGR
188 (source
189 (origin
190 (method git-fetch)
191 (uri (git-reference
b0e7b699 192 (url "https://github.com/mapbox/protozero")
dc8621a2
TGR
193 (commit (string-append "v" version))))
194 (file-name (git-file-name name version))
195 (sha256
599d0190 196 (base32 "1hfijpfylf1c71wa3mk70gjc88b6k1q7cxb87cwqdflw5q2x8ma6"))))
dc8621a2
TGR
197 (build-system cmake-build-system)
198 (home-page "https://github.com/mapbox/protozero")
199 (synopsis "Minimalistic protocol buffer decoder and encoder in C++")
200 (description "Protozero is a minimalistic protocol buffer decoder and
201encoder in C++. The developer using protozero has to manually translate the
202@file{.proto} description into code.")
203 (license (list
204 license:asl2.0 ; for folly
205 license:bsd-2))))
206
8d63ddda
DP
207(define-public python-protobuf
208 (package
209 (name "python-protobuf")
ba4d96d2 210 (version "3.12.4")
8d63ddda
DP
211 (source
212 (origin
213 (method url-fetch)
214 (uri (pypi-uri "protobuf" version))
215 (sha256
216 (base32
ba4d96d2 217 "0mj6z58aiw532s1mq48m9xdrm3gdyp2vv9cdinfb5wmnfpm5m7n9"))))
8d63ddda 218 (build-system python-build-system)
ba4d96d2
VM
219 (native-inputs
220 `(("python-wheel" ,python-wheel)))
f22efa01 221 (propagated-inputs
8d63ddda
DP
222 `(("python-six" ,python-six)))
223 (home-page "https://github.com/google/protobuf")
224 (synopsis "Protocol buffers is a data interchange format")
225 (description
226 "Protocol buffers are a language-neutral, platform-neutral extensible
227mechanism for serializing structured data.")
7e685dee 228 (license license:bsd-3)))
8d63ddda
DP
229
230(define-public python2-protobuf
5c31f4aa 231 (package-with-python2 python-protobuf))
d78bfd27 232
7373eb83
MB
233;; For tensorflow.
234(define-public python-protobuf-3.6
235 (package/inherit python-protobuf
1eeae57b 236 (name "python-protobuf")
7373eb83 237 (version (package-version protobuf-3.6) )
1eeae57b
RW
238 (source
239 (origin
240 (method url-fetch)
241 (uri (pypi-uri "protobuf" version))
242 (sha256
243 (base32
244 "04bqb12smlckzmgkj6vgmpbr3cby0n6726cmz33bqr7kn1vb728l"))))))
245
d78bfd27
CZ
246(define-public emacs-protobuf-mode
247 (package
248 (name "emacs-protobuf-mode")
249 (version (package-version protobuf))
250 (source (package-source protobuf))
251 (build-system emacs-build-system)
252 (arguments
253 `(#:phases
254 (modify-phases %standard-phases
63edbb65 255 (add-before 'add-source-to-load-path 'change-working-directory
d78bfd27
CZ
256 (lambda _ (chdir "editors") #t)))))
257 (home-page "https://github.com/protocolbuffers/protobuf")
258 (synopsis "Protocol buffers major mode for Emacs")
259 (description
260 "This package provides an Emacs major mode for editing Protocol Buffer
261source files.")
262 (license license:bsd-3)))
d59c84f5
MC
263
264(define-public ruby-protobuf
265 (package
266 (name "ruby-protobuf")
267 (version "3.10.3")
268 (source (origin
269 (method git-fetch)
270 (uri (git-reference
b0e7b699 271 (url "https://github.com/ruby-protobuf/protobuf")
d59c84f5
MC
272 (commit (string-append "v" version))))
273 (file-name (git-file-name name version))
274 (sha256
275 (base32
276 "1yzz7jgpp6qip5d6qhzbkf5gqaydfk3z3c1ngccwzp6w6wa75g8a"))))
277 (build-system ruby-build-system)
278 (arguments
279 `(#:phases
280 (modify-phases %standard-phases
281 (add-after 'unpack 'do-not-use-bundler-for-tests
282 (lambda _
283 (substitute* "spec/spec_helper.rb"
284 (("Bundler\\.setup.*") ""))
285 #t))
286 (add-after 'unpack 'relax-version-requirements
287 (lambda _
288 (substitute* ((@@ (guix build ruby-build-system) first-gemspec))
289 (("'rake',.*")
290 "'rake'\n")
291 (("\"rubocop\",.*")
292 "'rubocop'\n")
293 (("\"parser\",.*")
294 "'parser'\n"))
295 #t))
296 (add-after 'unpack 'patch-protoc
297 (lambda* (#:key inputs #:allow-other-keys)
298 (let ((protoc (assoc-ref inputs "protobuf")))
299 (substitute* "lib/protobuf/tasks/compile.rake"
300 (("\"protoc\"")
301 (string-append "\"" protoc "/bin/protoc" "\"")))
302 #t)))
303 (add-after 'unpack 'skip-failing-test
304 ;; See: https://github.com/ruby-protobuf/protobuf/issues/419
305 (lambda _
306 (substitute* "spec/lib/protobuf/rpc/connectors/ping_spec.rb"
307 (("expect\\(::IO\\)\\.to receive\\(:select\\).*" all)
308 (string-append " pending\n" all)))
309 #t))
310 (add-after 'replace-git-ls-files 'replace-more-git-ls-files
311 (lambda _
312 (substitute* ((@@ (guix build ruby-build-system) first-gemspec))
313 (("`git ls-files -- \\{test,spec,features\\}/*`")
314 "`find test spec features -type f | sort`")
315 (("`git ls-files -- bin/*`")
316 "`find bin -type f | sort`"))
317 #t))
318 (replace 'check
319 (lambda _
320 (invoke "rspec"))))))
321 (native-inputs
322 `(("ruby-benchmark-ips" ,ruby-benchmark-ips)
323 ("ruby-ffi-rzmq" ,ruby-ffi-rzmq)
324 ("ruby-parser" ,ruby-parser)
325 ("ruby-pry-byebug" ,ruby-pry-byebug)
326 ("ruby-pry-stack-explorer" ,ruby-pry-stack-explorer)
327 ("ruby-rake" ,ruby-rake)
328 ("ruby-rspec" ,ruby-rspec)
329 ("ruby-rubocop" ,ruby-rubocop)
330 ("ruby-ruby-prof" ,ruby-ruby-prof)
331 ("ruby-simplecov" ,ruby-simplecov)
332 ("ruby-timecop" ,ruby-timecop)
333 ("ruby-varint" ,ruby-varint)
334 ("ruby-yard" ,ruby-yard)))
335 (inputs
336 `(("protobuf" ,protobuf)))
337 (propagated-inputs
338 `(("ruby-activesupport" ,ruby-activesupport)
339 ("ruby-middleware" ,ruby-middleware)
340 ("ruby-thor" ,ruby-thor)))
341 (home-page "https://github.com/ruby-protobuf/protobuf")
342 (synopsis "Implementation of Google's Protocol Buffers in Ruby")
343 (description "Protobuf is an implementation of Google's Protocol Buffers
344in pure Ruby.")
345 (license license:expat)))
77f66f53
MC
346
347;;; This is a modified ruby-protobuf package used by ruby-cucumber-messages
348;;; until https://github.com/ruby-protobuf/protobuf/pull/411 and
349;;; https://github.com/ruby-protobuf/protobuf/pull/415 are merged upstream.
350(define-public ruby-protobuf-cucumber
351 (hidden-package
352 (package
353 (inherit ruby-protobuf)
354 (name "ruby-protobuf-cucumber")
355 (version "3.10.8")
356 (source
357 (origin
358 (method url-fetch)
359 (uri (rubygems-uri "protobuf-cucumber" version))
360 (sha256
361 (base32
362 "1rd6naabhpfb1i5dr6fp5mqwaawsx0mqm73h5ycwkgbm1n2si872")))))))