about summary refs log tree commit diff
path: root/pkgs/development
diff options
context:
space:
mode:
authorBen Siraphob <bensiraphob@gmail.com>2021-08-02 15:31:36 +0700
committerGitHub <noreply@github.com>2021-08-02 15:31:36 +0700
commitae3a0556776bf4d5deef7ec8714ea06a477e4be5 (patch)
tree6ad1e72f77817f2448e85750850aaf508191075c /pkgs/development
parent038a9952a2f7746c505f4f2de78b7b518134f8b6 (diff)
parentb2402c5cd3aa0ef5d46e6f894079f20005d6dee5 (diff)
Merge pull request #132310 from alyssais/grpc
grpc: fix cross
Diffstat (limited to 'pkgs/development')
-rw-r--r--pkgs/development/libraries/grpc/default.nix8
1 files changed, 6 insertions, 2 deletions
diff --git a/pkgs/development/libraries/grpc/default.nix b/pkgs/development/libraries/grpc/default.nix
index 2bf843241a6aa..62f0c2e3d3148 100644
--- a/pkgs/development/libraries/grpc/default.nix
+++ b/pkgs/development/libraries/grpc/default.nix
@@ -1,4 +1,5 @@
-{ lib, stdenv, fetchFromGitHub, fetchpatch, cmake, zlib, c-ares, pkg-config, re2, openssl, protobuf
+{ lib, stdenv, fetchFromGitHub, fetchpatch, buildPackages
+, cmake, zlib, c-ares, pkg-config, re2, openssl, protobuf, grpc
 , abseil-cpp, libnsl
 }:
 
@@ -20,7 +21,8 @@ stdenv.mkDerivation rec {
     })
   ];
 
-  nativeBuildInputs = [ cmake pkg-config ];
+  nativeBuildInputs = [ cmake pkg-config ]
+    ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) grpc;
   propagatedBuildInputs = [ c-ares re2 zlib abseil-cpp ];
   buildInputs = [ c-ares.cmake-config openssl protobuf ]
     ++ lib.optionals stdenv.isLinux [ libnsl ];
@@ -35,6 +37,8 @@ stdenv.mkDerivation rec {
       "-DBUILD_SHARED_LIBS=ON"
       "-DCMAKE_SKIP_BUILD_RPATH=OFF"
       "-DCMAKE_CXX_STANDARD=17"
+    ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+      "-D_gRPC_PROTOBUF_PROTOC_EXECUTABLE=${buildPackages.protobuf}/bin/protoc"
     ];
 
   # CMake creates a build directory by default, this conflicts with the