Merge pull request #132310 from alyssais/grpc

grpc: fix cross
This commit is contained in:
Ben Siraphob 2021-08-02 15:31:36 +07:00 committed by GitHub
commit ae3a055677
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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