34ecf95
# The CMake build works, except grpc_cli is only built with the tests.
34ecf95
%bcond_with cmake
34ecf95
34ecf95
# Note that, in this spec file,e building the tests requires using CMake.
34ecf95
#
34ecf95
# C/C++ tests still are not quite building correctly:
34ecf95
#   /usr/bin/g++ -O2  -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64  -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection  -std=c++11 -Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld CMakeFiles/alloc_test.dir/test/core/gpr/alloc_test.cc.o -o alloc_test  -Wl,-rpath,/builddir/build/BUILD/grpc-1.26.0/x86_64-redhat-linux-gnu  -ldl  -lrt  -lm  -lpthread  libgrpc_test_util_unsecure.so.9.0.0  libgrpc_unsecure.so.9.0.0  libgpr.so.9.0.0  /usr/lib64/libz.so  /usr/lib64/libcares.so.2.4.2  libaddress_sorting.so.9.0.0  libupb.so.9.0.0  -ldl  -lrt  -lm  -lpthread && :
34ecf95
#   /usr/bin/ld: libgrpc_test_util_unsecure.so.9.0.0: undefined reference to `grpc_secure_channel_create'
34ecf95
#   /usr/bin/ld: libgrpc_test_util_unsecure.so.9.0.0: undefined reference to `grpc_local_credentials_create'
34ecf95
#   /usr/bin/ld: libgrpc_test_util_unsecure.so.9.0.0: undefined reference to `grpc_server_credentials_release'
34ecf95
#   /usr/bin/ld: libgrpc_test_util_unsecure.so.9.0.0: undefined reference to `grpc_server_credentials_set_auth_metadata_processor'
34ecf95
#   /usr/bin/ld: libgrpc_test_util_unsecure.so.9.0.0: undefined reference to `grpc_channel_credentials_release'
34ecf95
#   /usr/bin/ld: libgrpc_test_util_unsecure.so.9.0.0: undefined reference to `grpc_server_add_secure_http2_port'
34ecf95
#   /usr/bin/ld: libgrpc_test_util_unsecure.so.9.0.0: undefined reference to `grpc_local_server_credentials_create'
34ecf95
#   collect2: error: ld returned 1 exit status
34ecf95
%bcond_with core_tests
34ecf95
34ecf95
87469ef
Name:           grpc
87469ef
Version:        1.26.0
56e498c
Release:        13%{?dist}
87469ef
Summary:        RPC library and framework
87469ef
7adc2b7
# CMakeLists.txt: gRPC_CORE_SOVERSION
7adc2b7
%global c_so_version 15
7adc2b7
# CMakeLists.txt: gRPC_CPP_SOVERSION
7adc2b7
%global cpp_so_version 1
7adc2b7
# CMakeLists.txt: gRPC_CSHARP_SOVERSION
7adc2b7
%global csharp_so_version 2
7adc2b7
87469ef
# The entire source is ASL 2.0 except the following:
87469ef
#
87469ef
# BSD:
87469ef
#   - third_party/upb/, except third_party/upb/third_party/lunit/
87469ef
#     * Potentially linked into any compiled subpackage (but not -doc,
87469ef
#       pure-Python subpackages, etc.)
87469ef
#   - third_party/address_sorting/
87469ef
#     * Potentially linked into any compiled subpackage (but not -doc,
87469ef
#       pure-Python subpackages, etc.)
87469ef
#
87469ef
# as well as the following which do not contribute to the base License field or
87469ef
# any subpackage License field for the reasons noted:
87469ef
#
87469ef
# MPLv2.0:
87469ef
#   - etc/roots.pem
87469ef
#     * Truncated to an empty file in prep; a symlink to the shared system
87469ef
#       certificates is used instead
87469ef
#   - src/android/test/interop/app/src/main/assets/roots.pem
87469ef
#     * Truncated to an empty file in prep
87469ef
# ISC:
87469ef
#   - src/boringssl/crypto_test_data.cc and src/boringssl/err_data.c
87469ef
#     * Removed in prep; not used when building with system OpenSSL
87469ef
# BSD:
87469ef
#   - src/objective-c/*.podspec and templates/src/objective-c/*.podspec.template
87469ef
#     * Unused since the Objective-C bindings are not currently built
87469ef
# MIT:
87469ef
#   - third_party/cares/ares_build.h
87469ef
#     * Removed in prep; header from system C-Ares used instead
87469ef
#   - third_party/rake-compiler-dock/
87469ef
#     * Removed in prep, since we build no containers
87469ef
#   - third_party/upb/third_party/lunit/
87469ef
#     * Removed in prep, since there is no obvious way to run the upb tests
87469ef
License:        ASL 2.0 and BSD
87469ef
URL:            https://www.%{name}.io
87469ef
%global forgeurl https://github.com/%{name}/%{name}/
87469ef
Source0:        %{forgeurl}/archive/v%{version}/%{name}-%{version}.tar.gz
87469ef
87469ef
# ~~~~ C (core) and C++ (cpp) ~~~~
87469ef
87469ef
BuildRequires:  gcc-c++
34ecf95
%if %{with cmake}
34ecf95
BuildRequires:  cmake
34ecf95
BuildRequires:  ninja-build
34ecf95
%else
87469ef
BuildRequires:  make
34ecf95
%endif
87469ef
BuildRequires:  chrpath
87469ef
5ab84a2
BuildRequires:  pkgconfig(zlib)
5ab84a2
BuildRequires:  cmake(gflags)
5ab84a2
BuildRequires:  pkgconfig(protobuf)
87469ef
BuildRequires:  protobuf-compiler
5ab84a2
87469ef
BuildRequires:  openssl-devel
87469ef
BuildRequires:  c-ares-devel
5ab84a2
BuildRequires:  pkgconfig(openssl)
5ab84a2
BuildRequires:  cmake(c-ares)
34ecf95
34ecf95
%if %{with core_tests}
5ab84a2
BuildRequires:  cmake(benchmark)
5ab84a2
BuildRequires:  cmake(gtest)
5ab84a2
BuildRequires:  pkgconfig(gmock)
5ab84a2
BuildRequires:  pkgconfig(libprofiler)
34ecf95
%endif
87469ef
87469ef
# ~~~~ Python ~~~~
87469ef
87469ef
%global set_grpc_python_environment %{expand:
2d85140
export GRPC_PYTHON_BUILD_WITH_CYTHON='True'
2d85140
export GRPC_PYTHON_BUILD_SYSTEM_OPENSSL='True'
2d85140
export GRPC_PYTHON_BUILD_SYSTEM_ZLIB='True'
2d85140
export GRPC_PYTHON_BUILD_SYSTEM_CARES='True'
2d85140
export GRPC_PYTHON_DISABLE_LIBC_COMPATIBILITY='True'
2d85140
export GRPC_PYTHON_ENABLE_DOCUMENTATION_BUILD='True'
2d85140
}
87469ef
87469ef
BuildRequires:  python3-devel
87469ef
BuildRequires:  python3dist(setuptools)
87469ef
BuildRequires:  pyproject-rpm-macros
87469ef
# Not automatically generated even when we set GRPC_PYTHON_BUILD_WITH_CYTHON:
87469ef
BuildRequires:  python3dist(cython)
87469ef
# Otherwise, we use generated BR’s.
87469ef
87469ef
# ~~~~ Miscellaneous ~~~~
87469ef
87469ef
# https://bugzilla.redhat.com/show_bug.cgi?id=1893533
87469ef
%global _lto_cflags %{nil}
87469ef
87469ef
BuildRequires:  ca-certificates
87469ef
# For converting absolute symlinks in the buildroot to relative ones
87469ef
BuildRequires:  symlinks
87469ef
87469ef
BuildRequires:  dos2unix
87469ef
2229437
# Apply Fedora system crypto policies. Since this is Fedora-specific, the patch
2229437
# is not suitable for upstream.
87469ef
# https://docs.fedoraproject.org/en-US/packaging-guidelines/CryptoPolicies/#_cc_applications
87469ef
Patch0:         %{name}-0001-enforce-system-crypto-policies.patch
34ecf95
# Make gRPC podspec template more robust
34ecf95
# https://github.com/grpc/grpc/pull/21445
87469ef
Patch3:         99f8a10aec994a8957fbb6787768b444ef34d6a2.patch
34ecf95
# Remove grpc sources from grpc++
34ecf95
# https://github.com/grpc/grpc/pull/21662
87469ef
Patch4:         72351f63fd650cc7acfcd2d0307e8e8e8f777283.patch
87469ef
# Based on remove-gnu99.patch from
87469ef
# https://src.fedoraproject.org/rpms/grpc/pull-request/3; corresponds to
87469ef
# ignored upstream PR https://github.com/grpc/grpc/pull/23671. For consistency,
87469ef
# we also patch a related shell script that we do not use.
87469ef
# 
87469ef
# Using -std=gnu99 for C++ code makes GCC warn and clang error; besides, it
87469ef
# makes no sense.
87469ef
Patch5:         %{name}-1.26.0-python-no-std-gnu99.patch
87469ef
# Backport upstream commit 9e0b427893b65b220faf8a31a6afdc67f6f41364 “Use !=
87469ef
# with literals”
87469ef
Patch6:         %{name}-1.26.0-python-SyntaxWarning.patch
87469ef
# Stop adding -static-libgcc when linking Python bindings
87469ef
Patch7:         %{name}-1.26.0-python-no-static-libgcc.patch
87469ef
# Build python3-grpcio_tools against system protobuf packages instead of
87469ef
# expecting a git submodule. Must also add requisite linker flags using
87469ef
# GRPC_PYTHON_LDFLAGS.
87469ef
Patch8:         %{name}-1.26.0-python-grpcio_tools-use-system-protobuf.patch
87469ef
# Allow us to use the setup.py in grpcio-tests (e.g. for generating BR’s)
87469ef
# before we have built grpcio-tools; the build_package_protos command is simply
87469ef
# not available in this case. Activated by setting environment variable
87469ef
# GRPCIO_TESTS_IGNORE_MISSING_TOOLS with any value.
87469ef
Patch9:         %{name}-1.26.0-grpcio-tests-setup-without-grpcio-tools.patch
87469ef
# In grpcio-tests, require enum34 for install only on those ancient Pythons
87469ef
# that require it; we are not using such a Python!
87469ef
Patch10:        %{name}-1.26.0-grpcio-tests-conditionalize-enum34.patch
87469ef
87469ef
Requires:       %{name}-data = %{version}-%{release}
87469ef
87469ef
# Upstream https://github.com/protocolbuffers/upb does not support building
87469ef
# with anything other than Bazel, and Bazel is not likely to make it into
87469ef
# Fedora anytime soon due to its nightmarish collection of dependencies.
87469ef
# Monitor this at https://bugzilla.redhat.com/show_bug.cgi?id=1470842.
87469ef
# Therefore upb cannot be packaged for Fedora, and we must use the bundled copy.
87469ef
#
87469ef
# Note that upstream has never chosen a version, and it is not clear from which
87469ef
# commit the bundled copy was taken or forked.
87469ef
#
87469ef
# Note also that libupb is installed in the system-wide linker path, which will
87469ef
# be a problem if upb is ever packaged separately. We will cross that bridge if
87469ef
# we get there.
87469ef
Provides:       bundled(upb)
87469ef
87469ef
# Regarding third_party/address_sorting: this looks a bit like a bundled
87469ef
# library, but it is not. From a source file comment:
87469ef
#   This is an adaptation of Android's implementation of RFC 6724 (in Android’s
87469ef
#   getaddrinfo.c). It has some cosmetic differences from Android’s
87469ef
#   getaddrinfo.c, but Android’s getaddrinfo.c was used as a guide or example
87469ef
#   of a way to implement the RFC 6724 spec when this was written.
b3bb2c6
bf7e9a8
%description
bf7e9a8
gRPC is a modern open source high performance RPC framework that can run in any
bf7e9a8
environment. It can efficiently connect services in and across data centers
bf7e9a8
with pluggable support for load balancing, tracing, health checking and
bf7e9a8
authentication. It is also applicable in last mile of distributed computing to
bf7e9a8
connect devices, mobile applications and browsers to backend services.
bf7e9a8
bf7e9a8
The main usage scenarios:
bf7e9a8
56e498c
  • Efficiently connecting polyglot services in microservices style architecture
