diff --git a/abseil-20200225.tar.gz b/abseil-20200225.tar.gz deleted file mode 100644 index 3b14c5553ff25487f3e9aa1193d6823181494965..0000000000000000000000000000000000000000 Binary files a/abseil-20200225.tar.gz and /dev/null differ diff --git a/grpc-1.31.0-python-grpcio-use-system-abseil.patch b/grpc-1.31.0-python-grpcio-use-system-abseil.patch new file mode 100644 index 0000000000000000000000000000000000000000..c9cebf4a9d9a2b03a51e2f49c5cfdccfaf86bd7f --- /dev/null +++ b/grpc-1.31.0-python-grpcio-use-system-abseil.patch @@ -0,0 +1,45 @@ +diff -Naur grpc-1.37.0-original/setup.py grpc-1.37.0/setup.py +--- grpc-1.37.0-original/setup.py 2021-04-06 18:48:56.000000000 -0400 ++++ grpc-1.37.0/setup.py 2021-04-08 15:34:35.182802019 -0400 +@@ -28,6 +28,7 @@ + from distutils import util + import os + import os.path ++import pathlib + import pkg_resources + import platform + import re +@@ -154,6 +155,11 @@ + # runtime, the shared library must be installed + BUILD_WITH_SYSTEM_RE2 = os.environ.get('GRPC_PYTHON_BUILD_SYSTEM_RE2', False) + ++# Export this variable to use the system installation of abseil. You need to ++# have the header files installed (in /usr/include/absl) and during ++# runtime, the shared library must be installed ++BUILD_WITH_SYSTEM_ABSL = os.environ.get('GRPC_PYTHON_BUILD_SYSTEM_ABSL', False) ++ + # For local development use only: This skips building gRPC Core and its + # dependencies, including protobuf and boringssl. This allows "incremental" + # compilation by first building gRPC Core using make, then building only the +@@ -296,6 +302,10 @@ + CORE_C_FILES = filter(lambda x: 'third_party/re2' not in x, CORE_C_FILES) + RE2_INCLUDE = (os.path.join('/usr', 'include', 're2'),) + ++if BUILD_WITH_SYSTEM_ABSL: ++ CORE_C_FILES = filter(lambda x: 'third_party/abseil-cpp' not in x, CORE_C_FILES) ++ ABSL_INCLUDE = (os.path.join('/usr', 'include'),) ++ + EXTENSION_INCLUDE_DIRECTORIES = ((PYTHON_STEM,) + CORE_INCLUDE + ABSL_INCLUDE + + ADDRESS_SORTING_INCLUDE + CARES_INCLUDE + + RE2_INCLUDE + SSL_INCLUDE + UPB_INCLUDE + +@@ -325,6 +335,10 @@ + EXTENSION_LIBRARIES += ('cares',) + if BUILD_WITH_SYSTEM_RE2: + EXTENSION_LIBRARIES += ('re2',) ++if BUILD_WITH_SYSTEM_ABSL: ++ EXTENSION_LIBRARIES += tuple( ++ lib.stem[3:] for lib in pathlib.Path('/usr').glob('lib*/libabsl_*.so') ++ ) + + DEFINE_MACROS = (('OPENSSL_NO_ASM', 1), ('_WIN32_WINNT', 0x600)) + if not DISABLE_LIBC_COMPATIBILITY: diff --git a/grpc.spec b/grpc.spec index 19a24eec31cc88cef977b5478a9ebb7049f547e8..d223e112decd7a96226eedd842ac662882b0754e 100644 --- a/grpc.spec +++ b/grpc.spec @@ -1,11 +1,10 @@ Name: grpc Version: 1.31.0 -Release: 4 +Release: 5 Summary: A modern, open source high performance RPC framework that can run in any environment License: ASL 2.0 URL: https://www.grpc.io Source0: https://github.com/grpc/grpc/archive/v%{version}/%{name}-%{version}.tar.gz -Source1: abseil-20200225.tar.gz Patch0000: Copy-channel-args-hash-before-appending-ruby-user-ag.patch Patch0001: Ran-generate_proto_ruby.sh-to-update-generated-files.patch @@ -17,13 +16,15 @@ Patch0006: repair-pkgconfig-path.patch Patch0007: add-secure-compile-option-in-Makefile.patch Patch0008: fix-re2-build-error.patch Patch0009: allow-grpcio-to-be-build-against-system-re2.patch +Patch0010: grpc-1.31.0-python-grpcio-use-system-abseil.patch BuildRequires: gcc-c++ pkgconfig protobuf-devel protobuf-compiler gdb BuildRequires: openssl-devel c-ares-devel gflags-devel gtest-devel zlib-devel gperftools-devel BuildRequires: python3-devel python3-setuptools python3-Cython BuildRequires: cmake >= 3.13.0 BuildRequires: pkgconfig(re2) -Requires: protobuf-compiler gflags +BuildRequires: abseil-cpp-devel +Requires: protobuf-compiler gflags abseil-cpp Provides: %{name}-plugins = %{version}-%{release} Obsoletes: %{name}-plugins < %{version}-%{release} @@ -55,7 +56,6 @@ Python3 bindings for gRPC. sed -i 's:^prefix ?= .*:prefix ?= %{_prefix}:' Makefile sed -i 's:$(prefix)/lib:$(prefix)/%{_lib}:' Makefile sed -i 's:^GTEST_LIB =.*::' Makefile -tar -zxf %{SOURCE1} --strip-components 1 -C %{_builddir}/%{name}-%{version}/third_party/abseil-cpp/ %build mkdir -p cmake/build @@ -66,6 +66,7 @@ cmake ../../ -DgRPC_INSTALL=ON\ -DgRPC_SSL_PROVIDER=package \ -DgRPC_ZLIB_PROVIDER=package \ -DgRPC_RE2_PROVIDER=package \ + -DgRPC_ABSL_PROVIDER=package \ -DgRPC_GFLAGS_PROVIDER=package \ -DgRPC_INSTALL_LIBDIR=%{buildroot}%{_libdir} \ -DgRPC_INSTALL_BINDIR=%{buildroot}%{_bindir} \ @@ -83,6 +84,7 @@ export GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=True export GRPC_PYTHON_BUILD_SYSTEM_ZLIB=True export GRPC_PYTHON_BUILD_SYSTEM_CARES=True export GRPC_PYTHON_BUILD_SYSTEM_RE2=True +export GRPC_PYTHON_BUILD_SYSTEM_ABSL=True export CFLAGS="%optflags" cd ../.. %py3_build @@ -106,13 +108,11 @@ cd ../.. %{_bindir}/grpc_*_plugin %{_libdir}/*.so.1* -%{_libdir}/*absl* %{_datadir}/%{name} %files devel %defattr(-,root,root) %{_libdir}/*.so -%exclude %{_libdir}/*absl* %{_libdir}/pkgconfig/* %{_includedir}/grpc %{_includedir}/grpc++ @@ -124,6 +124,12 @@ cd ../.. %{python3_sitearch}/grpcio-%{version}-py?.?.egg-info %changelog +* Tue Oct 19 2021 gaihuiying - 1.31.0-5 +- Type:requirement +- ID:NA +- SUG:NA +- DESC:separate abseil-cpp from grpc source + * Thu Jun 10 2021 gaihuiying - 1.31.0-4 - Type:requirement - ID:NA