projects/guix·blob javascript-team · refs

694 lines · 27.5 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 ;; "utf8_range" development now takes place in main protobuf repository.
112 (snippet #~(delete-all-but "third_party" "utf8_range"))
113 (file-name (git-file-name name version))
114 (sha256
115 (base32 "1rdxm75bqwjj4qd3hz4vlydra6bw5dq391kwln2q0pjfx9gbrjhk"))))
116 (build-system cmake-build-system)
117 (arguments
118 (list
119 #:configure-flags
120 #~(list "-DBUILD_SHARED_LIBS=ON")
121 #:phases
122 #~(modify-phases %standard-phases
123 (add-after 'unpack 'disable-broken-tests
124 ;; The following tests used to fail on 32 bit architectures
125 ;; such as i686-linux.
126 (lambda _
127 (let-syntax ((disable-tests
128 (syntax-rules ()
129 ((_ file test ...)
130 (substitute* file
131 ((test name)
132 (string-append "DISABLED_" name)) ...)))))
133 ;; https://github.com/protocolbuffers/protobuf/issues/8460.
134 (disable-tests
135 "src/google/protobuf/any_test.cc"
136 "TestPackFromSerializationExceedsSizeLimit")
137 ;; https://github.com/protocolbuffers/protobuf/issues/8459.
138 (disable-tests
139 "src/google/protobuf/arena_unittest.cc"
140 "SpaceAllocated_and_Used"
141 "BlockSizeSmallerThanAllocation")
142 ;; https://github.com/protocolbuffers/protobuf/issues/8082.
143 (disable-tests
144 "src/google/protobuf/io/zero_copy_stream_unittest.cc"
145 "LargeOutput")))))))
146 (native-inputs (list googletest))
147 (inputs (list abseil-cpp zlib))
148 (home-page "https://protobuf.dev")
149 (synopsis "Data encoding for remote procedure calls (RPCs)")
150 (description
151 "Protocol Buffers are a way of encoding structured data in an efficient
152yet extensible format. Google uses Protocol Buffers for almost all of its
153internal RPC protocols and file formats.")
154 (license license:bsd-3)))
155
156(define-public python-protobuf-6
157 (package
158 (inherit protobuf-6)
159 (name "python-protobuf")
160 (version "6.31.1")
161 (source
162 (origin
163 (method url-fetch)
164 (uri (pypi-uri "protobuf" version))
165 (sha256
166 (base32
167 "16nakbb14jjzhgmrvpn0g7k0iasgl8p0xa3kvjj5gfghhb4w9jnq"))))
168 (outputs (list "out"))
169 (build-system pyproject-build-system)
170 (arguments (list #:tests? #f)) ;no tests provided for Python variant
171 (native-inputs (list python-setuptools python-wheel))
172 (inputs (list protobuf-6))))
173
174;; This is the last version that does not depend on abseil
175(define-public protobuf
176 (package
177 (name "protobuf")
178 (version "3.21.12")
179 (source (origin
180 (method url-fetch)
181 (uri (string-append
182 "https://github.com/protocolbuffers/"
183 "protobuf/releases/download/v"
184 (string-join (drop (string-split version #\.) 1) ".")
185 "/protobuf-cpp-" version ".tar.gz"))
186 (modules '((guix build utils)))
187 (snippet '(delete-file-recursively "third_party"))
188 (sha256
189 (base32
190 "0q1lyw3wdd6vlvrh21xwh1dgkxsypy52l2xjzxpkr4d59999pasf"))
191 (patches (search-patches "protobuf-fix-build-on-32bit.patch"
192 "protobuf-pathmax.patch"))))
193 (outputs (list "out"
194 "static")) ; ~12 MiB of .a files
195 (build-system cmake-build-system)
196 (arguments
197 (list
198 ;; TODO: Add the BUILD_SHARED_LIBS flag to cmake-build-system.
199 #:configure-flags #~(list "-DBUILD_SHARED_LIBS=ON"
200 "-Dprotobuf_USE_EXTERNAL_GTEST=ON")
201 #:phases
202 #~(modify-phases %standard-phases
203 (add-after 'unpack 'disable-broken-tests
204 ;; The following tests fail on 32 bit architectures such as
205 ;; i686-linux.
206 (lambda _
207 (let-syntax ((disable-tests
208 (syntax-rules ()
209 ((_ file test ...)
210 (substitute* file
211 ((test name)
212 (string-append "DISABLED_" name)) ...)))))
213 ;; See: https://github.com/protocolbuffers/protobuf/issues/8460.
214 (disable-tests "src/google/protobuf/any_test.cc"
215 "TestPackFromSerializationExceedsSizeLimit")
216 ;; See: https://github.com/protocolbuffers/protobuf/issues/8459.
217 (disable-tests "src/google/protobuf/arena_unittest.cc"
218 "SpaceAllocated_and_Used"
219 "BlockSizeSmallerThanAllocation")
220 ;; See: https://github.com/protocolbuffers/protobuf/issues/8082.
221 (disable-tests "src/google/protobuf/io/zero_copy_stream_unittest.cc"
222 "LargeOutput")
223 ;; setsockopt SO_RCVTIMEO is unsupported
224 #$@(if (target-hurd?)
225 #~((disable-tests "src/google/protobuf/io/zero_copy_stream_unittest.cc"
226 "BlockingFileIoWithTimeout"))
227 #~()))))
228 (add-before 'configure 'set-c++-standard
229 (lambda _
230 (substitute* "CMakeLists.txt"
231 ;; The 32bit patch requires C++14.
232 ;; TODO: Remove after next release.
233 (("CMAKE_CXX_STANDARD 11") "CMAKE_CXX_STANDARD 14"))))
234 (add-after 'install 'move-static-libraries
235 (lambda* (#:key outputs #:allow-other-keys)
236 ;; Move static libraries to the "static" output.
237 (let* ((out (assoc-ref outputs "out"))
238 (lib (string-append out "/lib"))
239 (static (assoc-ref outputs "static"))
240 (slib (string-append static "/lib")))
241 (mkdir-p slib)
242 (for-each (lambda (file)
243 (install-file file slib)
244 (delete-file file))
245 (find-files lib "\\.a$"))))))))
246 (native-inputs (append (if (%current-target-system)
247 (list this-package)
248 '())
249 (list googletest)))
250 (inputs (list zlib googletest))
251 (home-page "https://github.com/protocolbuffers/protobuf")
252 (synopsis "Data encoding for remote procedure calls (RPCs)")
253 (description
254 "Protocol Buffers are a way of encoding structured data in an efficient
255yet extensible format. Google uses Protocol Buffers for almost all of its
256internal RPC protocols and file formats.")
257 (license license:bsd-3)))
258
259(define-public protobuf-static-for-onnxruntime
260 (package
261 (inherit protobuf)
262 (name "protobuf-static")
263 (arguments
264 (substitute-keyword-arguments (package-arguments protobuf)
265 ((#:configure-flags _)
266 #~(list "-DBUILD_SHARED_LIBS=OFF"
267 "-Dprotobuf_BUILD_SHARED_LIBS=OFF"
268 "-Dprotobuf_USE_EXTERNAL_GTEST=ON"
269 ;; -fPIC is needed because this .a will be linked into
270 ;; onnxruntime's shared .so.
271 "-DCMAKE_POSITION_INDEPENDENT_CODE=ON"
272 ;; C++17 is needed because descriptor.pb.h declares
273 ;; static constexpr members (e.g. FileOptions::SPEED)
274 ;; with out-of-line definitions in descriptor.pb.cc
275 ;; guarded by "#if (__cplusplus < 201703)". In C++14
276 ;; both produce symbols, causing duplicate definitions
277 ;; when the .a is linked into a binary. C++17 makes
278 ;; static constexpr implicitly inline and suppresses
279 ;; the out-of-line definitions.
280 "-DCMAKE_CXX_STANDARD=17"))
281 ((#:phases phases)
282 #~(modify-phases #$phases
283 (delete 'move-static-libraries)
284 (replace 'set-c++-standard
285 (lambda _
286 (substitute* "CMakeLists.txt"
287 (("CMAKE_CXX_STANDARD 11") "CMAKE_CXX_STANDARD 17"))))))))))
288
289(define-public protobuf-c
290 (package
291 (name "protobuf-c")
292 (version "1.4.1")
293 (source (origin
294 (method url-fetch)
295 (uri (string-append "https://github.com/protobuf-c/protobuf-c/"
296 "releases/download/v" version
297 "/protobuf-c-" version ".tar.gz"))
298 (sha256
299 (base32
300 "17rk42r3gcc46c2svd1mxs542wnl4mi77a6klkhg6wl1a36zmi2c"))))
301 (build-system gnu-build-system)
302 (inputs (list protobuf))
303 (native-inputs (append (if (%current-target-system)
304 (list protobuf)
305 '())
306 (list pkg-config)))
307 (arguments (if (%current-target-system)
308 (list #:configure-flags
309 #~(list
310 (string-append
311 "PROTOC="
312 (search-input-file %build-inputs "bin/protoc"))))
313 (list)))
314 (home-page "https://github.com/protobuf-c/protobuf-c")
315 (synopsis "Protocol Buffers implementation in C")
316 (description
317 "This is protobuf-c, a C implementation of the Google Protocol Buffers
318data serialization format. It includes @code{libprotobuf-c}, a pure C library
319that implements protobuf encoding and decoding, and @code{protoc-c}, a code
320generator that converts Protocol Buffer @code{.proto} files to C descriptor
321code.")
322 (license license:bsd-2)))
323
324(define-public protozero
325 (package
326 (name "protozero")
327 (version "1.7.1")
328 (source
329 (origin
330 (method git-fetch)
331 (uri (git-reference
332 (url "https://github.com/mapbox/protozero")
333 (commit (string-append "v" version))))
334 (file-name (git-file-name name version))
335 (sha256
336 (base32 "052cq5mdjjgcsgk612zkqi8k08p3ikl22r59dk6i6fq41dxldja7"))))
337 (build-system cmake-build-system)
338 (home-page "https://github.com/mapbox/protozero")
339 (synopsis "Minimalistic protocol buffer decoder and encoder in C++")
340 (description "Protozero is a minimalistic protocol buffer decoder and
341encoder in C++. The developer using protozero has to manually translate the
342@file{.proto} description into code.")
343 (license (list
344 license:asl2.0 ; for folly
345 license:bsd-2))))
346
347(define-public nanopb
348 (package
349 (name "nanopb")
350 (version "0.4.6.4")
351 (source (origin
352 (method git-fetch) ;for tests
353 (uri (git-reference
354 (url "https://github.com/nanopb/nanopb")
355 (commit version)))
356 (file-name (git-file-name name version))
357 (sha256
358 (base32
359 "0gb6q4igrjj8jap4p1ijza4y8dkjlingzym3cli1w18f90d7xlh7"))))
360 (build-system cmake-build-system)
361 (arguments
362 (list
363 #:configure-flags #~(list "-DBUILD_SHARED_LIBS=ON"
364 "-DBUILD_STATIC_LIBS=OFF")
365 #:phases
366 #~(modify-phases %standard-phases
367 (replace 'check
368 (lambda* (#:key tests? #:allow-other-keys)
369 (when tests?
370 (with-directory-excursion "../source/tests"
371 (invoke "scons"))))))))
372 (native-inputs (list protobuf python-protobuf python-wrapper scons))
373 (home-page "https://jpa.kapsi.fi/nanopb/")
374 (synopsis "Small code-size Protocol Buffers implementation in ANSI C")
375 (description "Nanopb is a small code-size Protocol Buffers implementation
376in ansi C. It is especially suitable for use in microcontrollers, but fits
377any memory-restricted system.")
378 (license license:zlib)))
379
380(define-public nanopb-malloc
381 (package
382 (inherit nanopb)
383 (name "nanopb-malloc")
384 (arguments
385 (substitute-keyword-arguments (package-arguments nanopb)
386 ((#:configure-flags flags #~'())
387 #~(cons* "-DCMAKE_C_FLAGS=-DPB_ENABLE_MALLOC=ON" #$flags))))))
388
389(define-public python-mypy-protobuf
390 (package
391 (name "python-mypy-protobuf")
392 (version "3.3.0")
393 (source (origin
394 (method git-fetch)
395 (uri (git-reference
396 (url "https://github.com/nipunn1313/mypy-protobuf")
397 (commit (string-append "v" version))))
398 (file-name (git-file-name name version))
399 (sha256
400 (base32
401 "0z03h9k68qvnlyhpk0ndwp01bdx77vrjr6mybxq4ldilkkbksklk"))))
402 (build-system pyproject-build-system)
403 (arguments
404 (list
405 #:phases
406 #~(modify-phases %standard-phases
407 (add-before 'check 'generate-protos-for-tests
408 (lambda _
409 ;; Generate Python sources.
410 (for-each (lambda (proto)
411 (invoke "protoc"
412 "--proto_path=proto"
413 "--experimental_allow_proto3_optional"
414 "--python_out=test/generated" proto))
415 (find-files "." "\\.proto$"))
416 ;; Generate GRPC protos.
417 (for-each (lambda (proto)
418 (invoke "python" "-m" "grpc_tools.protoc"
419 "--proto_path=proto"
420 "--experimental_allow_proto3_optional"
421 "--grpc_python_out=test/generated" proto))
422 (find-files "proto/testproto/grpc" "\\.proto$"))))
423 (replace 'check
424 (lambda* (#:key tests? #:allow-other-keys)
425 (setenv "PYTHONPATH" "test/generated")
426 (invoke "pytest" "-vv" "--ignore=test/generated" "test"))))))
427 (native-inputs
428 (list python-grpc-stubs
429 python-grpcio-tools
430 python-pytest
431 python-typing-extensions
432 python-setuptools
433 python-wheel))
434 (propagated-inputs
435 (list protobuf
436 python-protobuf
437 python-types-protobuf))
438 (home-page "https://github.com/nipunn1313/mypy-protobuf")
439 (synopsis "Generate Mypy stub files from protobuf specifications")
440 (description "This Python package provide tools to generate Mypy stubs
441from protobuf specification files.")
442 (license license:asl2.0)))
443
444(define-public python-nanopb
445 (package
446 (inherit nanopb)
447 (name "python-nanopb")
448 (build-system pyproject-build-system)
449 (arguments
450 (list
451 #:tests? #f ;no Python-specific tests
452 #:phases
453 #~(modify-phases %standard-phases
454 (add-after 'unpack 'use-poetry-core
455 (lambda _
456 ;; Patch to use the core poetry API.
457 (substitute* "extra/poetry/pyproject.toml"
458 (("poetry.masonry.api") "poetry.core.masonry.api"))))
459 (add-before 'build 'pre-build
460 (lambda _
461 (copy-file "extra/poetry/pyproject.toml" "pyproject.toml")
462 (delete-file "build.py")
463 ;; Mimic extra/poetry/poetry_build.sh.
464 (mkdir "nanopb")
465 (copy-recursively "generator" "nanopb/generator")
466 (invoke "touch" "nanopb/__init__.py"
467 "nanopb/generator/__init__.py")
468 (invoke "make" "-C" "nanopb/generator/proto"))))))
469 (native-inputs (list python-poetry-core protobuf python-setuptools))
470 (propagated-inputs (list python-protobuf))
471 (synopsis "Small code-size Protocol Buffers implementation in Python")))
472
473(define-public python-protobuf-5
474 (package
475 (name "python-protobuf")
476 (version "5.28.3")
477 (source
478 (origin
479 (method url-fetch)
480 (uri (pypi-uri "protobuf" version))
481 (sha256
482 (base32
483 "0yzg3i40p7rbr51xr72avpvn72yin5xcxybkyc0y99c0j72dpfk4"))))
484 (build-system pyproject-build-system)
485 (arguments
486 (list
487 #:tests? #f)) ; no tests provided for Python variant
488 (native-inputs
489 (list python-setuptools
490 python-wheel))
491 (inputs (list protobuf))
492 (home-page "https://github.com/protocolbuffers/protobuf")
493 (synopsis "Protocol buffers is a data interchange format")
494 (description
495 "Protocol buffers are a language-neutral, platform-neutral extensible
496mechanism for serializing structured data.")
497 (license license:bsd-3)))
498
499(define-public python-protobuf-4
500 (package/inherit python-protobuf-5
501 (name "python-protobuf")
502 (version "4.21.6")
503 (source
504 (origin
505 (method url-fetch)
506 (uri (pypi-uri "protobuf" version))
507 (sha256
508 (base32 "1pabwidv12r73fy0jlslpgi60zd1lbx9rjnb23kgdm8wcsjl043b"))))))
509
510(define-public python-protobuf
511 (package
512 (name "python-protobuf")
513 (version "3.20.3")
514 (source
515 (origin
516 (method url-fetch)
517 (uri (pypi-uri "protobuf" version))
518 (sha256
519 (base32
520 "1wh5f4rnzbv46xy1rx62cprhg5hqf2py06s9b7rfpzwwki12fd1f"))))
521 (build-system pyproject-build-system)
522 (arguments
523 (list
524 #:tests? #f)) ; no tests provided for Python variant
525 (native-inputs
526 (list python-setuptools))
527 ;; The C++ implementation is not compatible with Python 3.11, so we cannot
528 ;; pass --cpp_implementation any more. Without that flag, only the pure
529 ;; Python implementation is built and the C++ protobuf library is not needed.
530 (home-page "https://github.com/google/protobuf")
531 (synopsis "Protocol buffers is a data interchange format")
532 (description
533 "Protocol buffers are a language-neutral, platform-neutral extensible
534mechanism for serializing structured data.")
535 (license license:bsd-3)))
536
537(define-public python-pure-protobuf
538 (package
539 (name "python-pure-protobuf")
540 (version "3.1.5")
541 (source
542 (origin
543 (method git-fetch)
544 (uri (git-reference
545 (url "https://github.com/eigenein/protobuf")
546 (commit version)))
547 (file-name (git-file-name name version))
548 (sha256
549 (base32 "1ab665h5nmvg52zqdaa0pnmvimh6m6zis2l2vz3lqjd0jqm5zghs"))))
550 (build-system pyproject-build-system)
551 (arguments
552 (list
553 #:build-backend "poetry.core.masonry.api"))
554 (native-inputs
555 (list python-poetry-core
556 python-poetry-dynamic-versioning
557 python-pydantic
558 python-pytest
559 python-pytest-benchmark))
560 (home-page "https://pypi.org/project/pure-protobuf/")
561 (synopsis "Protobuf implementation using dataclasses")
562 (description
563 "@code{python-pure-protobuf} takes advantage of the standard
564dataclasses module to define message types. Protocol buffers are a
565language-neutral, platform-neutral extensible mechanism for serializing
566structured data.")
567 (license license:expat)))
568
569(define-public python-proto-plus
570 (package
571 (name "python-proto-plus")
572 (version "1.26.1")
573 (source
574 (origin
575 (method url-fetch)
576 (uri (pypi-uri "proto_plus" version))
577 (sha256
578 (base32 "04m0jsy1cf7fqzafswvcqvwihgfyp9xkrqlr71vql260qjj1b991"))))
579 (build-system pyproject-build-system)
580 (arguments
581 (list
582 #:test-flags
583 ;; Not packaged <https://github.com/google/pytype>:
584 ;; ModuleNotFoundError: No module named 'google.type'
585 #~(list "--deselect=tests/test_fields_enum.py::test_unwrapped_enum_fields")))
586 (native-inputs
587 (list python-pytest
588 ;; python-pytype
589 python-pytz
590 python-setuptools))
591 (propagated-inputs
592 (list python-protobuf))
593 (home-page "https://github.com/googleapis/proto-plus-python.git")
594 (synopsis "Pythonic protocol buffers")
595 (description "This is a wrapper around protocol buffers. Protocol buffers
596is a specification format for APIs, such as those inside Google. This library
597provides protocol buffer message classes and objects that largely behave like
598native Python types.")
599 (license license:asl2.0)))
600
601(define-public emacs-protobuf-mode
602 (package
603 (name "emacs-protobuf-mode")
604 (version (package-version protobuf))
605 (source (package-source protobuf))
606 (build-system emacs-build-system)
607 (arguments
608 (list #:lisp-directory "editors"))
609 (home-page "https://github.com/protocolbuffers/protobuf")
610 (synopsis "Protocol buffers major mode for Emacs")
611 (description
612 "This package provides an Emacs major mode for editing Protocol Buffer
613source files.")
614 (license license:bsd-3)))
615
616(define-public ruby-protobuf
617 (package
618 (name "ruby-protobuf")
619 (version "3.10.9")
620 (source (origin
621 (method git-fetch)
622 (uri (git-reference
623 (url "https://github.com/ruby-protobuf/protobuf")
624 (commit (string-append "v" version))))
625 (file-name (git-file-name name version))
626 (sha256
627 (base32
628 "1d6fihqwrq46sg5vjm0nps8bbin7zcbz5m358wgzh76iapwij2rq"))))
629 (build-system ruby-build-system)
630 (arguments
631 (list
632 #:phases
633 #~(modify-phases %standard-phases
634 (add-after 'unpack 'do-not-use-bundler-for-tests
635 (lambda _
636 (substitute* "spec/spec_helper.rb"
637 (("Bundler\\.setup.*") ""))))
638 (add-after 'unpack 'relax-version-requirements
639 (lambda _
640 (substitute* ((@@ (guix build ruby-build-system) first-gemspec))
641 (("'rake',.*")
642 "'rake'\n")
643 (("\"rubocop\",.*")
644 "'rubocop'\n")
645 (("\"parser\",.*")
646 "'parser'\n"))))
647 (add-after 'unpack 'patch-protoc
648 (lambda* (#:key inputs #:allow-other-keys)
649 (substitute* "lib/protobuf/tasks/compile.rake"
650 (("\"protoc\"")
651 (string-append "\"" (search-input-file inputs "bin/protoc")
652 "\"")))))
653 (add-after 'unpack 'skip-failing-test
654 ;; See: https://github.com/ruby-protobuf/protobuf/issues/419
655 (lambda _
656 (substitute* "spec/lib/protobuf/rpc/connectors/ping_spec.rb"
657 (("expect\\(::IO\\)\\.to receive\\(:select\\).*" all)
658 (string-append " pending\n" all)))))
659 (add-after 'replace-git-ls-files 'replace-more-git-ls-files
660 (lambda _
661 (substitute* ((@@ (guix build ruby-build-system) first-gemspec))
662 (("`git ls-files -- \\{test,spec,features\\}/*`")
663 "`find test spec features -type f | sort`")
664 (("`git ls-files -- bin/*`")
665 "`find bin -type f | sort`"))))
666 (replace 'check
667 (lambda* (#:key tests? #:allow-other-keys)
668 (when tests?
669 (invoke "rspec")))))))
670 (native-inputs
671 (list ruby-benchmark-ips
672 ruby-ffi-rzmq
673 ruby-parser
674 ruby-pry-stack-explorer
675 ruby-rake
676 ruby-rspec
677 ruby-rubocop
678 ruby-ruby-prof
679 ruby-simplecov
680 ruby-timecop
681 ruby-varint
682 ruby-yard))
683 (inputs
684 (list protobuf))
685 (propagated-inputs
686 (list ruby-activesupport
687 ruby-middleware
688 ruby-thor
689 ruby-thread-safe))
690 (home-page "https://github.com/ruby-protobuf/protobuf")
691 (synopsis "Implementation of Google's Protocol Buffers in Ruby")
692 (description "Protobuf is an implementation of Google's Protocol Buffers
693in pure Ruby.")
694 (license license:expat)))