• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Build -python subpackage
2%bcond_without python
3# Build -java subpackage
4%bcond_without java
5
6#global rcver rc2
7
8Summary:        Protocol Buffers - Google's data interchange format
9Name:           protobuf
10Version:        3.14.0
11Release:        8
12License:        BSD
13URL:            https://github.com/protocolbuffers/protobuf
14Source:         https://github.com/protocolbuffers/protobuf/releases/download/v%{version}%{?rcver}/%{name}-all-%{version}%{?rcver}.tar.gz
15Source1:        protobuf-init.el
16
17Patch9000:      0001-add-secure-compile-option-in-Makefile.patch
18Patch9001:      0002-add-secure-compile-fs-check-in-Makefile.patch
19Patch9002:      0003-fix-CVE-2021-22570.patch
20Patch9003:      0004-Improve-performance-of-parsing-unknown-fields-in-Jav.patch
21Patch9004:	0005-fix-CVE-2022-1941.patch
22Patch9005:	0006-fix-CVE-2022-3171.patch
23Patch9006:	0007-add-coverage-compile-option.patch
24
25BuildRequires:  make autoconf automake emacs gcc-c++ libtool pkgconfig zlib-devel
26
27%description
28
29Protocol Buffers (a.k.a., protobuf) are Google's language-neutral,
30platform-neutral, extensible mechanism for serializing structured data.
31You can find protobuf's documentation on the Google Developers site.
32
33%package compiler
34Summary:	Protocol Buffers compiler
35Requires:       %{name} = %{version}-%{release}
36Obsoletes:      protobuf-emacs < %{version}
37Obsoletes:      protobuf-emacs-el < %{version}
38Obsoletes:      protobuf2-compiler
39Requires:       emacs-filesystem >= %{_emacs_version}
40
41%description compiler
42This package containers Protocol Buffers compiler for all programming languages.
43
44
45%package devel
46Summary:        Protocol Buffers C++ headers and libraries
47Requires:       %{name} = %{version}-%{release}
48Requires:       %{name}-compiler = %{version}-%{release}
49Requires:       zlib-devel pkgconfig vim-enhanced
50Provides:       %{name}-static
51Provides:       %{name}-vim
52Obsoletes:      %{name}-static < %{version}
53Obsoletes:      %{name}-vim < %{version}
54Obsoletes:      protobuf2-devel
55Obsoletes:      protobuf2-vim
56Obsoletes:      protobuf2-static
57
58
59%description devel
60This package contains Protocol Buffers compiler for all languages and
61C++ headers and libraries
62
63%package lite
64Summary:        Protocol Buffers LITE_RUNTIME libraries
65
66%description lite
67Protocol Buffers built with optimize_for = LITE_RUNTIME.
68
69The "optimize_for = LITE_RUNTIME" option causes the compiler to generate code
70which only depends libprotobuf-lite, which is much smaller than libprotobuf but
71lacks descriptors, reflection, and some other features.
72
73%package lite-devel
74Summary:        Protocol Buffers LITE_RUNTIME development libraries
75Requires:       %{name}-devel = %{version}-%{release}
76Requires:       %{name}-lite = %{version}-%{release}
77Provides:       %{name}-lite-static
78Obsoletes:      %{name}-lite-static <  %{version}
79Obsoletes:      protobuf2-lite-devel
80Obsoletes:      protobuf2-lite-static
81
82%description lite-devel
83This package contains development libraries built with
84optimize_for = LITE_RUNTIME.
85
86The "optimize_for = LITE_RUNTIME" option causes the compiler to generate code
87which only depends libprotobuf-lite, which is much smaller than libprotobuf but
88lacks descriptors, reflection, and some other features.
89
90%if %{with python}
91%package -n python%{python3_pkgversion}-%{name}
92Summary:        Python 3 bindings for Google Protocol Buffers
93BuildArch:      noarch
94BuildRequires:  python%{python3_pkgversion}-devel
95BuildRequires:  python%{python3_pkgversion}-setuptools
96BuildRequires:  python%{python3_pkgversion}-wheel
97Requires:       python%{python3_pkgversion}-six >= 1.9
98Conflicts:      %{name}-compiler > %{version}-%{release}
99Conflicts:      %{name}-compiler < %{version}-%{release}
100Provides:       %{name}-python3 = %{version}-%{release}
101%{?python_provide:%python_provide python%{python3_pkgversion}-%{name}}
102
103%description -n python%{python3_pkgversion}-%{name}
104This package contains Python 3 libraries for Google Protocol Buffers
105%endif
106
107
108%if %{with java}
109%package java
110Summary:        Java Protocol Buffers runtime library
111BuildArch:      noarch
112BuildRequires:  maven-local
113BuildRequires:  mvn(com.google.code.gson:gson)
114BuildRequires:  mvn(com.google.guava:guava)
115BuildRequires:  mvn(junit:junit)
116BuildRequires:  mvn(org.apache.felix:maven-bundle-plugin)
117BuildRequires:  mvn(org.apache.maven.plugins:maven-antrun-plugin)
118BuildRequires:  mvn(org.apache.maven.plugins:maven-source-plugin)
119BuildRequires:  mvn(org.codehaus.mojo:build-helper-maven-plugin)
120BuildRequires:  mvn(org.easymock:easymock)
121Obsoletes:      %{name}-javanano < 3.6.0
122
123%description java
124This package contains Java Protocol Buffers runtime library.
125
126%package javalite
127Summary:        Java Protocol Buffers lite runtime library
128BuildArch:      noarch
129
130%description javalite
131This package contains Java Protocol Buffers lite runtime library.
132
133%package java-util
134Summary:        Utilities for Protocol Buffers
135BuildArch:      noarch
136
137%description java-util
138Utilities to work with protos. It contains JSON support
139as well as utilities to work with proto3 well-known types.
140
141%package javadoc
142Summary:        Javadoc for %{name}-java
143BuildArch:      noarch
144
145%description javadoc
146This package contains the API documentation for %{name}-java.
147
148%package parent
149Summary:        Protocol Buffer Parent POM
150BuildArch:      noarch
151
152%description parent
153Protocol Buffer Parent POM.
154
155%package bom
156Summary:        Protocol Buffer BOM POM
157BuildArch:      noarch
158
159%description bom
160Protocol Buffer BOM POM.
161
162%endif
163
164%prep
165%setup -q -n %{name}-%{version}%{?rcver}
166%autopatch -p1
167find -name \*.cc -o -name \*.h | xargs chmod -x
168chmod 644 examples/*
169%if %{with java}
170#%pom_remove_dep com.google.truth:truth java/pom.xml
171#%pom_remove_dep org.easymock:easymockclassextension java/pom.xml java/*/pom.xml
172%pom_remove_dep org.easymock:easymockclassextension java/pom.xml java/core/pom.xml java/lite/pom.xml java/util/pom.xml
173%pom_remove_dep com.google.truth:truth java/pom.xml java/util/pom.xml java/lite/pom.xml java/core/pom.xml
174%pom_remove_dep com.google.errorprone:error_prone_annotations java/util/pom.xml
175%pom_remove_dep com.google.guava:guava-testlib java/pom.xml java/util/pom.xml
176
177# These use easymockclassextension
178rm java/core/src/test/java/com/google/protobuf/ServiceTest.java
179
180#rm -r java/core/src/test
181
182# These use truth or error_prone_annotations or guava-testlib
183rm java/core/src/test/java/com/google/protobuf/LiteralByteStringTest.java
184rm java/core/src/test/java/com/google/protobuf/BoundedByteStringTest.java
185rm java/core/src/test/java/com/google/protobuf/RopeByteStringTest.java
186rm java/core/src/test/java/com/google/protobuf/RopeByteStringSubstringTest.java
187rm java/core/src/test/java/com/google/protobuf/TextFormatTest.java
188rm java/core/src/test/java/com/google/protobuf/UnknownFieldSetTest.java
189rm java/core/src/test/java/com/google/protobuf/UnknownFieldSetPerformanceTest.java
190rm -r java/util/src/test/java/com/google/protobuf/util
191rm -r java/util/src/main/java/com/google/protobuf/util
192
193# Make OSGi dependency on sun.misc package optional
194%pom_xpath_inject "pom:configuration/pom:instructions" "<Import-Package>sun.misc;resolution:=optional,*</Import-Package>" java/core
195
196# Backward compatibility symlink
197%mvn_file :protobuf-java:jar: %{name}/%{name}-java %{name}
198
199# This test is incredibly slow on arm
200# https://github.com/protocolbuffers/protobuf/issues/2389
201%ifarch %{arm}
202mv java/core/src/test/java/com/google/protobuf/IsValidUtf8Test.java \
203   java/core/src/test/java/com/google/protobuf/IsValidUtf8Test.java.slow
204mv java/core/src/test/java/com/google/protobuf/DecodeUtf8Test.java \
205  java/core/src/test/java/com/google/protobuf/DecodeUtf8Test.java.slow
206%endif
207%endif
208
209rm -f src/solaris/libstdc++.la
210
211%build
212iconv -f iso8859-1 -t utf-8 CONTRIBUTORS.txt > CONTRIBUTORS.txt.utf8
213mv CONTRIBUTORS.txt.utf8 CONTRIBUTORS.txt
214export PTHREAD_LIBS="-lpthread"
215./autogen.sh
216%configure
217%make_build CXXFLAGS="%{build_cxxflags} -Wno-error=type-limits"
218
219%if %{with python}
220pushd python
221%py3_build
222popd
223%endif
224
225%if %{with java}
226%mvn_build -s -- -f java/pom.xml
227%endif
228
229%{_emacs_bytecompile} editors/protobuf-mode.el
230
231
232%check
233# Java tests fail on s390x
234%ifarch s390x
235fail=0
236%else
237fail=1
238%endif
239%make_build check CXXFLAGS="%{build_cxxflags} -Wno-error=type-limits" || exit $fail
240
241
242%install
243%make_install %{?_smp_mflags} STRIPBINARIES=no INSTALL="%{__install} -p" CPPROG="cp -p"
244find %{buildroot} -type f -name "*.la" -exec rm -f {} \;
245
246%if %{with python}
247pushd python
248#python ./setup.py install --root=%{buildroot} --single-version-externally-managed --record=INSTALLED_FILES --optimize=1
249%py3_install
250find %{buildroot}%{python3_sitelib} -name \*.py |
251  xargs sed -i -e '1{\@^#!@d}'
252popd
253%endif
254install -p -m 644 -D editors/proto.vim %{buildroot}%{_datadir}/vim/vimfiles/syntax/proto.vim
255
256%if %{with java}
257%mvn_install
258%endif
259
260mkdir -p %{buildroot}%{_emacs_sitelispdir}/%{name}
261install -p -m 0644 editors/protobuf-mode.el %{buildroot}%{_emacs_sitelispdir}/%{name}
262install -p -m 0644 editors/protobuf-mode.elc %{buildroot}%{_emacs_sitelispdir}/%{name}
263mkdir -p %{buildroot}%{_emacs_sitestartdir}
264install -p -m 0644 %{SOURCE1} %{buildroot}%{_emacs_sitestartdir}
265
266%ldconfig_scriptlets
267%ldconfig_scriptlets lite
268%ldconfig_scriptlets compiler
269
270%files
271%doc CHANGES.txt CONTRIBUTORS.txt README.md
272%license LICENSE
273%{_libdir}/libprotobuf.so.25*
274
275%files compiler
276%{_bindir}/protoc
277%{_libdir}/libprotoc.so.25*
278%{_emacs_sitelispdir}/%{name}/
279%{_emacs_sitestartdir}/protobuf-init.el
280%license LICENSE
281%doc README.md
282
283
284%files devel
285%dir %{_includedir}/google
286%{_includedir}/google/protobuf/
287%{_libdir}/libprotobuf.so
288%{_libdir}/libprotoc.so
289%{_libdir}/pkgconfig/protobuf.pc
290%doc examples/add_person.cc examples/addressbook.proto examples/list_people.cc examples/Makefile examples/README.md
291%{_libdir}/libprotobuf.a
292%{_libdir}/libprotoc.a
293%{_datadir}/vim/vimfiles/syntax/proto.vim
294
295%files lite
296%{_libdir}/libprotobuf-lite.so.25*
297
298%files lite-devel
299%{_libdir}/libprotobuf-lite.so
300%{_libdir}/pkgconfig/protobuf-lite.pc
301%{_libdir}/libprotobuf-lite.a
302
303%if %{with python}
304%files -n python%{python3_pkgversion}-protobuf
305%dir %{python3_sitelib}/google
306%{python3_sitelib}/google/protobuf/
307%{python3_sitelib}/protobuf-%{version}%{?rcver}-py3.*.egg-info/
308%{python3_sitelib}/protobuf-%{version}%{?rcver}-py3.*-nspkg.pth
309%doc python/README.md
310%doc examples/add_person.py examples/list_people.py examples/addressbook.proto
311%endif
312
313%if %{with java}
314%files java -f .mfiles-protobuf-java
315%doc examples/AddPerson.java examples/ListPeople.java
316%doc java/README.md
317%license LICENSE
318
319%files java-util -f .mfiles-protobuf-java-util
320
321%files javadoc -f .mfiles-javadoc
322%license LICENSE
323
324%files parent -f .mfiles-protobuf-parent
325%license LICENSE
326
327%files bom -f .mfiles-protobuf-bom
328%license LICENSE
329
330%files javalite -f .mfiles-protobuf-javalite
331%license LICENSE
332%endif
333
334%changelog
335* Wed Dec 06 2023 konglidong <konglidong@uniontech.com> - 3.14.0-8
336- obsolets protobuf2 for fix install conflict
337
338* Mon Nov 21 2022 chengzeruizhi <chengzeruizhi@huawei.com> - 3.14.0-7
339- Type:enhancement
340- ID:NA
341- SUG:NA
342- DESC: add compile option for coverage
343
344* Tue Oct 18 2022 chengzeruizhi <chengzeruizhi@huawei.com> - 3.14.0-6
345- Type:bugfix
346- ID:NA
347- SUG:NA
348- DESC: fix CVE-2022-3171
349
350* Tue Oct 11 2022 chengzeruizhi <chengzeruizhi@huawei.com> - 3.14.0-5
351- Type:bugfix
352- ID:NA
353- SUG:NA
354- DESC: fix CVE-2022-1941
355
356* Wed Apr 27 2022 wangxiaochao <wangxiaochao2@huawei.com> - 3.14.0-4
357- Type:bugfix
358- ID:NA
359- SUG:NA
360- DESC: Improve performance of parsing unknown fields in Java
361
362* Fri Mar 18 2022 wangxiaochao <wangxiaochao2@huawei.com> - 3.14.0-3
363- Type:bugfix
364- ID:NA
365- SUG:NA
366- DESC: fix CVE-2021-22570
367
368* Thu Mar 10 2022 wangxiaochao <wangxiaochao2@huawei.com> - 3.14.0-2
369- Type:bugfix
370- ID:NA
371- SUG:NA
372- DESC: fix mainline compile failed
373
374* Fri Jul 30 2021 liyanan <liyanan32@huawei.com> - 3.14.0-1
375- update to 3.14.0
376
377* Mon Apr 26 2021 haozi007 <liuhao27@huawei.com> - 3.12.3-16
378- Type:enhancement
379- ID:NA
380- SUG:NA
381- DESC: split compiler from devel
382
383* Sat Feb 20 2021 haozi007 <liuhao27@huawei.com> - 3.12.3-15
384- Type:enhancement
385- ID:NA
386- SUG:NA
387- DESC: add fstack check
388
389* Tue Sep 1 2020 wutao <wutao61@huawei.com> - 3.12.3-14
390- Type:enhancement
391- ID:NA
392- SUG:NA
393- DESC: enhance java function and fix build errors
394
395* Sat Aug 29 2020 openEuler Buildteam <buildteam@openeuler.org> - 3.12.3-13
396- Type:bugfix
397- ID:NA
398- SUG:NA
399- DESC: remove Conflicts
400
401* Fri Aug 28 2020 openEuler Buildteam <buildteam@openeuler.org> - 3.12.3-12
402- Type:bugfix
403- ID:NA
404- SUG:NA
405- DESC: invalid version of Conflicts
406
407* Thu Jul 23 2020 openEuler Buildteam <buildteam@openeuler.org> - 3.12.3-11
408- Type:enhancement
409- ID:NA
410- SUG:NA
411- DESC: drop python2-protobuf and refactor .spec file
412
413* Thu Jul 16 2020 openEuler Buildteam <buildteam@openeuler.org> - 3.12.3-10
414- Type:bugfix
415- ID:NA
416- SUG:NA
417- DESC:upgrade from 3.9.0 to 3.12.3
418
419* Wed Apr 08 2020 openEuler Buildteam <buildteam@openeuler.org> - 3.9.0-9
420- Type:enhancement
421- ID:NA
422- SUG:NA
423- DESC: remove unnecessary files
424
425* Thu Dec 12 2019 openEuler Buildteam <buildteam@openeuler.org> - 3.9.0-8.h3
426- Type:bugfix
427- ID:NA
428- SUG:NA
429- DESC:add bind now secure compile option
430
431* Wed Nov 27 2019 openEuler Buildteam <buildteam@openeuler.org> - 3.9.0-8.h2
432- Type:enhancement
433- ID:NA
434- SUG:NA
435- DESC:compatible to centos 7.5
436
437* Tue Nov 26 2019 openEuler Buildteam <buildteam@openeuler.org> - 3.9.0-8.h1
438- Type:bugfix
439- ID:NA
440- SUG:NA
441- DESC:upgrade from 3.5.0 to 3.9.0
442
443* Fri Nov 01 2019 openEuler Buildteam <buildteam@openeuler.org> - 3.5.0-8.h1
444- Type:bugfix
445- ID:NA
446- SUG:NA
447- DESC:change patch's names according to new rules
448