56e498c
  • Connecting mobile devices, browser clients to backend services
56e498c
  • Generating efficient client libraries
bf7e9a8
bf7e9a8
Core Features that make it awesome:
bf7e9a8
56e498c
  • Idiomatic client libraries in 10 languages
56e498c
  • Highly efficient on wire and with a simple service definition framework
56e498c
  • Bi-directional streaming with http/2 based transport
56e498c
  • Pluggable auth, tracing, load balancing and health checking
87469ef
87469ef
This package provides the shared C core library.
87469ef
87469ef
87469ef
%generate_buildrequires
87469ef
%set_grpc_python_environment
87469ef
%pyproject_buildrequires -r
87469ef
# Generate BRs from other Python packages; but use grep to filter out those we
87469ef
# are building and installing ourselves.
87469ef
(
87469ef
  export GRPCIO_TESTS_IGNORE_MISSING_TOOLS=1
87469ef
  pushd "tools/distrib/python/grpcio_tools/" >/dev/null
87469ef
  %pyproject_buildrequires -r
87469ef
  popd >/dev/null
87469ef
  for suffix in channelz health_checking reflection status testing tests
87469ef
  do
87469ef
    pushd "src/python/grpcio_${suffix}/" >/dev/null
87469ef
    %pyproject_buildrequires -r
87469ef
    popd >/dev/null
87469ef
  done
87469ef
) | grep -vF 'grpc'
87469ef
87469ef
87469ef
%package data
87469ef
Summary:        Data for gRPC bindings
87469ef
License:        ASL 2.0
87469ef
BuildArch:      noarch
87469ef
87469ef
Requires:       ca-certificates
87469ef
87469ef
%description data
87469ef
Common data for gRPC bindings: currently, this contains only a symbolic link to
87469ef
the system shared TLS certificates.
87469ef
87469ef
87469ef
%package doc
87469ef
Summary:        Documentation and examples for gRPC
87469ef
License:        ASL 2.0
87469ef
BuildArch:      noarch
87469ef
87469ef
%description doc
87469ef
Documentation and examples for gRPC.
87469ef
87469ef
87469ef
%package cpp
87469ef
Summary:        C++ language bindings for gRPC
87469ef
# License:        same as base package
87469ef
Requires:       %{name}%{?_isa} = %{version}-%{release}
87469ef
87469ef
%description cpp
87469ef
C++ language bindings for gRPC.
bf7e9a8
bf7e9a8
bf7e9a8
%package plugins
87469ef
Summary:        Protocol buffers compiler plugins for gRPC
87469ef
# License:        same as base package
87469ef
Requires:       %{name}%{?_isa} = %{version}-%{release}
87469ef
Requires:       protobuf-compiler
bf7e9a8
bf7e9a8
%description plugins
bf7e9a8
Plugins to the protocol buffers compiler to generate gRPC sources.
bf7e9a8
87469ef
bf7e9a8
%package cli
87469ef
Summary:        Command-line tool for gRPC
87469ef
# License:        same as base package
87469ef
Requires:       %{name}%{?_isa} = %{version}-%{release}
bf7e9a8
bf7e9a8
%description cli
87469ef
The command line tool can do the following things:
87469ef
56e498c
  • Send unary rpc.
