Subject: [bug#69257] [PATCH rust-team v2 012/117] gnu: Add rust-grpcio-sys-0.12.

From: Herman Rimm <[email-masked]>
Date: Sun, 28 Apr 2024 20:54:38 +0200

* gnu/packages/crates-io.scm (rust-grpcio-sys-0.12): Add variable.

Change-Id: I63484c21aca89aa348eb160fcae41676a87c5564
---
 gnu/packages/crates-io.scm | 44 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)

diff --git a/gnu/packages/crates-io.scm b/gnu/packages/crates-io.scm
index a2ffce5820..faea57c6f7 100644
--- a/gnu/packages/crates-io.scm
+++ b/gnu/packages/crates-io.scm
@@ -70,6 +70,7 @@ (define-module (gnu packages crates-io)
   #:use-module (gnu packages)
   #:use-module (gnu packages acl)
   #:use-module (gnu packages admin)
+  #:use-module (gnu packages adns)
   #:use-module (gnu packages audio)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages avahi)
@@ -110,6 +111,8 @@ (define-module (gnu packages crates-io)
   #:use-module (gnu packages protobuf)
   #:use-module (gnu packages pulseaudio)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages regex)
+  #:use-module (gnu packages rpc)
   #:use-module (gnu packages rust)
   #:use-module (gnu packages rust-apps)
   #:use-module (gnu packages selinux)
@@ -30703,6 +30706,47 @@ (define-public rust-grpcio-compiler-0.12
       "This package provides a @code{gRPC} compiler for grpcio.")
     (license license:asl2.0)))
 
+(define-public rust-grpcio-sys-0.12
+  (package
+    (name "rust-grpcio-sys")
+    (version "0.12.1+1.46.5-patched")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (crate-uri "grpcio-sys" version))
+       (file-name (string-append name "-" version ".tar.gz"))
+       (sha256
+        (base32 "0qpcvarqzwd2lz43z02wxx6rkd3zhk7dm3a2y01l5x5n0cc5sqng"))
+       (modules '((guix build utils)))
+       (snippet '(begin
+                   (substitute* "Cargo.toml.orig"
+                     (("boringssl(-src)? = .*") "")
+                     ;; Do not use static zlib.
+                     ((", \"static\"") ""))
+                   (copy-file "Cargo.toml.orig" "Cargo.toml")))))
+    (build-system cargo-build-system)
+    (arguments
+     `(#:cargo-test-flags '("--features" "openssl") ; Required to build.
+       #:cargo-inputs (("rust-bindgen" ,rust-bindgen-0.59)
+                       ("rust-cc" ,rust-cc-1)
+                       ("rust-cmake" ,rust-cmake-0.1)
+                       ("rust-libc" ,rust-libc-0.2)
+                       ("rust-libz-sys" ,rust-libz-sys-1)
+                       ("rust-openssl-sys" ,rust-openssl-sys-0.9)
+                       ("rust-pkg-config" ,rust-pkg-config-0.3)
+                       ("rust-walkdir" ,rust-walkdir-2))
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'build 'use-pkg-config
+           (lambda _ (setenv "GRPCIO_SYS_USE_PKG_CONFIG" "1"))))))
+    (inputs (list abseil-cpp c-ares grpc-for-python-grpcio openssl re2 zlib))
+    (native-inputs (list pkg-config))
+    (home-page "https://github.com/tikv/grpc-rs")
+    (synopsis "FFI bindings to gRPC C core library")
+    (description "This package provides FFI bindings to the @code{gRPC}
+C core library.")
+    (license license:asl2.0)))
+
 (define-public rust-gumdrop-0.8
   (package
     (name "rust-gumdrop")
-- 
2.41.0