Repository: conan-io/conan-center-index

Issue:
[package] grpc/1.37.1: add x86_64 to arm cross crompilation capabilities
The current reciepe does not cross-compile because of not correctly managed build_requierements of protobuf (providing protoc) and protoc-plugin provided by grpc itself.


### Package and Environment Details (include every applicable attribute)
  * Package Name/Version: **grpc/1.37.1**
  * Compiler+version: **GCC 9**
  * Docker image: **conanio/gcc9-armv7hf**
  * Conan version: **conan 1.36.0**
  * Python version: **Python 3.7.4**


### Conan profile (output of `conan profile show default` or `conan profile show <profile>` if custom profile is in use)
host-profile
```
[settings]
os=Linux
arch=armv7
compiler=gcc
compiler.version=9
compiler.libcxx=libstdc++11
build_type=Release
[options]
[build_requires]
[env]
```
build-profile
```
[settings]
os=Linux
arch=x86_64
compiler=gcc
compiler.version=9
compiler.libcxx=libstdc++11
build_type=Release
[options]
[build_requires]
[env]
```


### Steps to reproduce (Include if Applicable)

```
docker run -v $(pwd)/conan-docker-cache/:/home/conan/.conan --rm conanio/gcc9-armv7hf bash -c "conan install -pr=/home/conan/.conan/profiles/build grpc/1.37.1@ --build missing"
```

Here i propose a pull-request, where the problems are tackled. https://github.com/conan-io/conan-center-index/pull/5607





Discussion:
Currently i have two problems bringing the pull request forward. 
1. I filed the pull-request before i got accepted in the early access program. So the jenkins job did not start. I am now accepted in the program and i do not know how to retrigger the jenkins pipeline for the pull-request.
2. I accepted the license/cla with my github account, but the Pull-Request page stays at `pending -- Contributor License Agreement is not signed yet.`

What can i do here to bring this pull-request forward?

**update:**

Ok i was missing my commiters email adress in my github account. That was the reason why the cla check did fail. I was able to solve this. I see @SSE4 did reopen the pull-request to trigger the ci. Thanks for taken car-of this :)



Resolving patch:
diff --git a/recipes/grpc/all/conanfile.py b/recipes/grpc/all/conanfile.py
--- a/recipes/grpc/all/conanfile.py
+++ b/recipes/grpc/all/conanfile.py
@@ -7,7 +7,7 @@
 class grpcConan(ConanFile):
     name = "grpc"
     description = "Google's RPC (remote procedure call) library and framework."
-    topics = ("conan", "grpc", "rpc")
+    topics = ("grpc", "rpc")
     url = "https://github.com/conan-io/conan-center-index"
     homepage = "https://github.com/grpc/grpc"
     license = "Apache-2.0"
@@ -54,11 +54,11 @@ def _build_subfolder(self):
 
     def requirements(self):
         self.requires('zlib/1.2.11')
-        self.requires('openssl/1.1.1k')
+        self.requires('openssl/1.1.1l')
         self.requires('protobuf/3.17.1')
         self.requires('c-ares/1.17.1')
-        self.requires('abseil/20210324.1')
-        self.requires('re2/20210401')
+        self.requires('abseil/20210324.2')
+        self.requires('re2/20210601')
 
     def build_requirements(self):
         self.build_requires('protobuf/3.17.1')
@@ -71,7 +71,7 @@ def config_options(self):
         if self.settings.os == "Windows":
             del self.options.fPIC
 
-    def configure(self):
+    def validate(self):
         if self.settings.compiler == "Visual Studio":
             compiler_version = tools.Version(self.settings.compiler.version)
             if compiler_version < 14:
@@ -79,11 +79,17 @@ def configure(self):
 
     def source(self):
         tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True)
