%global _trivial .0 %global _buildid .100 # Build -python subpackage %bcond_without python # Build -java subpackage %bcond_with java # Build -emacs subpackage %bcond_without emacs # Disable LTO to work around annobin error messages %global _lto_cflags %nil Summary: Protocol Buffers - Google's data interchange format Name: protobuf Version: 3.14.0 Release: 16%{dist}%{?_trivial}%{?_buildid} License: BSD URL: https://github.com/protocolbuffers/protobuf Source: https://github.com/protocolbuffers/protobuf/archive/v%{version}/%{name}-%{version}-all.tar.gz Source1: ftdetect-proto.vim Source2: protobuf-init.el # For tests (using exactly the same version as the release) Source3: https://github.com/google/googletest/archive/5ec7f0c4a113e2f18ac2c6cc7df51ad6afc24081.zip # Patches remain unchanged Patch1: protobuf-3.14-disable-IoTest.LargeOutput.patch Patch2: CVE-2021-22570.patch Patch3: CVE-2022-1941.patch BuildRequires: cmake BuildRequires: ninja-build %if %{with emacs} BuildRequires: emacs %endif BuildRequires: gcc-c++ BuildRequires: pkgconfig BuildRequires: zlib-devel %description 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. %package compiler Summary: Protocol Buffers compiler Requires: %{name} = %{version}-%{release} %description compiler This package contains Protocol Buffers compiler for all programming languages %package devel Summary: Protocol Buffers C++ headers and libraries Requires: %{name} = %{version}-%{release} Requires: %{name}-compiler = %{version}-%{release} Requires: zlib-devel Requires: pkgconfig %description devel This package contains Protocol Buffers compiler for all languages and C++ headers and libraries %package static Summary: Static development files for %{name} Requires: %{name}-devel = %{version}-%{release} %description static Static libraries for Protocol Buffers %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. %package lite-devel Summary: Protocol Buffers LITE_RUNTIME development libraries Requires: %{name}-devel = %{version}-%{release} Requires: %{name}-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. %package lite-static Summary: Static development files for %{name}-lite Requires: %{name}-devel = %{version}-%{release} %description lite-static This package contains static 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. %if %{with python} %package -n python%{python3_pkgversion}-%{name} Summary: Python 3 bindings for Google Protocol Buffers BuildArch: noarch BuildRequires: python%{python3_pkgversion}-devel BuildRequires: python%{python3_pkgversion}-setuptools BuildRequires: python%{python3_pkgversion}-wheel Requires: python%{python3_pkgversion}-six >= 1.9 Conflicts: %{name}-compiler > %{version} Conflicts: %{name}-compiler < %{version} Provides: %{name}-python3 = %{version}-%{release} %{?python_provide:%python_provide python%{python3_pkgversion}-%{name}} %description -n python%{python3_pkgversion}-%{name} This package contains Python 3 libraries for Google Protocol Buffers %endif %package vim Summary: Vim syntax highlighting for Google Protocol Buffers descriptions BuildArch: noarch Requires: vim-enhanced %description vim This package contains syntax highlighting for Google Protocol Buffers descriptions in Vim editor %if %{with java} %package java Summary: Java Protocol Buffers runtime library BuildArch: noarch BuildRequires: maven-local BuildRequires: mvn(com.google.code.gson:gson) BuildRequires: mvn(com.google.guava:guava) BuildRequires: mvn(junit:junit) BuildRequires: mvn(org.apache.felix:maven-bundle-plugin) BuildRequires: mvn(org.apache.maven.plugins:maven-antrun-plugin) BuildRequires: mvn(org.apache.maven.plugins:maven-source-plugin) BuildRequires: mvn(org.codehaus.mojo:build-helper-maven-plugin) BuildRequires: mvn(org.easymock:easymock) Conflicts: %{name}-compiler > %{version} Conflicts: %{name}-compiler < %{version} Obsoletes: %{name}-javanano < 3.6.0 %description java This package contains Java Protocol Buffers runtime library. %package javalite Summary: Java Protocol Buffers lite runtime library BuildArch: noarch %description javalite This package contains Java Protocol Buffers lite runtime library. %package java-util Summary: Utilities for Protocol Buffers BuildArch: noarch %description java-util Utilities to work with protos. It contains JSON support as well as utilities to work with proto3 well-known types. %package javadoc Summary: Javadoc for %{name}-java BuildArch: noarch %description javadoc This package contains the API documentation for %{name}-java. %package parent Summary: Protocol Buffer Parent POM BuildArch: noarch %description parent Protocol Buffer Parent POM. %package bom Summary: Protocol Buffer BOM POM BuildArch: noarch %description bom Protocol Buffer BOM POM. %endif %if %{with emacs} %package emacs Summary: Emacs mode for Google Protocol Buffers descriptions BuildArch: noarch Requires: emacs-filesystem >= %{_emacs_version} Obsoletes: protobuf-emacs-el < 3.6.1-4 %description emacs This package contains syntax highlighting for Google Protocol Buffers descriptions in the Emacs editor. %endif %prep %setup -q -n %{name}-%{version} -a 3 %patch -P 1 -p1 %patch -P 2 -p1 %patch -P 3 -p1 mv googletest-5ec7f0c4a113e2f18ac2c6cc7df51ad6afc24081/* third_party/googletest/ find -name \*.cc -o -name \*.h | xargs chmod -x chmod 644 examples/* %if %{with java} %pom_remove_dep org.easymock:easymockclassextension java/pom.xml java/core/pom.xml java/lite/pom.xml java/util/pom.xml %pom_remove_dep com.google.truth:truth java/pom.xml java/core/pom.xml java/lite/pom.xml java/util/pom.xml %pom_remove_dep com.google.errorprone:error_prone_annotations java/util/pom.xml %pom_remove_dep com.google.guava:guava-testlib java/pom.xml java/util/pom.xml # These use easymockclassextension rm java/core/src/test/java/com/google/protobuf/ServiceTest.java # These use truth or error_prone_annotations or guava-testlib rm java/core/src/test/java/com/google/protobuf/LiteralByteStringTest.java rm java/core/src/test/java/com/google/protobuf/BoundedByteStringTest.java rm java/core/src/test/java/com/google/protobuf/RopeByteStringTest.java rm java/core/src/test/java/com/google/protobuf/RopeByteStringSubstringTest.java rm java/core/src/test/java/com/google/protobuf/TextFormatTest.java rm -r java/util/src/test/java/com/google/protobuf/util rm -r java/util/src/main/java/com/google/protobuf/util # Make OSGi dependency on sun.misc package optional %pom_xpath_inject "pom:configuration/pom:instructions" "sun.misc;resolution:=optional,*" java/core # Backward compatibility symlink %mvn_file :protobuf-java:jar: %{name}/%{name}-java %{name} # This test is incredibly slow on arm # https://github.com/google/protobuf/issues/2389 %ifarch %{arm} s390x mv java/core/src/test/java/com/google/protobuf/IsValidUtf8Test.java \ java/core/src/test/java/com/google/protobuf/IsValidUtf8Test.java.slow mv java/core/src/test/java/com/google/protobuf/DecodeUtf8Test.java \ java/core/src/test/java/com/google/protobuf/DecodeUtf8Test.java.slow %endif %endif rm -f src/solaris/libstdc++.la %build # Configure the build using CMake %cmake cmake \ -GNinja \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_LIBDIR=%{_libdir} \ -DCMAKE_CXX_FLAGS="%{build_cxxflags} -Wno-error=type-limits -Wno-error=deprecated-declarations" \ -Dprotobuf_BUILD_TESTS=ON \ -DBUILD_SHARED_LIBS=ON # Compile the project %cmake_build %if %{with python} pushd python %py3_build popd %endif %if %{with java} %ifarch s390x %{arm} export MAVEN_OPTS=-Xmx1024m %endif %mvn_build -s -- -f java/pom.xml %endif %if %{with emacs} %{_emacs_bytecompile} editors/protobuf-mode.el %endif %check # Run the test suite using CTest %ctest %install # Install the files using the cmake install target %cmake_install # Remove useless .la files find %{buildroot} -type f -name "*.la" -exec rm -f {} \; # Install Python components %if %{with python} pushd python %py3_install find %{buildroot}%{python3_sitelib} -name \*.py | xargs sed -i -e '1{\@^#!@d}' popd %endif # Install Vim components install -p -m 644 -D %{SOURCE1} %{buildroot}%{_datadir}/vim/vimfiles/ftdetect/proto.vim install -p -m 644 -D editors/proto.vim %{buildroot}%{_datadir}/vim/vimfiles/syntax/proto.vim # Install Java components %if %{with java} %mvn_install %endif # Install Emacs components %if %{with emacs} mkdir -p %{buildroot}%{_emacs_sitelispdir}/%{name} install -p -m 0644 editors/protobuf-mode.el %{buildroot}%{_emacs_sitelispdir}/%{name} install -p -m 0644 editors/protobuf-mode.elc %{buildroot}%{_emacs_sitelispdir}/%{name} mkdir -p %{buildroot}%{_emacs_sitestartdir} install -p -m 0644 %{SOURCE2} %{buildroot}%{_emacs_sitestartdir} %endif %ldconfig_scriptlets %ldconfig_scriptlets lite %files %doc CHANGES.txt CONTRIBUTORS.txt README.md %license LICENSE %{_libdir}/libprotobuf.so.* %files compiler %doc README.md %license LICENSE %{_bindir}/protoc %{_libdir}/libprotoc.so.* %files devel %dir %{_includedir}/google %{_includedir}/google/protobuf/ %{_libdir}/libprotobuf.so %{_libdir}/libprotoc.so %{_libdir}/pkgconfig/protobuf.pc # This is the key addition that fixes your original problem %{_libdir}/cmake/protobuf/ %doc examples/add_person.cc examples/addressbook.proto examples/list_people.cc examples/Makefile examples/README.md %if %{with emacs} %files emacs %{_emacs_sitelispdir}/%{name}/ %{_emacs_sitestartdir}/protobuf-init.el %endif %files static %{_libdir}/libprotobuf.a %{_libdir}/libprotoc.a %files lite %{_libdir}/libprotobuf-lite.so.* %files lite-devel %{_libdir}/libprotobuf-lite.so %{_libdir}/pkgconfig/protobuf-lite.pc %files lite-static %{_libdir}/libprotobuf-lite.a %if %{with python} %files -n python%{python3_pkgversion}-protobuf %dir %{python3_sitelib}/google %{python3_sitelib}/google/protobuf/ %{python3_sitelib}/protobuf-%{version}-py3.*.egg-info/ %{python3_sitelib}/protobuf-%{version}-py3.*-nspkg.pth %doc python/README.md %doc examples/add_person.py examples/list_people.py examples/addressbook.proto %endif %files vim %{_datadir}/vim/vimfiles/ftdetect/proto.vim %{_datadir}/vim/vimfiles/syntax/proto.vim %if %{with java} %files java -f .mfiles-protobuf-java %doc examples/AddPerson.java examples/ListPeople.java %doc java/README.md %license LICENSE %files java-util -f .mfiles-protobuf-java-util %files javadoc -f .mfiles-javadoc %license LICENSE %files parent -f .mfiles-protobuf-parent %license LICENSE %files bom -f .mfiles-protobuf-bom %license LICENSE %files javalite -f .mfiles-protobuf-javalite %license LICENSE %endif %changelog