56e498c
  • Attach metadata and display received metadata.
56e498c
  • Handle common authentication to server.
56e498c
  • Infer request/response types from server reflection result.
56e498c
  • Find the request/response types from a given proto file.
56e498c
  • Read proto request in text form.
56e498c
  • Read request in wire form (for protobuf messages, this means serialized
87469ef
    binary form).
56e498c
  • Display proto response in text form.
56e498c
  • Write response in wire form to a file.
87469ef
bf7e9a8
bf7e9a8
%package devel
87469ef
Summary:        Development files for gRPC library
87469ef
# License:        same as base package
87469ef
Requires:       %{name}%{?_isa} = %{version}-%{release}
87469ef
Requires:       %{name}-cpp%{?_isa} = %{version}-%{release}
bf7e9a8
bf7e9a8
%description devel
87469ef
Development headers and files for gRPC libraries (both C and C++).
87469ef
bf7e9a8
637ef64
%package -n python3-grpcio
87469ef
Summary:        Python language bindings for gRPC
87469ef
# License:        same as base package
87469ef
87469ef
# Note that the Python package has no runtime dependency on the base C library;
87469ef
# everything it needs is bundled.
87469ef
Requires:       %{name}-data = %{version}-%{release}
637ef64
637ef64
%description -n python3-grpcio
87469ef
Python language bindings for gRPC (HTTP/2-based RPC framework).
87469ef
87469ef
87469ef
%package -n python3-grpcio-tools
87469ef
Summary:       Package for gRPC Python tools
87469ef
# License:        same as base package
87469ef
87469ef
%description -n python3-grpcio-tools
87469ef
Package for gRPC Python tools.
87469ef
87469ef
87469ef
%package -n python3-grpcio-channelz
87469ef
Summary:        Channel Level Live Debug Information Service for gRPC
87469ef
License:        ASL 2.0
87469ef
BuildArch:      noarch
87469ef
87469ef
%description -n python3-grpcio-channelz
87469ef
Channelz is a live debug tool in gRPC Python.
87469ef
87469ef
87469ef
%package -n python3-grpcio-health-checking
87469ef
Summary:        Standard Health Checking Service for gRPC
87469ef
License:        ASL 2.0
87469ef
BuildArch:      noarch
87469ef
87469ef
%description -n python3-grpcio-health-checking
87469ef
Reference package for GRPC Python health checking.
87469ef
87469ef
87469ef
%package -n python3-grpcio-reflection
87469ef
Summary:        Standard Protobuf Reflection Service for gRPC
87469ef
License:        ASL 2.0
87469ef
BuildArch:      noarch
87469ef
87469ef
%description -n python3-grpcio-reflection
87469ef
Reference package for reflection in GRPC Python.
87469ef
87469ef
87469ef
%package -n python3-grpcio-status
87469ef
Summary:        Status proto mapping for gRPC
87469ef
License:        ASL 2.0
87469ef
BuildArch:      noarch
87469ef
87469ef
%description -n python3-grpcio-status
87469ef
Reference package for GRPC Python status proto mapping.
87469ef
87469ef
87469ef
%package -n python3-grpcio-testing
87469ef
Summary:        Testing utilities for gRPC Python
87469ef
License:        ASL 2.0
87469ef
BuildArch:      noarch
87469ef
87469ef
%description -n python3-grpcio-testing
87469ef
Testing utilities for gRPC Python.
87469ef
87469ef
87469ef
%package -n python-grpcio-doc
87469ef
License:        ASL 2.0
87469ef
Summary:        Documentation for Python language bindings for gRPC
87469ef
BuildArch:      noarch
87469ef
87469ef
Provides:       python-grpcio-channelz-doc = %{version}-%{release}
87469ef
Provides:       python-grpcio-health-checking-doc = %{version}-%{release}
87469ef
Provides:       python-grpcio-reflection-doc = %{version}-%{release}
87469ef
Provides:       python-grpcio-status-doc = %{version}-%{release}
87469ef
Provides:       python-grpcio-testing-doc = %{version}-%{release}
87469ef
87469ef
%description -n python-grpcio-doc
87469ef
Documentation for Python language bindings for gRPC, including the following
87469ef
packages:
87469ef
56e498c
  • grpcio
