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 ;;; Copyright © 2020 Brett Gilio <brettg@gnu.org>
11 ;;; This file is part of GNU Guix.
13 ;;; GNU Guix is free software; you can redistribute it and/or modify it
14 ;;; under the terms of the GNU General Public License as published by
15 ;;; the Free Software Foundation; either version 3 of the License, or (at
16 ;;; your option) any later version.
18 ;;; GNU Guix is distributed in the hope that it will be useful, but
19 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ;;; GNU General Public License for more details.
23 ;;; You should have received a copy of the GNU General Public License
24 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
26 (define-module (gnu packages protobuf)
27 #:use-module (guix packages)
28 #:use-module (guix download)
29 #:use-module (guix git-download)
30 #:use-module (guix build-system cmake)
31 #:use-module (guix build-system gnu)
32 #:use-module (guix build-system python)
33 #:use-module (guix build-system emacs)
34 #:use-module (guix build-system ruby)
35 #:use-module ((guix licenses) #:prefix license:)
36 #:use-module (guix utils)
37 #:use-module (gnu packages compression)
38 #:use-module (gnu packages check)
39 #:use-module (gnu packages gcc)
40 #:use-module (gnu packages libevent)
41 #:use-module (gnu packages pkg-config)
42 #:use-module (gnu packages python)
43 #:use-module (gnu packages python-check)
44 #:use-module (gnu packages python-xyz)
45 #:use-module (gnu packages ruby))
54 (uri (string-append "https://dl.farsightsecurity.com/dist/" name "/"
55 name "-" version ".tar.gz"))
58 "1i9y8a1712aj80p5a1kcp378bnjrg3s2127q7304hklhmjcrjl1d"))))
59 (build-system gnu-build-system)
61 `(("pkg-config" ,pkg-config)))
63 `(("libevent" ,libevent)))
64 (home-page "https://github.com/farsightsec/fstrm")
65 (synopsis "Implementation of the Frame Streams data transport protocol")
67 "fstrm is an optimised implementation of Frame Streams as a C library and
68 several tools built on top of it.
70 @dfn{Frame Streams} is a light-weight, binary-clean protocol that allows for
71 the transport of arbitrarily-encoded data payload sequences with minimal
72 framing overhead---just four bytes per data frame. It does not specify an
73 encoding format for these data frames and can be used with any data
74 serialisation format that produces byte sequences, such as Protocol Buffers,
75 XML, JSON, MessagePack, YAML, etc.
77 Frame Streams can be used either as a streaming transport over a reliable byte
78 stream socket (TCP sockets, TLS connections, @code{AF_UNIX} sockets, etc.) for
79 data in motion, or as a file format for data at rest.")
80 (license (list license:asl2.0
81 (license:non-copyleft #f "See libmy/argv*")))))
83 (define-public protobuf
89 (uri (string-append "https://github.com/google/protobuf/releases/"
90 "download/v" version "/protobuf-cpp-"
94 "0nan2wkkwkcx3qyx0cf5vfzjcjhr5qgh4jfx6v2lwpf5q03mmv2h"))))
95 (build-system gnu-build-system)
96 (inputs `(("zlib" ,zlib)))
98 "static")) ; ~12 MiB of .a files
101 (modify-phases %standard-phases
102 (add-after 'install 'move-static-libraries
103 (lambda* (#:key outputs #:allow-other-keys)
104 ;; Move static libraries to the "static" output.
105 (let* ((out (assoc-ref outputs "out"))
106 (lib (string-append out "/lib"))
107 (static (assoc-ref outputs "static"))
108 (slib (string-append static "/lib")))
110 (for-each (lambda (file)
111 (install-file file slib)
113 (find-files lib "\\.a$"))
115 (home-page "https://github.com/google/protobuf")
116 (synopsis "Data encoding for remote procedure calls (RPCs)")
118 "Protocol Buffers are a way of encoding structured data in an efficient
119 yet extensible format. Google uses Protocol Buffers for almost all of its
120 internal RPC protocols and file formats.")
121 (license license:bsd-3)))
123 ;; Tensorflow requires version 3.6 specifically.
124 (define-public protobuf-3.6
125 (package/inherit protobuf
129 (uri (string-append "https://github.com/google/protobuf/releases/"
130 "download/v" version "/protobuf-cpp-"
134 "0a955bz59ihrb5wg7dwi12xajdi5pmz4bl0g147rbdwv393jwwxk"))))))
136 ;; The 3.5 series are the last versions that do not require C++ 11.
137 (define-public protobuf-3.5
143 (uri (string-append "https://github.com/google/protobuf/releases/"
144 "download/v" version "/protobuf-cpp-"
148 "14j0427ykjzrd9a66c2mpk0sjcccjlsx6q8ww6hzwb6sha3vm3f2"))))))
150 ;; XXX Remove this old version when no other packages depend on it.
151 (define-public protobuf-2
152 (package (inherit protobuf)
156 (uri (string-append "https://github.com/google/protobuf/releases/"
157 "download/v" version "/protobuf-"
161 "040rcs9fpv4bslhiy43v7dcrzakz4vwwpyqg4jp8bn24sl95ci7f"))))))
163 (define-public protobuf-c
169 (uri (string-append "https://github.com/protobuf-c/protobuf-c/"
170 "releases/download/v" version
171 "/protobuf-c-" version ".tar.gz"))
174 "0y3yaanq97si7iyld06p8w20m0shpj7sf4xwzbhhvijhxw36d592"))))
175 (build-system gnu-build-system)
176 (inputs `(("protobuf" ,protobuf)))
177 (native-inputs `(("pkg-config" ,pkg-config)))
178 (home-page "https://github.com/protobuf-c/protobuf-c")
179 (synopsis "Protocol Buffers implementation in C")
181 "This is protobuf-c, a C implementation of the Google Protocol Buffers
182 data serialization format. It includes @code{libprotobuf-c}, a pure C library
183 that implements protobuf encoding and decoding, and @code{protoc-c}, a code
184 generator that converts Protocol Buffer @code{.proto} files to C descriptor
186 (license license:bsd-2)))
188 (define-public protozero
196 (url "https://github.com/mapbox/protozero")
197 (commit (string-append "v" version))))
198 (file-name (git-file-name name version))
200 (base32 "1hfijpfylf1c71wa3mk70gjc88b6k1q7cxb87cwqdflw5q2x8ma6"))))
201 (build-system cmake-build-system)
202 (home-page "https://github.com/mapbox/protozero")
203 (synopsis "Minimalistic protocol buffer decoder and encoder in C++")
204 (description "Protozero is a minimalistic protocol buffer decoder and
205 encoder in C++. The developer using protozero has to manually translate the
206 @file{.proto} description into code.")
208 license:asl2.0 ; for folly
211 (define-public python-protobuf
213 (name "python-protobuf")
218 (uri (pypi-uri "protobuf" version))
221 "0mj6z58aiw532s1mq48m9xdrm3gdyp2vv9cdinfb5wmnfpm5m7n9"))))
222 (build-system python-build-system)
224 `(("python-wheel" ,python-wheel)))
226 `(("python-six" ,python-six)))
227 (home-page "https://github.com/google/protobuf")
228 (synopsis "Protocol buffers is a data interchange format")
230 "Protocol buffers are a language-neutral, platform-neutral extensible
231 mechanism for serializing structured data.")
232 (license license:bsd-3)))
234 (define-public python-pure-protobuf
236 (name "python-pure-protobuf")
240 ;; The PyPI tarball is broken: it has no tests.
243 (url "https://github.com/eigenein/protobuf")
245 (file-name (git-file-name name version))
247 (base32 "15dp5pvazd0jx4wzzh79080ah7hkpd3axh40al9vhzs2hf3v90hx"))))
248 (build-system python-build-system)
250 `(("python-flake8" ,python-flake8)
251 ("python-pytest" ,python-pytest)
252 ("python-pytest-cov" ,python-pytest-cov)
253 ("python-isort" ,python-isort)))
256 (modify-phases %standard-phases
257 (add-before 'check 'setup-test-env
258 (lambda* (#:key outputs #:allow-other-keys)
259 (let* ((out (assoc-ref outputs "out"))
261 (string-append out "/lib/python"
262 ,(version-major+minor
263 (package-version python))
266 (string-append py3sitedir ":"
267 (getenv "PYTHONPATH"))))
271 (invoke "pytest" "--cov-report" "term-missing" "--cov"
273 (invoke "flake8" "pure_protobuf" "tests"
275 (invoke "isort" "-rc" "-c" "pure_protobuf" "tests")
277 (home-page "https://pypi.org/project/pure-protobuf/")
278 (synopsis "Protobuf implementation using dataclasses")
280 "@code{python-pure-protobuf} takes advantage of the standard
281 dataclasses module to define message types. Protocol buffers are a
282 language-neutral, platform-neutral extensible mechanism for serializing
284 (license license:expat)))
286 (define-public python2-protobuf
287 (package-with-python2 python-protobuf))
290 (define-public python-protobuf-3.6
291 (package/inherit python-protobuf
292 (name "python-protobuf")
293 (version (package-version protobuf-3.6) )
297 (uri (pypi-uri "protobuf" version))
300 "04bqb12smlckzmgkj6vgmpbr3cby0n6726cmz33bqr7kn1vb728l"))))))
302 (define-public emacs-protobuf-mode
304 (name "emacs-protobuf-mode")
305 (version (package-version protobuf))
306 (source (package-source protobuf))
307 (build-system emacs-build-system)
310 (modify-phases %standard-phases
311 (add-before 'add-source-to-load-path 'change-working-directory
312 (lambda _ (chdir "editors") #t)))))
313 (home-page "https://github.com/protocolbuffers/protobuf")
314 (synopsis "Protocol buffers major mode for Emacs")
316 "This package provides an Emacs major mode for editing Protocol Buffer
318 (license license:bsd-3)))
320 (define-public ruby-protobuf
322 (name "ruby-protobuf")
327 (url "https://github.com/ruby-protobuf/protobuf")
328 (commit (string-append "v" version))))
329 (file-name (git-file-name name version))
332 "1yzz7jgpp6qip5d6qhzbkf5gqaydfk3z3c1ngccwzp6w6wa75g8a"))))
333 (build-system ruby-build-system)
336 (modify-phases %standard-phases
337 (add-after 'unpack 'do-not-use-bundler-for-tests
339 (substitute* "spec/spec_helper.rb"
340 (("Bundler\\.setup.*") ""))
342 (add-after 'unpack 'relax-version-requirements
344 (substitute* ((@@ (guix build ruby-build-system) first-gemspec))
352 (add-after 'unpack 'patch-protoc
353 (lambda* (#:key inputs #:allow-other-keys)
354 (let ((protoc (assoc-ref inputs "protobuf")))
355 (substitute* "lib/protobuf/tasks/compile.rake"
357 (string-append "\"" protoc "/bin/protoc" "\"")))
359 (add-after 'unpack 'skip-failing-test
360 ;; See: https://github.com/ruby-protobuf/protobuf/issues/419
362 (substitute* "spec/lib/protobuf/rpc/connectors/ping_spec.rb"
363 (("expect\\(::IO\\)\\.to receive\\(:select\\).*" all)
364 (string-append " pending\n" all)))
366 (add-after 'replace-git-ls-files 'replace-more-git-ls-files
368 (substitute* ((@@ (guix build ruby-build-system) first-gemspec))
369 (("`git ls-files -- \\{test,spec,features\\}/*`")
370 "`find test spec features -type f | sort`")
371 (("`git ls-files -- bin/*`")
372 "`find bin -type f | sort`"))
376 (invoke "rspec"))))))
378 `(("ruby-benchmark-ips" ,ruby-benchmark-ips)
379 ("ruby-ffi-rzmq" ,ruby-ffi-rzmq)
380 ("ruby-parser" ,ruby-parser)
381 ("ruby-pry-byebug" ,ruby-pry-byebug)
382 ("ruby-pry-stack-explorer" ,ruby-pry-stack-explorer)
383 ("ruby-rake" ,ruby-rake)
384 ("ruby-rspec" ,ruby-rspec)
385 ("ruby-rubocop" ,ruby-rubocop)
386 ("ruby-ruby-prof" ,ruby-ruby-prof)
387 ("ruby-simplecov" ,ruby-simplecov)
388 ("ruby-timecop" ,ruby-timecop)
389 ("ruby-varint" ,ruby-varint)
390 ("ruby-yard" ,ruby-yard)))
392 `(("protobuf" ,protobuf)))
394 `(("ruby-activesupport" ,ruby-activesupport)
395 ("ruby-middleware" ,ruby-middleware)
396 ("ruby-thor" ,ruby-thor)))
397 (home-page "https://github.com/ruby-protobuf/protobuf")
398 (synopsis "Implementation of Google's Protocol Buffers in Ruby")
399 (description "Protobuf is an implementation of Google's Protocol Buffers
401 (license license:expat)))
403 ;;; This is a modified ruby-protobuf package used by ruby-cucumber-messages
404 ;;; until https://github.com/ruby-protobuf/protobuf/pull/411 and
405 ;;; https://github.com/ruby-protobuf/protobuf/pull/415 are merged upstream.
406 (define-public ruby-protobuf-cucumber
409 (inherit ruby-protobuf)
410 (name "ruby-protobuf-cucumber")
415 (uri (rubygems-uri "protobuf-cucumber" version))
418 "1rd6naabhpfb1i5dr6fp5mqwaawsx0mqm73h5ycwkgbm1n2si872")))))))