projects/guix·blob kernel-updates · refs

324 lines · 12.8 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2019, 2023 Ricardo Wurmus <[email protected]>
3;;; Copyright © 2020, 2021 Efraim Flashner <[email protected]>
4;;; Copyright © 2020 Marius Bakke <[email protected]>
5;;; Copyright © 2020 Brett Gilio <[email protected]>
6;;; Copyright © 2021 Greg Hogan <[email protected]>
7;;; Copyright © 2021 Tobias Geerinckx-Rice <[email protected]>
8;;; Copyright © 2022, 2024 Maxim Cournoyer <[email protected]>
9;;; Copyright © 2025 Nicolas Graves <[email protected]>
10;;;
11;;; This file is part of GNU Guix.
12;;;
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.
17;;;
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.
22;;;
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/>.
25
26(define-module (gnu packages rpc)
27 #:use-module (gnu packages autotools)
28 #:use-module (gnu packages bison)
29 #:use-module (gnu packages boost)
30 #:use-module (gnu packages check)
31 #:use-module (gnu packages compression)
32 #:use-module (gnu packages cpp)
33 #:use-module (gnu packages dns)
34 #:use-module (gnu packages compiler-tools)
35 #:use-module (gnu packages pkg-config)
36 #:use-module (gnu packages protobuf)
37 #:use-module (gnu packages python)
38 #:use-module (gnu packages python-build)
39 #:use-module (gnu packages python-web)
40 #:use-module (gnu packages python-xyz)
41 #:use-module (gnu packages regex)
42 #:use-module (gnu packages tls)
43 #:use-module (guix build-system cmake)
44 #:use-module (guix build-system gnu)
45 #:use-module (guix build-system pyproject)
46 #:use-module (guix download)
47 #:use-module (guix gexp)
48 #:use-module (guix git-download)
49 #:use-module ((guix licenses) #:prefix license:)
50 #:use-module (guix packages)
51 #:use-module (guix utils)
52 #:use-module (srfi srfi-1))
53
54;; XXX: Starting from version 1.47.5, opencensus-proto is required.
55;; The package is already deprecated upstream, so it's probably not
56;; worth it spending time packaging it in Guix, just inject the source
57;; instead, to also avoid us a recursive git fetch.
58(define opencensus-proto-for-grpc-source
59 (origin
60 (method url-fetch)
61 (uri "https://github.com/census-instrumentation/opencensus-proto/archive/v0.3.0.tar.gz")
62 (sha256
63 (base32 "1c3jfl1zgjhhqyqii1wils2k05akkvrw50xmf0q0rs2r885kzqdp"))))
64
65(define-public grpc
66 (package
67 (name "grpc")
68 (version "1.52.2")
69 (outputs '("out" "static"))
70 (source (origin
71 (method git-fetch)
72 (uri (git-reference
73 (url "https://github.com/grpc/grpc")
74 (commit (string-append "v" version))))
75 (file-name (git-file-name name version))
76 (sha256
77 (base32
78 "09165p6rh5xvcnnwnmy22lwdfchgjg39y02rwj6zg4rzfps8cb43"))))
79 (build-system cmake-build-system)
80 (arguments
81 (list
82 #:tests? #f ; no test target
83 #:configure-flags
84 #~(list "-DgRPC_ZLIB_PROVIDER=package"
85 "-DgRPC_ABSL_PROVIDER=package"
86 "-DgRPC_CARES_PROVIDER=package"
87 "-DgRPC_SSL_PROVIDER=package"
88 "-DgRPC_PROTOBUF_PROVIDER=package"
89 "-DgRPC_RE2_PROVIDER=package"
90 (string-append "-DCMAKE_INSTALL_PREFIX=" #$output)
91 "-DCMAKE_INSTALL_LIBDIR=lib"
92 (string-append "-DCMAKE_INSTALL_RPATH=" #$output "/lib")
93 "-DCMAKE_VERBOSE_MAKEFILE=ON")
94 #:phases
95 #~(modify-phases %standard-phases
96 (add-after 'unpack 'unpack-third-party
97 (lambda _
98 (mkdir-p "third_party/opencensus-proto/src")
99 (invoke "tar" "xvf" #+opencensus-proto-for-grpc-source
100 "-C" "third_party/opencensus-proto/src")))
101 (add-before 'configure 'configure-shared
102 (lambda* (#:key configure-flags #:allow-other-keys)
103 (mkdir "../build-shared")
104 (with-directory-excursion "../build-shared"
105 (apply invoke "cmake" "../source"
106 "-DBUILD_SHARED_LIBS=ON"
107 configure-flags)
108 (apply invoke "make"
109 (list "-j" (number->string (parallel-job-count)))))))
110 (add-after 'install 'install-shared-libraries
111 (lambda _
112 (with-directory-excursion "../build-shared"
113 (invoke "make" "install"))))
114 (add-before 'strip 'move-static-libs
115 (lambda _
116 (let ((static #$output:static))
117 (mkdir-p (string-append static "/lib"))
118 (with-directory-excursion (string-append #$output "/lib")
119 (for-each
120 (lambda (file)
121 (rename-file file (string-append static "/lib/" file)))
122 (find-files "." "\\.a$")))))))))
123 (native-inputs
124 (list pkg-config
125 protobuf
126 python-wrapper))
127 (inputs
128 (list c-ares/cmake
129 openssl
130 re2
131 zlib))
132 (propagated-inputs
133 ;; Abseil libraries are in the 'Requires' field of the various gRPC
134 ;; pkg-config files.
135 (list abseil-cpp-cxxstd11))
136 (home-page "https://grpc.io")
137 (synopsis "High performance universal RPC framework")
138 (description "gRPC is a modern high performance @dfn{Remote Procedure Call}
139(RPC) framework that can run in any environment. It can efficiently connect
140services in and across data centers with pluggable support for load balancing,
141tracing, health checking and authentication. It is also applicable in last
142mile of distributed computing to connect devices, mobile applications and
143browsers to backend services.")
144 (license license:asl2.0)))
145
146(define-public python-grpc-stubs
147 (package
148 (name "python-grpc-stubs")
149 (version "1.53.0.6")
150 (source
151 (origin
152 (method git-fetch)
153 (uri (git-reference
154 (url "https://github.com/shabbyrobe/grpc-stubs")
155 (commit version)))
156 (file-name (git-file-name name version))
157 (sha256
158 (base32 "0k2h787dk411sprdmx71kpwjpghmgfv0jyl84irl6s5szmqhy2y3"))))
159 (build-system pyproject-build-system)
160 (arguments (list #:tests? #f)) ;No tests.
161 (native-inputs (list python-setuptools))
162 (propagated-inputs (list python-grpcio python-typing-extensions))
163 (home-page "https://github.com/shabbyrobe/grpc-stubs")
164 (synopsis "Typing stubs for Python")
165 (description "This is a PEP-561-compliant stub-only package which provides
166type information of gRPC.")
167 (license license:expat)))
168
169(define-public python-grpcio-status
170 (package
171 (name "python-grpcio-status")
172 ;; XXX: Should follow python-grpcio, but 1.52.0 has been yanked.
173 (version "1.51.0")
174 (source
175 (origin
176 (method url-fetch)
177 (uri (pypi-uri "grpcio-status" version))
178 (sha256
179 (base32 "18lg21jzmwkd3x107ccqb1mwj4fg30l2pg2izvdz1nawapxb65al"))))
180 (build-system pyproject-build-system)
181 (arguments (list #:tests? #f)) ; No tests in Pypi.
182 (propagated-inputs
183 (list python-googleapis-common-protos
184 python-grpcio
185 python-protobuf-4))
186 (native-inputs (list python-setuptools))
187 (home-page "https://grpc.io")
188 (synopsis "Status proto mapping for gRPC")
189 (description
190 "This package provides status proto mapping for @code{gRPC}.")
191 (license license:asl2.0)))
192
193(define-public python-grpcio
194 (package
195 (name "python-grpcio")
196 (version "1.52.0")
197 (source
198 (origin
199 (method url-fetch)
200 (uri (pypi-uri "grpcio" version))
201 (sha256
202 (base32 "1nsgm8q4yahzdab4m3irffdw9zklq4kb7f8hki1ayfgw54ysim55"))
203 (modules '((guix build utils) (ice-9 ftw) (srfi srfi-26)))
204 (snippet
205 '(begin
206 ;; Delete this generated file.
207 (delete-file "src/python/grpcio/grpc/_cython/cygrpc.cpp")
208 (with-directory-excursion "third_party"
209 ;; Delete the bundled source code of libraries that are possible
210 ;; to provide as inputs.
211 (for-each delete-file-recursively
212 (scandir "." (negate (cut member <> '("." ".."
213 "address_sorting"
214 "upb"
215 "xxhash"))))))))))
216 (build-system pyproject-build-system)
217 (arguments
218 (list
219 #:tests? #f ; There seems to be no tests.
220 #:phases
221 #~(modify-phases %standard-phases
222 (add-before 'build 'use-system-libraries
223 (lambda _
224 (substitute* "setup.py"
225 (("EXTENSION_INCLUDE_DIRECTORIES = \\(" m)
226 (string-append m " ('" #$(this-package-input "grpc")
227 "/include/grpc/impl/codegen/',) + ")))
228 (setenv "GRPC_PYTHON_BUILD_SYSTEM_CARES" "1")
229 (setenv "GRPC_PYTHON_BUILD_SYSTEM_OPENSSL" "1")
230 (setenv "GRPC_PYTHON_BUILD_SYSTEM_ZLIB" "1")
231 (setenv "GRPC_PYTHON_BUILD_SYSTEM_RE2" "1")
232 (setenv "GRPC_PYTHON_BUILD_SYSTEM_ABSL" "1")
233 (setenv "GRPC_PYTHON_BUILD_WITH_CYTHON" "1")
234 ;; Fix the linker options to link with abseil-cpp, which is
235 ;; looked under /usr/lib.
236 (substitute* "setup.py"
237 (("pathlib.Path\\('/usr').glob\\('lib\\*/libabsl_\\*.so')")
238 (format #f "pathlib.Path('~a').glob('lib*/libabsl_*.so')"
239 #$(this-package-input "abseil-cpp"))))))
240 (add-before 'build 'configure-compiler
241 (lambda _
242 (substitute* '("setup.py" "src/python/grpcio/commands.py")
243 (("'cc'") "'gcc'")))))))
244 (inputs (list abseil-cpp-cxxstd11 c-ares grpc openssl re2 zlib))
245 (native-inputs (list python-cython-0 python-setuptools))
246 (home-page "https://grpc.io")
247 (synopsis "HTTP/2-based RPC framework")
248 (description
249 "This package provides a Python library for communicating with the
250HTTP/2-based RPC framework gRPC.")
251 (license license:asl2.0)))
252
253(define-public python-grpcio-tools
254 (package
255 (name "python-grpcio-tools")
256 (version "1.52.0")
257 (source
258 (origin
259 (method url-fetch)
260 (uri (pypi-uri "grpcio-tools" version))
261 (modules '((guix build utils)))
262 (snippet
263 ;; This file is auto-generated.
264 '(delete-file "grpc_tools/_protoc_compiler.cpp"))
265 (sha256
266 (base32 "0m5xwhz3l0n3b1bzjncynwflnc5iyv4xrjq046ppcck4rpj9fgn0"))))
267 (build-system pyproject-build-system)
268 (arguments
269 (list
270 #:tests? #f ;XXX: no tests in PyPI, try to build from Git
271 #:phases
272 #~(modify-phases %standard-phases
273 (add-after 'unpack 'configure
274 (lambda _
275 (setenv "GRPC_PYTHON_BUILD_WITH_CYTHON" "1"))))))
276 (native-inputs (list python-cython python-setuptools))
277 (propagated-inputs (list python-grpcio python-protobuf-4))
278 (home-page "https://grpc.io")
279 (synopsis "Protobuf code generator for gRPC")
280 (description
281 "The gRPC tools for Python provide a special plugin for generating server
282and client code from @file{.proto} service definitions.")
283 (license license:asl2.0)))
284
285(define-public apache-thrift
286 (package
287 (name "apache-thrift")
288 (version "0.14.2")
289 (source
290 (origin
291 (method git-fetch)
292 (uri (git-reference
293 (url "https://github.com/apache/thrift")
294 (commit (string-append "v" version))))
295 (file-name (git-file-name name version))
296 (sha256
297 (base32 "0wmnb3h0xq8qc5a9g9lliszh6qg254f5856h72viab46bizmdd4a"))))
298 (build-system gnu-build-system)
299 (arguments
300 '(#:tests? #f
301 #:configure-flags
302 (list (string-append "--with-boost="
303 (assoc-ref %build-inputs "boost")))))
304 (native-inputs
305 (list autoconf
306 automake
307 libtool
308 pkg-config
309 flex
310 bison))
311 (inputs
312 (list boost libressl))
313 (outputs '("out" "lib" "include"))
314 (home-page "https://thrift.apache.org/")
315 (synopsis
316 "Lightweight, language-independent software stack for point-to-point
317RPC")
318 (description
319 "Thrift provides clean abstractions and implementations for data
320transport, data serialization, and application level processing. The code
321generation system takes a simple definition language as input and generates
322code across programming languages that uses the abstracted stack to build
323interoperable RPC clients and servers.")
324 (license license:asl2.0)))