Skip to content

Commit

Permalink
Do not build python3 on El7
Browse files Browse the repository at this point in the history
Also add python2-grpcio pacakge for El7.
Also don't use ldconfig_scriptlets macro
as it's not available in redhat-rpm-macros
currently available in El7.

Add a patch to disable ares support by
adding GRPC_ARES=0, this is needed as minimus
c-ares version needed is 1.11.0 while in CentOS
base we have 1.10.0.

Also remove patch 1 and 3 to get grpc build with
older gcc.
  • Loading branch information
karelyatin committed May 30, 2019
1 parent 1f1b01a commit 5978d76
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 5 deletions.
38 changes: 38 additions & 0 deletions grpc-0004-DISABLE-ARES.patch
@@ -0,0 +1,38 @@
From 627826854c00fe4f9763288a5f3d0073bfeeb6c4 Mon Sep 17 00:00:00 2001
From: yatinkarel <ykarel@redhat.com>
Date: Thu, 30 May 2019 13:18:35 +0530
Subject: [PATCH] DISABLE ARES and change proto-path

---
Makefile | 2 +-
setup.py | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 53e70c95ba..7ed4d8e375 100644
--- a/Makefile
+++ b/Makefile
@@ -353,7 +353,7 @@ ifeq ($(SYSTEM),Darwin)
CXXFLAGS += -stdlib=libc++
endif
CXXFLAGS += -Wnon-virtual-dtor
-CPPFLAGS += -g -Wall -Wextra -Werror -Wno-long-long -Wno-unused-parameter -DOSATOMIC_USE_INLINED=1 -Wno-deprecated-declarations -Ithird_party/nanopb -DPB_FIELD_32BIT
+CPPFLAGS += -g -Wall -Wextra -Werror -Wno-long-long -Wno-unused-parameter -DOSATOMIC_USE_INLINED=1 -Wno-deprecated-declarations -Ithird_party/nanopb -DPB_FIELD_32BIT -DGRPC_ARES=0
COREFLAGS += -fno-rtti -fno-exceptions
LDFLAGS += -g

diff --git a/setup.py b/setup.py
index 1e205bdf91..1ece3f6f61 100644
--- a/setup.py
+++ b/setup.py
@@ -161,6 +161,7 @@ if EXTRA_ENV_COMPILE_ARGS is None:
elif "darwin" in sys.platform:
EXTRA_ENV_COMPILE_ARGS += ' -stdlib=libc++ -fvisibility=hidden -fno-wrapv -fno-exceptions'
EXTRA_ENV_COMPILE_ARGS += ' -DPB_FIELD_32BIT'
+EXTRA_ENV_COMPILE_ARGS += ' -DGRPC_ARES=0'

if EXTRA_ENV_LINK_ARGS is None:
EXTRA_ENV_LINK_ARGS = ''
--
2.20.1

60 changes: 55 additions & 5 deletions grpc.spec
@@ -1,3 +1,12 @@
%if 0%{?fedora} || 0%{?rhel} > 7
# Do not build python3 subpackage on EL7 and python2 on El > 8
%bcond_without python3
%bcond_with python2
%else
%bcond_with python3
%bcond_without python2
%endif

Name: grpc
Version: 1.20.1
Release: 1%{?dist}
Expand All @@ -17,17 +26,23 @@ BuildRequires: gtest-devel
BuildRequires: zlib-devel
BuildRequires: gperftools-devel

%if %{with python2}
BuildRequires: python2-devel
BuildRequires: python2-setuptools
BuildRequires: python2-Cython
%endif

%if %{with python3}
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-Cython
%endif

Patch0: grpc-0001-enforce-system-crypto-policies.patch
# https://github.com/grpc/grpc/pull/15532
Patch1: grpc-0002-patch-from-15532.patch
# https://github.com/grpc/grpc/pull/17732
# Patch3: 0003-tcp_posix.cc-fix-typo-in-bitwise-condition.patch
Patch2: grpc-0003-use-shell-loop-instead-makefile-function.patch
Patch3: grpc-0004-use-gettid-from-glibc.patch
Patch4: grpc-0004-DISABLE-ARES.patch

%description
gRPC is a modern open source high performance RPC framework that can run in any
Expand Down Expand Up @@ -72,20 +87,31 @@ Requires: %{name}%{?_isa} = %{version}-%{release}
%description devel
Development headers and files for gRPC libraries.

%if %{with python2}
%package -n python2-grpcio
Summary: Python language bindings for grpc, remote procedure call (RPC) framework
Requires: %{name}%{?_isa} = %{version}-%{release}
%{?python_provide:%python_provide python2-%{pypi_name}}

%description -n python2-grpcio
Python2 bindings for gRPC library.
%endif

%if %{with python3}
%package -n python3-grpcio
Summary: Python language bindings for grpc, remote procedure call (RPC) framework
Requires: %{name}%{?_isa} = %{version}-%{release}
%{?python_provide:%python_provide python3-%{pypi_name}}

%description -n python3-grpcio
Python3 bindings for gRPC library.
%endif

%prep
%autosetup -N
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
sed -i 's:^prefix ?= .*:prefix ?= %{_prefix}:' Makefile
sed -i 's:$(prefix)/lib:$(prefix)/%{_lib}:' Makefile
sed -i 's:^GTEST_LIB =.*::' Makefile
Expand All @@ -99,15 +125,30 @@ export GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=True
export GRPC_PYTHON_BUILD_SYSTEM_ZLIB=True
export GRPC_PYTHON_BUILD_SYSTEM_CARES=True
export CFLAGS="%optflags"
%if %{with python3}
%py3_build
%endif
%if %{with python2}
%py2_build
%endif

%install
make install prefix="%{buildroot}%{_prefix}"
make install-grpc-cli prefix="%{buildroot}%{_prefix}"
find %{buildroot} -type f -name '*.a' -exec rm -f {} \;
%if %{with python3}
%py3_install
%endif
%if %{with python2}
%py2_install
%endif

%if 0%{?fedora} || 0%{?rhel} > 7
%ldconfig_scriptlets
%else
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%endif

%files
%doc README.md
Expand All @@ -131,10 +172,19 @@ find %{buildroot} -type f -name '*.a' -exec rm -f {} \;
%{_includedir}/grpc++
%{_includedir}/grpcpp

%if %{with python2}
%files -n python2-grpcio
%license LICENSE
%{python2_sitearch}/grpc
%{python2_sitearch}/grpcio-%{version}-py?.?.egg-info
%endif

%if %{with python3}
%files -n python3-grpcio
%license LICENSE
%{python3_sitearch}/grpc
%{python3_sitearch}/grpcio-%{version}-py?.?.egg-info
%endif

%changelog
* Fri May 17 2019 Sergey Avseyev <sergey.avseyev@gmail.com> - 1.20.1-1
Expand Down

0 comments on commit 5978d76

Please sign in to comment.