Merge pull request #45143 from LnL7/darwin-grpc

grpc: fix darwin build
This commit is contained in:
xeji 2018-08-17 18:57:32 +02:00 committed by GitHub
commit 7569513ef8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 4 deletions

View file

@ -1,4 +1,4 @@
{ stdenv, fetchurl, writeTextDir }:
{ targetPlatform, stdenv, fetchurl, writeTextDir }:
let self =
stdenv.mkDerivation rec {
@ -36,12 +36,12 @@ stdenv.mkDerivation rec {
set_target_properties(c-ares::cares PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${self}/include"
INTERFACE_LINK_LIBRARIES "nsl;rt"
${stdenv.lib.optionalString stdenv.isLinux ''INTERFACE_LINK_LIBRARIES "nsl;rt"''}
)
set_property(TARGET c-ares::cares APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(c-ares::cares PROPERTIES
IMPORTED_LOCATION_RELEASE "${self}/lib/libcares.so.2.2.0"
IMPORTED_SONAME_RELEASE "libcares.so.2"
IMPORTED_LOCATION_RELEASE "${self}/lib/libcares${targetPlatform.extensions.sharedLibrary}"
IMPORTED_SONAME_RELEASE "libcares${targetPlatform.extensions.sharedLibrary}"
)
add_library(c-ares::cares_shared INTERFACE IMPORTED)
set_target_properties(c-ares::cares_shared PROPERTIES INTERFACE_LINK_LIBRARIES "c-ares::cares")

View file

@ -9,6 +9,7 @@ stdenv.mkDerivation rec {
};
nativeBuildInputs = [ cmake pkgconfig ];
buildInputs = [ zlib c-ares c-ares.cmake-config openssl protobuf gflags ];
cmakeFlags =
[ "-DgRPC_ZLIB_PROVIDER=package"
"-DgRPC_CARES_PROVIDER=package"
@ -16,11 +17,19 @@ stdenv.mkDerivation rec {
"-DgRPC_PROTOBUF_PROVIDER=package"
"-DgRPC_GFLAGS_PROVIDER=package"
];
# CMake creates a build directory by default, this conflicts with the
# basel BUILD file on case-insensitive filesystems.
preConfigure = ''
rm -vf BUILD
'';
enableParallelBuilds = true;
meta = with stdenv.lib; {
description = "The C based gRPC (C++, Python, Ruby, Objective-C, PHP, C#)";
license = licenses.asl20;
maintainers = [ maintainers.lnl7 ];
homepage = https://grpc.io/;
};
}