blob: 8a9e762734607c2c47dc8ffd6ef51422e2576895 [file] [log] [blame]
Andrew Geissler595f6302022-01-24 19:11:47 +00001DESCRIPTION = "A high performance, open source, general-purpose RPC framework. \
2Provides gRPC libraries for multiple languages written on top of shared C core library \
3(C++, Node.js, Python, Ruby, Objective-C, PHP, C#)"
4HOMEPAGE = "https://github.com/grpc/grpc"
5SECTION = "libs"
6LICENSE = "Apache-2"
7LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"
8
9DEPENDS = "c-ares protobuf protobuf-native protobuf-c protobuf-c-native openssl libnsl2 abseil-cpp re2"
10DEPENDS:append:class-target = " googletest grpc-native "
11DEPENDS:append:class-nativesdk = " grpc-native "
12
13PACKAGE_BEFORE_PN = "${PN}-compiler"
14
15RDEPENDS:${PN}-compiler = "${PN}"
16RDEPENDS:${PN}-dev:class_native += "${PN}-compiler"
17# Configuration above allows to cross-compile gRPC applications
18# In order to compile applications on the target, use the dependency below
19# Both dependencies are mutually exclusive
20# RDEPENDS:${PN}-dev += "${PN}-compiler"
21
22S = "${WORKDIR}/git"
23SRCREV_grpc = "635693ce624f3b3a89e5a764f0664958ef08b2b9"
24BRANCH = "v1.41.x"
25SRC_URI = "git://github.com/grpc/grpc.git;protocol=https;name=grpc;branch=${BRANCH} \
26 file://0001-cmake-revert-db88fb0ee826e73323e06ac6166ac038ee71f6a.patch \
27 file://0001-Revert-Changed-GRPCPP_ABSEIL_SYNC-to-GPR_ABSEIL_SYNC.patch \
28 "
29# Fixes build with older compilers 4.8 especially on ubuntu 14.04
30CXXFLAGS:append:class-native = " -Wl,--no-as-needed"
31
32inherit cmake pkgconfig
33
34EXTRA_OECMAKE = " \
35 -DgRPC_CARES_PROVIDER=package \
36 -DgRPC_ZLIB_PROVIDER=package \
37 -DgRPC_SSL_PROVIDER=package \
38 -DgRPC_PROTOBUF_PROVIDER=package \
39 -DgRPC_ABSL_PROVIDER=package \
40 -DgRPC_RE2_PROVIDER=package \
41 -DgRPC_INSTALL=ON \
42 -DCMAKE_CROSSCOMPILING=ON \
43 -DgRPC_INSTALL_LIBDIR=${baselib} \
44 -DgRPC_INSTALL_CMAKEDIR=${baselib}/cmake/${BPN} \
45 "
46
47PACKAGECONFIG ??= "cpp shared"
48PACKAGECONFIG_class-target ?= "shared"
49PACKAGECONFIG[cpp] = "-DgRPC_BUILD_GRPC_CPP_PLUGIN=ON,-DgRPC_BUILD_GRPC_CPP_PLUGIN=OFF"
50PACKAGECONFIG[csharp] = "-DgRPC_BUILD_GRPC_CSHARP_PLUGIN=ON,-DgRPC_BUILD_GRPC_CSHARP_PLUGIN=OFF"
51PACKAGECONFIG[node] = "-DgRPC_BUILD_GRPC_NODE_PLUGIN=ON,-DgRPC_BUILD_GRPC_NODE_PLUGIN=OFF"
52PACKAGECONFIG[objective-c] = "-DgRPC_BUILD_GRPC_OBJECTIVE_C_PLUGIN=ON,-DgRPC_BUILD_GRPC_OBJECTIVE_C_PLUGIN=OFF"
53PACKAGECONFIG[php] = "-DgRPC_BUILD_GRPC_PHP_PLUGIN=ON,-DgRPC_BUILD_GRPC_PHP_PLUGIN=OFF"
54PACKAGECONFIG[python] = "-DgRPC_BUILD_GRPC_PYTHON_PLUGIN=ON,-DgRPC_BUILD_GRPC_PYTHON_PLUGIN=OFF"
55PACKAGECONFIG[ruby] = "-DgRPC_BUILD_GRPC_RUBY_PLUGIN=ON,-DgRPC_BUILD_GRPC_RUBY_PLUGIN=OFF"
56PACKAGECONFIG[protobuf-lite] = "-DgRPC_USE_PROTO_LITE=ON,-DgRPC_USE_PROTO_LITE=OFF,protobuf-lite"
57PACKAGECONFIG[shared] = "-DBUILD_SHARED_LIBS=ON,-DBUILD_SHARED_LIBS=OFF,,"
58
59do_configure:prepend() {
60 sed -i -e "s#lib/pkgconfig/#${baselib}/pkgconfig/#g" ${S}/CMakeLists.txt
61}
62
63do_configure:prepend:mipsarch() {
64 sed -i -e "s/set(_gRPC_ALLTARGETS_LIBRARIES \${CMAKE_DL_LIBS} rt m pthread)/set(_gRPC_ALLTARGETS_LIBRARIES \${CMAKE_DL_LIBS} atomic rt m pthread)/g" ${S}/CMakeLists.txt
65}
66
67do_configure:prepend:powerpc() {
68 sed -i -e "s/set(_gRPC_ALLTARGETS_LIBRARIES \${CMAKE_DL_LIBS} rt m pthread)/set(_gRPC_ALLTARGETS_LIBRARIES \${CMAKE_DL_LIBS} atomic rt m pthread)/g" ${S}/CMakeLists.txt
69}
70
71do_configure:prepend:riscv64() {
72 sed -i -e "s/set(_gRPC_ALLTARGETS_LIBRARIES \${CMAKE_DL_LIBS} rt m pthread)/set(_gRPC_ALLTARGETS_LIBRARIES \${CMAKE_DL_LIBS} atomic rt m pthread)/g" ${S}/CMakeLists.txt
73}
74
75do_configure:prepend:riscv32() {
76 sed -i -e "s/set(_gRPC_ALLTARGETS_LIBRARIES \${CMAKE_DL_LIBS} rt m pthread)/set(_gRPC_ALLTARGETS_LIBRARIES \${CMAKE_DL_LIBS} atomic rt m pthread)/g" ${S}/CMakeLists.txt
77}
78
79do_configure:prepend:toolchain-clang:x86() {
80 sed -i -e "s/set(_gRPC_ALLTARGETS_LIBRARIES \${CMAKE_DL_LIBS} rt m pthread)/set(_gRPC_ALLTARGETS_LIBRARIES \${CMAKE_DL_LIBS} atomic rt m pthread)/g" ${S}/CMakeLists.txt
81}
82
83BBCLASSEXTEND = "native nativesdk"
84
85SYSROOT_DIRS_BLACKLIST:append:class-target = " ${baselib}/cmake/grpc"
86
87FILES:${PN}-compiler += "${bindir}"