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>
6 ;;; This file is part of GNU Guix.
8 ;;; GNU Guix is free software; you can redistribute it and/or modify it
9 ;;; under the terms of the GNU General Public License as published by
10 ;;; the Free Software Foundation; either version 3 of the License, or (at
11 ;;; your option) any later version.
13 ;;; GNU Guix is distributed in the hope that it will be useful, but
14 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;;; GNU General Public License for more details.
18 ;;; You should have received a copy of the GNU General Public License
19 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21 (define-module (gnu packages rpc)
22 #:use-module ((guix licenses) #:prefix license:)
23 #:use-module (guix packages)
24 #:use-module (guix git-download)
25 #:use-module (guix download)
26 #:use-module (guix utils)
27 #:use-module (guix build-system cmake)
28 #:use-module (guix build-system gnu)
29 #:use-module (guix build-system python)
30 #:use-module (gnu packages adns)
31 #:use-module (gnu packages autotools)
32 #:use-module (gnu packages bison)
33 #:use-module (gnu packages boost)
34 #:use-module (gnu packages compression)
35 #:use-module (gnu packages cpp)
36 #:use-module (gnu packages flex)
37 #:use-module (gnu packages pkg-config)
38 #:use-module (gnu packages protobuf)
39 #:use-module (gnu packages python)
40 #:use-module (gnu packages python-xyz)
41 #:use-module (gnu packages tls))
47 (outputs '("out" "static"))
51 (url "https://github.com/grpc/grpc")
52 (commit (string-append "v" version))))
53 (file-name (git-file-name name version))
56 "0czmbwnafc7jnrrq2fnac2av83vs2q7q0wy4k11w9zbpld7j5h6d"))))
57 (build-system cmake-build-system)
59 `(#:tests? #f ; no test target
61 (list "-DgRPC_ZLIB_PROVIDER=package"
62 "-DgRPC_ABSL_PROVIDER=package"
63 "-DgRPC_CARES_PROVIDER=package"
64 "-DgRPC_SSL_PROVIDER=package"
65 "-DgRPC_PROTOBUF_PROVIDER=package"
66 (string-append "-DCMAKE_INSTALL_PREFIX="
67 (assoc-ref %outputs "out"))
68 "-DCMAKE_INSTALL_LIBDIR=lib"
69 (string-append "-DCMAKE_INSTALL_RPATH="
70 (assoc-ref %outputs "out") "/lib")
71 "-DCMAKE_VERBOSE_MAKEFILE=ON")
73 (modify-phases %standard-phases
74 (add-before 'configure 'configure-shared
75 (lambda* (#:key (configure-flags '()) #:allow-other-keys)
76 (mkdir "../build-shared")
77 (with-directory-excursion "../build-shared"
80 "-DBUILD_SHARED_LIBS=ON"
83 `("-j" ,(number->string (parallel-job-count)))))))
84 (add-after 'install 'install-shared-libraries
86 (with-directory-excursion "../build-shared"
87 (invoke "make" "install"))))
88 (add-before 'strip 'move-static-libs
89 (lambda* (#:key outputs #:allow-other-keys)
90 (let ((out (assoc-ref outputs "out"))
91 (static (assoc-ref outputs "static")))
92 (mkdir-p (string-append static "/lib"))
93 (with-directory-excursion
94 (string-append out "/lib")
98 (string-append static "/lib/" file)))
99 (find-files "." "\\.a$"))))
102 `(("abseil-cpp" ,abseil-cpp)
103 ("c-ares" ,c-ares/cmake)
107 `(("protobuf" ,protobuf)
108 ("python" ,python-wrapper)))
109 (home-page "https://grpc.io")
110 (synopsis "High performance universal RPC framework")
111 (description "gRPC is a modern high performance @dfn{Remote Procedure Call}
112 (RPC) framework that can run in any environment. It can efficiently connect
113 services in and across data centers with pluggable support for load balancing,
114 tracing, health checking and authentication. It is also applicable in last
115 mile of distributed computing to connect devices, mobile applications and
116 browsers to backend services.")
117 (license license:asl2.0)))
119 ;; Some packages require this older version.
120 (define-public grpc-1.16.1
127 (url "https://github.com/grpc/grpc")
128 (commit (string-append "v" version))))
129 (file-name (git-file-name "grpc" version))
132 "1jimqz3115f9pli5w6ik9wi7mjc7ix6y7yrq4a1ab9fc3dalj7p2"))))
134 (substitute-keyword-arguments (package-arguments grpc)
136 `(modify-phases ,phases
137 ;; Note: This would be nicer as a snippet, but that creates a tarball
138 ;; instead of a checkout and breaks assumptions made by the builder.
139 (add-after 'unpack 'rename-gettid
141 ;; Rename custom gettid() syscall wrapper to avoid conflict
142 ;; with gettid() from glibc 2.30.
143 (substitute* '("src/core/lib/gpr/log_linux.cc"
144 "src/core/lib/gpr/log_posix.cc"
145 "src/core/lib/iomgr/ev_epollex_linux.cc")
150 (define-public python-grpcio
152 (name "python-grpcio")
157 (uri (pypi-uri "grpcio" version))
160 "0zl89jwcff9hkd8mi4yf3qbhns9vbv1s4x4vahm5mkpr7jwk5ras"))
161 (modules '((guix build utils) (ice-9 ftw)))
164 (with-directory-excursion "third_party"
165 ;; Delete the bundled source code of libraries that are possible
166 ;; to provide as inputs.
167 (for-each delete-file-recursively
176 (build-system python-build-system)
178 '(#:phases (modify-phases %standard-phases
179 (add-before 'build 'use-system-libraries
181 (setenv "GRPC_PYTHON_BUILD_SYSTEM_CARES" "1")
182 (setenv "GRPC_PYTHON_BUILD_SYSTEM_OPENSSL" "1")
183 (setenv "GRPC_PYTHON_BUILD_SYSTEM_ZLIB" "1")
185 (add-before 'build 'configure-compiler
187 (substitute* '("setup.py" "src/python/grpcio/commands.py")
195 `(("python-six" ,python-six)))
196 (home-page "https://grpc.io")
197 (synopsis "HTTP/2-based RPC framework")
198 (description "This package provides a Python library for communicating
199 with the HTTP/2-based RPC framework gRPC.")
200 (license license:asl2.0)))
202 (define-public apache-thrift
204 (name "apache-thrift")
210 (url "https://github.com/apache/thrift")
211 (commit (string-append "v" version))))
212 (file-name (git-file-name name version))
215 "17ckl7p7s3ga33yrjisilsimp80ansqxl54wvpkv0j7vx2zvc13y"))))
216 (build-system gnu-build-system)
220 (list (string-append "--with-boost="
221 (assoc-ref %build-inputs "boost")))))
223 `(("autoconf" ,autoconf)
224 ("automake" ,automake)
226 ("pkg-config" ,pkg-config)
231 ("libressl" ,libressl)))
232 (outputs '("out" "lib" "include"))
233 (home-page "https://thrift.apache.org/")
235 "Lightweight, language-independent software stack for point-to-point
238 "Thrift provides clean abstractions and implementations for data
239 transport, data serialization, and application level processing. The code
240 generation system takes a simple definition language as input and generates
241 code across programming languages that uses the abstracted stack to build
242 interoperable RPC clients and servers.")
243 (license license:asl2.0)))