Commit | Line | Data |
---|---|---|
14d17788 LC |
1 | ;;; GNU Guix --- Functional package management for GNU |
2 | ;;; Copyright © 2014 Ludovic Courtès <ludo@gnu.org> | |
8d63ddda DP |
3 | ;;; Copyright © 2016 Daniel Pimentel <d4n1@d4n1.org> |
4 | ;;; Copyright © 2016 Leo Famulari <leo@famulari.name> | |
f8a6ae18 | 5 | ;;; Copyright © 2017, 2018, 2019, 2022 Ricardo Wurmus <rekado@elephly.net> |
599d0190 | 6 | ;;; Copyright © 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr> |
07fdfb9e | 7 | ;;; Copyright © 2020, 2021, 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com> |
ba4d96d2 | 8 | ;;; Copyright © 2020 Vinicius Monego <monego@posteo.net> |
a90cf896 | 9 | ;;; Copyright © 2020 Brett Gilio <brettg@gnu.org> |
53bbbfb7 | 10 | ;;; Copyright © 2021 Felix Gruber <felgru@posteo.net> |
14d17788 LC |
11 | ;;; |
12 | ;;; This file is part of GNU Guix. | |
13 | ;;; | |
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. | |
18 | ;;; | |
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. | |
23 | ;;; | |
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/>. | |
26 | ||
27 | (define-module (gnu packages protobuf) | |
59d79767 | 28 | #:use-module (guix gexp) |
14d17788 LC |
29 | #:use-module (guix packages) |
30 | #:use-module (guix download) | |
dc8621a2 TGR |
31 | #:use-module (guix git-download) |
32 | #:use-module (guix build-system cmake) | |
14d17788 | 33 | #:use-module (guix build-system gnu) |
8bdc4c15 | 34 | #:use-module (guix build-system pyproject) |
8d63ddda | 35 | #:use-module (guix build-system python) |
d78bfd27 | 36 | #:use-module (guix build-system emacs) |
d59c84f5 | 37 | #:use-module (guix build-system ruby) |
7e685dee | 38 | #:use-module ((guix licenses) #:prefix license:) |
6f1784fa | 39 | #:use-module (guix utils) |
5eb16865 | 40 | #:use-module (gnu packages build-tools) |
8d63ddda | 41 | #:use-module (gnu packages compression) |
6f1784fa | 42 | #:use-module (gnu packages check) |
8d63ddda | 43 | #:use-module (gnu packages gcc) |
7d9935b4 | 44 | #:use-module (gnu packages libevent) |
bfd07331 | 45 | #:use-module (gnu packages pkg-config) |
44d10b1f | 46 | #:use-module (gnu packages python) |
13bb41f8 | 47 | #:use-module (gnu packages python-build) |
6f1784fa | 48 | #:use-module (gnu packages python-check) |
d59c84f5 | 49 | #:use-module (gnu packages python-xyz) |
1a7fb20e | 50 | #:use-module (gnu packages rpc) |
d59c84f5 | 51 | #:use-module (gnu packages ruby)) |
14d17788 | 52 | |
7d9935b4 TGR |
53 | (define-public fstrm |
54 | (package | |
55 | (name "fstrm") | |
b167c54e | 56 | (version "0.6.1") |
7d9935b4 TGR |
57 | (source |
58 | (origin | |
59 | (method url-fetch) | |
b167c54e TGR |
60 | (uri (string-append "https://dl.farsightsecurity.com/dist/fstrm/" |
61 | "fstrm-" version ".tar.gz")) | |
7d9935b4 | 62 | (sha256 |
b167c54e | 63 | (base32 "13q9iz5fpp607zvk0i39158fvvjciz4y5k14rly94b9ak0gar95w")))) |
7d9935b4 | 64 | (build-system gnu-build-system) |
59d79767 TGR |
65 | (arguments |
66 | (list #:configure-flags | |
67 | #~(list "--disable-static"))) | |
7d9935b4 | 68 | (native-inputs |
8394619b | 69 | (list pkg-config)) |
7d9935b4 | 70 | (inputs |
8394619b | 71 | (list libevent)) |
7d9935b4 TGR |
72 | (home-page "https://github.com/farsightsec/fstrm") |
73 | (synopsis "Implementation of the Frame Streams data transport protocol") | |
74 | (description | |
75 | "fstrm is an optimised implementation of Frame Streams as a C library and | |
76 | several tools built on top of it. | |
77 | ||
78 | @dfn{Frame Streams} is a light-weight, binary-clean protocol that allows for | |
79 | the transport of arbitrarily-encoded data payload sequences with minimal | |
80 | framing overhead---just four bytes per data frame. It does not specify an | |
81 | encoding format for these data frames and can be used with any data | |
82 | serialisation format that produces byte sequences, such as Protocol Buffers, | |
83 | XML, JSON, MessagePack, YAML, etc. | |
84 | ||
85 | Frame Streams can be used either as a streaming transport over a reliable byte | |
86 | stream socket (TCP sockets, TLS connections, @code{AF_UNIX} sockets, etc.) for | |
87 | data in motion, or as a file format for data at rest.") | |
069d6a3f TGR |
88 | (license (list license:expat ; the combined work |
89 | license:hpnd)))) ; libmy/argv* | |
7d9935b4 | 90 | |
14d17788 LC |
91 | (define-public protobuf |
92 | (package | |
93 | (name "protobuf") | |
0ce685c6 | 94 | (version "3.17.3") |
14d17788 LC |
95 | (source (origin |
96 | (method url-fetch) | |
de30a6e0 | 97 | (uri (string-append "https://github.com/google/protobuf/releases/" |
dd12d4aa RW |
98 | "download/v" version "/protobuf-cpp-" |
99 | version ".tar.gz")) | |
14d17788 LC |
100 | (sha256 |
101 | (base32 | |
0ce685c6 | 102 | "1jzqrklhj9grs6xbddyb5dyxfbgbgbyhl5zig8ml50wb22gwkkji")))) |
14d17788 | 103 | (build-system gnu-build-system) |
8394619b | 104 | (inputs (list zlib)) |
ffe7eee5 TGR |
105 | (outputs (list "out" |
106 | "static")) ; ~12 MiB of .a files | |
107 | (arguments | |
108 | `(#:phases | |
109 | (modify-phases %standard-phases | |
0ce685c6 MC |
110 | (add-after 'unpack 'disable-broken-tests |
111 | ;; The following tests fail on 32 bit architectures such as | |
112 | ;; i686-linux. | |
113 | (lambda _ | |
114 | (let-syntax ((disable-tests | |
115 | (syntax-rules () | |
116 | ((_ file test ...) | |
117 | (substitute* file | |
118 | ((test name) | |
119 | (string-append "DISABLED_" name)) ...))))) | |
120 | ;; See: https://github.com/protocolbuffers/protobuf/issues/8460. | |
121 | (disable-tests "src/google/protobuf/any_test.cc" | |
122 | "TestPackFromSerializationExceedsSizeLimit") | |
123 | ;; See: https://github.com/protocolbuffers/protobuf/issues/8459. | |
124 | (disable-tests "src/google/protobuf/arena_unittest.cc" | |
125 | "SpaceAllocated_and_Used" | |
126 | "BlockSizeSmallerThanAllocation") | |
127 | ;; See: https://github.com/protocolbuffers/protobuf/issues/8082. | |
128 | (disable-tests "src/google/protobuf/io/zero_copy_stream_unittest.cc" | |
129 | "LargeOutput")))) | |
ffe7eee5 TGR |
130 | (add-after 'install 'move-static-libraries |
131 | (lambda* (#:key outputs #:allow-other-keys) | |
132 | ;; Move static libraries to the "static" output. | |
133 | (let* ((out (assoc-ref outputs "out")) | |
134 | (lib (string-append out "/lib")) | |
135 | (static (assoc-ref outputs "static")) | |
136 | (slib (string-append static "/lib"))) | |
137 | (mkdir-p slib) | |
138 | (for-each (lambda (file) | |
139 | (install-file file slib) | |
140 | (delete-file file)) | |
0ce685c6 | 141 | (find-files lib "\\.a$")))))))) |
3b0ac795 | 142 | (home-page "https://github.com/google/protobuf") |
14d17788 LC |
143 | (synopsis "Data encoding for remote procedure calls (RPCs)") |
144 | (description | |
145 | "Protocol Buffers are a way of encoding structured data in an efficient | |
146 | yet extensible format. Google uses Protocol Buffers for almost all of its | |
147 | internal RPC protocols and file formats.") | |
7e685dee | 148 | (license license:bsd-3))) |
8d63ddda | 149 | |
7373eb83 MB |
150 | ;; Tensorflow requires version 3.6 specifically. |
151 | (define-public protobuf-3.6 | |
dbcf2b61 MB |
152 | (package |
153 | (inherit protobuf) | |
c22c803e RW |
154 | (version "3.6.1") |
155 | (source (origin | |
156 | (method url-fetch) | |
157 | (uri (string-append "https://github.com/google/protobuf/releases/" | |
158 | "download/v" version "/protobuf-cpp-" | |
159 | version ".tar.gz")) | |
160 | (sha256 | |
161 | (base32 | |
162 | "0a955bz59ihrb5wg7dwi12xajdi5pmz4bl0g147rbdwv393jwwxk")))))) | |
163 | ||
7373eb83 MB |
164 | ;; The 3.5 series are the last versions that do not require C++ 11. |
165 | (define-public protobuf-3.5 | |
dbcf2b61 MB |
166 | (package |
167 | (inherit protobuf) | |
7373eb83 MB |
168 | (version "3.5.1") |
169 | (source (origin | |
170 | (method url-fetch) | |
171 | (uri (string-append "https://github.com/google/protobuf/releases/" | |
172 | "download/v" version "/protobuf-cpp-" | |
173 | version ".tar.gz")) | |
174 | (sha256 | |
175 | (base32 | |
176 | "14j0427ykjzrd9a66c2mpk0sjcccjlsx6q8ww6hzwb6sha3vm3f2")))))) | |
177 | ||
fa9ac83e TGR |
178 | ;; XXX Remove this old version when no other packages depend on it. |
179 | (define-public protobuf-2 | |
180 | (package (inherit protobuf) | |
181 | (version "2.6.1") | |
182 | (source (origin | |
183 | (method url-fetch) | |
184 | (uri (string-append "https://github.com/google/protobuf/releases/" | |
185 | "download/v" version "/protobuf-" | |
186 | version ".tar.bz2")) | |
187 | (sha256 | |
188 | (base32 | |
07fdfb9e MC |
189 | "040rcs9fpv4bslhiy43v7dcrzakz4vwwpyqg4jp8bn24sl95ci7f")))) |
190 | (arguments (substitute-keyword-arguments (package-arguments protobuf) | |
191 | ((#:phases phases) | |
192 | `(modify-phases ,phases | |
193 | (delete 'disable-broken-tests))))))) | |
fa9ac83e | 194 | |
bfd07331 RW |
195 | (define-public protobuf-c |
196 | (package | |
197 | (name "protobuf-c") | |
e68ae709 | 198 | (version "1.3.3") |
bfd07331 RW |
199 | (source (origin |
200 | (method url-fetch) | |
201 | (uri (string-append "https://github.com/protobuf-c/protobuf-c/" | |
202 | "releases/download/v" version | |
203 | "/protobuf-c-" version ".tar.gz")) | |
204 | (sha256 | |
205 | (base32 | |
e68ae709 | 206 | "0y3yaanq97si7iyld06p8w20m0shpj7sf4xwzbhhvijhxw36d592")))) |
bfd07331 | 207 | (build-system gnu-build-system) |
8394619b LC |
208 | (inputs (list protobuf)) |
209 | (native-inputs (list pkg-config)) | |
bfd07331 RW |
210 | (home-page "https://github.com/protobuf-c/protobuf-c") |
211 | (synopsis "Protocol Buffers implementation in C") | |
212 | (description | |
213 | "This is protobuf-c, a C implementation of the Google Protocol Buffers | |
214 | data serialization format. It includes @code{libprotobuf-c}, a pure C library | |
215 | that implements protobuf encoding and decoding, and @code{protoc-c}, a code | |
216 | generator that converts Protocol Buffer @code{.proto} files to C descriptor | |
217 | code.") | |
7e685dee | 218 | (license license:bsd-2))) |
bfd07331 | 219 | |
dc8621a2 TGR |
220 | (define-public protozero |
221 | (package | |
222 | (name "protozero") | |
a3500a0a | 223 | (version "1.7.1") |
dc8621a2 TGR |
224 | (source |
225 | (origin | |
226 | (method git-fetch) | |
227 | (uri (git-reference | |
b0e7b699 | 228 | (url "https://github.com/mapbox/protozero") |
dc8621a2 TGR |
229 | (commit (string-append "v" version)))) |
230 | (file-name (git-file-name name version)) | |
231 | (sha256 | |
a3500a0a | 232 | (base32 "052cq5mdjjgcsgk612zkqi8k08p3ikl22r59dk6i6fq41dxldja7")))) |
dc8621a2 TGR |
233 | (build-system cmake-build-system) |
234 | (home-page "https://github.com/mapbox/protozero") | |
235 | (synopsis "Minimalistic protocol buffer decoder and encoder in C++") | |
236 | (description "Protozero is a minimalistic protocol buffer decoder and | |
237 | encoder in C++. The developer using protozero has to manually translate the | |
238 | @file{.proto} description into code.") | |
239 | (license (list | |
240 | license:asl2.0 ; for folly | |
241 | license:bsd-2)))) | |
242 | ||
cc3cc72d MC |
243 | (define-public nanopb |
244 | (package | |
245 | (name "nanopb") | |
246 | (version "0.4.6.4") | |
247 | (source (origin | |
248 | (method git-fetch) ;for tests | |
249 | (uri (git-reference | |
250 | (url "https://github.com/nanopb/nanopb") | |
251 | (commit version))) | |
252 | (file-name (git-file-name name version)) | |
253 | (sha256 | |
254 | (base32 | |
255 | "0gb6q4igrjj8jap4p1ijza4y8dkjlingzym3cli1w18f90d7xlh7")))) | |
256 | (build-system cmake-build-system) | |
257 | (arguments | |
258 | (list | |
259 | #:configure-flags #~(list "-DBUILD_SHARED_LIBS=ON" | |
260 | "-DBUILD_STATIC_LIBS=OFF") | |
261 | #:phases | |
262 | #~(modify-phases %standard-phases | |
263 | (replace 'check | |
264 | (lambda* (#:key tests? #:allow-other-keys) | |
265 | (when tests? | |
266 | (with-directory-excursion "../source/tests" | |
267 | (invoke "scons")))))))) | |
268 | (native-inputs (list protobuf python-protobuf python-wrapper scons)) | |
269 | (home-page "https://jpa.kapsi.fi/nanopb/") | |
270 | (synopsis "Small code-size Protocol Buffers implementation in ANSI C") | |
271 | (description "Nanopb is a small code-size Protocol Buffers implementation | |
272 | in ansi C. It is especially suitable for use in microcontrollers, but fits | |
273 | any memory-restricted system.") | |
274 | (license license:zlib))) | |
275 | ||
1a7fb20e MC |
276 | (define-public python-mypy-protobuf |
277 | (package | |
278 | (name "python-mypy-protobuf") | |
279 | (version "3.3.0") | |
280 | (source (origin | |
281 | (method git-fetch) | |
282 | (uri (git-reference | |
283 | (url "https://github.com/nipunn1313/mypy-protobuf") | |
284 | (commit (string-append "v" version)))) | |
285 | (file-name (git-file-name name version)) | |
286 | (sha256 | |
287 | (base32 | |
288 | "0z03h9k68qvnlyhpk0ndwp01bdx77vrjr6mybxq4ldilkkbksklk")))) | |
8bdc4c15 | 289 | (build-system pyproject-build-system) |
1a7fb20e MC |
290 | (arguments |
291 | (list | |
292 | #:phases | |
293 | #~(modify-phases %standard-phases | |
1a7fb20e MC |
294 | (add-before 'check 'generate-protos-for-tests |
295 | (lambda _ | |
296 | ;; Generate Python sources. | |
297 | (for-each (lambda (proto) | |
298 | (invoke "protoc" | |
299 | "--proto_path=proto" | |
300 | "--experimental_allow_proto3_optional" | |
301 | "--python_out=test/generated" proto)) | |
302 | (find-files "." "\\.proto$")) | |
303 | ;; Generate GRPC protos. | |
304 | (for-each (lambda (proto) | |
305 | (invoke "python" "-m" "grpc_tools.protoc" | |
306 | "--proto_path=proto" | |
307 | "--experimental_allow_proto3_optional" | |
308 | "--grpc_python_out=test/generated" proto)) | |
309 | (find-files "proto/testproto/grpc" "\\.proto$")))) | |
310 | (replace 'check | |
311 | (lambda* (#:key tests? #:allow-other-keys) | |
312 | (setenv "PYTHONPATH" "test/generated") | |
313 | (invoke "pytest" "-vv" "--ignore=test/generated" "test")))))) | |
314 | (native-inputs | |
315 | (list python-grpc-stubs | |
316 | python-grpcio-tools | |
1a7fb20e MC |
317 | python-pytest |
318 | python-typing-extensions-next)) | |
319 | (propagated-inputs | |
320 | (list protobuf | |
321 | python-protobuf | |
322 | python-types-protobuf)) | |
323 | (home-page "https://github.com/nipunn1313/mypy-protobuf") | |
324 | (synopsis "Generate Mypy stub files from protobuf specifications") | |
325 | (description "This Python package provide tools to generate Mypy stubs | |
326 | from protobuf specification files.") | |
327 | (license license:asl2.0))) | |
328 | ||
5eb16865 MC |
329 | (define-public python-nanopb |
330 | (package | |
331 | (inherit nanopb) | |
332 | (name "python-nanopb") | |
333 | (build-system python-build-system) | |
334 | (arguments | |
335 | (list | |
336 | #:tests? #f ;no Python-specific tests | |
337 | #:phases | |
338 | #~(modify-phases %standard-phases | |
339 | (replace 'build | |
340 | (lambda _ | |
341 | (copy-file "extra/poetry/pyproject.toml" "pyproject.toml") | |
342 | (delete-file "build.py") | |
343 | ;; Mimick extra/poetry/poetry_build.sh. | |
344 | (mkdir "nanopb") | |
345 | (copy-recursively "generator" "nanopb/generator") | |
346 | (invoke "touch" "nanopb/__init__.py" | |
347 | "nanopb/generator/__init__.py") | |
348 | (invoke "make" "-C" "nanopb/generator/proto") | |
349 | (invoke "python" "-m" "build" "--wheel" "--no-isolation" "."))) | |
350 | (replace 'install | |
351 | (lambda* (#:key outputs #:allow-other-keys) | |
352 | (let ((whl (car (find-files "dist" "\\.whl$")))) | |
353 | (invoke "pip" "--no-cache-dir" "--no-input" | |
354 | "install" "--no-deps" "--prefix" #$output whl))))))) | |
355 | (native-inputs (list poetry protobuf python-pypa-build)) | |
356 | (propagated-inputs (list python-protobuf)) | |
357 | (synopsis "Small code-size Protocol Buffers implementation in Python"))) | |
358 | ||
8d63ddda DP |
359 | (define-public python-protobuf |
360 | (package | |
361 | (name "python-protobuf") | |
5f8491ea | 362 | (version "3.20.1") |
8d63ddda DP |
363 | (source |
364 | (origin | |
365 | (method url-fetch) | |
366 | (uri (pypi-uri "protobuf" version)) | |
367 | (sha256 | |
368 | (base32 | |
5f8491ea | 369 | "1ja2vpk9nklllmsirmil2s4l7ni9yfqvbvj47zz5xx17s1k1bhxd")))) |
8d63ddda | 370 | (build-system python-build-system) |
8d63ddda DP |
371 | (home-page "https://github.com/google/protobuf") |
372 | (synopsis "Protocol buffers is a data interchange format") | |
373 | (description | |
374 | "Protocol buffers are a language-neutral, platform-neutral extensible | |
375 | mechanism for serializing structured data.") | |
7e685dee | 376 | (license license:bsd-3))) |
8d63ddda | 377 | |
6f1784fa LP |
378 | (define-public python-pure-protobuf |
379 | (package | |
380 | (name "python-pure-protobuf") | |
7a0491ad | 381 | (version "2.0.1") |
6f1784fa LP |
382 | (source |
383 | (origin | |
7a0491ad | 384 | ;; The PyPI tarball is broken: it has no tests. |
6f1784fa LP |
385 | (method git-fetch) |
386 | (uri (git-reference | |
387 | (url "https://github.com/eigenein/protobuf") | |
388 | (commit version))) | |
389 | (file-name (git-file-name name version)) | |
390 | (sha256 | |
7a0491ad | 391 | (base32 "15dp5pvazd0jx4wzzh79080ah7hkpd3axh40al9vhzs2hf3v90hx")))) |
6f1784fa LP |
392 | (build-system python-build-system) |
393 | (native-inputs | |
8394619b | 394 | (list python-flake8 python-pytest python-pytest-cov python-isort)) |
6f1784fa LP |
395 | (arguments |
396 | `(#:phases | |
397 | (modify-phases %standard-phases | |
6f1784fa LP |
398 | (replace 'check |
399 | (lambda _ | |
400 | (invoke "pytest" "--cov-report" "term-missing" "--cov" | |
401 | "pure_protobuf") | |
402 | (invoke "flake8" "pure_protobuf" "tests" | |
403 | "--ignore=F541") | |
6131b838 | 404 | (invoke "isort" "-rc" "-c" "pure_protobuf" "tests")))))) |
6f1784fa LP |
405 | (home-page "https://pypi.org/project/pure-protobuf/") |
406 | (synopsis "Protobuf implementation using dataclasses") | |
407 | (description | |
81fe5863 | 408 | "@code{python-pure-protobuf} takes advantage of the standard |
6f1784fa LP |
409 | dataclasses module to define message types. Protocol buffers are a |
410 | language-neutral, platform-neutral extensible mechanism for serializing | |
411 | structured data.") | |
412 | (license license:expat))) | |
413 | ||
7373eb83 MB |
414 | ;; For tensorflow. |
415 | (define-public python-protobuf-3.6 | |
dbcf2b61 MB |
416 | (package |
417 | (inherit python-protobuf) | |
1eeae57b | 418 | (name "python-protobuf") |
7373eb83 | 419 | (version (package-version protobuf-3.6) ) |
1eeae57b RW |
420 | (source |
421 | (origin | |
422 | (method url-fetch) | |
423 | (uri (pypi-uri "protobuf" version)) | |
424 | (sha256 | |
425 | (base32 | |
57be6ba0 CB |
426 | "04bqb12smlckzmgkj6vgmpbr3cby0n6726cmz33bqr7kn1vb728l")))) |
427 | (inputs | |
428 | (cons python-six | |
429 | (package-inputs python-protobuf))))) | |
1eeae57b | 430 | |
f8a6ae18 RW |
431 | (define-public python-proto-plus |
432 | (package | |
433 | (name "python-proto-plus") | |
434 | (version "1.20.3") | |
435 | (source | |
436 | (origin | |
437 | (method url-fetch) | |
438 | (uri (pypi-uri "proto-plus" version)) | |
439 | (sha256 | |
440 | (base32 "1raad9qnmfva94nm33k40bcwrckgljbfky5pdwh4xhg6r5dj52zj")))) | |
441 | (build-system python-build-system) | |
442 | (propagated-inputs (list python-protobuf)) | |
443 | (home-page "https://github.com/googleapis/proto-plus-python.git") | |
444 | (synopsis "Pythonic protocol buffers") | |
445 | (description "This is a wrapper around protocol buffers. Protocol buffers | |
446 | is a specification format for APIs, such as those inside Google. This library | |
447 | provides protocol buffer message classes and objects that largely behave like | |
448 | native Python types.") | |
449 | (license license:asl2.0))) | |
450 | ||
d78bfd27 CZ |
451 | (define-public emacs-protobuf-mode |
452 | (package | |
453 | (name "emacs-protobuf-mode") | |
454 | (version (package-version protobuf)) | |
455 | (source (package-source protobuf)) | |
456 | (build-system emacs-build-system) | |
457 | (arguments | |
458 | `(#:phases | |
459 | (modify-phases %standard-phases | |
6b83da96 | 460 | (add-before 'expand-load-path 'change-working-directory |
d78bfd27 CZ |
461 | (lambda _ (chdir "editors") #t))))) |
462 | (home-page "https://github.com/protocolbuffers/protobuf") | |
463 | (synopsis "Protocol buffers major mode for Emacs") | |
464 | (description | |
465 | "This package provides an Emacs major mode for editing Protocol Buffer | |
466 | source files.") | |
467 | (license license:bsd-3))) | |
d59c84f5 MC |
468 | |
469 | (define-public ruby-protobuf | |
470 | (package | |
471 | (name "ruby-protobuf") | |
472 | (version "3.10.3") | |
473 | (source (origin | |
474 | (method git-fetch) | |
475 | (uri (git-reference | |
b0e7b699 | 476 | (url "https://github.com/ruby-protobuf/protobuf") |
d59c84f5 MC |
477 | (commit (string-append "v" version)))) |
478 | (file-name (git-file-name name version)) | |
479 | (sha256 | |
480 | (base32 | |
481 | "1yzz7jgpp6qip5d6qhzbkf5gqaydfk3z3c1ngccwzp6w6wa75g8a")))) | |
482 | (build-system ruby-build-system) | |
483 | (arguments | |
484 | `(#:phases | |
485 | (modify-phases %standard-phases | |
486 | (add-after 'unpack 'do-not-use-bundler-for-tests | |
487 | (lambda _ | |
488 | (substitute* "spec/spec_helper.rb" | |
489 | (("Bundler\\.setup.*") "")) | |
490 | #t)) | |
491 | (add-after 'unpack 'relax-version-requirements | |
492 | (lambda _ | |
493 | (substitute* ((@@ (guix build ruby-build-system) first-gemspec)) | |
494 | (("'rake',.*") | |
495 | "'rake'\n") | |
496 | (("\"rubocop\",.*") | |
497 | "'rubocop'\n") | |
498 | (("\"parser\",.*") | |
499 | "'parser'\n")) | |
500 | #t)) | |
501 | (add-after 'unpack 'patch-protoc | |
502 | (lambda* (#:key inputs #:allow-other-keys) | |
503 | (let ((protoc (assoc-ref inputs "protobuf"))) | |
504 | (substitute* "lib/protobuf/tasks/compile.rake" | |
505 | (("\"protoc\"") | |
506 | (string-append "\"" protoc "/bin/protoc" "\""))) | |
507 | #t))) | |
508 | (add-after 'unpack 'skip-failing-test | |
509 | ;; See: https://github.com/ruby-protobuf/protobuf/issues/419 | |
510 | (lambda _ | |
511 | (substitute* "spec/lib/protobuf/rpc/connectors/ping_spec.rb" | |
512 | (("expect\\(::IO\\)\\.to receive\\(:select\\).*" all) | |
513 | (string-append " pending\n" all))) | |
514 | #t)) | |
515 | (add-after 'replace-git-ls-files 'replace-more-git-ls-files | |
516 | (lambda _ | |
517 | (substitute* ((@@ (guix build ruby-build-system) first-gemspec)) | |
518 | (("`git ls-files -- \\{test,spec,features\\}/*`") | |
519 | "`find test spec features -type f | sort`") | |
520 | (("`git ls-files -- bin/*`") | |
521 | "`find bin -type f | sort`")) | |
522 | #t)) | |
523 | (replace 'check | |
524 | (lambda _ | |
525 | (invoke "rspec")))))) | |
526 | (native-inputs | |
8394619b LC |
527 | (list ruby-benchmark-ips |
528 | ruby-ffi-rzmq | |
529 | ruby-parser | |
530 | ruby-pry-byebug | |
531 | ruby-pry-stack-explorer | |
532 | ruby-rake | |
533 | ruby-rspec | |
534 | ruby-rubocop | |
535 | ruby-ruby-prof | |
536 | ruby-simplecov | |
537 | ruby-timecop | |
538 | ruby-varint | |
539 | ruby-yard)) | |
d59c84f5 | 540 | (inputs |
8394619b | 541 | (list protobuf)) |
d59c84f5 | 542 | (propagated-inputs |
8394619b | 543 | (list ruby-activesupport ruby-middleware ruby-thor ruby-thread-safe)) |
d59c84f5 MC |
544 | (home-page "https://github.com/ruby-protobuf/protobuf") |
545 | (synopsis "Implementation of Google's Protocol Buffers in Ruby") | |
546 | (description "Protobuf is an implementation of Google's Protocol Buffers | |
547 | in pure Ruby.") | |
548 | (license license:expat))) | |
77f66f53 MC |
549 | |
550 | ;;; This is a modified ruby-protobuf package used by ruby-cucumber-messages | |
551 | ;;; until https://github.com/ruby-protobuf/protobuf/pull/411 and | |
552 | ;;; https://github.com/ruby-protobuf/protobuf/pull/415 are merged upstream. | |
553 | (define-public ruby-protobuf-cucumber | |
554 | (hidden-package | |
555 | (package | |
556 | (inherit ruby-protobuf) | |
557 | (name "ruby-protobuf-cucumber") | |
558 | (version "3.10.8") | |
559 | (source | |
560 | (origin | |
561 | (method url-fetch) | |
562 | (uri (rubygems-uri "protobuf-cucumber" version)) | |
563 | (sha256 | |
564 | (base32 | |
565 | "1rd6naabhpfb1i5dr6fp5mqwaawsx0mqm73h5ycwkgbm1n2si872"))))))) |