First cut of a hand-modified BUILD.gn file for GRPC. In a previous CL we added BUILD.gn.template and used it to generate a BUILD.gn file but we did not hand-edit the BUILD.gn file and we did not try to make it work. In this CL we take a first cut at hand-editing it so that GRPC compiles. This allows GRPC to build and we are able to run a unit test that does not actually use the network. We have not yet tried to actually use the network. One open question is what to do with the dependency on c-ares. Currently we have removed it from the build and that seems ok so far. Change-Id: Ib1bf57e54491b85792740dcc1432eb88ed088990
diff --git a/BUILD.gn b/BUILD.gn index 2855925..9b19967 100644 --- a/BUILD.gn +++ b/BUILD.gn
@@ -12,13 +12,9 @@ ".", "include/", ] - defines = [ - "GRPC_USE_PROTO_LITE", - ] + defines = [ "GRPC_USE_PROTO_LITE" ] } - - source_set("gpr") { sources = [ "include/grpc/impl/codegen/atm.h", @@ -123,16 +119,10 @@ "src/core/lib/support/tmpfile_windows.c", "src/core/lib/support/wrap_memcpy.c", ] - deps = [ - ] - public_configs = [ - ":grpc_config", - ] + public_configs = [ ":grpc_config" ] } - - source_set("grpc") { sources = [ "include/grpc/byte_buffer.h", @@ -173,6 +163,10 @@ "src/core/ext/census/census_interface.h", "src/core/ext/census/census_rpc_stats.h", "src/core/ext/census/context.c", + "src/core/ext/census/gen/census.pb.c", + "src/core/ext/census/gen/census.pb.h", + "src/core/ext/census/gen/trace_context.pb.c", + "src/core/ext/census/gen/trace_context.pb.h", "src/core/ext/census/grpc_context.c", "src/core/ext/census/grpc_filter.c", "src/core/ext/census/grpc_filter.h", @@ -218,6 +212,10 @@ "src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.c", "src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.c", "src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h", + "src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.c", + "src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h", + "src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c", + "src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h", "src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.c", "src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c", "src/core/ext/filters/client_channel/lb_policy_factory.c", @@ -621,17 +619,25 @@ "src/core/tsi/transport_security_interface.h", ] deps = [ - "//third_party/boringssl", - "//third_party/zlib", ":gpr", + "//third_party/boringssl", + "//third_party/cares", + "//third_party/zlib", ] - - public_configs = [ - ":grpc_config", - ] + public_configs = [ ":grpc_config" ] } - +source_set("nanopb") { + sources = [ + "third_party/nanopb/pb.h", + "third_party/nanopb/pb_common.c", + "third_party/nanopb/pb_common.h", + "third_party/nanopb/pb_decode.c", + "third_party/nanopb/pb_decode.h", + "third_party/nanopb/pb_encode.c", + "third_party/nanopb/pb_encode.h", + ] +} source_set("grpc++") { sources = [ @@ -763,6 +769,8 @@ "src/cpp/server/dynamic_thread_pool.h", "src/cpp/server/health/default_health_check_service.cc", "src/cpp/server/health/default_health_check_service.h", + "src/cpp/server/health/health.pb.c", + "src/cpp/server/health/health.pb.h", "src/cpp/server/health/health_check_service.cc", "src/cpp/server/health/health_check_service_server_builder_option.cc", "src/cpp/server/insecure_server_credentials.cc", @@ -783,80 +791,64 @@ "src/cpp/util/time_cc.cc", ] deps = [ + ":grpc", + ":nanopb", "//third_party/boringssl", "//third_party/protobuf:protobuf_lite", - ":grpc", - ] - - public_configs = [ - ":grpc_config", - ] -} - -# Only compile the plugin for the host architecture. -if (current_toolchain == host_toolchain) { - - -source_set("grpc_plugin_support") { - sources = [ - "include/grpc++/impl/codegen/config_protobuf.h", - "src/compiler/config.h", - "src/compiler/cpp_generator.cc", - "src/compiler/cpp_generator.h", - "src/compiler/cpp_generator_helpers.h", - "src/compiler/csharp_generator.cc", - "src/compiler/csharp_generator.h", - "src/compiler/csharp_generator_helpers.h", - "src/compiler/generator_helpers.h", - "src/compiler/node_generator.cc", - "src/compiler/node_generator.h", - "src/compiler/node_generator_helpers.h", - "src/compiler/objective_c_generator.cc", - "src/compiler/objective_c_generator.h", - "src/compiler/objective_c_generator_helpers.h", - "src/compiler/php_generator.cc", - "src/compiler/php_generator.h", - "src/compiler/php_generator_helpers.h", - "src/compiler/protobuf_plugin.h", - "src/compiler/python_generator.cc", - "src/compiler/python_generator.h", - "src/compiler/python_generator_helpers.h", - "src/compiler/python_private_generator.h", - "src/compiler/ruby_generator.cc", - "src/compiler/ruby_generator.h", - "src/compiler/ruby_generator_helpers-inl.h", - "src/compiler/ruby_generator_map-inl.h", - "src/compiler/ruby_generator_string-inl.h", - "src/compiler/schema_interface.h", - ] - deps = [ - "//third_party/protobuf:protoc_lib", - ] - - public_configs = [ - ":grpc_config", - ] -} - -} -# Only compile the plugin for the host architecture. -if (current_toolchain == host_toolchain) { - -executable("grpc_cpp_plugin") { - sources = [ - "src/compiler/cpp_plugin.cc", - ] - deps = [ - "//third_party/protobuf:protoc_lib", - ":grpc_plugin_support", - ] - - configs += [ - "//third_party/protobuf:protobuf_config", ] public_configs = [ ":grpc_config" ] } +# Only compile the plugin for the host architecture. +if (current_toolchain == host_toolchain) { + source_set("grpc_plugin_support") { + sources = [ + "include/grpc++/impl/codegen/config_protobuf.h", + "src/compiler/config.h", + "src/compiler/cpp_generator.cc", + "src/compiler/cpp_generator.h", + "src/compiler/cpp_generator_helpers.h", + "src/compiler/csharp_generator.cc", + "src/compiler/csharp_generator.h", + "src/compiler/csharp_generator_helpers.h", + "src/compiler/generator_helpers.h", + "src/compiler/node_generator.cc", + "src/compiler/node_generator.h", + "src/compiler/node_generator_helpers.h", + "src/compiler/objective_c_generator.cc", + "src/compiler/objective_c_generator.h", + "src/compiler/objective_c_generator_helpers.h", + "src/compiler/php_generator.cc", + "src/compiler/php_generator.h", + "src/compiler/php_generator_helpers.h", + "src/compiler/protobuf_plugin.h", + "src/compiler/python_generator.cc", + "src/compiler/python_generator.h", + "src/compiler/python_generator_helpers.h", + "src/compiler/python_private_generator.h", + "src/compiler/ruby_generator.cc", + "src/compiler/ruby_generator.h", + "src/compiler/ruby_generator_helpers-inl.h", + "src/compiler/ruby_generator_map-inl.h", + "src/compiler/ruby_generator_string-inl.h", + "src/compiler/schema_interface.h", + ] + deps = [ + "//third_party/protobuf:protoc_lib", + ] + + public_configs = [ ":grpc_config" ] + } + + executable("grpc_cpp_plugin") { + sources = [ + "src/compiler/cpp_plugin.cc", + ] + deps = [ + ":grpc_plugin_support", + "//third_party/protobuf:protoc_lib", + ] + configs += [ "//third_party/protobuf:protobuf_config" ] + public_configs = [ ":grpc_config" ] + } } - -
diff --git a/include/grpc/impl/codegen/port_platform.h b/include/grpc/impl/codegen/port_platform.h index 1906886..972d64b 100644 --- a/include/grpc/impl/codegen/port_platform.h +++ b/include/grpc/impl/codegen/port_platform.h
@@ -292,6 +292,26 @@ #else /* _LP64 */ #define GPR_ARCH_32 1 #endif /* _LP64 */ +#elif defined(__Fuchsia__) +#define GPR_FUCHSIA 1 +#define GPR_ARCH_64 1 +#define GPR_PLATFORM_STRING "fuchsia" +#include <features.h> +// Specifying musl libc affects wrap_memcpy.c. It causes memmove() to be +// invoked. +#define GPR_MUSL_LIBC_COMPAT 1 +#define GPR_CPU_POSIX 1 +#define GPR_GCC_ATOMIC 1 +#define GPR_PTHREAD_TLS 1 +#define GPR_POSIX_LOG 1 +#define GPR_POSIX_SYNC 1 +#define GPR_POSIX_ENV 1 +#define GPR_POSIX_TMPFILE 1 +#define GPR_POSIX_SUBPROCESS 1 +#define GPR_POSIX_SYNC 1 +#define GPR_POSIX_STRING 1 +#define GPR_POSIX_TIME 1 +#define GPR_GETPID_IN_UNISTD_H 1 #else #error "Could not auto-detect platform" #endif
diff --git a/src/core/lib/iomgr/port.h b/src/core/lib/iomgr/port.h index 9fae8c0..039c01a 100644 --- a/src/core/lib/iomgr/port.h +++ b/src/core/lib/iomgr/port.h
@@ -131,6 +131,20 @@ #define GRPC_POSIX_SOCKETUTILS 1 #define GRPC_POSIX_WAKEUP_FD 1 #define GRPC_TIMER_USE_GENERIC 1 +#elif defined(GPR_FUCHSIA) +#define GRPC_HAVE_IFADDRS 1 +#define GRPC_HAVE_IPV6_RECVPKTINFO 1 +#define GRPC_HAVE_IP_PKTINFO 1 +#define GRPC_HAVE_MSG_NOSIGNAL 1 +#define GRPC_HAVE_UNIX_SOCKET 1 +#define GRPC_POSIX_WAKEUP_FD 1 +// TODO(rudominer) Check that this does something we want. +#define GRPC_POSIX_NO_SPECIAL_WAKEUP_FD 1 +#define GRPC_POSIX_SOCKET 1 +#define GRPC_POSIX_SOCKETADDR 1 +// TODO(rudominer) Check this does something we want. +#define GRPC_POSIX_SOCKETUTILS 1 +#define GRPC_TIMER_USE_GENERIC 1 #elif !defined(GPR_NO_AUTODETECT_PLATFORM) #error "Platform not recognized" #endif