The C based gRPC (C++, Python, Ruby, Objective-C, PHP, C#) https://grpc.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
2.5 KiB

%YAML 1.2
--- |
PHP_ARG_ENABLE(grpc, whether to enable grpc support,
[ --enable-grpc Enable grpc support])
if test "$PHP_GRPC" != "no"; then
dnl Write more examples of tests here...
dnl # --with-grpc -> add include path
PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/include)
5 years ago
PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/src/core/ext/upb-generated)
PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/src/core/ext/upbdefs-generated)
PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/src/php/ext/grpc)
5 years ago
PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/abseil-cpp)
PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/address_sorting/include)
PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/boringssl-with-bazel/src/include)
PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/re2)
5 years ago
PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/upb)
[protobuf] Upgrade third_party/protobuf to 22.x (#32606) The very non-trivial upgrade of third_party/protobuf to 22.x This PR strives to be as small as possible and many changes that were compatible with protobuf 21.x and didn't have to be merged atomically with the upgrade were already merged. Due to the complexity of the upgrade, this PR wasn't created automatically by a tool, but manually. Subsequent upgraded of third_party/protobuf with our OSS release script should work again once this change is merged. This is best reviewed commit-by-commit, I tried to group changes in logical areas. Notable changes: - the upgrade of third_party/protobuf submodule, the bazel protobuf dependency itself - upgrade of UPB dependency to 22.x (in the past, we used to always upgrade upb to "main", but upb now has release branch as well). UPB needs to be upgraded atomically with protobuf since there's a de-facto circular dependency (new protobuf depends on new upb, which depends on new protobuf for codegen). - some protobuf and upb bazel rules are now aliases, so ` extract_metadata_from_bazel_xml.py` and `gen_upb_api_from_bazel_xml.py` had to be modified to be able to follow aliases and reach the actual aliased targets. - some protobuf public headers were renamed, so especially `src/compiler` needed to be updated to use the new headers. - protobuf and upb now both depend on utf8_range project, so since we bundle upb with grpc in some languages, we now have to bundle utf8_range as well (hence changes in build for python, PHP, objC, cmake etc). - protoc now depends on absl and utf8_range (previously protobuf had absl dependency, but not for the codegen part), so python's make_grpcio_tools.py required partial rewrite to be able to handle those dependencies in the grpcio_tools build. - many updates and fixes required for C++ distribtests (currently they all pass, but we'll probably need to follow up, make protobuf's and grpc's handling of dependencies more aligned and revisit the distribtests) - bunch of other changes mostly due to overhaul of protobuf's and upb's internal build layout. TODOs: - [DONE] make sure IWYU and clang_tidy_code pass - create a list of followups (e.g. work to reenable the few tests I had to disable and to remove workaround I had to use) - [DONE in cl/523706129] figure out problem(s) with internal import --------- Co-authored-by: Craig Tiller <ctiller@google.com>
2 years ago
PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/utf8_range)
PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/xxhash)
LIBS="-lpthread $LIBS"
CFLAGS="-std=c11 -g -O2"
CXXFLAGS="-std=c++14 -fno-exceptions -fno-rtti -g -O2"
GRPC_SHARED_LIBADD="-lpthread $GRPC_SHARED_LIBADD"
PHP_REQUIRE_CXX()
PHP_ADD_LIBRARY(pthread)
PHP_ADD_LIBRARY(dl,,GRPC_SHARED_LIBADD)
PHP_ADD_LIBRARY(dl)
case $host in
*darwin*)
PHP_ADD_LIBRARY(c++,1,GRPC_SHARED_LIBADD)
;;
*)
PHP_ADD_LIBRARY(stdc++,1,GRPC_SHARED_LIBADD)
PHP_ADD_LIBRARY(rt,,GRPC_SHARED_LIBADD)
PHP_ADD_LIBRARY(rt)
;;
esac
PHP_SUBST(GRPC_SHARED_LIBADD)
<%
srcs = []
srcs.extend(php_config_m4.src)
lib_maps = {lib.name: lib for lib in libs}
php_deps = php_config_m4.get('deps', [])
php_full_deps = []
for dep in php_deps:
php_full_deps.append(dep)
php_full_deps.extend(lib_maps[dep].transitive_deps)
for dep in set(php_full_deps) - set({'z'}):
srcs.extend(lib_maps[dep].src)
srcs = sorted(set(srcs))
%>
PHP_NEW_EXTENSION(grpc,
% for src in srcs:
${src} ${"\\"}
% endfor
, $ext_shared, , -fvisibility=hidden ${"\\"}
-DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN ${"\\"}
-D_HAS_EXCEPTIONS=0 -DNOMINMAX -DGRPC_ARES=0 ${"\\"}
-DGRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK=1 ${"\\"}
-DGRPC_XDS_USER_AGENT_NAME_SUFFIX='"\"PHP\""' ${"\\"}
-DGRPC_XDS_USER_AGENT_VERSION_SUFFIX='"\"${settings.php_version.php()}\""')
<%
dirs = sorted(set(src[:src.rfind('/')] for src in srcs))
%>
% for dir in dirs:
PHP_ADD_BUILD_DIR($ext_builddir/${dir})
% endfor
fi