gnu: xorg-sgml-doctools: Update to 1.12.
[jackhill/guix/guix.git] / gnu / packages / rpc.scm
CommitLineData
c61557b1
MB
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2019 Ricardo Wurmus <rekado@elephly.net>
73a5891d 3;;; Copyright © 2020, 2021 Efraim Flashner <efraim@flashner.co.il>
447fafe3 4;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
f8549086 5;;; Copyright © 2020 Brett Gilio <brettg@gnu.org>
bd32f85b 6;;; Copyright © 2021 Greg Hogan <code@greghogan.com>
347cc542 7;;; Copyright © 2021 Tobias Geerinckx-Rice <me@tobias.gr>
c61557b1
MB
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)
f2c7513d 28 #:use-module (guix download)
8cc103cb 29 #:use-module (guix utils)
c61557b1 30 #:use-module (guix build-system cmake)
fbc1cbb5 31 #:use-module (guix build-system gnu)
f2c7513d 32 #:use-module (guix build-system python)
c61557b1 33 #:use-module (gnu packages adns)
fbc1cbb5
KCB
34 #:use-module (gnu packages autotools)
35 #:use-module (gnu packages bison)
36 #:use-module (gnu packages boost)
c61557b1 37 #:use-module (gnu packages compression)
447fafe3 38 #:use-module (gnu packages cpp)
fbc1cbb5
KCB
39 #:use-module (gnu packages flex)
40 #:use-module (gnu packages pkg-config)
c61557b1
MB
41 #:use-module (gnu packages protobuf)
42 #:use-module (gnu packages python)
f2c7513d 43 #:use-module (gnu packages python-xyz)
f8549086 44 #:use-module (gnu packages regex)
73a5891d
EF
45 #:use-module (gnu packages tls)
46 #:use-module (srfi srfi-1))
c61557b1
MB
47
48(define-public grpc
49 (package
50 (name "grpc")
dd31176b 51 (version "1.34.0")
c61557b1
MB
52 (outputs '("out" "static"))
53 (source (origin
54 (method git-fetch)
55 (uri (git-reference
b0e7b699 56 (url "https://github.com/grpc/grpc")
c61557b1
MB
57 (commit (string-append "v" version))))
58 (file-name (git-file-name name version))
59 (sha256
60 (base32
dd31176b 61 "1fs407hnlnm0b8sncjwys9rc7ia5nb7wxrpx39nq3pzzfs1lv3vq"))))
c61557b1
MB
62 (build-system cmake-build-system)
63 (arguments
64 `(#:tests? #f ; no test target
65 #:configure-flags
66 (list "-DgRPC_ZLIB_PROVIDER=package"
447fafe3 67 "-DgRPC_ABSL_PROVIDER=package"
c61557b1
MB
68 "-DgRPC_CARES_PROVIDER=package"
69 "-DgRPC_SSL_PROVIDER=package"
70 "-DgRPC_PROTOBUF_PROVIDER=package"
f8549086 71 "-DgRPC_RE2_PROVIDER=package"
c61557b1
MB
72 (string-append "-DCMAKE_INSTALL_PREFIX="
73 (assoc-ref %outputs "out"))
74 "-DCMAKE_INSTALL_LIBDIR=lib"
75 (string-append "-DCMAKE_INSTALL_RPATH="
76 (assoc-ref %outputs "out") "/lib")
77 "-DCMAKE_VERBOSE_MAKEFILE=ON")
78 #:phases
79 (modify-phases %standard-phases
80 (add-before 'configure 'configure-shared
81 (lambda* (#:key (configure-flags '()) #:allow-other-keys)
82 (mkdir "../build-shared")
83 (with-directory-excursion "../build-shared"
84 (apply invoke
85 "cmake" "../source"
86 "-DBUILD_SHARED_LIBS=ON"
87 configure-flags)
88 (apply invoke "make"
89 `("-j" ,(number->string (parallel-job-count)))))))
90 (add-after 'install 'install-shared-libraries
91 (lambda _
92 (with-directory-excursion "../build-shared"
93 (invoke "make" "install"))))
94 (add-before 'strip 'move-static-libs
95 (lambda* (#:key outputs #:allow-other-keys)
96 (let ((out (assoc-ref outputs "out"))
97 (static (assoc-ref outputs "static")))
98 (mkdir-p (string-append static "/lib"))
99 (with-directory-excursion
100 (string-append out "/lib")
101 (for-each
102 (lambda (file)
103 (rename-file file
104 (string-append static "/lib/" file)))
105 (find-files "." "\\.a$"))))
106 #t)))))
107 (inputs
8394619b 108 (list abseil-cpp c-ares/cmake openssl re2 zlib))
c61557b1 109 (native-inputs
f8549086
BG
110 `(("pkg-config" ,pkg-config)
111 ("protobuf" ,protobuf)
c61557b1
MB
112 ("python" ,python-wrapper)))
113 (home-page "https://grpc.io")
114 (synopsis "High performance universal RPC framework")
115 (description "gRPC is a modern high performance @dfn{Remote Procedure Call}
116(RPC) framework that can run in any environment. It can efficiently connect
117services in and across data centers with pluggable support for load balancing,
118tracing, health checking and authentication. It is also applicable in last
119mile of distributed computing to connect devices, mobile applications and
120browsers to backend services.")
121 (license license:asl2.0)))
f2c7513d 122
447fafe3
MB
123;; Some packages require this older version.
124(define-public grpc-1.16.1
125 (package
126 (inherit grpc)
127 (version "1.16.1")
128 (source (origin
129 (method git-fetch)
130 (uri (git-reference
b0e7b699 131 (url "https://github.com/grpc/grpc")
447fafe3
MB
132 (commit (string-append "v" version))))
133 (file-name (git-file-name "grpc" version))
134 (sha256
135 (base32
8cc103cb
MB
136 "1jimqz3115f9pli5w6ik9wi7mjc7ix6y7yrq4a1ab9fc3dalj7p2"))))
137 (arguments
138 (substitute-keyword-arguments (package-arguments grpc)
139 ((#:phases phases)
140 `(modify-phases ,phases
141 ;; Note: This would be nicer as a snippet, but that creates a tarball
142 ;; instead of a checkout and breaks assumptions made by the builder.
143 (add-after 'unpack 'rename-gettid
144 (lambda _
145 ;; Rename custom gettid() syscall wrapper to avoid conflict
146 ;; with gettid() from glibc 2.30.
147 (substitute* '("src/core/lib/gpr/log_linux.cc"
148 "src/core/lib/gpr/log_posix.cc"
149 "src/core/lib/iomgr/ev_epollex_linux.cc")
150 (("gettid\\(")
f0ce5a60 151 "sys_gettid("))))))))
73a5891d 152 (native-inputs
8394619b
LC
153 (modify-inputs (package-native-inputs grpc)
154 (delete "abseil-cpp" "protobuf")
155 (prepend abseil-cpp-20200923.3 protobuf-3.6)))))
447fafe3 156
f2c7513d
MB
157(define-public python-grpcio
158 (package
159 (name "python-grpcio")
9dec9122 160 (version "1.27.2")
f2c7513d
MB
161 (source
162 (origin
163 (method url-fetch)
164 (uri (pypi-uri "grpcio" version))
165 (sha256
166 (base32
9dec9122
MB
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))))
f2c7513d 183 (build-system python-build-system)
9dec9122
MB
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
8394619b 198 (list c-ares openssl zlib))
f2c7513d 199 (propagated-inputs
8394619b 200 (list python-six))
f2c7513d
MB
201 (home-page "https://grpc.io")
202 (synopsis "HTTP/2-based RPC framework")
203 (description "This package provides a Python library for communicating
204with the HTTP/2-based RPC framework gRPC.")
205 (license license:asl2.0)))
fbc1cbb5
KCB
206
207(define-public apache-thrift
208 (package
209 (name "apache-thrift")
88beddcc 210 (version "0.14.2")
fbc1cbb5
KCB
211 (source
212 (origin
213 (method git-fetch)
214 (uri (git-reference
b0e7b699 215 (url "https://github.com/apache/thrift")
fbc1cbb5
KCB
216 (commit (string-append "v" version))))
217 (file-name (git-file-name name version))
218 (sha256
88beddcc 219 (base32 "0wmnb3h0xq8qc5a9g9lliszh6qg254f5856h72viab46bizmdd4a"))))
fbc1cbb5
KCB
220 (build-system gnu-build-system)
221 (arguments
222 '(#:tests? #f
223 #:configure-flags
224 (list (string-append "--with-boost="
225 (assoc-ref %build-inputs "boost")))))
226 (native-inputs
8394619b
LC
227 (list autoconf
228 automake
229 libtool
230 pkg-config
231 flex
232 bison))
fbc1cbb5 233 (inputs
8394619b 234 (list boost libressl))
fbc1cbb5
KCB
235 (outputs '("out" "lib" "include"))
236 (home-page "https://thrift.apache.org/")
237 (synopsis
238 "Lightweight, language-independent software stack for point-to-point
239RPC")
240 (description
241 "Thrift provides clean abstractions and implementations for data
242transport, data serialization, and application level processing. The code
243generation system takes a simple definition language as input and generates
244code across programming languages that uses the abstracted stack to build
245interoperable RPC clients and servers.")
246 (license license:asl2.0)))