aboutsummaryrefslogtreecommitdiffstats
path: root/meta-networking
diff options
context:
space:
mode:
authorArmin Kuster <akuster808@gmail.com>2018-03-05 16:46:25 -0800
committerArmin Kuster <akuster808@gmail.com>2018-09-24 06:49:24 -0700
commit35c6359155d6082d279ba86b94125d684d435dad (patch)
treed8be5d9637697222d7611c07e405826d44d19ba4 /meta-networking
parent7fbbbead470e35649305d9372887f84850d2135d (diff)
downloadmeta-openembedded-contrib-35c6359155d6082d279ba86b94125d684d435dad.tar.gz
grpc: move it from oe to networking layer
grpc has dependancy on meta-networking packages. Signed-off-by: Armin Kuster <akuster808@gmail.com>
Diffstat (limited to 'meta-networking')
-rw-r--r--meta-networking/recipes-devtools/grpc/grpc/0001-CMakeLists.txt-Fix-grpc_cpp_plugin-path-during-cross.patch68
-rw-r--r--meta-networking/recipes-devtools/grpc/grpc/0001-CMakeLists.txt-Fix-libraries-installation-for-Linux.patch166
-rw-r--r--meta-networking/recipes-devtools/grpc/grpc/0004-CMakeLists.txt-Find-c-ares-in-target-sysroot-alone.patch42
-rw-r--r--meta-networking/recipes-devtools/grpc/grpc_1.8.5.bb36
4 files changed, 312 insertions, 0 deletions
diff --git a/meta-networking/recipes-devtools/grpc/grpc/0001-CMakeLists.txt-Fix-grpc_cpp_plugin-path-during-cross.patch b/meta-networking/recipes-devtools/grpc/grpc/0001-CMakeLists.txt-Fix-grpc_cpp_plugin-path-during-cross.patch
new file mode 100644
index 0000000000..5774e62eb1
--- /dev/null
+++ b/meta-networking/recipes-devtools/grpc/grpc/0001-CMakeLists.txt-Fix-grpc_cpp_plugin-path-during-cross.patch
@@ -0,0 +1,68 @@
+From cc6dbabea0e452ebc93682df860a79ed9a45722e Mon Sep 17 00:00:00 2001
+From: Alexey Firago <alexey_firago@mentor.com>
+Date: Fri, 20 Oct 2017 00:04:19 +0300
+Subject: [PATCH] CMakeLists.txt: Fix grpc_cpp_plugin path during
+ cross-compilation
+
+Signed-off-by: Alexey Firago <alexey_firago@mentor.com>
+---
+ CMakeLists.txt | 9 ++++++++-
+ templates/CMakeLists.txt.template | 9 ++++++++-
+ 2 files changed, 16 insertions(+), 2 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index f9cd630..9663934 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -328,6 +328,13 @@ function(protobuf_generate_grpc_cpp)
+ return()
+ endif()
+
++ #if cross-compiling, find host plugin
++ if(CMAKE_CROSSCOMPILING)
++ find_program(gRPC_CPP_PLUGIN grpc_cpp_plugin)
++ else()
++ set(gRPC_CPP_PLUGIN $<TARGET_FILE:grpc_cpp_plugin>)
++ endif()
++
+ set(_protobuf_include_path -I . -I ${PROTOBUF_WELLKNOWN_IMPORT_DIR})
+ foreach(FIL ${ARGN})
+ get_filename_component(ABS_FIL ${FIL} ABSOLUTE)
+@@ -345,7 +352,7 @@ function(protobuf_generate_grpc_cpp)
+ COMMAND ${_gRPC_PROTOBUF_PROTOC_EXECUTABLE}
+ ARGS --grpc_out=generate_mock_code=true:${_gRPC_PROTO_GENS_DIR}
+ --cpp_out=${_gRPC_PROTO_GENS_DIR}
+- --plugin=protoc-gen-grpc=$<TARGET_FILE:grpc_cpp_plugin>
++ --plugin=protoc-gen-grpc=${gRPC_CPP_PLUGIN}
+ ${_protobuf_include_path}
+ ${REL_FIL}
+ DEPENDS ${ABS_FIL} ${_gRPC_PROTOBUF_PROTOC} grpc_cpp_plugin
+diff --git a/templates/CMakeLists.txt.template b/templates/CMakeLists.txt.template
+index 64daf04..a7e8629 100644
+--- a/templates/CMakeLists.txt.template
++++ b/templates/CMakeLists.txt.template
+@@ -373,6 +373,13 @@
+ return()
+ endif()
+
++ #if cross-compiling, find host plugin
++ if(CMAKE_CROSSCOMPILING)
++ find_program(gRPC_CPP_PLUGIN grpc_cpp_plugin)
++ else()
++ set(gRPC_CPP_PLUGIN $<TARGET_FILE:grpc_cpp_plugin>)
++ endif()
++
+ set(_protobuf_include_path -I . -I <%text>${PROTOBUF_WELLKNOWN_IMPORT_DIR}</%text>)
+ foreach(FIL <%text>${ARGN}</%text>)
+ get_filename_component(ABS_FIL <%text>${FIL}</%text> ABSOLUTE)
+@@ -390,7 +397,7 @@
+ COMMAND <%text>${_gRPC_PROTOBUF_PROTOC_EXECUTABLE}</%text>
+ ARGS --grpc_out=<%text>generate_mock_code=true:${_gRPC_PROTO_GENS_DIR}</%text>
+ --cpp_out=<%text>${_gRPC_PROTO_GENS_DIR}</%text>
+- --plugin=protoc-gen-grpc=$<TARGET_FILE:grpc_cpp_plugin>
++ --plugin=protoc-gen-grpc=${gRPC_CPP_PLUGIN}
+ <%text>${_protobuf_include_path}</%text>
+ <%text>${REL_FIL}</%text>
+ DEPENDS <%text>${ABS_FIL}</%text> <%text>${_gRPC_PROTOBUF_PROTOC}</%text> grpc_cpp_plugin
+--
+2.7.4
diff --git a/meta-networking/recipes-devtools/grpc/grpc/0001-CMakeLists.txt-Fix-libraries-installation-for-Linux.patch b/meta-networking/recipes-devtools/grpc/grpc/0001-CMakeLists.txt-Fix-libraries-installation-for-Linux.patch
new file mode 100644
index 0000000000..f8d965294a
--- /dev/null
+++ b/meta-networking/recipes-devtools/grpc/grpc/0001-CMakeLists.txt-Fix-libraries-installation-for-Linux.patch
@@ -0,0 +1,166 @@
+From 8e9bf962a45a82f1c2eb5858e29fa89a3a60b564 Mon Sep 17 00:00:00 2001
+From: Alexey Firago <alexey_firago@mentor.com>
+Date: Mon, 30 Oct 2017 23:24:49 +0300
+Subject: [PATCH 1/4] CMakeLists.txt: Fix libraries installation for Linux
+
+* Set libs versions as in Makefile
+
+Signed-off-by: Alexey Firago <alexey_firago@mentor.com>
+
+%% original patch: 0001-CMakeLists.txt-Fix-libraries-installation-for-Linux.patch
+---
+ CMakeLists.txt | 55 +++++++++++++++++++++++++++++++++++
+ CMakeLists.txt => CMakeLists.txt.orig | 0
+ 2 files changed, 55 insertions(+)
+ copy CMakeLists.txt => CMakeLists.txt.orig (100%)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index b1a49df..13e64ac 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -30,6 +30,15 @@ set(PACKAGE_TARNAME "${PACKAGE_NAME}-${PACKAGE_VERSION}")
+ set(PACKAGE_BUGREPORT "https://github.com/grpc/grpc/issues/")
+ project(${PACKAGE_NAME} C CXX)
+
++set (CORE_VERSION_MAJOR "4")
++set (CORE_VERSION "4.0.0")
++
++set (CPP_VERSION_MAJOR "1")
++set (CPP_VERSION "${PACKAGE_VERSION}")
++
++set (CSHARP_VERSION_MAJOR "1")
++set (CSHARP_VERSION "${PACKAGE_VERSION}")
++
+ set(gRPC_INSTALL_BINDIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables")
+ set(gRPC_INSTALL_LIBDIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries")
+ set(gRPC_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "Installation directory for headers")
+@@ -841,6 +850,10 @@ if(WIN32 AND MSVC)
+ endif()
+ endif()
+
++if(_gRPC_PLATFORM_LINUX)
++ set_property(TARGET gpr PROPERTY VERSION ${CORE_VERSION})
++ set_property(TARGET gpr PROPERTY SOVERSION ${CORE_VERSION_MAJOR})
++endif()
+
+ target_include_directories(gpr
+ PUBLIC $<INSTALL_INTERFACE:${gRPC_INSTALL_INCLUDEDIR}> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
+@@ -1221,6 +1234,10 @@ if(WIN32 AND MSVC)
+ endif()
+ endif()
+
++if(_gRPC_PLATFORM_LINUX)
++ set_property(TARGET grpc PROPERTY VERSION ${CORE_VERSION})
++ set_property(TARGET grpc PROPERTY SOVERSION ${CORE_VERSION_MAJOR})
++endif()
+
+ target_include_directories(grpc
+ PUBLIC $<INSTALL_INTERFACE:${gRPC_INSTALL_INCLUDEDIR}> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
+@@ -1535,6 +1552,10 @@ if(WIN32 AND MSVC)
+ endif()
+ endif()
+
++if(_gRPC_PLATFORM_LINUX)
++ set_property(TARGET grpc_cronet PROPERTY VERSION ${CORE_VERSION})
++ set_property(TARGET grpc_cronet PROPERTY SOVERSION ${CORE_VERSION_MAJOR})
++endif()
+
+ target_include_directories(grpc_cronet
+ PUBLIC $<INSTALL_INTERFACE:${gRPC_INSTALL_INCLUDEDIR}> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
+@@ -2377,6 +2398,10 @@ if(WIN32 AND MSVC)
+ endif()
+ endif()
+
++if(_gRPC_PLATFORM_LINUX)
++ set_property(TARGET grpc_unsecure PROPERTY VERSION ${CORE_VERSION})
++ set_property(TARGET grpc_unsecure PROPERTY SOVERSION ${CORE_VERSION_MAJOR})
++endif()
+
+ target_include_directories(grpc_unsecure
+ PUBLIC $<INSTALL_INTERFACE:${gRPC_INSTALL_INCLUDEDIR}> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
+@@ -2592,6 +2617,10 @@ if(WIN32 AND MSVC)
+ endif()
+ endif()
+
++if(_gRPC_PLATFORM_LINUX)
++ set_property(TARGET grpc++ PROPERTY VERSION ${CPP_VERSION})
++ set_property(TARGET grpc++ PROPERTY SOVERSION ${CPP_VERSION_MAJOR})
++endif()
+
+ target_include_directories(grpc++
+ PUBLIC $<INSTALL_INTERFACE:${gRPC_INSTALL_INCLUDEDIR}> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
+@@ -3078,6 +3107,10 @@ if(WIN32 AND MSVC)
+ endif()
+ endif()
+
++if(_gRPC_PLATFORM_LINUX)
++ set_property(TARGET grpc++_cronet PROPERTY VERSION ${CPP_VERSION})
++ set_property(TARGET grpc++_cronet PROPERTY SOVERSION ${CPP_VERSION_MAJOR})
++endif()
+
+ target_include_directories(grpc++_cronet
+ PUBLIC $<INSTALL_INTERFACE:${gRPC_INSTALL_INCLUDEDIR}> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
+@@ -3282,6 +3315,11 @@ protobuf_generate_grpc_cpp(
+ src/proto/grpc/status/status.proto
+ )
+
++if(_gRPC_PLATFORM_LINUX)
++ set_property(TARGET grpc++_error_details PROPERTY VERSION ${CPP_VERSION})
++ set_property(TARGET grpc++_error_details PROPERTY SOVERSION ${CPP_VERSION_MAJOR})
++endif()
++
+ target_include_directories(grpc++_error_details
+ PUBLIC $<INSTALL_INTERFACE:${gRPC_INSTALL_INCLUDEDIR}> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
+ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
+@@ -3408,6 +3446,11 @@ protobuf_generate_grpc_cpp(
+ src/proto/grpc/reflection/v1alpha/reflection.proto
+ )
+
++if(_gRPC_PLATFORM_LINUX)
++ set_property(TARGET grpc++_reflection PROPERTY VERSION ${CPP_VERSION})
++ set_property(TARGET grpc++_reflection PROPERTY SOVERSION ${CPP_VERSION_MAJOR})
++endif()
++
+ target_include_directories(grpc++_reflection
+ PUBLIC $<INSTALL_INTERFACE:${gRPC_INSTALL_INCLUDEDIR}> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
+ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
+@@ -3827,6 +3870,10 @@ if(WIN32 AND MSVC)
+ endif()
+ endif()
+
++if(_gRPC_PLATFORM_LINUX)
++ set_property(TARGET grpc++_unsecure PROPERTY VERSION ${CPP_VERSION})
++ set_property(TARGET grpc++_unsecure PROPERTY SOVERSION ${CPP_VERSION_MAJOR})
++endif()
+
+ target_include_directories(grpc++_unsecure
+ PUBLIC $<INSTALL_INTERFACE:${gRPC_INSTALL_INCLUDEDIR}> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
+@@ -4140,6 +4187,10 @@ if(WIN32 AND MSVC)
+ endif()
+ endif()
+
++if(_gRPC_PLATFORM_LINUX)
++ set_property(TARGET grpc_plugin_support PROPERTY VERSION ${CORE_VERSION})
++ set_property(TARGET grpc_plugin_support PROPERTY SOVERSION ${CORE_VERSION_MAJOR})
++endif()
+
+ target_include_directories(grpc_plugin_support
+ PUBLIC $<INSTALL_INTERFACE:${gRPC_INSTALL_INCLUDEDIR}> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
+@@ -4649,6 +4700,10 @@ if(WIN32 AND MSVC)
+ endif()
+ endif()
+
++if(_gRPC_PLATFORM_LINUX)
++ set_property(TARGET grpc_csharp_ext PROPERTY VERSION ${CSHARP_VERSION})
++ set_property(TARGET grpc_csharp_ext PROPERTY SOVERSION ${CSHARP_VERSION_MAJOR})
++endif()
+
+ target_include_directories(grpc_csharp_ext
+ PUBLIC $<INSTALL_INTERFACE:${gRPC_INSTALL_INCLUDEDIR}> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
+diff --git a/CMakeLists.txt b/CMakeLists.txt.orig
+similarity index 100%
+copy from CMakeLists.txt
+copy to CMakeLists.txt.orig
+--
+2.16.1
+
diff --git a/meta-networking/recipes-devtools/grpc/grpc/0004-CMakeLists.txt-Find-c-ares-in-target-sysroot-alone.patch b/meta-networking/recipes-devtools/grpc/grpc/0004-CMakeLists.txt-Find-c-ares-in-target-sysroot-alone.patch
new file mode 100644
index 0000000000..8985022fad
--- /dev/null
+++ b/meta-networking/recipes-devtools/grpc/grpc/0004-CMakeLists.txt-Find-c-ares-in-target-sysroot-alone.patch
@@ -0,0 +1,42 @@
+From a498b56ba96948015f0f2784b2ab8296946716ee Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 1 Feb 2018 23:28:17 -0800
+Subject: [PATCH 4/4] CMakeLists.txt: Find c-ares in target sysroot alone
+
+Current code lets it look into native sysroot as well
+which is then preferred during cross compile and it adds
+absolute path to libcares into linker flags
+on heterogenous architectures linker complains and build
+fails
+
+| /mnt/a/oe/build/tmp/work/cortexa7t2hf-neon-vfpv4-bec-linux-gnueabi/grpc/1.8.5-r0/recipe-sysroot-native/usr/lib/lib
+cares.so.2.2.0: file not recognized: File format not recognized
+| collect2: error: ld returned 1 exit status
+
+Upstream-Status: Pending
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ CMakeLists.txt | 6 ++----
+ 1 file changed, 2 insertions(+), 4 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 1d7eef1..058423d 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -153,10 +153,8 @@ if("${gRPC_CARES_PROVIDER}" STREQUAL "module")
+ set(gRPC_INSTALL FALSE)
+ endif()
+ elseif("${gRPC_CARES_PROVIDER}" STREQUAL "package")
+- find_package(c-ares REQUIRED CONFIG)
+- if(TARGET c-ares::cares)
+- set(_gRPC_CARES_LIBRARIES c-ares::cares)
+- endif()
++ find_package(c-ares REQUIRED)
++ set(_gRPC_CARES_LIBRARIES cares)
+ set(_gRPC_FIND_CARES "if(NOT c-ares_FOUND)\n find_package(c-ares CONFIG)\nendif()")
+ endif()
+
+--
+2.16.1
+
diff --git a/meta-networking/recipes-devtools/grpc/grpc_1.8.5.bb b/meta-networking/recipes-devtools/grpc/grpc_1.8.5.bb
new file mode 100644
index 0000000000..0883ec176b
--- /dev/null
+++ b/meta-networking/recipes-devtools/grpc/grpc_1.8.5.bb
@@ -0,0 +1,36 @@
+DESCRIPTION = "A high performance, open source, general-purpose RPC framework. \
+Provides gRPC libraries for multiple languages written on top of shared C core library \
+(C++, Node.js, Python, Ruby, Objective-C, PHP, C#)"
+HOMEPAGE = "https://github.com/grpc/grpc"
+SECTION = "libs"
+LICENSE = "Apache-2"
+
+DEPENDS = "gflags c-ares protobuf protobuf-native protobuf-c protobuf-c-native openssl"
+DEPENDS_append_class-target = " gtest grpc-native "
+
+LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"
+
+SRC_URI = "https://github.com/grpc/grpc/archive/v${PV}.tar.gz \
+ file://0001-CMakeLists.txt-Fix-libraries-installation-for-Linux.patch \
+ file://0004-CMakeLists.txt-Find-c-ares-in-target-sysroot-alone.patch \
+ "
+SRC_URI[md5sum] = "b565fa6787e42f4969395870c2ad436e"
+SRC_URI[sha256sum] = "df9168da760fd2ee970c74c9d1b63377e0024be248deaa844e784d0df47599de"
+
+SRC_URI_append_class-target = " file://0001-CMakeLists.txt-Fix-grpc_cpp_plugin-path-during-cross.patch"
+
+inherit cmake
+
+EXTRA_OECMAKE = " \
+ -DgRPC_CARES_PROVIDER=package \
+ -DgRPC_ZLIB_PROVIDER=package \
+ -DgRPC_SSL_PROVIDER=package \
+ -DgRPC_PROTOBUF_PROVIDER=package \
+ -DgRPC_GFLAGS_PROVIDER=package \
+ -DgRPC_INSTALL=1 \
+ -DBUILD_SHARED_LIBS=ON \
+ "
+
+FILES_${PN}-dev += "${libdir}/cmake"
+
+BBCLASSEXTEND = "native"