SHA256
1
0
forked from pool/protobuf

Accepting request 1084558 from system:homeautomation:home-assistant:unstable

- update to v22.3
- python sub packages version is set 4.22.3 as defined in
  python/google/protobuf/__init__.py to stay compatible
- skip python2 builds by default
- 10355.patch    got merged upstream
- add-missing-stdint-header.patch   added for compile fixes

OBS-URL: https://build.opensuse.org/request/show/1084558
OBS-URL: https://build.opensuse.org/package/show/devel:tools:building/protobuf?expand=0&rev=146
This commit is contained in:
Martin Pluskal
2023-05-04 08:11:13 +00:00
committed by Git OBS Bridge
parent dbb3b2b277
commit 10972090a8
8 changed files with 80 additions and 132 deletions

View File

@@ -18,17 +18,19 @@
%{!?make_build:%global make_build make %{?_smp_mflags}}
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define sover 3_21_12
%define sover 22_3_0
%define tarname protobuf
%define src_install_dir %{_prefix}/src/%{name}
%define extra_java_flags -source 7 -target 7
# requires gmock, which is not yet in the distribution
%bcond_with check
%bcond_with python2
%bcond_without java
%bcond_without python2
%bcond_without python3
Name: protobuf
Version: 21.12
Version: 22.3
# python module have their own version specified in python/google/protobuf/__init__.py
%define pversion 4.22.3
Release: 0
Summary: Protocol Buffers - Google's data interchange format
License: BSD-3-Clause
@@ -39,13 +41,13 @@ Source1: manifest.txt.in
Source2: baselibs.conf
Source1000: %{name}-rpmlintrc
Patch0: gcc12-disable-__constinit-with-c++-11.patch
# https://github.com/protocolbuffers/protobuf/pull/10355
Patch1: 10355.patch
Patch1: add-missing-stdint-header.patch
BuildRequires: %{python_module abseil}
BuildRequires: %{python_module devel}
BuildRequires: %{python_module python-dateutil}
BuildRequires: %{python_module setuptools}
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: abseil-cpp-devel >= 20230125
BuildRequires: cmake
BuildRequires: fdupes
BuildRequires: gcc-c++
BuildRequires: libtool
@@ -129,18 +131,11 @@ RPC protocols and file formats.
This package contains source code for Protocol Buffers.
%package -n %{name}-java
Summary: Java Bindings for Google Protocol Buffers
Group: Development/Libraries/Java
Requires: java >= 1.6.0
%description -n %{name}-java
This package contains the Java bindings for Google Protocol Buffers.
%if 0%{?python_subpackage_only}
%package -n python-%{name}
Summary: Python Bindings for Google Protocol Buffers
Group: Development/Libraries/Python
Version: %pversion
Requires: python-six >= 1.9
%description -n python-%{name}
@@ -154,6 +149,7 @@ Group: Development/Libraries/Python
Provides: python-%{name} = %{version}
Obsoletes: python-%{name} < %{version}
Requires: python2-six >= 1.9
Version: %pversion
%description -n python2-%{name}
This package contains the Python bindings for Google Protocol Buffers.
@@ -162,13 +158,22 @@ This package contains the Python bindings for Google Protocol Buffers.
Summary: Python3 Bindings for Google Protocol Buffers
Group: Development/Libraries/Python
Requires: python3-six >= 1.9
Version: %pversion
%description -n python3-%{name}
This package contains the Python bindings for Google Protocol Buffers.
%endif
%package -n %{name}-java
Summary: Java Bindings for Google Protocol Buffers
Group: Development/Libraries/Java
Requires: java >= 1.6.0
%description -n %{name}-java
This package contains the Java bindings for Google Protocol Buffers.
%prep
%autosetup -p1 -n %{tarname}-%{version}
%autosetup -p1 -n %{tarname}-%{VERSION}
# The previous blank line is crucial for older system being able
# to use the autosetup macro
@@ -184,15 +189,15 @@ sed -i '/google_test_dir/d' python/setup.py
sed -i -e '/env python/d' python/google/protobuf/internal/*.py
%build
autoreconf -fvi
%configure \
--disable-static
%make_build
# tests are not part of offical tar ball
%cmake \
-Dprotobuf_BUILD_TESTS=OFF \
-Dprotobuf_ABSL_PROVIDER=package
%cmake_build
%if %{with java}
pushd java
../src/protoc --java_out=core/src/main/java -I../src ../src/google/protobuf/descriptor.proto
pushd ../java
../build/protoc --java_out=core/src/main/java -I../src ../src/google/protobuf/descriptor.proto
mkdir classes
javac %{extra_java_flags} -d classes core/src/main/java/com/google/protobuf/*.java
sed -e 's/@VERSION@/%{version}/' < %{SOURCE1} > manifest.txt
@@ -200,7 +205,8 @@ jar cfm %{name}-java-%{version}.jar manifest.txt -C classes com
popd
%endif
pushd python
pushd ../python
export PROTOC=../build/protoc
%python_build
popd
@@ -210,10 +216,11 @@ popd
%endif
%install
%make_install
%cmake_install
install -Dm 0644 editors/proto.vim %{buildroot}%{_datadir}/vim/site/syntax/proto.vim
# no need for that
find %{buildroot} -type f -name "*.la" -delete -print
rm %{buildroot}%_libdir/libutf8_*.a
%if %{with java}
pushd java
@@ -229,6 +236,7 @@ popd
%endif
pushd python
export PROTOC=../build/protoc
%python_install
popd
%python_expand %fdupes %{buildroot}%{$python_sitelib}
@@ -261,18 +269,21 @@ find %{buildroot}%{src_install_dir} -type f -name ".gitignore" -exec rm -f "{}"
%files -n libprotobuf%{sover}
%license LICENSE
%{_libdir}/libprotobuf-3.%{version}.so
%{_libdir}/libprotobuf.so.*
%files -n libprotoc%{sover}
%{_libdir}/libprotoc-3.%{version}.so
%{_libdir}/libprotoc.so.*
%files -n libprotobuf-lite%{sover}
%{_libdir}/libprotobuf-lite-3.%{version}.so
%{_libdir}/libprotobuf-lite.so.*
%files devel
%doc CHANGES.txt CONTRIBUTORS.txt README.md
%{_bindir}/protoc
%doc CONTRIBUTORS.txt README.md
%{_bindir}/protoc*
%{_includedir}/google
%{_includedir}/*.h
%{_libdir}/cmake/protobuf
%{_libdir}/cmake/utf8_range
%{_libdir}/pkgconfig/*
%{_libdir}/libprotobuf-lite.so
%{_libdir}/libprotobuf.so