gnu: pspp: Update to 1.4.0.
[jackhill/guix/guix.git] / gnu / packages / protobuf.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2014 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2016 Daniel Pimentel <d4n1@d4n1.org>
4 ;;; Copyright © 2016 Leo Famulari <leo@famulari.name>
5 ;;; Copyright © 2017, 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
6 ;;; Copyright © 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
7 ;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
8 ;;; Copyright © 2020 Vinicius Monego <monego@posteo.net>
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)
28 #:use-module (guix git-download)
29 #:use-module (guix build-system cmake)
30 #:use-module (guix build-system gnu)
31 #:use-module (guix build-system python)
32 #:use-module (guix build-system emacs)
33 #:use-module (guix build-system ruby)
34 #:use-module ((guix licenses) #:prefix license:)
35 #:use-module (gnu packages compression)
36 #:use-module (gnu packages gcc)
37 #:use-module (gnu packages libevent)
38 #:use-module (gnu packages pkg-config)
39 #:use-module (gnu packages python)
40 #:use-module (gnu packages python-xyz)
41 #:use-module (gnu packages ruby))
42
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
64 several tools built on top of it.
65
66 @dfn{Frame Streams} is a light-weight, binary-clean protocol that allows for
67 the transport of arbitrarily-encoded data payload sequences with minimal
68 framing overhead---just four bytes per data frame. It does not specify an
69 encoding format for these data frames and can be used with any data
70 serialisation format that produces byte sequences, such as Protocol Buffers,
71 XML, JSON, MessagePack, YAML, etc.
72
73 Frame Streams can be used either as a streaming transport over a reliable byte
74 stream socket (TCP sockets, TLS connections, @code{AF_UNIX} sockets, etc.) for
75 data in motion, or as a file format for data at rest.")
76 (license (list license:asl2.0
77 (license:non-copyleft #f "See libmy/argv*")))))
78
79 (define-public protobuf
80 (package
81 (name "protobuf")
82 (version "3.12.3")
83 (source (origin
84 (method url-fetch)
85 (uri (string-append "https://github.com/google/protobuf/releases/"
86 "download/v" version "/protobuf-cpp-"
87 version ".tar.gz"))
88 (sha256
89 (base32
90 "0s29dj8l9j6jk04im3ivcji1x9jm42fwjmwcmli0smz0m337xyaf"))))
91 (build-system gnu-build-system)
92 (inputs `(("zlib" ,zlib)))
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))))))
111 (home-page "https://github.com/google/protobuf")
112 (synopsis "Data encoding for remote procedure calls (RPCs)")
113 (description
114 "Protocol Buffers are a way of encoding structured data in an efficient
115 yet extensible format. Google uses Protocol Buffers for almost all of its
116 internal RPC protocols and file formats.")
117 (license license:bsd-3)))
118
119 ;; Tensorflow requires version 3.6 specifically.
120 (define-public protobuf-3.6
121 (package/inherit protobuf
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
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
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
159 (define-public protobuf-c
160 (package
161 (name "protobuf-c")
162 (version "1.3.2")
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
170 "0x4ybd9rfd878p2imz0hb8zxfd7l60vbdw7cg84dnysr9kqm3wjk"))))
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
178 data serialization format. It includes @code{libprotobuf-c}, a pure C library
179 that implements protobuf encoding and decoding, and @code{protoc-c}, a code
180 generator that converts Protocol Buffer @code{.proto} files to C descriptor
181 code.")
182 (license license:bsd-2)))
183
184 (define-public protozero
185 (package
186 (name "protozero")
187 (version "1.6.8")
188 (source
189 (origin
190 (method git-fetch)
191 (uri (git-reference
192 (url "https://github.com/mapbox/protozero")
193 (commit (string-append "v" version))))
194 (file-name (git-file-name name version))
195 (sha256
196 (base32 "1hfijpfylf1c71wa3mk70gjc88b6k1q7cxb87cwqdflw5q2x8ma6"))))
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
201 encoder 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
207 (define-public python-protobuf
208 (package
209 (name "python-protobuf")
210 (version "3.12.4")
211 (source
212 (origin
213 (method url-fetch)
214 (uri (pypi-uri "protobuf" version))
215 (sha256
216 (base32
217 "0mj6z58aiw532s1mq48m9xdrm3gdyp2vv9cdinfb5wmnfpm5m7n9"))))
218 (build-system python-build-system)
219 (native-inputs
220 `(("python-wheel" ,python-wheel)))
221 (propagated-inputs
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
227 mechanism for serializing structured data.")
228 (license license:bsd-3)))
229
230 (define-public python2-protobuf
231 (package-with-python2 python-protobuf))
232
233 ;; For tensorflow.
234 (define-public python-protobuf-3.6
235 (package/inherit python-protobuf
236 (name "python-protobuf")
237 (version (package-version protobuf-3.6) )
238 (source
239 (origin
240 (method url-fetch)
241 (uri (pypi-uri "protobuf" version))
242 (sha256
243 (base32
244 "04bqb12smlckzmgkj6vgmpbr3cby0n6726cmz33bqr7kn1vb728l"))))))
245
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
255 (add-before 'add-source-to-load-path 'change-working-directory
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
261 source files.")
262 (license license:bsd-3)))
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
271 (url "https://github.com/ruby-protobuf/protobuf")
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
344 in pure Ruby.")
345 (license license:expat)))
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")))))))