projects/guix·blob java-team · refs

702 lines · 27.7 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2014, 2022 Ludovic Courtès <[email protected]>
3;;; Copyright © 2016 Daniel Pimentel <[email protected]>
4;;; Copyright © 2016 Leo Famulari <[email protected]>
5;;; Copyright © 2017-2019, 2022-2025 Ricardo Wurmus <[email protected]>
6;;; Copyright © 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice <[email protected]>
7;;; Copyright © 2020, 2021, 2022, 2023 Maxim Cournoyer <[email protected]>
8;;; Copyright © 2020 Vinicius Monego <[email protected]>
9;;; Copyright © 2020 Brett Gilio <[email protected]>
10;;; Copyright © 2021 Felix Gruber <[email protected]>
11;;; Copyright © 2023, 2024 Zheng Junjie <[email protected]>
12;;;
13;;; This file is part of GNU Guix.
14;;;
15;;; GNU Guix is free software; you can redistribute it and/or modify it
16;;; under the terms of the GNU General Public License as published by
17;;; the Free Software Foundation; either version 3 of the License, or (at
18;;; your option) any later version.
19;;;
20;;; GNU Guix is distributed in the hope that it will be useful, but
21;;; WITHOUT ANY WARRANTY; without even the implied warranty of
22;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23;;; GNU General Public License for more details.
24;;;
25;;; You should have received a copy of the GNU General Public License
26;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
27
28(define-module (gnu packages protobuf)
29 #:use-module (guix gexp)
30 #:use-module (guix packages)
31 #:use-module (guix download)
32 #:use-module (guix git-download)
33 #:use-module (guix build-system cmake)
34 #:use-module (guix build-system gnu)
35 #:use-module (guix build-system pyproject)
36 #:use-module (guix build-system emacs)
37 #:use-module (guix build-system ruby)
38 #:use-module ((guix licenses) #:prefix license:)
39 #:use-module (guix utils)
40 #:use-module (gnu packages)
41 #:use-module (gnu packages build-tools)
42 #:use-module (gnu packages compression)
43 #:use-module (gnu packages check)
44 #:use-module (gnu packages cpp)
45 #:use-module (gnu packages gcc)
46 #:use-module (gnu packages libevent)
47 #:use-module (gnu packages pkg-config)
48 #:use-module (gnu packages python)
49 #:use-module (gnu packages python-build)
50 #:use-module (gnu packages python-check)
51 #:use-module (gnu packages python-xyz)
52 #:use-module (gnu packages rpc)
53 #:use-module (gnu packages rails)
54 #:use-module (gnu packages ruby)
55 #:use-module (gnu packages ruby-check)
56 #:use-module (gnu packages ruby-xyz)
57 #:use-module (gnu packages serialization)
58 #:use-module (gnu packages time)
59 #:use-module (srfi srfi-1))
60
61(define-public fstrm
62 (package
63 (name "fstrm")
64 (version "0.6.1")
65 (source
66 (origin
67 (method url-fetch)
68 (uri (string-append "https://dl.farsightsecurity.com/dist/fstrm/"
69 "fstrm-" version ".tar.gz"))
70 (sha256
71 (base32 "13q9iz5fpp607zvk0i39158fvvjciz4y5k14rly94b9ak0gar95w"))))
72 (build-system gnu-build-system)
73 (arguments
74 (list #:configure-flags
75 #~(list "--disable-static")))
76 (native-inputs
77 (list pkg-config))
78 (inputs
79 (list libevent))
80 (home-page "https://github.com/farsightsec/fstrm")
81 (synopsis "Implementation of the Frame Streams data transport protocol")
82 (description
83 "fstrm is an optimised implementation of Frame Streams as a C library and
84several tools built on top of it.
85
86@dfn{Frame Streams} is a light-weight, binary-clean protocol that allows for
87the transport of arbitrarily-encoded data payload sequences with minimal
88framing overhead---just four bytes per data frame. It does not specify an
89encoding format for these data frames and can be used with any data
90serialisation format that produces byte sequences, such as Protocol Buffers,
91XML, JSON, MessagePack, YAML, etc.
92
93Frame Streams can be used either as a streaming transport over a reliable byte
94stream socket (TCP sockets, TLS connections, @code{AF_UNIX} sockets, etc.) for
95data in motion, or as a file format for data at rest.")
96 (license (list license:expat ; the combined work
97 license:hpnd)))) ; libmy/argv*
98
99;; Onnx requires version >=4.25.1 specifically.
100(define-public protobuf-6
101 (package
102 (name "protobuf")
103 (version "6.31.1")
104 (source
105 (origin
106 (method git-fetch)
107 (uri (git-reference
108 (url "https://github.com/protocolbuffers/protobuf/")
109 (commit (string-append "v" version))))
110 (modules '((guix build utils)
111 (ice-9 ftw)
112 (srfi srfi-26)))
113 (snippet
114 #~(begin
115 ;; XXX: 'delete-all-but' is copied from the turbovnc package.
116 (define (delete-all-but directory . preserve)
117 (define (directory? x)
118 (and=> (stat x #f)
119 (compose (cut eq? 'directory <>) stat:type)))
120 (with-directory-excursion directory
121 (let* ((pred
122 (negate (cut member <> (append '("." "..") preserve))))
123 (items (scandir "." pred)))
124 (for-each delete-file-recursively items))))
125 ;; "utf8_range" development now takes place in main protobuf
126 ;; repository.
127 (delete-all-but "third_party" "utf8_range")))
128 (file-name (git-file-name name version))
129 (sha256
130 (base32 "1rdxm75bqwjj4qd3hz4vlydra6bw5dq391kwln2q0pjfx9gbrjhk"))))
131 (build-system cmake-build-system)
132 (arguments
133 (list
134 #:configure-flags
135 #~(list "-DBUILD_SHARED_LIBS=ON")
136 #:phases
137 #~(modify-phases %standard-phases
138 (add-after 'unpack 'disable-broken-tests
139 ;; The following tests used to fail on 32 bit architectures
140 ;; such as i686-linux.
141 (lambda _
142 (let-syntax ((disable-tests
143 (syntax-rules ()
144 ((_ file test ...)
145 (substitute* file
146 ((test name)
147 (string-append "DISABLED_" name)) ...)))))
148 ;; https://github.com/protocolbuffers/protobuf/issues/8460.
149 (disable-tests
150 "src/google/protobuf/any_test.cc"
151 "TestPackFromSerializationExceedsSizeLimit")
152 ;; https://github.com/protocolbuffers/protobuf/issues/8459.
153 (disable-tests
154 "src/google/protobuf/arena_unittest.cc"
155 "SpaceAllocated_and_Used"
156 "BlockSizeSmallerThanAllocation")
157 ;; https://github.com/protocolbuffers/protobuf/issues/8082.
158 (disable-tests
159 "src/google/protobuf/io/zero_copy_stream_unittest.cc"
160 "LargeOutput")))))))
161 (native-inputs (list googletest))
162 (inputs (list abseil-cpp zlib))
163 (home-page "https://protobuf.dev")
164 (synopsis "Data encoding for remote procedure calls (RPCs)")
165 (description
166 "Protocol Buffers are a way of encoding structured data in an efficient
167yet extensible format. Google uses Protocol Buffers for almost all of its
168internal RPC protocols and file formats.")
169 (license license:bsd-3)))
170
171(define-public python-protobuf-6
172 (package
173 (inherit protobuf-6)
174 (name "python-protobuf")
175 (version "6.31.1")
176 (source
177 (origin
178 (method url-fetch)
179 (uri (pypi-uri "protobuf" version))
180 (sha256
181 (base32
182 "16nakbb14jjzhgmrvpn0g7k0iasgl8p0xa3kvjj5gfghhb4w9jnq"))))
183 (outputs (list "out"))
184 (build-system pyproject-build-system)
185 (arguments (list #:tests? #f)) ;no tests provided for Python variant
186 (native-inputs (list python-setuptools python-wheel))
187 (inputs (list protobuf-6))))
188
189(define-public protobuf
190 (package
191 (name "protobuf")
192 (version "3.21.9")
193 (source (origin
194 (method url-fetch)
195 (uri (string-append
196 "https://github.com/protocolbuffers/"
197 "protobuf/releases/download/v"
198 (string-join (drop (string-split version #\.) 1) ".")
199 "/protobuf-cpp-" version ".tar.gz"))
200 (modules '((guix build utils)))
201 (snippet '(delete-file-recursively "third_party"))
202 (sha256
203 (base32
204 "01cl4l0rnnzjbhjjs2gyg2pk13505gh86ikh22jqjp54dp8mvp5x"))
205 (patches (search-patches "protobuf-fix-build-on-32bit.patch"))))
206 (outputs (list "out"
207 "static")) ; ~12 MiB of .a files
208 (build-system cmake-build-system)
209 (arguments
210 (list
211 ;; TODO: Add the BUILD_SHARED_LIBS flag to cmake-build-system.
212 #:configure-flags #~(list "-DBUILD_SHARED_LIBS=ON"
213 "-Dprotobuf_USE_EXTERNAL_GTEST=ON")
214 #:phases
215 #~(modify-phases %standard-phases
216 (add-after 'unpack 'disable-broken-tests
217 ;; The following tests fail on 32 bit architectures such as
218 ;; i686-linux.
219 (lambda _
220 (let-syntax ((disable-tests
221 (syntax-rules ()
222 ((_ file test ...)
223 (substitute* file
224 ((test name)
225 (string-append "DISABLED_" name)) ...)))))
226 ;; See: https://github.com/protocolbuffers/protobuf/issues/8460.
227 (disable-tests "src/google/protobuf/any_test.cc"
228 "TestPackFromSerializationExceedsSizeLimit")
229 ;; See: https://github.com/protocolbuffers/protobuf/issues/8459.
230 (disable-tests "src/google/protobuf/arena_unittest.cc"
231 "SpaceAllocated_and_Used"
232 "BlockSizeSmallerThanAllocation")
233 ;; See: https://github.com/protocolbuffers/protobuf/issues/8082.
234 (disable-tests "src/google/protobuf/io/zero_copy_stream_unittest.cc"
235 "LargeOutput"))))
236 (add-before 'configure 'set-c++-standard
237 (lambda _
238 (substitute* "CMakeLists.txt"
239 ;; The 32bit patch requires C++14.
240 ;; TODO: Remove after next release.
241 (("CMAKE_CXX_STANDARD 11") "CMAKE_CXX_STANDARD 14"))))
242 (add-after 'install 'move-static-libraries
243 (lambda* (#:key outputs #:allow-other-keys)
244 ;; Move static libraries to the "static" output.
245 (let* ((out (assoc-ref outputs "out"))
246 (lib (string-append out "/lib"))
247 (static (assoc-ref outputs "static"))
248 (slib (string-append static "/lib")))
249 (mkdir-p slib)
250 (for-each (lambda (file)
251 (install-file file slib)
252 (delete-file file))
253 (find-files lib "\\.a$"))))))))
254 (native-inputs (append (if (%current-target-system)
255 (list this-package)
256 '())
257 (list googletest)))
258 (inputs (list zlib googletest))
259 (home-page "https://github.com/protocolbuffers/protobuf")
260 (synopsis "Data encoding for remote procedure calls (RPCs)")
261 (description
262 "Protocol Buffers are a way of encoding structured data in an efficient
263yet extensible format. Google uses Protocol Buffers for almost all of its
264internal RPC protocols and file formats.")
265 (license license:bsd-3)))
266
267(define-public protobuf-static-for-onnxruntime
268 (package
269 (inherit protobuf)
270 (name "protobuf-static")
271 (arguments
272 (substitute-keyword-arguments (package-arguments protobuf)
273 ((#:configure-flags _)
274 #~(list "-DBUILD_SHARED_LIBS=OFF"
275 "-Dprotobuf_BUILD_SHARED_LIBS=OFF"
276 "-Dprotobuf_USE_EXTERNAL_GTEST=ON"
277 ;; -fPIC is needed because this .a will be linked into
278 ;; onnxruntime's shared .so.
279 "-DCMAKE_POSITION_INDEPENDENT_CODE=ON"
280 ;; C++17 is needed because descriptor.pb.h declares
281 ;; static constexpr members (e.g. FileOptions::SPEED)
282 ;; with out-of-line definitions in descriptor.pb.cc
283 ;; guarded by "#if (__cplusplus < 201703)". In C++14
284 ;; both produce symbols, causing duplicate definitions
285 ;; when the .a is linked into a binary. C++17 makes
286 ;; static constexpr implicitly inline and suppresses
287 ;; the out-of-line definitions.
288 "-DCMAKE_CXX_STANDARD=17"))
289 ((#:phases phases)
290 #~(modify-phases #$phases
291 (delete 'move-static-libraries)
292 (replace 'set-c++-standard
293 (lambda _
294 (substitute* "CMakeLists.txt"
295 (("CMAKE_CXX_STANDARD 11") "CMAKE_CXX_STANDARD 17"))))))))))
296
297(define-public protobuf-c
298 (package
299 (name "protobuf-c")
300 (version "1.4.1")
301 (source (origin
302 (method url-fetch)
303 (uri (string-append "https://github.com/protobuf-c/protobuf-c/"
304 "releases/download/v" version
305 "/protobuf-c-" version ".tar.gz"))
306 (sha256
307 (base32
308 "17rk42r3gcc46c2svd1mxs542wnl4mi77a6klkhg6wl1a36zmi2c"))))
309 (build-system gnu-build-system)
310 (inputs (list protobuf))
311 (native-inputs (append (if (%current-target-system)
312 (list protobuf)
313 '())
314 (list pkg-config)))
315 (arguments (if (%current-target-system)
316 (list #:configure-flags
317 #~(list
318 (string-append
319 "PROTOC="
320 (search-input-file %build-inputs "bin/protoc"))))
321 (list)))
322 (home-page "https://github.com/protobuf-c/protobuf-c")
323 (synopsis "Protocol Buffers implementation in C")
324 (description
325 "This is protobuf-c, a C implementation of the Google Protocol Buffers
326data serialization format. It includes @code{libprotobuf-c}, a pure C library
327that implements protobuf encoding and decoding, and @code{protoc-c}, a code
328generator that converts Protocol Buffer @code{.proto} files to C descriptor
329code.")
330 (license license:bsd-2)))
331
332(define-public protozero
333 (package
334 (name "protozero")
335 (version "1.7.1")
336 (source
337 (origin
338 (method git-fetch)
339 (uri (git-reference
340 (url "https://github.com/mapbox/protozero")
341 (commit (string-append "v" version))))
342 (file-name (git-file-name name version))
343 (sha256
344 (base32 "052cq5mdjjgcsgk612zkqi8k08p3ikl22r59dk6i6fq41dxldja7"))))
345 (build-system cmake-build-system)
346 (home-page "https://github.com/mapbox/protozero")
347 (synopsis "Minimalistic protocol buffer decoder and encoder in C++")
348 (description "Protozero is a minimalistic protocol buffer decoder and
349encoder in C++. The developer using protozero has to manually translate the
350@file{.proto} description into code.")
351 (license (list
352 license:asl2.0 ; for folly
353 license:bsd-2))))
354
355(define-public nanopb
356 (package
357 (name "nanopb")
358 (version "0.4.6.4")
359 (source (origin
360 (method git-fetch) ;for tests
361 (uri (git-reference
362 (url "https://github.com/nanopb/nanopb")
363 (commit version)))
364 (file-name (git-file-name name version))
365 (sha256
366 (base32
367 "0gb6q4igrjj8jap4p1ijza4y8dkjlingzym3cli1w18f90d7xlh7"))))
368 (build-system cmake-build-system)
369 (arguments
370 (list
371 #:configure-flags #~(list "-DBUILD_SHARED_LIBS=ON"
372 "-DBUILD_STATIC_LIBS=OFF")
373 #:phases
374 #~(modify-phases %standard-phases
375 (replace 'check
376 (lambda* (#:key tests? #:allow-other-keys)
377 (when tests?
378 (with-directory-excursion "../source/tests"
379 (invoke "scons"))))))))
380 (native-inputs (list protobuf python-protobuf python-wrapper scons))
381 (home-page "https://jpa.kapsi.fi/nanopb/")
382 (synopsis "Small code-size Protocol Buffers implementation in ANSI C")
383 (description "Nanopb is a small code-size Protocol Buffers implementation
384in ansi C. It is especially suitable for use in microcontrollers, but fits
385any memory-restricted system.")
386 (license license:zlib)))
387
388(define-public nanopb-malloc
389 (package
390 (inherit nanopb)
391 (name "nanopb-malloc")
392 (arguments
393 (substitute-keyword-arguments (package-arguments nanopb)
394 ((#:configure-flags flags #~'())
395 #~(cons* "-DCMAKE_C_FLAGS=-DPB_ENABLE_MALLOC=ON" #$flags))))))
396
397(define-public python-mypy-protobuf
398 (package
399 (name "python-mypy-protobuf")
400 (version "3.3.0")
401 (source (origin
402 (method git-fetch)
403 (uri (git-reference
404 (url "https://github.com/nipunn1313/mypy-protobuf")
405 (commit (string-append "v" version))))
406 (file-name (git-file-name name version))
407 (sha256
408 (base32
409 "0z03h9k68qvnlyhpk0ndwp01bdx77vrjr6mybxq4ldilkkbksklk"))))
410 (build-system pyproject-build-system)
411 (arguments
412 (list
413 #:phases
414 #~(modify-phases %standard-phases
415 (add-before 'check 'generate-protos-for-tests
416 (lambda _
417 ;; Generate Python sources.
418 (for-each (lambda (proto)
419 (invoke "protoc"
420 "--proto_path=proto"
421 "--experimental_allow_proto3_optional"
422 "--python_out=test/generated" proto))
423 (find-files "." "\\.proto$"))
424 ;; Generate GRPC protos.
425 (for-each (lambda (proto)
426 (invoke "python" "-m" "grpc_tools.protoc"
427 "--proto_path=proto"
428 "--experimental_allow_proto3_optional"
429 "--grpc_python_out=test/generated" proto))
430 (find-files "proto/testproto/grpc" "\\.proto$"))))
431 (replace 'check
432 (lambda* (#:key tests? #:allow-other-keys)
433 (setenv "PYTHONPATH" "test/generated")
434 (invoke "pytest" "-vv" "--ignore=test/generated" "test"))))))
435 (native-inputs
436 (list python-grpc-stubs
437 python-grpcio-tools
438 python-pytest
439 python-typing-extensions
440 python-setuptools
441 python-wheel))
442 (propagated-inputs
443 (list protobuf
444 python-protobuf
445 python-types-protobuf))
446 (home-page "https://github.com/nipunn1313/mypy-protobuf")
447 (synopsis "Generate Mypy stub files from protobuf specifications")
448 (description "This Python package provide tools to generate Mypy stubs
449from protobuf specification files.")
450 (license license:asl2.0)))
451
452(define-public python-nanopb
453 (package
454 (inherit nanopb)
455 (name "python-nanopb")
456 (build-system pyproject-build-system)
457 (arguments
458 (list
459 #:tests? #f ;no Python-specific tests
460 #:phases
461 #~(modify-phases %standard-phases
462 (add-after 'unpack 'use-poetry-core
463 (lambda _
464 ;; Patch to use the core poetry API.
465 (substitute* "extra/poetry/pyproject.toml"
466 (("poetry.masonry.api") "poetry.core.masonry.api"))))
467 (add-before 'build 'pre-build
468 (lambda _
469 (copy-file "extra/poetry/pyproject.toml" "pyproject.toml")
470 (delete-file "build.py")
471 ;; Mimic extra/poetry/poetry_build.sh.
472 (mkdir "nanopb")
473 (copy-recursively "generator" "nanopb/generator")
474 (invoke "touch" "nanopb/__init__.py"
475 "nanopb/generator/__init__.py")
476 (invoke "make" "-C" "nanopb/generator/proto"))))))
477 (native-inputs (list python-poetry-core protobuf python-setuptools))
478 (propagated-inputs (list python-protobuf))
479 (synopsis "Small code-size Protocol Buffers implementation in Python")))
480
481(define-public python-protobuf-5
482 (package
483 (name "python-protobuf")
484 (version "5.28.3")
485 (source
486 (origin
487 (method url-fetch)
488 (uri (pypi-uri "protobuf" version))
489 (sha256
490 (base32
491 "0yzg3i40p7rbr51xr72avpvn72yin5xcxybkyc0y99c0j72dpfk4"))))
492 (build-system pyproject-build-system)
493 (arguments
494 (list
495 #:tests? #f)) ; no tests provided for Python variant
496 (native-inputs
497 (list python-setuptools
498 python-wheel))
499 (inputs (list protobuf))
500 (home-page "https://github.com/protocolbuffers/protobuf")
501 (synopsis "Protocol buffers is a data interchange format")
502 (description
503 "Protocol buffers are a language-neutral, platform-neutral extensible
504mechanism for serializing structured data.")
505 (license license:bsd-3)))
506
507(define-public python-protobuf-4
508 (package/inherit python-protobuf-5
509 (name "python-protobuf")
510 (version "4.21.6")
511 (source
512 (origin
513 (method url-fetch)
514 (uri (pypi-uri "protobuf" version))
515 (sha256
516 (base32 "1pabwidv12r73fy0jlslpgi60zd1lbx9rjnb23kgdm8wcsjl043b"))))))
517
518(define-public python-protobuf
519 (package
520 (name "python-protobuf")
521 (version "3.20.3")
522 (source
523 (origin
524 (method url-fetch)
525 (uri (pypi-uri "protobuf" version))
526 (sha256
527 (base32
528 "1wh5f4rnzbv46xy1rx62cprhg5hqf2py06s9b7rfpzwwki12fd1f"))))
529 (build-system pyproject-build-system)
530 (arguments
531 (list
532 #:tests? #f)) ; no tests provided for Python variant
533 (native-inputs
534 (list python-setuptools))
535 ;; The C++ implementation is not compatible with Python 3.11, so we cannot
536 ;; pass --cpp_implementation any more. Without that flag, only the pure
537 ;; Python implementation is built and the C++ protobuf library is not needed.
538 (home-page "https://github.com/google/protobuf")
539 (synopsis "Protocol buffers is a data interchange format")
540 (description
541 "Protocol buffers are a language-neutral, platform-neutral extensible
542mechanism for serializing structured data.")
543 (license license:bsd-3)))
544
545(define-public python-pure-protobuf
546 (package
547 (name "python-pure-protobuf")
548 (version "3.1.5")
549 (source
550 (origin
551 (method git-fetch)
552 (uri (git-reference
553 (url "https://github.com/eigenein/protobuf")
554 (commit version)))
555 (file-name (git-file-name name version))
556 (sha256
557 (base32 "1ab665h5nmvg52zqdaa0pnmvimh6m6zis2l2vz3lqjd0jqm5zghs"))))
558 (build-system pyproject-build-system)
559 (arguments
560 (list
561 #:build-backend "poetry.core.masonry.api"))
562 (native-inputs
563 (list python-poetry-core
564 python-poetry-dynamic-versioning
565 python-pydantic
566 python-pytest
567 python-pytest-benchmark))
568 (home-page "https://pypi.org/project/pure-protobuf/")
569 (synopsis "Protobuf implementation using dataclasses")
570 (description
571 "@code{python-pure-protobuf} takes advantage of the standard
572dataclasses module to define message types. Protocol buffers are a
573language-neutral, platform-neutral extensible mechanism for serializing
574structured data.")
575 (license license:expat)))
576
577(define-public python-proto-plus
578 (package
579 (name "python-proto-plus")
580 (version "1.26.1")
581 (source
582 (origin
583 (method url-fetch)
584 (uri (pypi-uri "proto_plus" version))
585 (sha256
586 (base32 "04m0jsy1cf7fqzafswvcqvwihgfyp9xkrqlr71vql260qjj1b991"))))
587 (build-system pyproject-build-system)
588 (arguments
589 (list
590 #:test-flags
591 ;; Not packaged <https://github.com/google/pytype>:
592 ;; ModuleNotFoundError: No module named 'google.type'
593 #~(list "--deselect=tests/test_fields_enum.py::test_unwrapped_enum_fields")))
594 (native-inputs
595 (list python-pytest
596 ;; python-pytype
597 python-pytz
598 python-setuptools))
599 (propagated-inputs
600 (list python-protobuf))
601 (home-page "https://github.com/googleapis/proto-plus-python.git")
602 (synopsis "Pythonic protocol buffers")
603 (description "This is a wrapper around protocol buffers. Protocol buffers
604is a specification format for APIs, such as those inside Google. This library
605provides protocol buffer message classes and objects that largely behave like
606native Python types.")
607 (license license:asl2.0)))
608
609(define-public emacs-protobuf-mode
610 (package
611 (name "emacs-protobuf-mode")
612 (version (package-version protobuf))
613 (source (package-source protobuf))
614 (build-system emacs-build-system)
615 (arguments
616 (list #:lisp-directory "editors"))
617 (home-page "https://github.com/protocolbuffers/protobuf")
618 (synopsis "Protocol buffers major mode for Emacs")
619 (description
620 "This package provides an Emacs major mode for editing Protocol Buffer
621source files.")
622 (license license:bsd-3)))
623
624(define-public ruby-protobuf
625 (package
626 (name "ruby-protobuf")
627 (version "3.10.9")
628 (source (origin
629 (method git-fetch)
630 (uri (git-reference
631 (url "https://github.com/ruby-protobuf/protobuf")
632 (commit (string-append "v" version))))
633 (file-name (git-file-name name version))
634 (sha256
635 (base32
636 "1d6fihqwrq46sg5vjm0nps8bbin7zcbz5m358wgzh76iapwij2rq"))))
637 (build-system ruby-build-system)
638 (arguments
639 (list
640 #:phases
641 #~(modify-phases %standard-phases
642 (add-after 'unpack 'do-not-use-bundler-for-tests
643 (lambda _
644 (substitute* "spec/spec_helper.rb"
645 (("Bundler\\.setup.*") ""))))
646 (add-after 'unpack 'relax-version-requirements
647 (lambda _
648 (substitute* ((@@ (guix build ruby-build-system) first-gemspec))
649 (("'rake',.*")
650 "'rake'\n")
651 (("\"rubocop\",.*")
652 "'rubocop'\n")
653 (("\"parser\",.*")
654 "'parser'\n"))))
655 (add-after 'unpack 'patch-protoc
656 (lambda* (#:key inputs #:allow-other-keys)
657 (substitute* "lib/protobuf/tasks/compile.rake"
658 (("\"protoc\"")
659 (string-append "\"" (search-input-file inputs "bin/protoc")
660 "\"")))))
661 (add-after 'unpack 'skip-failing-test
662 ;; See: https://github.com/ruby-protobuf/protobuf/issues/419
663 (lambda _
664 (substitute* "spec/lib/protobuf/rpc/connectors/ping_spec.rb"
665 (("expect\\(::IO\\)\\.to receive\\(:select\\).*" all)
666 (string-append " pending\n" all)))))
667 (add-after 'replace-git-ls-files 'replace-more-git-ls-files
668 (lambda _
669 (substitute* ((@@ (guix build ruby-build-system) first-gemspec))
670 (("`git ls-files -- \\{test,spec,features\\}/*`")
671 "`find test spec features -type f | sort`")
672 (("`git ls-files -- bin/*`")
673 "`find bin -type f | sort`"))))
674 (replace 'check
675 (lambda* (#:key tests? #:allow-other-keys)
676 (when tests?
677 (invoke "rspec")))))))
678 (native-inputs
679 (list ruby-benchmark-ips
680 ruby-ffi-rzmq
681 ruby-parser
682 ruby-pry-stack-explorer
683 ruby-rake
684 ruby-rspec
685 ruby-rubocop
686 ruby-ruby-prof
687 ruby-simplecov
688 ruby-timecop
689 ruby-varint
690 ruby-yard))
691 (inputs
692 (list protobuf))
693 (propagated-inputs
694 (list ruby-activesupport
695 ruby-middleware
696 ruby-thor
697 ruby-thread-safe))
698 (home-page "https://github.com/ruby-protobuf/protobuf")
699 (synopsis "Implementation of Google's Protocol Buffers in Ruby")
700 (description "Protobuf is an implementation of Google's Protocol Buffers
701in pure Ruby.")
702 (license license:expat)))