-        #fix the protoc search path for cross compiling
-        tools.replace_in_file("{}/cmake/protobuf.cmake".format(self._source_subfolder),
+        # Fix the protoc search path for cross compiling
+        tools.replace_in_file(os.path.join(self._source_subfolder, "cmake", "protobuf.cmake"),
                 "find_program(_gRPC_PROTOBUF_PROTOC_EXECUTABLE protoc)",
                 "find_program(_gRPC_PROTOBUF_PROTOC_EXECUTABLE protoc PATHS ENV PATH NO_DEFAULT_PATH)"
         )
+        if tools.Version(self.version) >= "1.39.0":
+            # Follow https://github.com/grpc/grpc/issues/26857, there is no reason to skip installation of
+            #   executable when cross-building
+            tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"),
+                    "if(gRPC_INSTALL AND NOT CMAKE_CROSSCOMPILING)",
+                    "if(gRPC_INSTALL)")
 
     def _configure_cmake(self):
         if self._cmake is not None:
@@ -219,14 +225,6 @@ def package_info(self):
         self.cpp_info.components["grpc++_unsecure"].system_libs = _system_libs
         self.cpp_info.components["grpc++_unsecure"].libs = ["grpc++_unsecure"]
 
-        # gRPC::grpc_plugin_support
-        self.cpp_info.components["grpc_plugin_support"].names["cmake_find_package"] = "grpc_plugin_support"
-        self.cpp_info.components["grpc_plugin_support"].names["cmake_find_package_multi"] = "grpc_plugin_support"
-        self.cpp_info.components["grpc_plugin_support"].requires = ["protobuf::libprotoc", "protobuf::libprotobuf"]
-        if self.settings.os in ['Macos', 'Linux']:
-            self.cpp_info.components["grpc_plugin_support"].system_libs = _system_libs
-        self.cpp_info.components["grpc_plugin_support"].libs = ["grpc_plugin_support"]
-
         # gRPC::grpcpp_channelz
         self.cpp_info.components["grpcpp_channelz"].names["cmake_find_package"] = "grpcpp_channelz"
         self.cpp_info.components["grpcpp_channelz"].names["cmake_find_package_multi"] = "grpcpp_channelz"
@@ -245,6 +243,14 @@ def package_info(self):
         self.cpp_info.components["upb"].libs = ["upb"]
 
         # Executables
+        # gRPC::grpc_plugin_support
+        self.cpp_info.components["grpc_plugin_support"].names["cmake_find_package"] = "grpc_plugin_support"
+        self.cpp_info.components["grpc_plugin_support"].names["cmake_find_package_multi"] = "grpc_plugin_support"
+        self.cpp_info.components["grpc_plugin_support"].requires = ["protobuf::libprotoc", "protobuf::libprotobuf"]
+        if self.settings.os in ['Macos', 'Linux']:
+            self.cpp_info.components["grpc_plugin_support"].system_libs = _system_libs
+        self.cpp_info.components["grpc_plugin_support"].libs = ["grpc_plugin_support"]
+
         # gRPC::grpc_cpp_plugin
         if self.options.cpp_plugin:
             module_target_rel_path = os.path.join("lib", "cmake", "grpc_cpp_plugin.cmake")


Test patch:
diff --git a/recipes/grpc/all/test_package/CMakeLists.txt b/recipes/grpc/all/test_package/CMakeLists.txt
--- a/recipes/grpc/all/test_package/CMakeLists.txt
+++ b/recipes/grpc/all/test_package/CMakeLists.txt
@@ -23,12 +23,7 @@ endif()
 # Find gRPC installation
 find_package(gRPC CONFIG REQUIRED)
 message(STATUS "Using gRPC ${gRPC_VERSION}")
-
-if (CMAKE_CROSSCOMPILING)
-  find_program(_GRPC_CPP_PLUGIN_EXECUTABLE grpc_cpp_plugin PATHS ENV PATH NO_DEFAULT_PATH)
-else()
-  set(_GRPC_CPP_PLUGIN_EXECUTABLE $<TARGET_FILE:gRPC::grpc_cpp_plugin>)
-endif()
+set(_GRPC_CPP_PLUGIN_EXECUTABLE $<TARGET_FILE:gRPC::grpc_cpp_plugin>)
 
 
 # Proto file