%global cpp_std 17 Name: protobuf Version: 3.19.6 Release: 2%{?dist} License: BSD-3-Clause Summary: Library for serializing structured data URL: https://github.com/protocolbuffers/protobuf Source0: %{name}-%{version}.tar.gz Source1: protoc.1 Patch0: protobuf-3.19.6.patch # The PyFrameObject structure members have been removed from the public C API. Patch1: protobuf-3.19.4-python3.11.patch # Python build needs protoc during build phase, which is built, but is not yet installed. %if "%{?dist}" == ".el8" %global uninstalled_artifacts_dir %{_builddir}/%{name}-%{version} %else %global uninstalled_artifacts_dir %{_builddir}/%{name}-%{version}/redhat-linux-build %endif BuildRequires: gcc-c++ BuildRequires: cmake BuildRequires: zlib-devel %description Protocol Buffers (a.k.a., protobuf) are Google's language-neutral, platform-neutral, extensible mechanism for serializing structured data. Protocol Buffers are a way of encoding structured data in an efficient yet extensible format. Google uses Protocol Buffers for almost all of its internal RPC protocols and file formats. Protocol buffers are a flexible, efficient, automated mechanism for serializing structured data – think XML, but smaller, faster, and simpler. You define how you want your data to be structured once, then you can use special generated source code to easily write and read your structured data to and from a variety of data streams and using a variety of languages. You can even update your data structure without breaking deployed programs that are compiled against the "old" format. %files %doc README.md CHANGES.txt CONTRIBUTORS.txt %license LICENSE %{_libdir}/libprotobuf.so.* # ==== compiler === %package compiler Summary: Protocol Buffers compiler Requires: protobuf = %{version}-%{release} %description compiler This package contains Protocol Buffers compiler for all programming languages %files compiler %doc README.md %license LICENSE %{_bindir}/protoc* %{_libdir}/libprotoc.so.* %{_mandir}/man1/protoc.1* # ==== devel === %package devel Summary: Protocol Buffers C++ headers and libraries Requires: protobuf = %{version}-%{release} Requires: protobuf-compiler = %{version}-%{release} Requires: zlib-devel %description devel This package contains Protocol Buffers compiler for all languages and C++ headers and libraries %files devel %dir %{_includedir}/google %{_includedir}/google/protobuf %{_libdir}/libprotobuf.so %{_libdir}/libprotoc.so %{_libdir}/cmake/protobuf %{_libdir}/pkgconfig/protobuf.pc # ==== lite ==== %package lite Summary: Protocol Buffers LITE_RUNTIME libraries %description lite Protocol Buffers built with optimize_for = LITE_RUNTIME. The "optimize_for = LITE_RUNTIME" option causes the compiler to generate code which only depends libprotobuf-lite, which is much smaller than libprotobuf but lacks descriptors, reflection, and some other features. %files lite %license LICENSE %{_libdir}/libprotobuf-lite.so.* # ==== lite-devel ==== %package lite-devel Summary: Protocol Buffers LITE_RUNTIME development libraries Requires: protobuf-devel = %{version}-%{release} Requires: protobuf-lite = %{version}-%{release} %description lite-devel This package contains development libraries built with optimize_for = LITE_RUNTIME. The "optimize_for = LITE_RUNTIME" option causes the compiler to generate code which only depends libprotobuf-lite, which is much smaller than libprotobuf but lacks descriptors, reflection, and some other features. %files lite-devel %{_libdir}/libprotobuf-lite.so %{_libdir}/pkgconfig/protobuf-lite.pc # ==== python3-protobuf ==== %package -n python3-%{name} Summary: Python bindings for Google Protocol Buffers BuildRequires: python3-devel BuildRequires: python3dist(setuptools) BuildRequires: python3dist(wheel) Requires: %{name}%{?_isa} = %{version}-%{release} Conflicts: %{name}-compiler > %{version} Conflicts: %{name}-compiler < %{version} Provides: %{name}-python3 = %{version}-%{release} %description -n python3-%{name} This package contains Python libraries for Google Protocol Buffers %files -n python3-%{name} %dir %{python3_sitearch}/google %{python3_sitearch}/google/protobuf/ %{python3_sitearch}/protobuf-%{version}%{?rcver}-py3.*.egg-info/ %{python3_sitearch}/protobuf-%{version}%{?rcver}-py3.*-nspkg.pth %doc python/README.md %doc examples/add_person.py examples/list_people.py examples/addressbook.proto # ======================= %prep %setup -q -n %{name}-%{version} %patch0 -p1 %patch1 -p1 -b .python311 %build %cmake \ -DCMAKE_INSTALL_PREFIX:PATH=%{_prefix} \ -Dprotobuf_ABSL_PROVIDER:STRING='package' \ -Dprotobuf_BUILD_EXAMPLES:BOOL=OFF \ -Dprotobuf_BUILD_LIBPROTOC:BOOL=ON \ -Dprotobuf_BUILD_PROTOC_BINARIES:BOOL=ON \ -Dprotobuf_BUILD_SHARED_LIBS:BOOL=ON \ -Dprotobuf_BUILD_TESTS:BOOL=OFF \ -Dutf8_range_ENABLE_INSTALL:BOOL=ON \ -Dutf8_range_ENABLE_TESTS:BOOL=OFF \ -S cmake %cmake_build pushd python # Python compile requires protoc, which is built but not yet installed PATH=%{uninstalled_artifacts_dir}:$PATH LDFLAGS="-L%{uninstalled_artifacts_dir} $LDFLAGS" %py3_build -- --cpp_implementation popd %install %cmake_install pushd python %py3_install -- --cpp_implementation popd # Man page for protoc install -p -m 0644 -D -t '%{buildroot}%{_mandir}/man1' '%{SOURCE1}' %check %changelog * Wed Aug 02 2023 Kim van der Riet - 3.19.6-2 - Added Python package * Thu May 11 2023 Kim van der Riet - 3.19.6-1 - Initial build