# RU: Java в этой сборке не используем (справочно). # EN: Java is not used in this build (for reference). %global java_min_ver_needed 3.3.3 # RU: Тесты по умолчанию выключены (включать при необходимости: --with check). # EN: Tests are disabled by default (enable when needed: --with check). %bcond_with check # RU: Python-подпакет по умолчанию включён (отключать при необходимости: --without python). # EN: Python subpackage is enabled by default (disable when needed: --without python). %bcond_without python # RU: C++-реализация python-модуля (значительно быстрее, отключать: --without python_cpp). # EN: C++ implementation of the Python module (much faster, disable: --without python_cpp). %bcond_without python_cpp Name: protobuf Version: 31.1 Release: 2%{?dist} Summary: Protocol Buffers - language-neutral data serialization mechanism Summary(ru): Протокол буферов — языконезависимый механизм сериализации данных License: BSD-3-Clause AND MIT URL: https://github.com/google/protobuf Source0: https://github.com/protocolbuffers/protobuf/releases/download/v%{version}/%{name}-%{version}.tar.gz # CVE-2026-0994: # Python json_format.ParseDict() recursion depth bypass via nested google.protobuf.Any. # Backported from upstream protobuf v33.5 / Python 6.33.5. Patch0: https://github.com/protocolbuffers/protobuf/commit/c4eda3e58680528147a4cc7e2b3c9044f795c9c9.patch Packager: NICE SOFT GROUP LLC (ООО "НАЙС СОФТ ГРУПП") 5024245440 Vendor: NiceSOFT Distribution: NiceOS.Core BugURL: https://bugs.niceos.ru/ VCS: https://specs.niceos.ru/rmps/%{name} BuildRequires: abseil-cpp-devel BuildRequires: cmake BuildRequires: gcc BuildRequires: gcc-c++ BuildRequires: make BuildRequires: libstdc++-devel %if %{with python} BuildRequires: python3-build BuildRequires: python3-devel BuildRequires: python3-packaging BuildRequires: python3-pip BuildRequires: python3-setuptools BuildRequires: python3-wheel %endif %if %{with check} BuildRequires: gmock-devel BuildRequires: gtest-devel %endif Provides: protobuf-compiler = %{version}-%{release} Provides: protobuf-lite = %{version}-%{release} %description Protocol Buffers (protobuf) is a method for serializing structured data developed by Google. It provides an efficient and flexible mechanism for encoding data that can be used across programming languages and platforms. This package ships the core libraries and the protoc compiler. %description -l ru Protocol Buffers (protobuf) — метод сериализации структурированных данных, разработанный Google. Он обеспечивает эффективный и гибкий механизм кодирования данных для использования на разных языках программирования и платформах. Пакет содержит основные библиотеки и компилятор protoc. %package devel Summary: Development files for the Protocol Buffers library Summary(ru): Файлы для разработки приложений с использованием Protocol Buffers Requires: %{name}%{?_isa} = %{version}-%{release} Requires: abseil-cpp-devel Provides: protobuf-lite-devel = %{version}-%{release} %description -n %{name}-devel Development files for Protocol Buffers, including headers, pkg-config and CMake configuration files needed to build applications that use protobuf. %description -l ru -n %{name}-devel Файлы для разработки приложений, использующих Protocol Buffers: заголовочные файлы, конфигурация pkg-config и CMake, необходимые для сборки программ с protobuf. %if %{with python} %package -n python3-protobuf Summary: Python bindings for Protocol Buffers Summary(ru): Python-привязки для Protocol Buffers %if %{with python_cpp} Requires: %{name}%{?_isa} = %{version}-%{release} %else BuildArch: noarch %endif Provides: protobuf-python3 = %{version}-%{release} %description -n python3-protobuf This package contains Python bindings for Google Protocol Buffers. %description -l ru -n python3-protobuf Пакет содержит Python-привязки для Google Protocol Buffers. %endif %prep %autosetup -S git -n %{name}-%{version} -p1 # RU: Удаляем медленные Java-тесты (Java не собираем, но держим чистоту дерева). # EN: Remove slow Java tests (Java is not built, keep the tree clean). rm -f java/core/src/test/java/com/google/%{name}/IsValidUtf8Test.java \ java/core/src/test/java/com/google/%{name}/DecodeUtf8Test.java || : # RU: Убираем исполняемый бит со исходников. # EN: Remove executable bit from source files. find . \( -name '*.cc' -o -name '*.h' \) -print0 | xargs -0r chmod -x # RU: Исправления для тестов gtest в 32-битных окружениях (на случай включения upstream-тестов). # EN: Fixes for gtest in 32-bit environments (kept in case upstream tests are enabled). sed -e "/^TEST(ArenaTest, BlockSizeSmallerThanAllocation) {$/a\\ if (sizeof(void*) == 4) {\\n GTEST_SKIP();\\n }" \ -e "/^TEST(ArenaTest, SpaceAllocated_and_Used) {$/a\\ if (sizeof(void*) == 4) {\\n GTEST_SKIP();\\n }" \ -i src/google/protobuf/arena_unittest.cc sed -e "/^TEST(AnyTest, TestPackFromSerializationExceedsSizeLimit) {$/a\\ if (sizeof(void*) == 4) {\\n GTEST_SKIP();\\n }" \ -i src/google/protobuf/any_test.cc rm -f src/solaris/libstdc++.la # RU: Приведение CONTRIBUTORS.txt к UTF-8. # EN: Convert CONTRIBUTORS.txt to UTF-8. iconv -f iso8859-1 -t utf-8 CONTRIBUTORS.txt > CONTRIBUTORS.txt.utf8 mv -f CONTRIBUTORS.txt.utf8 CONTRIBUTORS.txt # RU: Добавляем internal_defaults_escape (нужно для генерации python_edition_defaults.py). # EN: Add internal_defaults_escape (required to generate python_edition_defaults.py). echo 'add_executable(internal_defaults_escape editions/internal_defaults_escape.cc)' >> CMakeLists.txt echo 'target_link_libraries(internal_defaults_escape ${protobuf_ABSL_USED_TARGETS} ${protobuf_LIB_PROTOBUF} absl_flags_parse)' >> CMakeLists.txt %build %{cmake} \ -D CMAKE_INSTALL_PREFIX=/usr \ -D CMAKE_BUILD_TYPE=Release \ -D CMAKE_SKIP_INSTALL_RPATH=ON \ -D protobuf_BUILD_TESTS=OFF \ -D protobuf_ABSL_PROVIDER=package \ -D protobuf_BUILD_SHARED_LIBS=ON %{cmake_build} %if %{with python} pushd python %{__python3} protobuf_distutils/protobuf_distutils/generate_py_protobufs.py %{__python3} protobuf_distutils/setup.py build %{__python3} dist/setup.py build popd %endif %install %cmake_install # RU: pathfix.py (brp) падает на symlink'ах в %{_bindir}; protobuf ставит protoc и плагины как symlink на versioned-файл. # EN: pathfix.py (brp) fails on symlinks in %{_bindir}; protobuf installs protoc and some plugins as symlinks to versioned files. for f in protoc protoc-gen-upb protoc-gen-upbdefs; do p="%{buildroot}%{_bindir}/$f" if [ -L "$p" ]; then t="$(readlink -f "$p")" rm -f "$p" # RU: Предпочитаем hardlink (быстро и без дублей), если нельзя — копируем. # EN: Prefer hardlink (fast and no duplicates); if not possible, copy. ln "$t" "$p" 2>/dev/null || cp -a "$t" "$p" fi done %if %{with python} pushd python %{__python3} dist/setup.py install -O1 --skip-build --root %{buildroot} --prefix %{_prefix} --install-lib %{python3_sitearch} %{__python3} protobuf_distutils/setup.py install -O1 --skip-build --root %{buildroot} --prefix %{_prefix} --install-lib %{python3_sitearch} popd # RU: python_edition_defaults.binpb. # EN: python_edition_defaults.binpb. mkdir -p %{__cmake_builddir}/python %{_builddir}/protobuf-%{version}/%{__cmake_builddir}/protoc \ --edition_defaults_out %{__cmake_builddir}/python/python_edition_defaults.binpb \ --edition_defaults_minimum PROTO2 \ --edition_defaults_maximum 2024 \ --proto_path %{_builddir}/protobuf-%{version}/src/ \ google/protobuf/descriptor.proto # RU: python_edition_defaults.py. # EN: python_edition_defaults.py. %{_builddir}/protobuf-%{version}/%{__cmake_builddir}/internal_defaults_escape \ '--encoding=octal' \ '--defaults_path=%{__cmake_builddir}/python/python_edition_defaults.binpb' \ '--template_path=python/google/protobuf/internal/python_edition_defaults.py.template' \ '--output_path=%{buildroot}/%{python3_sitearch}/google/protobuf/internal/python_edition_defaults.py' \ '--placeholder=DEFAULTS_VALUE' # RU: Компиляция python protobuf-описаний (нужны *_pb2.py: descriptor_pb2, any_pb2 и т.д.). # EN: Compile Python protobuf definitions (needed *_pb2.py: descriptor_pb2, any_pb2, etc.). PROTOC=%{_builddir}/protobuf-%{version}/%{__cmake_builddir}/protoc for f in $(find src/google/protobuf/ -maxdepth 1 -name '*.proto' | grep -v test | grep -v sample | grep -v late); do bn="$(basename "$f")" "$PROTOC" \ --proto_path=%{_builddir}/protobuf-%{version}/src \ --python_out=%{buildroot}/%{python3_sitearch} \ google/protobuf/"$bn" done # RU: И обязательно plugin.proto (иначе не будет google/protobuf/compiler/plugin_pb2.py). # EN: And обязательно plugin.proto (otherwise google/protobuf/compiler/plugin_pb2.py won't be generated). "$PROTOC" \ --proto_path=%{_builddir}/protobuf-%{version}/src \ --python_out=%{buildroot}/%{python3_sitearch} \ google/protobuf/compiler/plugin.proto %endif %check %if %{with check} ctest --output-on-failure --test-dir %{_vpath_builddir} %endif %ldconfig_scriptlets %files %license LICENSE* %{_bindir}/protoc* %attr(0755,root,root) %{_libdir}/*.so.* %files devel %{_includedir}/* %{_libdir}/cmake/* %{_libdir}/libupb.a %{_libdir}/pkgconfig/*.pc %{_libdir}/*.so %if %{with python} %files -n python3-protobuf %license LICENSE* %{python3_sitearch}/* %endif %changelog * Sun May 24 2026 Stanislav Belikov - 31.1-2 - CVE-2026-0994 * Sun Jan 11 2026 NiceOS Team - 31.1-1 - Initial build for NiceOS (Первая сборка для НАЙС.ОС)