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, 2022 Ricardo Wurmus <rekado@elephly.net>
6 ;;; Copyright © 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
7 ;;; Copyright © 2020, 2021, 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
8 ;;; Copyright © 2020 Vinicius Monego <monego@posteo.net>
9 ;;; Copyright © 2020 Brett Gilio <brettg@gnu.org>
10 ;;; Copyright © 2021 Felix Gruber <felgru@posteo.net>
12 ;;; This file is part of GNU Guix.
14 ;;; GNU Guix is free software; you can redistribute it and/or modify it
15 ;;; under the terms of the GNU General Public License as published by
16 ;;; the Free Software Foundation; either version 3 of the License, or (at
17 ;;; your option) any later version.
19 ;;; GNU Guix is distributed in the hope that it will be useful, but
20 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
21 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 ;;; GNU General Public License for more details.
24 ;;; You should have received a copy of the GNU General Public License
25 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
27 (define-module (gnu packages protobuf)
28 #:use-module (guix gexp)
29 #:use-module (guix packages)
30 #:use-module (guix download)
31 #:use-module (guix git-download)
32 #:use-module (guix build-system cmake)
33 #:use-module (guix build-system gnu)
34 #:use-module (guix build-system python)
35 #:use-module (guix build-system emacs)
36 #:use-module (guix build-system ruby)
37 #:use-module ((guix licenses) #:prefix license:)
38 #:use-module (guix utils)
39 #:use-module (gnu packages compression)
40 #:use-module (gnu packages check)
41 #:use-module (gnu packages gcc)
42 #:use-module (gnu packages libevent)
43 #:use-module (gnu packages pkg-config)
44 #:use-module (gnu packages python)
45 #:use-module (gnu packages python-build)
46 #:use-module (gnu packages python-check)
47 #:use-module (gnu packages python-xyz)
48 #:use-module (gnu packages ruby))
57 (uri (string-append "https://dl.farsightsecurity.com/dist/fstrm/"
58 "fstrm-" version ".tar.gz"))
60 (base32 "13q9iz5fpp607zvk0i39158fvvjciz4y5k14rly94b9ak0gar95w"))))
61 (build-system gnu-build-system)
63 (list #:configure-flags
64 #~(list "--disable-static")))
69 (home-page "https://github.com/farsightsec/fstrm")
70 (synopsis "Implementation of the Frame Streams data transport protocol")
72 "fstrm is an optimised implementation of Frame Streams as a C library and
73 several tools built on top of it.
75 @dfn{Frame Streams} is a light-weight, binary-clean protocol that allows for
76 the transport of arbitrarily-encoded data payload sequences with minimal
77 framing overhead---just four bytes per data frame. It does not specify an
78 encoding format for these data frames and can be used with any data
79 serialisation format that produces byte sequences, such as Protocol Buffers,
80 XML, JSON, MessagePack, YAML, etc.
82 Frame Streams can be used either as a streaming transport over a reliable byte
83 stream socket (TCP sockets, TLS connections, @code{AF_UNIX} sockets, etc.) for
84 data in motion, or as a file format for data at rest.")
85 (license (list license:expat ; the combined work
86 license:hpnd)))) ; libmy/argv*
88 (define-public protobuf
94 (uri (string-append "https://github.com/google/protobuf/releases/"
95 "download/v" version "/protobuf-cpp-"
99 "1jzqrklhj9grs6xbddyb5dyxfbgbgbyhl5zig8ml50wb22gwkkji"))))
100 (build-system gnu-build-system)
103 "static")) ; ~12 MiB of .a files
106 (modify-phases %standard-phases
107 (add-after 'unpack 'disable-broken-tests
108 ;; The following tests fail on 32 bit architectures such as
111 (let-syntax ((disable-tests
116 (string-append "DISABLED_" name)) ...)))))
117 ;; See: https://github.com/protocolbuffers/protobuf/issues/8460.
118 (disable-tests "src/google/protobuf/any_test.cc"
119 "TestPackFromSerializationExceedsSizeLimit")
120 ;; See: https://github.com/protocolbuffers/protobuf/issues/8459.
121 (disable-tests "src/google/protobuf/arena_unittest.cc"
122 "SpaceAllocated_and_Used"
123 "BlockSizeSmallerThanAllocation")
124 ;; See: https://github.com/protocolbuffers/protobuf/issues/8082.
125 (disable-tests "src/google/protobuf/io/zero_copy_stream_unittest.cc"
127 (add-after 'install 'move-static-libraries
128 (lambda* (#:key outputs #:allow-other-keys)
129 ;; Move static libraries to the "static" output.
130 (let* ((out (assoc-ref outputs "out"))
131 (lib (string-append out "/lib"))
132 (static (assoc-ref outputs "static"))
133 (slib (string-append static "/lib")))
135 (for-each (lambda (file)
136 (install-file file slib)
138 (find-files lib "\\.a$"))))))))
139 (home-page "https://github.com/google/protobuf")
140 (synopsis "Data encoding for remote procedure calls (RPCs)")
142 "Protocol Buffers are a way of encoding structured data in an efficient
143 yet extensible format. Google uses Protocol Buffers for almost all of its
144 internal RPC protocols and file formats.")
145 (license license:bsd-3)))
147 ;; Tensorflow requires version 3.6 specifically.
148 (define-public protobuf-3.6
154 (uri (string-append "https://github.com/google/protobuf/releases/"
155 "download/v" version "/protobuf-cpp-"
159 "0a955bz59ihrb5wg7dwi12xajdi5pmz4bl0g147rbdwv393jwwxk"))))))
161 ;; The 3.5 series are the last versions that do not require C++ 11.
162 (define-public protobuf-3.5
168 (uri (string-append "https://github.com/google/protobuf/releases/"
169 "download/v" version "/protobuf-cpp-"
173 "14j0427ykjzrd9a66c2mpk0sjcccjlsx6q8ww6hzwb6sha3vm3f2"))))))
175 ;; XXX Remove this old version when no other packages depend on it.
176 (define-public protobuf-2
177 (package (inherit protobuf)
181 (uri (string-append "https://github.com/google/protobuf/releases/"
182 "download/v" version "/protobuf-"
186 "040rcs9fpv4bslhiy43v7dcrzakz4vwwpyqg4jp8bn24sl95ci7f"))))
187 (arguments (substitute-keyword-arguments (package-arguments protobuf)
189 `(modify-phases ,phases
190 (delete 'disable-broken-tests)))))))
192 (define-public protobuf-c
198 (uri (string-append "https://github.com/protobuf-c/protobuf-c/"
199 "releases/download/v" version
200 "/protobuf-c-" version ".tar.gz"))
203 "0y3yaanq97si7iyld06p8w20m0shpj7sf4xwzbhhvijhxw36d592"))))
204 (build-system gnu-build-system)
205 (inputs (list protobuf))
206 (native-inputs (list pkg-config))
207 (home-page "https://github.com/protobuf-c/protobuf-c")
208 (synopsis "Protocol Buffers implementation in C")
210 "This is protobuf-c, a C implementation of the Google Protocol Buffers
211 data serialization format. It includes @code{libprotobuf-c}, a pure C library
212 that implements protobuf encoding and decoding, and @code{protoc-c}, a code
213 generator that converts Protocol Buffer @code{.proto} files to C descriptor
215 (license license:bsd-2)))
217 (define-public protozero
225 (url "https://github.com/mapbox/protozero")
226 (commit (string-append "v" version))))
227 (file-name (git-file-name name version))
229 (base32 "052cq5mdjjgcsgk612zkqi8k08p3ikl22r59dk6i6fq41dxldja7"))))
230 (build-system cmake-build-system)
231 (home-page "https://github.com/mapbox/protozero")
232 (synopsis "Minimalistic protocol buffer decoder and encoder in C++")
233 (description "Protozero is a minimalistic protocol buffer decoder and
234 encoder in C++. The developer using protozero has to manually translate the
235 @file{.proto} description into code.")
237 license:asl2.0 ; for folly
240 (define-public python-protobuf
242 (name "python-protobuf")
247 (uri (pypi-uri "protobuf" version))
250 "1ja2vpk9nklllmsirmil2s4l7ni9yfqvbvj47zz5xx17s1k1bhxd"))))
251 (build-system python-build-system)
252 (home-page "https://github.com/google/protobuf")
253 (synopsis "Protocol buffers is a data interchange format")
255 "Protocol buffers are a language-neutral, platform-neutral extensible
256 mechanism for serializing structured data.")
257 (license license:bsd-3)))
259 (define-public python-pure-protobuf
261 (name "python-pure-protobuf")
265 ;; The PyPI tarball is broken: it has no tests.
268 (url "https://github.com/eigenein/protobuf")
270 (file-name (git-file-name name version))
272 (base32 "15dp5pvazd0jx4wzzh79080ah7hkpd3axh40al9vhzs2hf3v90hx"))))
273 (build-system python-build-system)
275 (list python-flake8 python-pytest python-pytest-cov python-isort))
278 (modify-phases %standard-phases
281 (invoke "pytest" "--cov-report" "term-missing" "--cov"
283 (invoke "flake8" "pure_protobuf" "tests"
285 (invoke "isort" "-rc" "-c" "pure_protobuf" "tests"))))))
286 (home-page "https://pypi.org/project/pure-protobuf/")
287 (synopsis "Protobuf implementation using dataclasses")
289 "@code{python-pure-protobuf} takes advantage of the standard
290 dataclasses module to define message types. Protocol buffers are a
291 language-neutral, platform-neutral extensible mechanism for serializing
293 (license license:expat)))
296 (define-public python-protobuf-3.6
298 (inherit python-protobuf)
299 (name "python-protobuf")
300 (version (package-version protobuf-3.6) )
304 (uri (pypi-uri "protobuf" version))
307 "04bqb12smlckzmgkj6vgmpbr3cby0n6726cmz33bqr7kn1vb728l"))))
310 (package-inputs python-protobuf)))))
312 (define-public python-proto-plus
314 (name "python-proto-plus")
319 (uri (pypi-uri "proto-plus" version))
321 (base32 "1raad9qnmfva94nm33k40bcwrckgljbfky5pdwh4xhg6r5dj52zj"))))
322 (build-system python-build-system)
323 (propagated-inputs (list python-protobuf))
324 (home-page "https://github.com/googleapis/proto-plus-python.git")
325 (synopsis "Pythonic protocol buffers")
326 (description "This is a wrapper around protocol buffers. Protocol buffers
327 is a specification format for APIs, such as those inside Google. This library
328 provides protocol buffer message classes and objects that largely behave like
329 native Python types.")
330 (license license:asl2.0)))
332 (define-public emacs-protobuf-mode
334 (name "emacs-protobuf-mode")
335 (version (package-version protobuf))
336 (source (package-source protobuf))
337 (build-system emacs-build-system)
340 (modify-phases %standard-phases
341 (add-before 'expand-load-path 'change-working-directory
342 (lambda _ (chdir "editors") #t)))))
343 (home-page "https://github.com/protocolbuffers/protobuf")
344 (synopsis "Protocol buffers major mode for Emacs")
346 "This package provides an Emacs major mode for editing Protocol Buffer
348 (license license:bsd-3)))
350 (define-public ruby-protobuf
352 (name "ruby-protobuf")
357 (url "https://github.com/ruby-protobuf/protobuf")
358 (commit (string-append "v" version))))
359 (file-name (git-file-name name version))
362 "1yzz7jgpp6qip5d6qhzbkf5gqaydfk3z3c1ngccwzp6w6wa75g8a"))))
363 (build-system ruby-build-system)
366 (modify-phases %standard-phases
367 (add-after 'unpack 'do-not-use-bundler-for-tests
369 (substitute* "spec/spec_helper.rb"
370 (("Bundler\\.setup.*") ""))
372 (add-after 'unpack 'relax-version-requirements
374 (substitute* ((@@ (guix build ruby-build-system) first-gemspec))
382 (add-after 'unpack 'patch-protoc
383 (lambda* (#:key inputs #:allow-other-keys)
384 (let ((protoc (assoc-ref inputs "protobuf")))
385 (substitute* "lib/protobuf/tasks/compile.rake"
387 (string-append "\"" protoc "/bin/protoc" "\"")))
389 (add-after 'unpack 'skip-failing-test
390 ;; See: https://github.com/ruby-protobuf/protobuf/issues/419
392 (substitute* "spec/lib/protobuf/rpc/connectors/ping_spec.rb"
393 (("expect\\(::IO\\)\\.to receive\\(:select\\).*" all)
394 (string-append " pending\n" all)))
396 (add-after 'replace-git-ls-files 'replace-more-git-ls-files
398 (substitute* ((@@ (guix build ruby-build-system) first-gemspec))
399 (("`git ls-files -- \\{test,spec,features\\}/*`")
400 "`find test spec features -type f | sort`")
401 (("`git ls-files -- bin/*`")
402 "`find bin -type f | sort`"))
406 (invoke "rspec"))))))
408 (list ruby-benchmark-ips
412 ruby-pry-stack-explorer
424 (list ruby-activesupport ruby-middleware ruby-thor ruby-thread-safe))
425 (home-page "https://github.com/ruby-protobuf/protobuf")
426 (synopsis "Implementation of Google's Protocol Buffers in Ruby")
427 (description "Protobuf is an implementation of Google's Protocol Buffers
429 (license license:expat)))
431 ;;; This is a modified ruby-protobuf package used by ruby-cucumber-messages
432 ;;; until https://github.com/ruby-protobuf/protobuf/pull/411 and
433 ;;; https://github.com/ruby-protobuf/protobuf/pull/415 are merged upstream.
434 (define-public ruby-protobuf-cucumber
437 (inherit ruby-protobuf)
438 (name "ruby-protobuf-cucumber")
443 (uri (rubygems-uri "protobuf-cucumber" version))
446 "1rd6naabhpfb1i5dr6fp5mqwaawsx0mqm73h5ycwkgbm1n2si872")))))))