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>
9 ;;; This file is part of GNU Guix.
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.
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.
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/>.
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))
51 (outputs '("out" "static"))
55 (url "https://github.com/grpc/grpc")
56 (commit (string-append "v" version))))
57 (file-name (git-file-name name version))
60 "1fs407hnlnm0b8sncjwys9rc7ia5nb7wxrpx39nq3pzzfs1lv3vq"))))
61 (build-system cmake-build-system)
63 `(#:tests? #f ; no test target
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")
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"
85 "-DBUILD_SHARED_LIBS=ON"
88 `("-j" ,(number->string (parallel-job-count)))))))
89 (add-after 'install 'install-shared-libraries
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")
103 (string-append static "/lib/" file)))
104 (find-files "." "\\.a$"))))
107 `(("abseil-cpp" ,abseil-cpp)
108 ("c-ares" ,c-ares/cmake)
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)))
126 ;; Some packages require this older version.
127 (define-public grpc-1.16.1
134 (url "https://github.com/grpc/grpc")
135 (commit (string-append "v" version))))
136 (file-name (git-file-name "grpc" version))
139 "1jimqz3115f9pli5w6ik9wi7mjc7ix6y7yrq4a1ab9fc3dalj7p2"))))
141 (substitute-keyword-arguments (package-arguments grpc)
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
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")
157 (define-public python-grpcio
159 (name "python-grpcio")
164 (uri (pypi-uri "grpcio" version))
167 "0zl89jwcff9hkd8mi4yf3qbhns9vbv1s4x4vahm5mkpr7jwk5ras"))
168 (modules '((guix build utils) (ice-9 ftw)))
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
183 (build-system python-build-system)
185 '(#:phases (modify-phases %standard-phases
186 (add-before 'build 'use-system-libraries
188 (setenv "GRPC_PYTHON_BUILD_SYSTEM_CARES" "1")
189 (setenv "GRPC_PYTHON_BUILD_SYSTEM_OPENSSL" "1")
190 (setenv "GRPC_PYTHON_BUILD_SYSTEM_ZLIB" "1")
192 (add-before 'build 'configure-compiler
194 (substitute* '("setup.py" "src/python/grpcio/commands.py")
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)))
209 (define-public apache-thrift
211 (name "apache-thrift")
217 (url "https://github.com/apache/thrift")
218 (commit (string-append "v" version))))
219 (file-name (git-file-name name version))
221 (base32 "1mj3c5jhjbg2sfkx9k9jqg88h1c5rswr9b606s02ny9ydf3akcny"))))
222 (build-system gnu-build-system)
226 (list (string-append "--with-boost="
227 (assoc-ref %build-inputs "boost")))))
229 `(("autoconf" ,autoconf)
230 ("automake" ,automake)
232 ("pkg-config" ,pkg-config)
237 ("libressl" ,libressl)))
238 (outputs '("out" "lib" "include"))
239 (home-page "https://thrift.apache.org/")
241 "Lightweight, language-independent software stack for point-to-point
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)))