56e498c
  • grpcio_channelz
56e498c
  • grpcio_health_checking
56e498c
  • grpcio_reflection
56e498c
  • grpcio_status
56e498c
  • grpcio_testing
87469ef
637ef64
bf7e9a8
%prep
87469ef
%autosetup -p1
34ecf95
%if %{without cmake}
87469ef
sed -i \
87469ef
    -e 's:^prefix ?= .*:prefix ?= %{_prefix}:' \
87469ef
    -e 's:$(prefix)/lib:$(prefix)/%{_lib}:' \
87469ef
    -e 's:^GTEST_LIB =.*::' Makefile
34ecf95
%endif
87469ef
87469ef
# Fix some of the weirdest accidentally-executable files
87469ef
find . -type f -name '*.md' -perm /0111 -execdir chmod -v a-x '{}' '+'
87469ef
87469ef
# Allow building Python documentation with a newer Sphinx; the upstream version
87469ef
# requirement is needlessly strict. (It is fine for upstream’s own purposes, as
87469ef
# they are happy to build documentation with a pinned old version.)
87469ef
sed -r -i "s/('Sphinx)~=.*'/\1'/" setup.py
87469ef
87469ef
# Remove unused sources that have licenses not in the License field, to ensure
87469ef
# they are not accidentally used in the build. See the comment above the base
87469ef
# package License field for more details.
87469ef
rm -rfv \
87469ef
    src/boringssl/*.c src/boringssl/*.cc \
87469ef
    third_party/cares/ares_build.h \
87469ef
    third_party/rake-compiler-dock \
87469ef
    third_party/upb/third_party/lunit
87469ef
# Since we are replacing roots.pem with a symlink to the shared system
87469ef
# certificates, we do not include its license (MPLv2.0) in any License field.
87469ef
# We remove its contents so that, if we make a packaging mistake, we will have
87469ef
# a bug but not an incorrect License field.
87469ef
echo '' > etc/roots.pem
87469ef
87469ef
# Remove Android sources and examples. We do not need these on Linux, and they
87469ef
# have some issues that will be flagged when reviewing the package, such as:
87469ef
#   - Another copy of the MPLv2.0-licensed certificate bundle from
87469ef
#     etc/roots.pem, in src/android/test/interop/app/src/main/assets/roots.pem
87469ef
#   - Pre-built jar files at
87469ef
#     src/android/test/interop/gradle/wrapper/gradle-wrapper.jar and
87469ef
#     examples/android/helloworld/gradle/wrapper/gradle-wrapper.jar
87469ef
rm -rvf examples/android src/android
87469ef
87469ef
# Remove unwanted .gitignore files, generally in examples. One could argue that
87469ef
# a sample .gitignore file is part of the example, but, well, we’re not going
87469ef
# to do that.
87469ef
find . -type f -name .gitignore -print -delete
87469ef
87469ef
# Find executables with /usr/bin/env shebangs in the examples, and fix them.
87469ef
find examples -type f -perm /0111 |
87469ef
  while read -r fn
87469ef
  do
87469ef
    if head -n 1 "${fn}" | grep -E '^#!/usr/bin/env[[:blank:]]'
87469ef
    then
87469ef
      sed -r -i '1{s|^(#!/usr/bin/)env[[:blank:]]+([^[:blank:]]+)|\1\2|}' \
87469ef
          "${fn}"
87469ef
    fi
87469ef
  done
87469ef
87469ef
# Fix some CRNL line endings:
87469ef
dos2unix \
87469ef
    examples/cpp/helloworld/CMakeLists.txt \
87469ef
    examples/cpp/helloworld/cmake_externalproject/CMakeLists.txt
87469ef
# We leave those under examples/csharp alone.
87469ef
34ecf95
%if %{with cmake}
34ecf95
# Patch CMakeLists for external gtest/gmock.
34ecf95
#
34ecf95
#  1. Upstream expects single-source bundled copies, which are not distributed
34ecf95
#     in the tarball. Create dummy sources, adding a typedef so the translation
34ecf95
#     unit is not empty, rather than removing references to these sources from
34ecf95
#     CMakeLists.txt. This is so that we do not end up with executables with no
34ecf95
#     sources, only libraries, which is CMake error.
34ecf95
#  2. Either remove references to the corresponding include directories, or
34ecf95
#     create the directories and leave them empty.
34ecf95
#  3. “Stuff” the external library into the target_link_libraries() for each
34ecf95
#     test by noting that GMock/GTest/GFlags are always used together.
34ecf95
for gwhat in test mock
34ecf95
do
34ecf95
  mkdir -p "third_party/googletest/google${gwhat}/src" \
34ecf95
      "third_party/googletest/google${gwhat}/include"
34ecf95
  echo "typedef int dummy_${gwhat}_type;" \
34ecf95
      > "third_party/googletest/google${gwhat}/src/g${gwhat}-all.cc"
34ecf95
done
34ecf95
sed -r -i 's/^([[:blank:]]*)(\$\{_gRPC_GFLAGS_LIBRARIES\})/'\
34ecf95
'\1\2\n\1gtest\n\1gmock/' CMakeLists.txt
34ecf95
%endif
34ecf95
bf7e9a8
bf7e9a8
%build
87469ef
# ~~~~ C (core) and C++ (cpp) ~~~~
87469ef
34ecf95
%if %{with cmake}
34ecf95
# We could use either make or ninja as the backend; ninja is faster and has no
34ecf95
# disadvantages (except a small additional BR, given we already need Python)
34ecf95
%cmake \
34ecf95
    -GNinja \
34ecf95
    -DgRPC_INSTALL_BINDIR=%{_bindir} \
34ecf95
    -DgRPC_INSTALL_LIBDIR=%{_libdir} \
34ecf95
    -DgRPC_INSTALL_INCLUDEDIR=%{_includedir} \
34ecf95
    -DgRPC_INSTALL_CMAKEDIR=%{_libdir}/cmake/%{name} \
34ecf95
    -DgRPC_INSTALL_SHAREDIR=%{_datadir}/%{name} \
34ecf95
    -DgRPC_BUILD_TESTS:BOOL=%{?with_core_tests:ON}%{?!with_core_tests:OFF} \
34ecf95
    -DgRPC_BUILD_CODEGEN:BOOL=ON \
34ecf95
    -DgRPC_BUILD_CSHARPEXT:BOOL=ON \
34ecf95
    -DgRPC_BACKWARDS_COMPATIBILITY_MODE:BOOL=OFF \
34ecf95
    -DgRPC_ZLIB_PROVIDER:STRING='package' \
34ecf95
    -DgRPC_CARES_PROVIDER:STRING='package' \
34ecf95
    -DgRPC_SSL_PROVIDER:STRING='package' \
34ecf95
    -DgRPC_PROTOBUF_PROVIDER:STRING='package' \
34ecf95
    -DgRPC_PROTOBUF_PACKAGE_TYPE:STRING='MODULE' \
34ecf95
    -DgRPC_GFLAGS_PROVIDER:STRING='package' \
34ecf95
    -DgRPC_BENCHMARK_PROVIDER:STRING='package' \
34ecf95
    -DgRPC_USE_PROTO_LITE:BOOL=OFF
34ecf95
%cmake_build
34ecf95
%else
87469ef
%set_build_flags
87469ef
# Default targets are: static shared plugins
bf7e9a8
%make_build shared plugins
34ecf95
%endif
bf7e9a8
87469ef
# ~~~~ Python ~~~~
87469ef
87469ef
# Since we will need all of the Python packages for the documentation build,
87469ef
# and there are some other interdependencies (e.g., many have setup_requires:
87469ef
# grpcio-tools), we do a temporary install of the built packages into a local
87469ef
# directory, and add it to the PYTHONPATH.
87469ef
PYROOT="${PWD}/%{_vpath_builddir}/pyroot"
87469ef
if [ -n "${PYTHONPATH-}" ]; then PYTHONPATH="${PYTHONPATH}:"; fi
87469ef
PYTHONPATH="${PYTHONPATH-}${PYROOT}%{python3_sitelib}"
87469ef
PYTHONPATH="${PYTHONPATH}:${PYROOT}%{python3_sitearch}"
87469ef
export PYTHONPATH
87469ef
87469ef
# ~~ grpcio ~~
87469ef
%set_grpc_python_environment
87469ef
%py3_build
87469ef
%{__python3} %{py_setup} %{?py_setup_args} install \
87469ef
    -O1 --skip-build --root "${PYROOT}"
87469ef
87469ef
# ~~ grpcio-tools ~~
87469ef
pushd "tools/distrib/python/grpcio_tools/" >/dev/null
87469ef
# When copying more things in here, make sure the subpackage License field
87469ef
# stays correct. We need copies, not symlinks, so that the “graft” in
87469ef
# MANIFEST.in works.
87469ef
mkdir -p %{name}_root/src
87469ef
for srcdir in compiler
87469ef
do
87469ef
  cp -rp "../../../../src/${srcdir}" "%{name}_root/src/"
87469ef
done
87469ef
cp -rp '../../../../include' '%{name}_root/'
87469ef
(
87469ef
  export GRPC_PYTHON_LDFLAGS='-lprotoc'
87469ef
  %py3_build
87469ef
)
87469ef
# Remove unwanted shebang from grpc_tools.protoc source file, which will be
87469ef
# installed without an executable bit:
87469ef
find . -type f -name protoc.py -execdir sed -r -i '1{/^#!/d}' '{}' '+'
87469ef
%{__python3} %{py_setup} %{?py_setup_args} install \
87469ef
    -O1 --skip-build --root "${PYROOT}"
87469ef
popd >/dev/null
87469ef
87469ef
# ~~ pure-python modules grpcio-* ~~
87469ef
for suffix in channelz health_checking reflection status testing
87469ef
do
87469ef
  echo "----> grpcio_${suffix} <----" 1>&2
87469ef
  pushd "src/python/grpcio_${suffix}/" >/dev/null
87469ef
  %py3_build
87469ef
  %{__python3} %{py_setup} %{?py_setup_args} install \
87469ef
      -O1 --skip-build --root "${PYROOT}"
87469ef
  popd >/dev/null
87469ef
done
87469ef
87469ef
# ~~ grpcio-tests ~~
87469ef
echo '----> grpcio_tests <----'
87469ef
pushd 'src/python/grpcio_tests/' >/dev/null
637ef64
%py3_build
87469ef
popd >/dev/null
87469ef
87469ef
# ~~ documentation ~~
87469ef
%{__python3} %{py_setup} %{?py_setup_args} doc
87469ef
637ef64
bf7e9a8
%install
87469ef
# ~~~~ C (core) and C++ (cpp) ~~~~
34ecf95
%if %{with cmake}
34ecf95
%cmake_install
34ecf95
#chrpath --delete '%{buildroot}%{_bindir}/%{name}_cli'
34ecf95
%else
87469ef
export STRIP=/bin/true
87469ef
make install prefix='%{buildroot}%{_prefix}'
87469ef
make install-grpc-cli prefix='%{buildroot}%{_prefix}'
87469ef
chrpath --delete '%{buildroot}%{_bindir}/%{name}_cli'
34ecf95
%endif
87469ef
# Remove any static libraries that may have been installed against our wishes
87469ef
find %{buildroot} -type f -name '*.a' -print -delete
87469ef
# Fix wrong permissions on installed headers
87469ef
find %{buildroot}%{_includedir}/%{name}* -type f -name '*.h' -perm /0111 \
87469ef
    -execdir chmod -v a-x '{}' '+'
87469ef
87469ef
# ~~~~ Python ~~~~
87469ef
87469ef
# Since several packages have an install_requires: grpcio-tools, we must ensure
87469ef
# the buildroot Python site-packages directories are in the PYTHONPATH.
87469ef
pushd '%{buildroot}'
87469ef
PYROOT="${PWD}"
87469ef
popd
87469ef
if [ -n "${PYTHONPATH-}" ]; then PYTHONPATH="${PYTHONPATH}:"; fi
87469ef
PYTHONPATH="${PYTHONPATH-}${PYROOT}%{python3_sitelib}"
87469ef
PYTHONPATH="${PYTHONPATH}:${PYROOT}%{python3_sitearch}"
87469ef
export PYTHONPATH
87469ef
87469ef
# ~~ grpcio ~~
87469ef
%py3_install
87469ef
87469ef
# ~~ grpcio-tools ~~
87469ef
pushd "tools/distrib/python/grpcio_tools/" >/dev/null
637ef64
%py3_install
87469ef
popd >/dev/null
87469ef
87469ef
# ~~ pure-python modules grpcio-* ~~
87469ef
for suffix in channelz health_checking reflection status testing
87469ef
do
87469ef
  pushd "src/python/grpcio_${suffix}/" >/dev/null
87469ef
  %py3_install
87469ef
  popd >/dev/null
87469ef
done
87469ef
87469ef
# ~~~~ Miscellaneous ~~~~
87469ef
87469ef
# Replace copies of the certificate bundle with symlinks to the shared system
87469ef
# certificates. This has the following benefits:
87469ef
#   - Reduces duplication and save space
87469ef
#   - Respects system-wide administrative trust configuration
87469ef
#   - Keeps “MPLv2.0” from having to be added to a number of License fields
87469ef
%global sysbundle %{_sysconfdir}/pki/ca-trust/extracted/pem/tls-ca-bundle.pem
87469ef
# We do not own this file; we temporarily install it in the buildroot so we do
87469ef
# not have dangling symlinks.
87469ef
install -D -t "%{buildroot}$(dirname '%{sysbundle}')" -m 0644 '%{sysbundle}'
87469ef
87469ef
find '%{buildroot}' -type f -name 'roots.pem' |
87469ef
  while read -r fn
87469ef
  do
87469ef
    ln -s -f "%{buildroot}%{sysbundle}" "${fn}"
87469ef
    symlinks -c -o "${fn}"
87469ef
  done
87469ef
87469ef
# ~~ documentation and examples ~~
87469ef
87469ef
install -D -t '%{buildroot}%{_pkgdocdir}' -m 0644 -p AUTHORS *.md
87469ef
cp -rp doc examples '%{buildroot}%{_pkgdocdir}'
87469ef
87469ef
%global pythondocdir %{_docdir}/python-grpcio
87469ef
install -d '%{buildroot}%{pythondocdir}'
87469ef
cp -rp doc/build '%{buildroot}%{pythondocdir}/html'
87469ef
87469ef
87469ef
%check
34ecf95
%if %{with core_tests} && %{with cmake}
34ecf95
%ctest
34ecf95
%endif
87469ef
87469ef
pushd src/python/grpcio_tests
87469ef
# Currently fails with
87469ef
#   ModuleNotFoundError: No module named 'grpc_channelz.v1.channelz_pb2'
87469ef
# Will look into this if it continues on the latest version.
87469ef
87469ef
# See the implementation of the %%pytest macro, upon which our environment
87469ef
# setup is based:
87469ef
env \
87469ef
    CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" \
87469ef
    LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}" \
87469ef
    PATH="%{buildroot}%{_bindir}:$PATH" \
87469ef
    PYTHONPATH="${PYTHONPATH:-%{buildroot}%{python3_sitearch}:%{buildroot}%{python3_sitelib}}" \
87469ef
    PYTHONDONTWRITEBYTECODE=1 \
87469ef
    %{__python3} %{py_setup} %{?py_setup_args} test_lite || :
87469ef
popd
bf7e9a8
bf7e9a8
bf7e9a8
%files
87469ef
%license LICENSE NOTICE.txt
87469ef
%{_libdir}/libaddress_sorting.so.%{c_so_version}*
87469ef
%{_libdir}/libgpr.so.%{c_so_version}*
87469ef
%{_libdir}/lib%{name}.so.%{c_so_version}*
87469ef
%{_libdir}/lib%{name}_cronet.so.%{c_so_version}*
87469ef
%{_libdir}/lib%{name}_unsecure.so.%{c_so_version}*
87469ef
%{_libdir}/libupb.so.%{c_so_version}*
87469ef
87469ef
87469ef
%files data
87469ef
%license LICENSE NOTICE.txt
87469ef
%dir %{_datadir}/%{name}
87469ef
%{_datadir}/%{name}/roots.pem
87469ef
# Actually part of ca-certificates dependency:
87469ef
%exclude %{sysbundle}
87469ef
87469ef
87469ef
%files doc
87469ef
%license LICENSE NOTICE.txt
87469ef
%{_pkgdocdir}
87469ef
# Built Python documentation:
87469ef
%exclude %{_pkgdocdir}/doc/build
87469ef
# Python documentation sources:
87469ef
%exclude %{_pkgdocdir}/doc/python/sphinx
87469ef
87469ef
87469ef
%files cpp
87469ef
%{_libdir}/lib%{name}++.so.%{cpp_so_version}*
87469ef
%{_libdir}/lib%{name}++_error_details.so.%{cpp_so_version}*
87469ef
%{_libdir}/lib%{name}++_reflection.so.%{cpp_so_version}*
87469ef
%{_libdir}/lib%{name}++_unsecure.so.%{cpp_so_version}*
87469ef
%{_libdir}/lib%{name}pp_channelz.so.%{cpp_so_version}*
87469ef
bf7e9a8
bf7e9a8
%files cli
87469ef
%{_bindir}/%{name}_cli
87469ef
bf7e9a8
bf7e9a8
%files plugins
87469ef
%{_bindir}/%{name}_*_plugin
87469ef
bf7e9a8
bf7e9a8
%files devel
3b94ecf
%{_libdir}/libaddress_sorting.so
3b94ecf
%{_libdir}/libgpr.so
87469ef
%{_libdir}/lib%{name}.so
87469ef
%{_libdir}/lib%{name}_cronet.so
87469ef
%{_libdir}/lib%{name}_unsecure.so
3b94ecf
%{_libdir}/libupb.so
87469ef
%{_includedir}/%{name}
87469ef
%{_libdir}/pkgconfig/gpr.pc
87469ef
%{_libdir}/pkgconfig/%{name}.pc
87469ef
%{_libdir}/pkgconfig/%{name}_unsecure.pc
87469ef
87469ef
%{_libdir}/lib%{name}++.so
87469ef
%{_libdir}/lib%{name}++_error_details.so
87469ef
%{_libdir}/lib%{name}++_reflection.so
87469ef
%{_libdir}/lib%{name}++_unsecure.so
87469ef
%{_includedir}/%{name}++
87469ef
%{_libdir}/pkgconfig/%{name}++.pc
87469ef
%{_libdir}/pkgconfig/%{name}++_unsecure.pc
87469ef
87469ef
%{_libdir}/lib%{name}pp_channelz.so
87469ef
%{_includedir}/%{name}pp
87469ef
bf7e9a8
637ef64
%files -n python3-grpcio
87469ef
%license LICENSE NOTICE.txt
637ef64
%{python3_sitearch}/grpc
aa731c9
%{python3_sitearch}/grpcio-%{version}-py%{python3_version}.egg-info
637ef64
87469ef
87469ef
%files -n python3-grpcio-tools
87469ef
%{python3_sitearch}/grpc_tools
87469ef
%{python3_sitearch}/grpcio_tools-%{version}-py%{python3_version}.egg-info
87469ef
87469ef
87469ef
%files -n python3-grpcio-channelz
87469ef
%{python3_sitelib}/grpc_channelz
87469ef
%{python3_sitelib}/grpcio_channelz-%{version}-py%{python3_version}.egg-info
87469ef
87469ef
87469ef
%files -n python3-grpcio-health-checking
87469ef
%{python3_sitelib}/grpc_health
87469ef
%{python3_sitelib}/grpcio_health_checking-%{version}-py%{python3_version}.egg-info
87469ef
87469ef
87469ef
%files -n python3-grpcio-reflection
87469ef
%{python3_sitelib}/grpc_reflection
87469ef
%{python3_sitelib}/grpcio_reflection-%{version}-py%{python3_version}.egg-info
87469ef
87469ef
87469ef
%files -n python3-grpcio-status
87469ef
%{python3_sitelib}/grpc_status
87469ef
%{python3_sitelib}/grpcio_status-%{version}-py%{python3_version}.egg-info
87469ef
87469ef
87469ef
%files -n python3-grpcio-testing
87469ef
%{python3_sitelib}/grpc_testing
87469ef
%{python3_sitelib}/grpcio_testing-%{version}-py%{python3_version}.egg-info
87469ef
87469ef
87469ef
%files -n python-grpcio-doc
87469ef
%license LICENSE NOTICE.txt
87469ef
%{pythondocdir}
87469ef
%exclude %{pythondocdir}/html/.buildinfo
87469ef
%exclude %{pythondocdir}/html/.doctrees
87469ef
87469ef
bf7e9a8
%changelog
56e498c
* Mon Mar 15 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 1.26.0-13
56e498c
- General:
56e498c
  * Replace * with • in descriptions
5ab84a2
  * Use cmake() dependencies first, and pkgconfig() dependencies second, where
5ab84a2
    available
9255a1a
  * Drop explicit pkgconfig BR
56e498c
34ecf95
* Tue Feb 16 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 1.26.0-12
34ecf95
- C (core) and C++ (cpp):
34ecf95
  * Add CMake build support but do not enable it yet; there is still a problem
34ecf95
    where grpc_cli is only built with the tests, and a linking problem when
34ecf95
    building the tests
34ecf95
34ecf95
* Tue Feb 02 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 1.26.0-11
87469ef
- General:
87469ef
  * Update summaries and descriptions
87469ef
  * Update License fields to include licenses from bundled components
87469ef
  * Fix failure to respect Fedora build flags
87469ef
  * Use the system shared certificate bundle instead of shipping our own
87469ef
- CLI:
87469ef
  * No longer set rpath $ORIGIN
87469ef
- C (core) and C++ (cpp):
87469ef
  * Add c_so_version/cpp_so_version macros
87469ef
  * Split out C++ bindings and shared data into subpackages
87469ef
  * Drop obsolete ldconfig_scriptlets macro
87469ef
  * Stop stripping debugging symbols
87469ef
- Python:
87469ef
  * Use generated BR’s
87469ef
  * Build and package Python binding documentation
87469ef
  * Disable accommodations for older libc’s
87469ef
  * Patch out -std=gnu99 flag, which is inappropriate for C++
87469ef
  * Build additional Python packages grpcio_tools, gprcio_channelz,
87469ef
    grpcio_health_checking, grpcio_reflection, grpcio_status, and
87469ef
    grpcio_testing
87469ef
00c46bd
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.26.0-10
00c46bd
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
00c46bd
42cea2c
* Thu Jan 14 08:46:34 CET 2021 Adrian Reber <adrian@lisas.de> - 1.26.0-9
42cea2c
- Rebuilt for protobuf 3.14
42cea2c
06f39c9
* Fri Nov 13 2020 Artem Polishchuk <ego.cordatus@gmail.com> - 1.26.0-8
06f39c9
- build: disable LTO due to rh#1893533
06f39c9
9310245
* Thu Sep 24 2020 Adrian Reber <adrian@lisas.de> - 1.26.0-7
9310245
- Rebuilt for protobuf 3.13
9310245
7c4d8c0
* Mon Aug 03 2020 Gwyn Ciesla <gwync@protonmail.com> - 1.26.0-6
7c4d8c0
- Patches for https://github.com/grpc/grpc/pull/21669
7c4d8c0
fd56af7
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.26.0-5
fd56af7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
fd56af7
ef05f06
* Sun Jun 14 2020 Adrian Reber <adrian@lisas.de> - 1.26.0-4
ef05f06
- Rebuilt for protobuf 3.12
ef05f06
ae84ab8
* Tue May 26 2020 Miro Hrončok <mhroncok@redhat.com> - 1.26.0-3
ae84ab8
- Rebuilt for Python 3.9
ae84ab8
324b1af
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.26.0-2
324b1af
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
324b1af
3b94ecf
* Wed Jan 15 2020 Sergey Avseyev <sergey.avseyev@gmail.com> - 1.26.0-1
3b94ecf
- Update to 1.26.0
3b94ecf
f302d3b
* Thu Dec 19 2019 Orion Poplawski <orion@nwra.com> - 1.20.1-5
f302d3b
- Rebuild for protobuf 3.11
f302d3b
4d76576
* Thu Oct 03 2019 Miro Hrončok <mhroncok@redhat.com> - 1.20.1-4
4d76576
- Rebuilt for Python 3.8.0rc1 (#1748018)
4d76576
751c424
* Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 1.20.1-3
751c424
- Rebuilt for Python 3.8
751c424
081b763
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.20.1-2
081b763
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
081b763
1f1b01a
* Fri May 17 2019 Sergey Avseyev <sergey.avseyev@gmail.com> - 1.20.1-1
1f1b01a
- Update to 1.20.1
1f1b01a
eabd20e
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.18.0-2
eabd20e
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
eabd20e
4d8a3c0
* Wed Jan 16 2019 Sergey Avseyev <sergey.avseyev@gmail.com> - 1.18.0-1
4d8a3c0
- Update to 1.18.0
4d8a3c0
c9c00b2
* Mon Dec 17 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 1.17.1-3
c9c00b2
- Properly store patch in SRPM
c9c00b2
fe04497
* Mon Dec 17 2018 Sergey Avseyev <sergey.avseyev@gmail.com> - 1.17.1-2
fe04497
- Build without ruby plugin for Fedora < 30 (Thanks to Mathieu Bridon)
fe04497
637ef64
* Fri Dec 14 2018 Sergey Avseyev <sergey.avseyev@gmail.com> - 1.17.1-1
637ef64
- Update to 1.17.1 and package python bindings
637ef64
bf7e9a8
* Fri Dec 07 2018 Sergey Avseyev <sergey.avseyev@gmail.com> - 1.17.0-1
bf7e9a8
- Initial revision