Added a patch for building/installing the bundled gRPC library.

This patch is cherry-picked from the following 2 commits in gRPC's
master branch and 2 PR's with at least one approval:

https://github.com/grpc/grpc/commit/807693b
https://github.com/grpc/grpc/commit/43f7acf
https://github.com/grpc/grpc/pull/11558
https://github.com/grpc/grpc/pull/11565

Review: https://reviews.apache.org/r/61576


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/70a41097
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/70a41097
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/70a41097

Branch: refs/heads/master
Commit: 70a410979508a5f09cf6c13f6bb7b77dd99f3292
Parents: b082dd8
Author: Chun-Hung Hsiao <chhs...@mesosphere.io>
Authored: Thu Aug 10 12:02:26 2017 -0700
Committer: Jie Yu <yujie....@gmail.com>
Committed: Thu Aug 10 16:55:05 2017 -0700

----------------------------------------------------------------------
 3rdparty/grpc-1.4.2.patch | 178 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 178 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/70a41097/3rdparty/grpc-1.4.2.patch
----------------------------------------------------------------------
diff --git a/3rdparty/grpc-1.4.2.patch b/3rdparty/grpc-1.4.2.patch
new file mode 100644
index 0000000..bce9871
--- /dev/null
+++ b/3rdparty/grpc-1.4.2.patch
@@ -0,0 +1,178 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index ac6804a7a8..27c40f0985 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -1504,6 +1504,8 @@ target_include_directories(grpc_cronet
+ target_link_libraries(grpc_cronet
+   ${_gRPC_BASELIB_LIBRARIES}
+   ${_gRPC_SSL_LIBRARIES}
++  ${_gRPC_ZLIB_LIBRARIES}
++  ${_gRPC_CARES_LIBRARIES}
+   ${_gRPC_ALLTARGETS_LIBRARIES}
+   gpr
+ )
+@@ -2094,6 +2096,8 @@ target_include_directories(grpc_unsecure
+ 
+ target_link_libraries(grpc_unsecure
+   ${_gRPC_BASELIB_LIBRARIES}
++  ${_gRPC_ZLIB_LIBRARIES}
++  ${_gRPC_CARES_LIBRARIES}
+   ${_gRPC_ALLTARGETS_LIBRARIES}
+   gpr
+ )
+diff --git a/Makefile b/Makefile
+index 3d2466fce9..8ac4dec61c 100644
+--- a/Makefile
++++ b/Makefile
+@@ -2650,7 +2650,7 @@ install-shared_cxx: shared_cxx strip-shared_cxx 
install-shared_c install-pkg-con
+ ifeq ($(SYSTEM),MINGW32)
+       $(Q) $(INSTALL) 
$(LIBDIR)/$(CONFIG)/libgrpc++$(SHARED_VERSION_CPP)-dll.a 
$(prefix)/lib/libgrpc++.a
+ else ifneq ($(SYSTEM),Darwin)
+-      $(Q) ln -sf 
$(SHARED_PREFIX)grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) 
$(prefix)/lib/libgrpc++.so.4
++      $(Q) ln -sf 
$(SHARED_PREFIX)grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) 
$(prefix)/lib/libgrpc++.so.1
+       $(Q) ln -sf 
$(SHARED_PREFIX)grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) 
$(prefix)/lib/libgrpc++.so
+ endif
+       $(E) "[INSTALL] Installing 
$(SHARED_PREFIX)grpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP)"
+@@ -2659,7 +2659,7 @@ endif
+ ifeq ($(SYSTEM),MINGW32)
+       $(Q) $(INSTALL) 
$(LIBDIR)/$(CONFIG)/libgrpc++_cronet$(SHARED_VERSION_CPP)-dll.a 
$(prefix)/lib/libgrpc++_cronet.a
+ else ifneq ($(SYSTEM),Darwin)
+-      $(Q) ln -sf 
$(SHARED_PREFIX)grpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) 
$(prefix)/lib/libgrpc++_cronet.so.4
++      $(Q) ln -sf 
$(SHARED_PREFIX)grpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) 
$(prefix)/lib/libgrpc++_cronet.so.1
+       $(Q) ln -sf 
$(SHARED_PREFIX)grpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) 
$(prefix)/lib/libgrpc++_cronet.so
+ endif
+       $(E) "[INSTALL] Installing 
$(SHARED_PREFIX)grpc++_error_details$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP)"
+@@ -2668,7 +2668,7 @@ endif
+ ifeq ($(SYSTEM),MINGW32)
+       $(Q) $(INSTALL) 
$(LIBDIR)/$(CONFIG)/libgrpc++_error_details$(SHARED_VERSION_CPP)-dll.a 
$(prefix)/lib/libgrpc++_error_details.a
+ else ifneq ($(SYSTEM),Darwin)
+-      $(Q) ln -sf 
$(SHARED_PREFIX)grpc++_error_details$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) 
$(prefix)/lib/libgrpc++_error_details.so.4
++      $(Q) ln -sf 
$(SHARED_PREFIX)grpc++_error_details$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) 
$(prefix)/lib/libgrpc++_error_details.so.1
+       $(Q) ln -sf 
$(SHARED_PREFIX)grpc++_error_details$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) 
$(prefix)/lib/libgrpc++_error_details.so
+ endif
+       $(E) "[INSTALL] Installing 
$(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP)"
+@@ -2677,7 +2677,7 @@ endif
+ ifeq ($(SYSTEM),MINGW32)
+       $(Q) $(INSTALL) 
$(LIBDIR)/$(CONFIG)/libgrpc++_reflection$(SHARED_VERSION_CPP)-dll.a 
$(prefix)/lib/libgrpc++_reflection.a
+ else ifneq ($(SYSTEM),Darwin)
+-      $(Q) ln -sf 
$(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) 
$(prefix)/lib/libgrpc++_reflection.so.4
++      $(Q) ln -sf 
$(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) 
$(prefix)/lib/libgrpc++_reflection.so.1
+       $(Q) ln -sf 
$(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) 
$(prefix)/lib/libgrpc++_reflection.so
+ endif
+       $(E) "[INSTALL] Installing 
$(SHARED_PREFIX)grpc++_unsecure$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP)"
+@@ -2686,7 +2686,7 @@ endif
+ ifeq ($(SYSTEM),MINGW32)
+       $(Q) $(INSTALL) 
$(LIBDIR)/$(CONFIG)/libgrpc++_unsecure$(SHARED_VERSION_CPP)-dll.a 
$(prefix)/lib/libgrpc++_unsecure.a
+ else ifneq ($(SYSTEM),Darwin)
+-      $(Q) ln -sf 
$(SHARED_PREFIX)grpc++_unsecure$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) 
$(prefix)/lib/libgrpc++_unsecure.so.4
++      $(Q) ln -sf 
$(SHARED_PREFIX)grpc++_unsecure$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) 
$(prefix)/lib/libgrpc++_unsecure.so.1
+       $(Q) ln -sf 
$(SHARED_PREFIX)grpc++_unsecure$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) 
$(prefix)/lib/libgrpc++_unsecure.so
+ endif
+ ifneq ($(SYSTEM),MINGW32)
+@@ -2703,7 +2703,7 @@ install-shared_csharp: shared_csharp strip-shared_csharp
+ ifeq ($(SYSTEM),MINGW32)
+       $(Q) $(INSTALL) 
$(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CSHARP)-dll.a 
$(prefix)/lib/libgrpc_csharp_ext.a
+ else ifneq ($(SYSTEM),Darwin)
+-      $(Q) ln -sf 
$(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) 
$(prefix)/lib/libgrpc_csharp_ext.so.4
++      $(Q) ln -sf 
$(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) 
$(prefix)/lib/libgrpc_csharp_ext.so.1
+       $(Q) ln -sf 
$(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) 
$(prefix)/lib/libgrpc_csharp_ext.so
+ endif
+ ifneq ($(SYSTEM),MINGW32)
+diff --git a/src/c-ares/CMakeLists.txt b/src/c-ares/CMakeLists.txt
+index 22acd51048..a5add7a64c 100644
+--- a/src/c-ares/CMakeLists.txt
++++ b/src/c-ares/CMakeLists.txt
+@@ -45,5 +45,53 @@ else()
+   add_definitions(-D_GNU_SOURCE=1)
+ endif()
+ 
+-file(GLOB lib_sources ../../third_party/cares/cares/*.c)
+-add_library(cares ${lib_sources})
++add_library(cares 
++  ../../third_party/cares/cares/ares__close_sockets.c
++  ../../third_party/cares/cares/ares__get_hostent.c
++  ../../third_party/cares/cares/ares__read_line.c
++  ../../third_party/cares/cares/ares__timeval.c
++  ../../third_party/cares/cares/ares_cancel.c
++  ../../third_party/cares/cares/ares_data.c
++  ../../third_party/cares/cares/ares_destroy.c
++  ../../third_party/cares/cares/ares_expand_name.c
++  ../../third_party/cares/cares/ares_expand_string.c
++  ../../third_party/cares/cares/ares_fds.c
++  ../../third_party/cares/cares/ares_free_hostent.c
++  ../../third_party/cares/cares/ares_free_string.c
++  ../../third_party/cares/cares/ares_getenv.c
++  ../../third_party/cares/cares/ares_gethostbyaddr.c
++  ../../third_party/cares/cares/ares_gethostbyname.c
++  ../../third_party/cares/cares/ares_getnameinfo.c
++  ../../third_party/cares/cares/ares_getsock.c
++  ../../third_party/cares/cares/ares_init.c
++  ../../third_party/cares/cares/ares_library_init.c
++  ../../third_party/cares/cares/ares_llist.c
++  ../../third_party/cares/cares/ares_mkquery.c
++  ../../third_party/cares/cares/ares_create_query.c
++  ../../third_party/cares/cares/ares_nowarn.c
++  ../../third_party/cares/cares/ares_options.c
++  ../../third_party/cares/cares/ares_parse_a_reply.c
++  ../../third_party/cares/cares/ares_parse_aaaa_reply.c
++  ../../third_party/cares/cares/ares_parse_mx_reply.c
++  ../../third_party/cares/cares/ares_parse_naptr_reply.c
++  ../../third_party/cares/cares/ares_parse_ns_reply.c
++  ../../third_party/cares/cares/ares_parse_ptr_reply.c
++  ../../third_party/cares/cares/ares_parse_soa_reply.c
++  ../../third_party/cares/cares/ares_parse_srv_reply.c
++  ../../third_party/cares/cares/ares_parse_txt_reply.c
++  ../../third_party/cares/cares/ares_platform.c
++  ../../third_party/cares/cares/ares_process.c
++  ../../third_party/cares/cares/ares_query.c
++  ../../third_party/cares/cares/ares_search.c
++  ../../third_party/cares/cares/ares_send.c
++  ../../third_party/cares/cares/ares_strcasecmp.c
++  ../../third_party/cares/cares/ares_strdup.c
++  ../../third_party/cares/cares/ares_strerror.c
++  ../../third_party/cares/cares/ares_timeout.c
++  ../../third_party/cares/cares/ares_version.c
++  ../../third_party/cares/cares/ares_writev.c
++  ../../third_party/cares/cares/bitncmp.c
++  ../../third_party/cares/cares/inet_net_pton.c
++  ../../third_party/cares/cares/inet_ntop.c
++  ../../third_party/cares/cares/windows_port.c
++)
+diff --git a/src/core/ext/census/tracing.c b/src/core/ext/census/tracing.c
+index 8b74628f4f..6bbeca27d9 100644
+--- a/src/core/ext/census/tracing.c
++++ b/src/core/ext/census/tracing.c
+@@ -36,7 +36,6 @@
+ #include <grpc/census.h>
+ #include <grpc/support/alloc.h>
+ #include <grpc/support/log.h>
+-#include <openssl/rand.h>
+ #include "src/core/ext/census/mlog.h"
+ 
+ void trace_start_span(const trace_span_context *span_ctxt,
+diff --git a/templates/CMakeLists.txt.template 
b/templates/CMakeLists.txt.template
+index 2252a7ea80..82ea9477c3 100644
+--- a/templates/CMakeLists.txt.template
++++ b/templates/CMakeLists.txt.template
+@@ -58,7 +58,7 @@
+       deps.append("${_gRPC_SSL_LIBRARIES}")
+     if target_dict.language == 'c++':
+       deps.append("${_gRPC_PROTOBUF_LIBRARIES}")
+-    if target_dict['name'] in ['grpc']:
++    if target_dict['name'] in ['grpc', 'grpc_cronet', 'grpc_unsecure']:
+       deps.append("${_gRPC_ZLIB_LIBRARIES}")
+       deps.append("${_gRPC_CARES_LIBRARIES}")
+     deps.append("${_gRPC_ALLTARGETS_LIBRARIES}")
+diff --git a/templates/Makefile.template b/templates/Makefile.template
+index a9dd171b84..2c638da3c8 100644
+--- a/templates/Makefile.template
++++ b/templates/Makefile.template
+@@ -1349,7 +1349,7 @@
+   ifeq ($(SYSTEM),MINGW32)
+       $(Q) $(INSTALL) 
$(LIBDIR)/$(CONFIG)/lib${lib.name}$(SHARED_VERSION_${lang_to_var[lib.language]})-dll.a
 $(prefix)/lib/lib${lib.name}.a
+   else ifneq ($(SYSTEM),Darwin)
+-      $(Q) ln -sf 
$(SHARED_PREFIX)${lib.name}$(SHARED_VERSION_${lang_to_var[lib.language]}).$(SHARED_EXT_${lang_to_var[lib.language]})
 $(prefix)/lib/lib${lib.name}.so.${settings.core_version.major}
++      $(Q) ln -sf 
$(SHARED_PREFIX)${lib.name}$(SHARED_VERSION_${lang_to_var[lib.language]}).$(SHARED_EXT_${lang_to_var[lib.language]})
 
$(prefix)/lib/lib${lib.name}.so.${settings.get(lang_to_var[lib.language].lower()
 + '_version').major}
+       $(Q) ln -sf 
$(SHARED_PREFIX)${lib.name}$(SHARED_VERSION_${lang_to_var[lib.language]}).$(SHARED_EXT_${lang_to_var[lib.language]})
 $(prefix)/lib/lib${lib.name}.so
+   endif
+   % endif

Reply via email to