gnu: icecat: Update to 78.10.0-guix0-preview1 [security fixes].
[jackhill/guix/guix.git] / gnu / packages / rpc.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2019 Ricardo Wurmus <rekado@elephly.net>
3 ;;; Copyright © 2020 Efraim Flashner <efraim@flashner.co.il>
4 ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
5 ;;; Copyright © 2020 Brett Gilio <brettg@gnu.org>
6 ;;; Copyright © 2021 Greg Hogan <code@greghogan.com>
7 ;;; Copyright © 2021 Tobias Geerinckx-Rice <me@tobias.gr>
8 ;;;
9 ;;; This file is part of GNU Guix.
10 ;;;
11 ;;; GNU Guix is free software; you can redistribute it and/or modify it
12 ;;; under the terms of the GNU General Public License as published by
13 ;;; the Free Software Foundation; either version 3 of the License, or (at
14 ;;; your option) any later version.
15 ;;;
16 ;;; GNU Guix is distributed in the hope that it will be useful, but
17 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;;; GNU General Public License for more details.
20 ;;;
21 ;;; You should have received a copy of the GNU General Public License
22 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
23
24 (define-module (gnu packages rpc)
25 #:use-module ((guix licenses) #:prefix license:)
26 #:use-module (guix packages)
27 #:use-module (guix git-download)
28 #:use-module (guix download)
29 #:use-module (guix utils)
30 #:use-module (guix build-system cmake)
31 #:use-module (guix build-system gnu)
32 #:use-module (guix build-system python)
33 #:use-module (gnu packages adns)
34 #:use-module (gnu packages autotools)
35 #:use-module (gnu packages bison)
36 #:use-module (gnu packages boost)
37 #:use-module (gnu packages compression)
38 #:use-module (gnu packages cpp)
39 #:use-module (gnu packages flex)
40 #:use-module (gnu packages pkg-config)
41 #:use-module (gnu packages protobuf)
42 #:use-module (gnu packages python)
43 #:use-module (gnu packages python-xyz)
44 #:use-module (gnu packages regex)
45 #:use-module (gnu packages tls))
46
47 (define-public grpc
48 (package
49 (name "grpc")
50 (version "1.34.0")
51 (outputs '("out" "static"))
52 (source (origin
53 (method git-fetch)
54 (uri (git-reference
55 (url "https://github.com/grpc/grpc")
56 (commit (string-append "v" version))))
57 (file-name (git-file-name name version))
58 (sha256
59 (base32
60 "1fs407hnlnm0b8sncjwys9rc7ia5nb7wxrpx39nq3pzzfs1lv3vq"))))
61 (build-system cmake-build-system)
62 (arguments
63 `(#:tests? #f ; no test target
64 #:configure-flags
65 (list "-DgRPC_ZLIB_PROVIDER=package"
66 "-DgRPC_ABSL_PROVIDER=package"
67 "-DgRPC_CARES_PROVIDER=package"
68 "-DgRPC_SSL_PROVIDER=package"
69 "-DgRPC_PROTOBUF_PROVIDER=package"
70 "-DgRPC_RE2_PROVIDER=package"
71 (string-append "-DCMAKE_INSTALL_PREFIX="
72 (assoc-ref %outputs "out"))
73 "-DCMAKE_INSTALL_LIBDIR=lib"
74 (string-append "-DCMAKE_INSTALL_RPATH="
75 (assoc-ref %outputs "out") "/lib")
76 "-DCMAKE_VERBOSE_MAKEFILE=ON")
77 #:phases
78 (modify-phases %standard-phases
79 (add-before 'configure 'configure-shared
80 (lambda* (#:key (configure-flags '()) #:allow-other-keys)
81 (mkdir "../build-shared")
82 (with-directory-excursion "../build-shared"
83 (apply invoke
84 "cmake" "../source"
85 "-DBUILD_SHARED_LIBS=ON"
86 configure-flags)
87 (apply invoke "make"
88 `("-j" ,(number->string (parallel-job-count)))))))
89 (add-after 'install 'install-shared-libraries
90 (lambda _
91 (with-directory-excursion "../build-shared"
92 (invoke "make" "install"))))
93 (add-before 'strip 'move-static-libs
94 (lambda* (#:key outputs #:allow-other-keys)
95 (let ((out (assoc-ref outputs "out"))
96 (static (assoc-ref outputs "static")))
97 (mkdir-p (string-append static "/lib"))
98 (with-directory-excursion
99 (string-append out "/lib")
100 (for-each
101 (lambda (file)
102 (rename-file file
103 (string-append static "/lib/" file)))
104 (find-files "." "\\.a$"))))
105 #t)))))
106 (inputs
107 `(("abseil-cpp" ,abseil-cpp)
108 ("c-ares" ,c-ares/cmake)
109 ("openssl" ,openssl)
110 ("re2" ,re2)
111 ("zlib" ,zlib)))
112 (native-inputs
113 `(("pkg-config" ,pkg-config)
114 ("protobuf" ,protobuf)
115 ("python" ,python-wrapper)))
116 (home-page "https://grpc.io")
117 (synopsis "High performance universal RPC framework")
118 (description "gRPC is a modern high performance @dfn{Remote Procedure Call}
119 (RPC) framework that can run in any environment. It can efficiently connect
120 services in and across data centers with pluggable support for load balancing,
121 tracing, health checking and authentication. It is also applicable in last
122 mile of distributed computing to connect devices, mobile applications and
123 browsers to backend services.")
124 (license license:asl2.0)))
125
126 ;; Some packages require this older version.
127 (define-public grpc-1.16.1
128 (package
129 (inherit grpc)
130 (version "1.16.1")
131 (source (origin
132 (method git-fetch)
133 (uri (git-reference
134 (url "https://github.com/grpc/grpc")
135 (commit (string-append "v" version))))
136 (file-name (git-file-name "grpc" version))
137 (sha256
138 (base32
139 "1jimqz3115f9pli5w6ik9wi7mjc7ix6y7yrq4a1ab9fc3dalj7p2"))))
140 (arguments
141 (substitute-keyword-arguments (package-arguments grpc)
142 ((#:phases phases)
143 `(modify-phases ,phases
144 ;; Note: This would be nicer as a snippet, but that creates a tarball
145 ;; instead of a checkout and breaks assumptions made by the builder.
146 (add-after 'unpack 'rename-gettid
147 (lambda _
148 ;; Rename custom gettid() syscall wrapper to avoid conflict
149 ;; with gettid() from glibc 2.30.
150 (substitute* '("src/core/lib/gpr/log_linux.cc"
151 "src/core/lib/gpr/log_posix.cc"
152 "src/core/lib/iomgr/ev_epollex_linux.cc")
153 (("gettid\\(")
154 "sys_gettid("))
155 #t))))))))
156
157 (define-public python-grpcio
158 (package
159 (name "python-grpcio")
160 (version "1.27.2")
161 (source
162 (origin
163 (method url-fetch)
164 (uri (pypi-uri "grpcio" version))
165 (sha256
166 (base32
167 "0zl89jwcff9hkd8mi4yf3qbhns9vbv1s4x4vahm5mkpr7jwk5ras"))
168 (modules '((guix build utils) (ice-9 ftw)))
169 (snippet
170 '(begin
171 (with-directory-excursion "third_party"
172 ;; Delete the bundled source code of libraries that are possible
173 ;; to provide as inputs.
174 (for-each delete-file-recursively
175 (scandir "."
176 (lambda (file)
177 (not (member file
178 '("." ".."
179 "abseil-cpp"
180 "address_sorting"
181 "upb")))))))
182 #t))))
183 (build-system python-build-system)
184 (arguments
185 '(#:phases (modify-phases %standard-phases
186 (add-before 'build 'use-system-libraries
187 (lambda _
188 (setenv "GRPC_PYTHON_BUILD_SYSTEM_CARES" "1")
189 (setenv "GRPC_PYTHON_BUILD_SYSTEM_OPENSSL" "1")
190 (setenv "GRPC_PYTHON_BUILD_SYSTEM_ZLIB" "1")
191 #t))
192 (add-before 'build 'configure-compiler
193 (lambda _
194 (substitute* '("setup.py" "src/python/grpcio/commands.py")
195 (("'cc'") "'gcc'"))
196 #t)))))
197 (inputs
198 `(("c-ares" ,c-ares)
199 ("openssl" ,openssl)
200 ("zlib" ,zlib)))
201 (propagated-inputs
202 `(("python-six" ,python-six)))
203 (home-page "https://grpc.io")
204 (synopsis "HTTP/2-based RPC framework")
205 (description "This package provides a Python library for communicating
206 with the HTTP/2-based RPC framework gRPC.")
207 (license license:asl2.0)))
208
209 (define-public apache-thrift
210 (package
211 (name "apache-thrift")
212 (version "0.14.1")
213 (source
214 (origin
215 (method git-fetch)
216 (uri (git-reference
217 (url "https://github.com/apache/thrift")
218 (commit (string-append "v" version))))
219 (file-name (git-file-name name version))
220 (sha256
221 (base32 "1mj3c5jhjbg2sfkx9k9jqg88h1c5rswr9b606s02ny9ydf3akcny"))))
222 (build-system gnu-build-system)
223 (arguments
224 '(#:tests? #f
225 #:configure-flags
226 (list (string-append "--with-boost="
227 (assoc-ref %build-inputs "boost")))))
228 (native-inputs
229 `(("autoconf" ,autoconf)
230 ("automake" ,automake)
231 ("libtool" ,libtool)
232 ("pkg-config" ,pkg-config)
233 ("flex" ,flex)
234 ("bison" ,bison)))
235 (inputs
236 `(("boost" ,boost)
237 ("libressl" ,libressl)))
238 (outputs '("out" "lib" "include"))
239 (home-page "https://thrift.apache.org/")
240 (synopsis
241 "Lightweight, language-independent software stack for point-to-point
242 RPC")
243 (description
244 "Thrift provides clean abstractions and implementations for data
245 transport, data serialization, and application level processing. The code
246 generation system takes a simple definition language as input and generates
247 code across programming languages that uses the abstracted stack to build
248 interoperable RPC clients and servers.")
249 (license license:asl2.0)))