diff --git a/add-secure-compile-option-in-Makefile.patch b/add-secure-compile-option-in-Makefile.patch index 4705fdac7d5779b7163dbf4cfb43eea8e1dd45c0..d1371d712b8d201aa832ff85232aa711ddc50800 100644 --- a/add-secure-compile-option-in-Makefile.patch +++ b/add-secure-compile-option-in-Makefile.patch @@ -8,9 +8,9 @@ diff -urN grpc/CMakeLists.txt grpc_new/CMakeLists.txt endif() set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_gRPC_C_CXX_FLAGS}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_gRPC_C_CXX_FLAGS}") -+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,-z,now -fPIE -fPIC") -+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-z,now -fstack-protector-strong") -+set(_gRPC_ALLTARGETS_LIBRARYIES "${_gRPC_ALLTARGETS_LIBRARYIES} -Wl,-z,now -pie") ++set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,-z,relro -Wl,-z,now -fPIE -fPIC -fstack-protector-strong -Wp,-D_FORTIFY_SOURCE=2 -O2") ++set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-z,relro -Wl,-z,now -fPIE -fPIC -fstack-protector-strong -Wp,-D_FORTIFY_SOURCE=2 -O2") ++set(_gRPC_ALLTARGETS_LIBRARYIES "${_gRPC_ALLTARGETS_LIBRARYIES} -Wl,-z,relro -Wl,-z,now -pie") if(gRPC_USE_PROTO_LITE) set(_gRPC_PROTOBUF_LIBRARY_NAME "libprotobuf-lite") @@ -23,9 +23,9 @@ index 6ede6e34d2..d6190ecde4 100644 DEFINES += $(EXTRA_DEFINES) LDLIBS += $(EXTRA_LDLIBS) -+CFLAGS += -Wl,-z,now -fPIE -fPIC -+CPPFLAGS += -Wl,-z,now -fstack-protector-strong -+LDFLAGS += -Wl,-z,now -pie ++CFLAGS += -Wl,-z,relro -Wl,-z,now -fPIE -fPIC -fstack-protector-strong -Wp,-D_FORTIFY_SOURCE=2 -O2 ++CPPFLAGS += -Wl,-z,relro -Wl,-z,now -fPIE -fPIC -fstack-protector-strong -Wp,-D_FORTIFY_SOURCE=2 -O2 ++LDFLAGS += -Wl,-z,relro -Wl,-z,now -pie + HOST_CPPFLAGS += $(CPPFLAGS) HOST_CFLAGS += $(CFLAGS) diff --git a/backport-grpc-1.41.1-python-grpcio-use-system-abseil.patch b/backport-grpc-1.41.1-python-grpcio-use-system-abseil.patch deleted file mode 100644 index 9d406aa368655e38d8d2e1fd0329e67a09173e4f..0000000000000000000000000000000000000000 --- a/backport-grpc-1.41.1-python-grpcio-use-system-abseil.patch +++ /dev/null @@ -1,46 +0,0 @@ -diff -Naur grpc-1.40.0-original/setup.py grpc-1.40.0/setup.py ---- grpc-1.40.0-original/setup.py 2021-09-03 19:20:52.000000000 -0400 -+++ grpc-1.40.0/setup.py 2021-09-07 14:57:55.247990450 -0400 -@@ -29,6 +29,7 @@ - from distutils import util - import os - import os.path -+import pathlib - import platform - import re - import shlex -@@ -154,6 +155,11 @@ - # runtime, the shared library must be installed - BUILD_WITH_SYSTEM_RE2 = _env_bool_value('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) -+ - # Export this variable to force building the python extension with a statically linked libstdc++. - # At least on linux, this is normally not needed as we can build manylinux-compatible wheels on linux just fine - # without statically linking libstdc++ (which leads to a slight increase in the wheel size). -@@ -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 = (('_WIN32_WINNT', 0x600),) - asm_files = [] - diff --git a/grpc-1.41.1.tar.gz b/grpc-1.50.1.tar.gz similarity index 51% rename from grpc-1.41.1.tar.gz rename to grpc-1.50.1.tar.gz index f7fe9a2de0ecd6b1f152212dc36ddaeb6f0fc01e..cdf67ed980b1f920f834d512d24ae5a167cb3ac1 100644 Binary files a/grpc-1.41.1.tar.gz and b/grpc-1.50.1.tar.gz differ diff --git a/grpc.spec b/grpc.spec index 093f096e4a3a7cc0559150dc5c51c7d109d0679e..60bbef510a6add2b958b5bf764e18d7497d931bf 100644 --- a/grpc.spec +++ b/grpc.spec @@ -1,17 +1,17 @@ -%global c_so_version 19 -%global cpp_so_version 1.41 +%global c_so_version 28 +%global cpp_so_version 1.50 +%global cpp_std 17 Name: grpc -Version: 1.41.1 -Release: 3 +Version: 1.50.1 +Release: 1 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 -Patch0006: repair-pkgconfig-path.patch -Patch0007: add-secure-compile-option-in-Makefile.patch -Patch0010: backport-grpc-1.41.1-python-grpcio-use-system-abseil.patch +Patch0001: repair-pkgconfig-path.patch +Patch0002: add-secure-compile-option-in-Makefile.patch BuildRequires: gcc-c++ pkgconfig protobuf-devel protobuf-compiler BuildRequires: openssl-devel c-ares-devel gtest-devel zlib-devel gperftools-devel @@ -41,7 +41,7 @@ Summary: Protocol buffers compiler plugins for gRPC # License: same as base package Requires: grpc = %{version}-%{release} Requires: protobuf-compiler - + %description plugins Plugins to the protocol buffers compiler to generate gRPC sources. @@ -58,11 +58,20 @@ 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 +#avoid downloading +mkdir %{_builddir}/%{name}-%{version}/third_party/opencensus-proto/src +sed -r -i 's/(std=c\+\+)14/\1%{cpp_std}/g' \ + setup.py grpc.gyp Rakefile \ + examples/cpp/*/Makefile \ + examples/cpp/*/CMakeLists.txt \ + tools/run_tests/artifacts/artifact_targets.py \ + tools/distrib/python/grpcio_tools/setup.py %build mkdir -p cmake/build cd cmake/build cmake ../../ -DgRPC_INSTALL=ON\ + -DCMAKE_CXX_STANDARD:STRING=%{cpp_std} \ -DgRPC_CARES_PROVIDER=package \ -DgRPC_PROTOBUF_PROVIDER=package \ -DgRPC_SSL_PROVIDER=package \ @@ -76,7 +85,8 @@ cmake ../../ -DgRPC_INSTALL=ON\ -DgRPC_INSTALL_SHAREDIR=%{buildroot}%{_datadir}/%{name} \ -DgRPC_INSTALL_PKGCONFIGDIR=%{buildroot}%{_libdir}/pkgconfig \ -DCMAKE_INSTALL_PREFIX=%{_prefix} \ - -DBUILD_SHARED_LIBS=ON + -DBUILD_SHARED_LIBS=ON \ + -DCMAKE_VERBOSE_MAKEFILE=ON make -j24 V=1 # build python module @@ -137,6 +147,12 @@ cd ../.. %{python3_sitearch}/grpcio-%{version}-py* %changelog +* Wed Apr 24 2024 Han Guangyu - 1.50.1-1 +- Type:requirement +- ID:NA +- SUG:NA +- DESC: update to 1.50.1 by merge master commit with adding secure compilation options and cancel gdb in buildrequires + * Sat Apr 16 2022 xingwei - 1.41.1-3 - Type:bugfix - ID:NA diff --git a/repair-pkgconfig-path.patch b/repair-pkgconfig-path.patch index 69056415552eb71d11112cbb4dbbfae79da5fca1..283a842054fa4c0f83e18aed8936a7517058c8c9 100644 --- a/repair-pkgconfig-path.patch +++ b/repair-pkgconfig-path.patch @@ -16,9 +16,9 @@ diff -urN grpc/CMakeLists.txt grpc_new/CMakeLists.txt --- grpc/CMakeLists.txt 2020-08-24 09:14:14.361862041 +0800 +++ grpc_new/CMakeLists.txt 2020-08-27 14:50:00.371507303 +0800 @@ -42,6 +42,7 @@ - set(gRPC_INSTALL_INCLUDEDIR "include" CACHE STRING "Installation directory for headers") set(gRPC_INSTALL_CMAKEDIR "lib/cmake/${PACKAGE_NAME}" CACHE STRING "Installation directory for cmake config files") set(gRPC_INSTALL_SHAREDIR "share/grpc" CACHE STRING "Installation directory for root certificates") + set(gRPC_BUILD_MSVC_MP_COUNT 0 CACHE STRING "The maximum number of processes for MSVC /MP option") +set(gRPC_INSTALL_PKGCONFIGDIR "lib/pkgconfig" CACHE STRING "Installation directory for pkgconfig") # Options @@ -27,7 +27,7 @@ diff -urN grpc/CMakeLists.txt grpc_new/CMakeLists.txt "${output_filepath}" @ONLY) install(FILES "${output_filepath}" -- DESTINATION "lib/pkgconfig/") +- DESTINATION "${gRPC_INSTALL_LIBDIR}/pkgconfig") + DESTINATION ${gRPC_INSTALL_PKGCONFIGDIR}) endfunction()