aboutsummaryrefslogtreecommitdiff
path: root/package/grpc
diff options
context:
space:
mode:
Diffstat (limited to 'package/grpc')
-rw-r--r--package/grpc/0001-CMakeLists.txt-fix-cross-compilation-with-gRPC_BUILD.patch43
-rw-r--r--package/grpc/0001-target-build-using-host-plugin.patch52
-rw-r--r--package/grpc/0002-Properly-detect-the-availability-of-pthread_setname_.patch4
-rw-r--r--package/grpc/Config.in8
-rw-r--r--package/grpc/grpc.hash2
-rw-r--r--package/grpc/grpc.mk26
6 files changed, 63 insertions, 72 deletions
diff --git a/package/grpc/0001-CMakeLists.txt-fix-cross-compilation-with-gRPC_BUILD.patch b/package/grpc/0001-CMakeLists.txt-fix-cross-compilation-with-gRPC_BUILD.patch
new file mode 100644
index 0000000000..553be8cb99
--- /dev/null
+++ b/package/grpc/0001-CMakeLists.txt-fix-cross-compilation-with-gRPC_BUILD.patch
@@ -0,0 +1,43 @@
+From 268815d74ea34856c686dce9e9c23106b51f2782 Mon Sep 17 00:00:00 2001
+From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
+Date: Tue, 2 Feb 2021 21:46:29 +0100
+Subject: [PATCH] CMakeLists.txt: fix cross-compilation with
+ gRPC_BUILD_GRPC_CPP_PLUGIN=OFF
+
+When cross-compiling gRPC, a native version of 'grpc_cpp_plugin' is searched
+in the environment. For most use cases, a cross version of this file is not
+needed.
+
+However, when cross-building with -DgRPC_BUILD_GRPC_CPP_PLUGIN=OFF, there
+are some build errors, for example:
+
+make[3]: *** No rule to make target 'grpc_cpp_plugin', needed by 'gens/src/proto/grpc/reflection/v1alpha/reflection.grpc.pb.cc'. Stop.
+
+This is because there is still a hard dependency on 'grpc_cpp_plugin' for
+these targets, not taking into account the cross-compilation case.
+
+Fix by depending on the variable gRPC_CPP_PLUGIN, which is set correctly for
+either cross or native case.
+
+Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
+
+---
+ CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 6bdae22083..08aea609f7 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -317,7 +317,7 @@ function(protobuf_generate_grpc_cpp)
+ --plugin=protoc-gen-grpc=${_gRPC_CPP_PLUGIN}
+ ${_protobuf_include_path}
+ ${REL_FIL}
+- DEPENDS ${ABS_FIL} ${_gRPC_PROTOBUF_PROTOC} grpc_cpp_plugin
++ DEPENDS ${ABS_FIL} ${_gRPC_PROTOBUF_PROTOC} ${_gRPC_CPP_PLUGIN}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ COMMENT "Running gRPC C++ protocol buffer compiler on ${FIL}"
+ VERBATIM)
+--
+2.26.2
+
diff --git a/package/grpc/0001-target-build-using-host-plugin.patch b/package/grpc/0001-target-build-using-host-plugin.patch
deleted file mode 100644
index 5b3c6a6fae..0000000000
--- a/package/grpc/0001-target-build-using-host-plugin.patch
+++ /dev/null
@@ -1,52 +0,0 @@
-From aa18148e392ef28275a182db34397ccb66fb4617 Mon Sep 17 00:00:00 2001
-From: Robert Rose <robertroyrose@gmail.com>
-Date: Wed, 28 Nov 2018 09:41:52 -0800
-Subject: [PATCH] CMakeLists.txt: allow passing a pre-existing grpc_cpp_plugin
-
-The grpc_cpp_plugin is meant to be executed during the build process
-of grpc. As such, in cross-compilation contexts, this program needs to
-be built for the host machine and not the target machine. In order to
-allow this, this commit adds an option gRPC_NATIVE_CPP_PLUGIN that can
-be passed on the command line, with the path to an existing
-grpc_cpp_plugin binary. If not passed, grpc_cpp_plugin is built as
-usual.
-
-Signed-off-by: Robert Rose <robertroyrose@gmail.com>
----
- CMakeLists.txt | 13 +++++++++++++
- 1 file changed, 13 insertions(+)
-
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index be695c2..45c2fcb 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -11043,6 +11043,18 @@ target_link_libraries(grpc_cli
- endif()
- if(gRPC_BUILD_CODEGEN AND gRPC_BUILD_GRPC_CPP_PLUGIN)
-
-+if (gRPC_NATIVE_CPP_PLUGIN)
-+
-+add_executable(grpc_cpp_plugin
-+ IMPORTED
-+)
-+
-+set_property(TARGET grpc_cpp_plugin
-+ PROPERTY IMPORTED_LOCATION ${gRPC_NATIVE_CPP_PLUGIN}
-+)
-+
-+else()
-+
- add_executable(grpc_cpp_plugin
- src/compiler/cpp_plugin.cc
- )
-@@ -11077,6 +11089,7 @@ if(gRPC_INSTALL)
- ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR}
- )
- endif()
-+endif()
-
- endif()
- if(gRPC_BUILD_CODEGEN AND gRPC_BUILD_GRPC_CSHARP_PLUGIN)
---
-2.26.2
-
diff --git a/package/grpc/0002-Properly-detect-the-availability-of-pthread_setname_.patch b/package/grpc/0002-Properly-detect-the-availability-of-pthread_setname_.patch
index c8b1dc8e73..32493ac1a0 100644
--- a/package/grpc/0002-Properly-detect-the-availability-of-pthread_setname_.patch
+++ b/package/grpc/0002-Properly-detect-the-availability-of-pthread_setname_.patch
@@ -20,7 +20,7 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt
index 45c2fcb..0b2be4f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
-@@ -180,6 +180,12 @@ if (NOT DEFINED CMAKE_POSITION_INDEPENDENT_CODE)
+@@ -208,6 +208,12 @@ if (NOT DEFINED CMAKE_POSITION_INDEPENDENT_CODE)
endif()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
@@ -37,7 +37,7 @@ diff --git a/include/grpc/impl/codegen/port_platform.h b/include/grpc/impl/codeg
index 4f213ff..55ecd9d 100644
--- a/include/grpc/impl/codegen/port_platform.h
+++ b/include/grpc/impl/codegen/port_platform.h
-@@ -163,7 +163,9 @@
+@@ -168,7 +168,9 @@
#endif /* _LP64 */
#ifdef __GLIBC__
#define GPR_POSIX_CRASH_HANDLER 1
diff --git a/package/grpc/Config.in b/package/grpc/Config.in
index 0270b38c35..d1bf0d078d 100644
--- a/package/grpc/Config.in
+++ b/package/grpc/Config.in
@@ -3,7 +3,8 @@ config BR2_PACKAGE_GRPC
depends on BR2_INSTALL_LIBSTDCPP
depends on BR2_TOOLCHAIN_HAS_THREADS # protobuf, re2
depends on BR2_PACKAGE_PROTOBUF_ARCH_SUPPORTS # protobuf
- depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 # protobuf, re2
+ depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 # protobuf, re2, libabseil-cpp
+ depends on BR2_HOST_GCC_AT_LEAST_4_9 # host-libabseil-cpp
depends on !BR2_STATIC_LIBS # protobuf, libabseil-cpp
depends on BR2_TOOLCHAIN_HAS_SYNC_4 || BR2_TOOLCHAIN_HAS_ATOMIC
depends on BR2_PACKAGE_LIBABSEIL_CPP_ARCH_SUPPORTS
@@ -19,9 +20,10 @@ config BR2_PACKAGE_GRPC
http://github.com/grpc/grpc
-comment "grpc needs a toolchain w/ C++, threads, dynamic library, gcc >= 4.8"
+comment "grpc needs a toolchain w/ C++, threads, dynamic library, gcc >= 4.9, host gcc >= 4.9"
depends on BR2_PACKAGE_LIBABSEIL_CPP_ARCH_SUPPORTS
depends on BR2_TOOLCHAIN_HAS_SYNC_4 || BR2_TOOLCHAIN_HAS_ATOMIC
depends on !BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_HAS_THREADS \
- || BR2_STATIC_LIBS || !BR2_TOOLCHAIN_GCC_AT_LEAST_4_8
+ || BR2_STATIC_LIBS || !BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 \
+ || !BR2_HOST_GCC_AT_LEAST_4_9
depends on BR2_PACKAGE_PROTOBUF_ARCH_SUPPORTS
diff --git a/package/grpc/grpc.hash b/package/grpc/grpc.hash
index 20368068d9..52d25fc5ed 100644
--- a/package/grpc/grpc.hash
+++ b/package/grpc/grpc.hash
@@ -1,3 +1,3 @@
# Locally computed
-sha256 1236514199d3deb111a6dd7f6092f67617cd2b147f7eda7adbafccea95de7381 grpc-1.31.0.tar.gz
+sha256 27dd2fc5c9809ddcde8eb6fa1fa278a3486566dfc28335fca13eb8df8bd3b958 grpc-1.35.0.tar.gz
sha256 cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30 LICENSE
diff --git a/package/grpc/grpc.mk b/package/grpc/grpc.mk
index 613f45dacc..27b28deff3 100644
--- a/package/grpc/grpc.mk
+++ b/package/grpc/grpc.mk
@@ -4,7 +4,7 @@
#
################################################################################
-GRPC_VERSION = 1.31.0
+GRPC_VERSION = 1.35.0
GRPC_SITE = $(call github,grpc,grpc,v$(GRPC_VERSION))
GRPC_LICENSE = Apache-2.0
GRPC_LICENSE_FILES = LICENSE
@@ -12,7 +12,7 @@ GRPC_LICENSE_FILES = LICENSE
GRPC_INSTALL_STAGING = YES
# Need to use host grpc_cpp_plugin during cross compilation.
-GRPC_DEPENDENCIES = c-ares host-grpc openssl protobuf re2 zlib libabseil-cpp
+GRPC_DEPENDENCIES = c-ares host-grpc libabseil-cpp openssl protobuf re2 zlib
HOST_GRPC_DEPENDENCIES = host-c-ares host-libabseil-cpp host-openssl host-protobuf \
host-re2 host-zlib
@@ -21,14 +21,20 @@ HOST_GRPC_DEPENDENCIES = host-c-ares host-libabseil-cpp host-openssl host-protob
# which doesn't do this. These CARES settings trick the gRPC cmake code into
# not looking for c-ares at all and yet still linking with the library.
GRPC_CONF_OPTS = \
+ -DgRPC_ABSL_PROVIDER=package \
-D_gRPC_CARES_LIBRARIES=cares \
-DgRPC_CARES_PROVIDER=none \
-DgRPC_PROTOBUF_PROVIDER=package \
-DgRPC_RE2_PROVIDER=package \
-DgRPC_SSL_PROVIDER=package \
-DgRPC_ZLIB_PROVIDER=package \
- -DgRPC_ABSL_PROVIDER=package \
- -DgRPC_NATIVE_CPP_PLUGIN=$(HOST_DIR)/bin/grpc_cpp_plugin
+ -DgRPC_BUILD_GRPC_CPP_PLUGIN=OFF \
+ -DgRPC_BUILD_GRPC_CSHARP_PLUGIN=OFF \
+ -DgRPC_BUILD_GRPC_NODE_PLUGIN=OFF \
+ -DgRPC_BUILD_GRPC_OBJECTIVE_C_PLUGIN=OFF \
+ -DgRPC_BUILD_GRPC_PHP_PLUGIN=OFF \
+ -DgRPC_BUILD_GRPC_PYTHON_PLUGIN=OFF \
+ -DgRPC_BUILD_GRPC_RUBY_PLUGIN=OFF
# grpc can use __atomic builtins, so we need to link with
# libatomic when available
@@ -64,21 +70,13 @@ GRPC_CONF_OPTS += \
-DCMAKE_CXX_FLAGS="$(GRPC_CXXFLAGS)"
HOST_GRPC_CONF_OPTS = \
+ -DgRPC_ABSL_PROVIDER=package \
-D_gRPC_CARES_LIBRARIES=cares \
-DgRPC_CARES_PROVIDER=none \
-DgRPC_PROTOBUF_PROVIDER=package \
-DgRPC_RE2_PROVIDER=package \
-DgRPC_SSL_PROVIDER=package \
- -DgRPC_ZLIB_PROVIDER=package \
- -DgRPC_ABSL_PROVIDER=package
-
-# With gcc 4.8 (at least on ubuntu) there is a bug in LTO which breaks
-# the linkage of the grpc_cpp_plugin with libprotobuf and pthread. This
-# additional flag fixes this.
-ifeq ($(BR2_HOST_GCC_AT_LEAST_4_9),)
-HOST_GRPC_CONF_OPTS += \
- -DCMAKE_EXE_LINKER_FLAGS="$(HOST_LDFLAGS) -Wl,--no-as-needed"
-endif
+ -DgRPC_ZLIB_PROVIDER=package
$(eval $(cmake-package))
$(eval $(host-cmake-package))