sync SP1 to LTS
This commit is contained in:
parent
1fb4065a97
commit
10c2cfd153
47
allow-grpcio-to-be-build-against-system-re2.patch
Normal file
47
allow-grpcio-to-be-build-against-system-re2.patch
Normal file
@ -0,0 +1,47 @@
|
||||
From 88b5952945662bee3d4b250a4d161b36afbf4f44 Mon Sep 17 00:00:00 2001
|
||||
From: Massimiliano Torromeo <massimiliano.torromeo@gmail.com>
|
||||
Date: Fri, 16 Oct 2020 20:21:31 +0200
|
||||
Subject: [PATCH] Allow grpcio to be built against system re2
|
||||
|
||||
---
|
||||
setup.py | 11 +++++++++++
|
||||
1 file changed, 11 insertions(+)
|
||||
|
||||
diff --git a/setup.py b/setup.py
|
||||
index 184d5457f1a..f7e1fbf7c56 100644
|
||||
--- a/setup.py
|
||||
+++ b/setup.py
|
||||
@@ -133,6 +133,11 @@
|
||||
BUILD_WITH_SYSTEM_CARES = os.environ.get('GRPC_PYTHON_BUILD_SYSTEM_CARES',
|
||||
False)
|
||||
|
||||
+# Export this variable to use the system installation of re2. You need to
|
||||
+# have the header files installed (in /usr/include/re2) and during
|
||||
+# runtime, the shared library must be installed
|
||||
+BUILD_WITH_SYSTEM_RE2 = os.environ.get('GRPC_PYTHON_BUILD_SYSTEM_RE2', 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
|
||||
@@ -258,6 +263,10 @@ def check_linker_need_libatomic():
|
||||
CORE_C_FILES = filter(lambda x: 'third_party/cares' not in x, CORE_C_FILES)
|
||||
CARES_INCLUDE = (os.path.join('/usr', 'include'),)
|
||||
|
||||
+if BUILD_WITH_SYSTEM_RE2:
|
||||
+ CORE_C_FILES = filter(lambda x: 'third_party/re2' not in x, CORE_C_FILES)
|
||||
+ RE2_INCLUDE = (os.path.join('/usr', 'include', 're2'),)
|
||||
+
|
||||
EXTENSION_INCLUDE_DIRECTORIES = ((PYTHON_STEM,) + CORE_INCLUDE + ABSL_INCLUDE +
|
||||
ADDRESS_SORTING_INCLUDE + CARES_INCLUDE +
|
||||
RE2_INCLUDE + SSL_INCLUDE + UPB_INCLUDE +
|
||||
@@ -284,6 +293,8 @@ def check_linker_need_libatomic():
|
||||
EXTENSION_LIBRARIES += ('z',)
|
||||
if BUILD_WITH_SYSTEM_CARES:
|
||||
EXTENSION_LIBRARIES += ('cares',)
|
||||
+if BUILD_WITH_SYSTEM_RE2:
|
||||
+ EXTENSION_LIBRARIES += ('re2',)
|
||||
|
||||
DEFINE_MACROS = (('OPENSSL_NO_ASM', 1), ('_WIN32_WINNT', 0x600))
|
||||
if not DISABLE_LIBC_COMPATIBILITY:
|
||||
---
|
||||
28.1
|
||||
122
fix-re2-build-error.patch
Normal file
122
fix-re2-build-error.patch
Normal file
@ -0,0 +1,122 @@
|
||||
From 45e413d2520795e7281e9a592af81620349bc186 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Wankadia <junyer@google.com>
|
||||
Date: Wed, 9 Sep 2020 04:26:36 -0700
|
||||
Subject: [PATCH] Attempt to find RE2 via CMake and via pkg-config.
|
||||
|
||||
---
|
||||
CMakeLists.txt | 1 +
|
||||
cmake/modules/Findre2.cmake | 58 +++++++++++++++++++++++++++++++
|
||||
cmake/re2.cmake | 6 +---
|
||||
templates/CMakeLists.txt.template | 1 +
|
||||
4 files changed, 61 insertions(+), 5 deletions(-)
|
||||
create mode 100644 cmake/modules/Findre2.cmake
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 4b04d25ac50..cecb4396c57 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -15624,6 +15624,7 @@ install(FILES
|
||||
)
|
||||
install(FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/Findc-ares.cmake
|
||||
+ ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/Findre2.cmake
|
||||
DESTINATION ${gRPC_INSTALL_CMAKEDIR}/modules
|
||||
)
|
||||
|
||||
diff --git a/cmake/modules/Findre2.cmake b/cmake/modules/Findre2.cmake
|
||||
new file mode 100644
|
||||
index 00000000000..41df4547138
|
||||
--- /dev/null
|
||||
+++ b/cmake/modules/Findre2.cmake
|
||||
@@ -0,0 +1,58 @@
|
||||
+# Copyright 2017 gRPC authors.
|
||||
+#
|
||||
+# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
+# you may not use this file except in compliance with the License.
|
||||
+# You may obtain a copy of the License at
|
||||
+#
|
||||
+# http://www.apache.org/licenses/LICENSE-2.0
|
||||
+#
|
||||
+# Unless required by applicable law or agreed to in writing, software
|
||||
+# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
+# See the License for the specific language governing permissions and
|
||||
+# limitations under the License.
|
||||
+
|
||||
+find_package(re2 QUIET CONFIG)
|
||||
+if(re2_FOUND)
|
||||
+ message(STATUS "Found RE2 via CMake.")
|
||||
+ return()
|
||||
+endif()
|
||||
+
|
||||
+find_package(PkgConfig REQUIRED)
|
||||
+# TODO(junyer): Use the IMPORTED_TARGET option whenever CMake 3.6 (or newer)
|
||||
+# becomes the minimum required: that will take care of the add_library() and
|
||||
+# set_property() calls; then we can simply alias PkgConfig::RE2 as re2::re2.
|
||||
+# For now, we can only set INTERFACE_* properties that existed in CMake 3.5.
|
||||
+pkg_check_modules(RE2 QUIET re2)
|
||||
+if(RE2_FOUND)
|
||||
+ set(re2_FOUND "${RE2_FOUND}")
|
||||
+ add_library(re2::re2 INTERFACE IMPORTED)
|
||||
+ if(RE2_INCLUDE_DIRS)
|
||||
+ set_property(TARGET re2::re2 PROPERTY
|
||||
+ INTERFACE_INCLUDE_DIRECTORIES "${RE2_INCLUDE_DIRS}")
|
||||
+ endif()
|
||||
+ if(RE2_CFLAGS_OTHER)
|
||||
+ # Filter out the -std flag, which is handled by CMAKE_CXX_STANDARD.
|
||||
+ # TODO(junyer): Use the FILTER option whenever CMake 3.6 (or newer)
|
||||
+ # becomes the minimum required: that will allow this to be concise.
|
||||
+ foreach(flag IN LISTS RE2_CFLAGS_OTHER)
|
||||
+ if("${flag}" MATCHES "^-std=")
|
||||
+ list(REMOVE_ITEM RE2_CFLAGS_OTHER "${flag}")
|
||||
+ endif()
|
||||
+ endforeach()
|
||||
+ set_property(TARGET re2::re2 PROPERTY
|
||||
+ INTERFACE_COMPILE_OPTIONS "${RE2_CFLAGS_OTHER}")
|
||||
+ endif()
|
||||
+ if(RE2_LDFLAGS)
|
||||
+ set_property(TARGET re2::re2 PROPERTY
|
||||
+ INTERFACE_LINK_LIBRARIES "${RE2_LDFLAGS}")
|
||||
+ endif()
|
||||
+ message(STATUS "Found RE2 via pkg-config.")
|
||||
+ return()
|
||||
+endif()
|
||||
+
|
||||
+if(re2_FIND_REQUIRED)
|
||||
+ message(FATAL_ERROR "Failed to find RE2.")
|
||||
+elseif(NOT re2_FIND_QUIETLY)
|
||||
+ message(WARNING "Failed to find RE2.")
|
||||
+endif()
|
||||
diff --git a/cmake/re2.cmake b/cmake/re2.cmake
|
||||
index 3e83aae6910..974b0a436e2 100644
|
||||
--- a/cmake/re2.cmake
|
||||
+++ b/cmake/re2.cmake
|
||||
@@ -45,13 +45,9 @@ if(gRPC_RE2_PROVIDER STREQUAL "module")
|
||||
set(gRPC_INSTALL FALSE)
|
||||
endif()
|
||||
elseif(gRPC_RE2_PROVIDER STREQUAL "package")
|
||||
- find_package(re2 REQUIRED CONFIG)
|
||||
-
|
||||
+ find_package(re2 REQUIRED)
|
||||
if(TARGET re2::re2)
|
||||
set(_gRPC_RE2_LIBRARIES re2::re2)
|
||||
- else()
|
||||
- set(_gRPC_RE2_LIBRARIES ${RE2_LIBRARIES})
|
||||
endif()
|
||||
- set(_gRPC_RE2_INCLUDE_DIR ${RE2_INCLUDE_DIRS})
|
||||
set(_gRPC_FIND_RE2 "if(NOT re2_FOUND)\n find_package(re2)\nendif()")
|
||||
endif()
|
||||
diff --git a/templates/CMakeLists.txt.template b/templates/CMakeLists.txt.template
|
||||
index c7f2556dc92..f7db0fd2d0c 100644
|
||||
--- a/templates/CMakeLists.txt.template
|
||||
+++ b/templates/CMakeLists.txt.template
|
||||
@@ -706,6 +706,7 @@
|
||||
)
|
||||
install(FILES
|
||||
<%text>${CMAKE_CURRENT_SOURCE_DIR}</%text>/cmake/modules/Findc-ares.cmake
|
||||
+ <%text>${CMAKE_CURRENT_SOURCE_DIR}</%text>/cmake/modules/Findre2.cmake
|
||||
DESTINATION <%text>${gRPC_INSTALL_CMAKEDIR}</%text>/modules
|
||||
)
|
||||
|
||||
--
|
||||
2.28.0
|
||||
32
grpc.spec
32
grpc.spec
@ -1,13 +1,12 @@
|
||||
Name: grpc
|
||||
Version: 1.31.0
|
||||
Release: 1
|
||||
Release: 2
|
||||
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
|
||||
Source2: benchmark-v1.5.1.tar.gz
|
||||
Source3: re2-2020-08-01.tar.gz
|
||||
Source4: googletest-release-1.10.0.tar.gz
|
||||
|
||||
Patch0000: Copy-channel-args-hash-before-appending-ruby-user-ag.patch
|
||||
@ -18,11 +17,14 @@ Patch0004: Fix-use-after-free-by-removing-stream-from-transport.patch
|
||||
Patch0005: repair-gflags-compile-error-with-cmake.patch
|
||||
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
|
||||
|
||||
BuildRequires: gcc-c++ pkgconfig protobuf-devel protobuf-compiler gdb
|
||||
BuildRequires: openssl-devel c-ares-devel gflags-devel gtest-devel zlib-devel gperftools-devel re2-devel
|
||||
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
|
||||
|
||||
Provides: %{name}-plugins = %{version}-%{release}
|
||||
@ -39,6 +41,7 @@ mile of distributed computing to connect devices, mobile applications and browse
|
||||
%package devel
|
||||
Summary: gRPC library development files
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
Requires: pkgconfig(re2)
|
||||
|
||||
%description devel
|
||||
Development headers and files for gRPC libraries.
|
||||
@ -58,7 +61,6 @@ 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/
|
||||
tar -zxf %{SOURCE2} --strip-components 1 -C %{_builddir}/%{name}-%{version}/third_party/benchmark/
|
||||
tar -zxf %{SOURCE3} --strip-components 1 -C %{_builddir}/%{name}-%{version}/third_party/re2/
|
||||
tar -zxf %{SOURCE4} --strip-components 1 -C %{_builddir}/%{name}-%{version}/third_party/googletest/
|
||||
|
||||
%build
|
||||
@ -69,6 +71,7 @@ cmake ../../ -DgRPC_INSTALL=ON\
|
||||
-DgRPC_PROTOBUF_PROVIDER=package \
|
||||
-DgRPC_SSL_PROVIDER=package \
|
||||
-DgRPC_ZLIB_PROVIDER=package \
|
||||
-DgRPC_RE2_PROVIDER=package \
|
||||
-DgRPC_GFLAGS_PROVIDER=package \
|
||||
-DgRPC_INSTALL_LIBDIR=%{buildroot}%{_libdir} \
|
||||
-DgRPC_INSTALL_BINDIR=%{buildroot}%{_bindir} \
|
||||
@ -77,27 +80,29 @@ cmake ../../ -DgRPC_INSTALL=ON\
|
||||
-DgRPC_INSTALL_SHAREDIR=%{buildroot}%{_datadir}/%{name} \
|
||||
-DgRPC_INSTALL_PKGCONFIGDIR=%{buildroot}%{_libdir}/pkgconfig \
|
||||
-DCMAKE_INSTALL_PREFIX=%{_prefix} \
|
||||
-DgRPC_BUILD_TESTS=ON \
|
||||
-DBUILD_SHARED_LIBS=ON
|
||||
make %{_smp_mflags}
|
||||
cd ../..
|
||||
make grpc_cli
|
||||
make -j24 V=1
|
||||
|
||||
# build python module
|
||||
export GRPC_PYTHON_BUILD_WITH_CYTHON=True
|
||||
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 CFLAGS="%optflags"
|
||||
cd ../..
|
||||
%py3_build
|
||||
|
||||
%install
|
||||
cd cmake/build
|
||||
make install/local
|
||||
cd ../..
|
||||
cp bins/opt/grpc_cli %{buildroot}%{_bindir}
|
||||
cp grpc_cli %{buildroot}%{_bindir}
|
||||
cp libgrpc++_test_config.so* %{buildroot}%{_libdir}
|
||||
rm -rf %{buildroot}%{_prefix}/lib
|
||||
|
||||
%delete_la_and_a
|
||||
cd ../..
|
||||
%py3_install
|
||||
|
||||
%ldconfig_scriptlets
|
||||
@ -111,14 +116,13 @@ rm -rf %{buildroot}%{_prefix}/lib
|
||||
%{_bindir}/grpc_*_plugin
|
||||
|
||||
%{_libdir}/*.so.1*
|
||||
%{_libdir}/*.so.11*
|
||||
%{_libdir}/*absl*
|
||||
%{_libdir}/*re2*
|
||||
%{_datadir}/%{name}
|
||||
|
||||
%files devel
|
||||
%defattr(-,root,root)
|
||||
%{_libdir}/*.so
|
||||
%exclude %{_libdir}/*absl*
|
||||
%{_libdir}/pkgconfig/*
|
||||
%{_includedir}/grpc
|
||||
%{_includedir}/grpc++
|
||||
@ -130,6 +134,12 @@ rm -rf %{buildroot}%{_prefix}/lib
|
||||
%{python3_sitearch}/grpcio-%{version}-py?.?.egg-info
|
||||
|
||||
%changelog
|
||||
* Wed Dec 09 2020 gaihuiying <gaihuiying1@huawei.com> - 1.31.0-2
|
||||
- Type:requirement
|
||||
- ID:NA
|
||||
- SUG:NA
|
||||
- DESC:separate re2 from grpc source
|
||||
|
||||
* Mon Aug 28 2020 liuxin <liuxin264@huawei.com> - 1.31.0-1
|
||||
- Type:requirement
|
||||
- ID:NA
|
||||
|
||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user