1 Star 0 Fork 40

zhangwenlong01/protobuf

forked from src-openEuler/protobuf 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
protobuf.spec 15.68 KB
一键复制 编辑 原始数据 按行查看 历史
zhangwenlong01 提交于 2024-04-15 06:58 . disable java for loongarch64
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537
#needsrootforbuild
# Build -python subpackage
%bcond_without python
# Build -java subpackage
%ifarch loongarch64
%bcond_with java
%else
%bcond_without java
%endif
Summary: Protocol Buffers - Google's data interchange format
Name: protobuf
Version: 25.1
Release: 4
License: BSD
URL: https://github.com/protocolbuffers/protobuf
Source: https://github.com/protocolbuffers/protobuf/releases/download/v%{version}%{?rcver}/%{name}-all-%{version}%{?rcver}.tar.gz
Source1: protobuf-init.el
%global so_version 25.1
Patch9000: 0001-add-secure-compile-option.patch
Patch9001: 0002-Fix-CC-compiler-support.patch
BuildRequires: cmake gcc-c++ emacs zlib-devel gmock-devel gtest-devel jsoncpp-devel
BuildRequires: fdupes pkgconfig python-rpm-macros pkgconfig(zlib) ninja-build
BuildRequires: abseil-cpp-devel >= 20230802
%description
Protocol Buffers (a.k.a., protobuf) are Google's language-neutral,
platform-neutral, extensible mechanism for serializing structured data.
You can find protobuf's documentation on the Google Developers site.
%package compiler
Summary: Protocol Buffers compiler
Requires: %{name} = %{version}-%{release}
Obsoletes: protobuf-emacs < %{version}
Obsoletes: protobuf-emacs-el < %{version}
Obsoletes: protobuf2-compiler
Requires: emacs-filesystem >= %{_emacs_version}
%description compiler
This package containers 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 pkgconfig vim-enhanced
Requires: abseil-cpp-devel >= 20230802
Provides: %{name}-static
Provides: %{name}-vim
Obsoletes: %{name}-static < %{version}
Obsoletes: %{name}-vim < %{version}
Obsoletes: protobuf2-devel
Obsoletes: protobuf2-vim
Obsoletes: protobuf2-static
%description devel
This package contains Protocol Buffers compiler for all languages and
C++ headers and libraries
%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}
Provides: %{name}-lite-static
Obsoletes: %{name}-lite-static < %{version}
Obsoletes: protobuf2-lite-devel
Obsoletes: protobuf2-lite-static
%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.
%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}-%{release}
Conflicts: %{name}-compiler < %{version}-%{release}
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
%if %{with java}
%package java
Summary: Java Protocol Buffers runtime library
BuildArch: noarch
BuildRequires: java-devel >= 1.6
BuildRequires: jpackage-utils
BuildRequires: maven-local
BuildRequires: mvn(com.google.code.gson:gson)
BuildRequires: mvn(com.google.guava:guava)
BuildRequires: mvn(junit:junit)
BuildRequires: mvn(org.easymock:easymock)
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: maven-compiler-plugin
BuildRequires: maven-install-plugin
BuildRequires: maven-jar-plugin
BuildRequires: maven-javadoc-plugin
BuildRequires: maven-release-plugin
BuildRequires: maven-resources-plugin
BuildRequires: maven-surefire-plugin
BuildRequires: maven-antrun-plugin
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
%prep
%setup -q -n %{name}-%{version}%{?rcver}
%autopatch -p1
find -name \*.cc -o -name \*.h | xargs chmod -x
chmod 644 examples/*
%if %{with java}
#%pom_remove_dep com.google.truth:truth java/pom.xml
#%pom_remove_dep org.easymock:easymockclassextension java/pom.xml java/*/pom.xml
#%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/util/pom.xml java/lite/pom.xml java/core/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
%pom_remove_dep com.google.j2objc:j2objc-annotations java/util/pom.xml
%pom_remove_plugin org.codehaus.mojo:animal-sniffer-maven-plugin java/pom.xml java/util/pom.xml
%pom_remove_dep org.mockito:mockito-core java/pom.xml java/core/pom.xml java/lite/pom.xml java/util/pom.xml
# These use easymockclassextension
rm java/core/src/test/java/com/google/protobuf/ServiceTest.java
#rm -r java/core/src/test
# 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 java/core/src/test/java/com/google/protobuf/UnknownFieldSetTest.java
rm java/core/src/test/java/com/google/protobuf/UnknownFieldSetPerformanceTest.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" "<Import-Package>sun.misc;resolution:=optional,*</Import-Package>" java/core
# Backward compatibility symlink
%mvn_file :protobuf-java:jar: %{name}/%{name}-java %{name}
# This test is incredibly slow on arm
# https://github.com/protocolbuffers/protobuf/issues/2389
%ifarch %{arm}
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
mkdir build
pushd build
%cmake \
-Dprotobuf_BUILD_EXAMPLES:BOOL=OFF \
-Dprotobuf_BUILD_LIBPROTOC:BOOL=ON \
-Dprotobuf_BUILD_SHARED_LIBS:BOOL=ON \
-Dprotobuf_USE_EXTERNAL_GTEST:BOOL=ON \
-Dprotobuf_ABSL_PROVIDER=package \
-Dprotobuf_BUILD_TESTS:BOOL=OFF \
-DCMAKE_EXE_LINKER_FLAGS=-Wl,--as-needed \
-DCMAKE_MODULE_LINKER_FLAGS=-Wl,--as-needed \
-DCMAKE_SHARED_LINKER_FLAGS=-Wl,--as-needed \
-DCMAKE_CXX_FLAGS="-g -O2" \
-DCMAKE_C_COMPILER=%{__cc} \
-DCMAKE_CXX_COMPILER=%{__cxx} \
-DCMAKE_SKIP_RPATH=TRUE \
-G Ninja \
../
popd
mkdir build-static
pushd build-static
export CMAKE_BUILD_DIR=build-static
%cmake \
-Dprotobuf_BUILD_EXAMPLES:BOOL=OFF \
-Dprotobuf_BUILD_LIBPROTOC:BOOL=ON \
-Dprotobuf_BUILD_SHARED_LIBS:BOOL=OFF \
-Dprotobuf_USE_EXTERNAL_GTEST:BOOL=ON \
-Dprotobuf_ABSL_PROVIDER=package \
-Dprotobuf_BUILD_TESTS:BOOL=OFF \
-DCMAKE_CXX_FLAGS="-fPIC" \
-DCMAKE_C_COMPILER=%{__cc} \
-DCMAKE_CXX_COMPILER=%{__cxx} \
-DCMAKE_SKIP_RPATH=TRUE \
-G Ninja \
../
popd
%build
%ninja_build -C build
%ninja_build -C build-static
# we have to override LD_LIBRARY_PATH because we eliminated rpath
export LD_LIBRARY_PATH="${PWD}/build":$LD_LIBRARY_PATH
%if %{with python}
# Use the just built protoc instead of any
# system version for python and/or java bindings
export PROTOC=../build/protoc
pushd python
CXXFLAGS="%{build_cxxflags}" \
LDFLAGS="-L../%{_vpath_builddir} -L../%{_vpath_builddir}/third_party/utf8_range %{build_ldflags}" \
%py3_build
popd
%endif
%if %{with java}
cp build/protoc ./
%pom_disable_module kotlin java/pom.xml
%pom_disable_module kotlin-lite java/pom.xml
%mvn_build -s -- -Dmaven.test.skip=true -f java/pom.xml
%endif
%{_emacs_bytecompile} editors/protobuf-mode.el
%check
# Java tests fail on s390x
%ifarch s390x
fail=0
%else
fail=1
%endif
%install
%ninja_install -C build-static
%ninja_install -C build
%if %{with python}
pushd python
CXXFLAGS="%{build_cxxflags}" \
LDFLAGS="-L../%{_vpath_builddir} -L../%{_vpath_builddir}/third_party/utf8_range %{build_ldflags}" \
#python ./setup.py install --root=%{buildroot} --single-version-externally-managed --record=INSTALLED_FILES --optimize=1
%py3_install
find %{buildroot}%{python3_sitelib} -name \*.py |
xargs sed -i -e '1{\@^#!@d}'
popd
%endif
install -p -m 644 -D editors/proto.vim %{buildroot}%{_datadir}/vim/vimfiles/syntax/proto.vim
%if %{with java}
%mvn_install
%endif
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 %{SOURCE1} %{buildroot}%{_emacs_sitestartdir}
%ldconfig_scriptlets
%ldconfig_scriptlets lite
%ldconfig_scriptlets compiler
%files
%doc CONTRIBUTORS.txt README.md
%license LICENSE
%{_libdir}/libprotobuf.so.%{so_version}{,.*}
%files compiler
%{_bindir}/protoc*
%{_libdir}/libprotoc.so.%{so_version}{,.*}
%{_emacs_sitelispdir}/%{name}/
%{_emacs_sitestartdir}/protobuf-init.el
%license LICENSE
%doc README.md
%files devel
%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
%{_libdir}/libprotoc.so
%{_libdir}/libutf8_range.a
%{_libdir}/libutf8_validity.a
%{_libdir}/libprotobuf.a
%{_libdir}/libprotoc.a
%{_datadir}/vim
%{_includedir}/java/core/src/main/java/com/google/protobuf/java_features.proto
%files lite
%{_libdir}/libprotobuf-lite.so.%{so_version}{,.*}
%files lite-devel
%{_libdir}/libprotobuf-lite.so
%{_libdir}/pkgconfig/protobuf-lite.pc
%{_libdir}/libprotobuf-lite.a
%if %{with python}
%files -n python%{python3_pkgversion}-protobuf
%dir %{python3_sitelib}/google
%{python3_sitelib}/google/protobuf/
%{python3_sitelib}/%{name}-*-py3.*.egg-info/
%{python3_sitelib}/%{name}-*-py3.*-nspkg.pth
%doc python/README.md
%doc examples/add_person.py examples/list_people.py examples/addressbook.proto
%endif
%if %{with java}
%files java -f .mfiles-protobuf-java
%doc examples/AddPerson.java examples/ListPeople.java
%doc java/README.md
%license LICENSE
%{_includedir}/java/core/src/main/java/com/google/protobuf/java_features.proto
%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
* Mon Apr 15 2024 Wenlong Zhang <[email protected]> - 25.1-4
- disable java for loongarch64
* Tue Apr 09 2024 zhongtao <[email protected]> - 25.1-3
- Type:bugfix
- ID:NA
- SUG:NA
- DESC: add secure complie option and code improve
* Wed Mar 20 2024 wangqiang <[email protected]> - 25.1-2
- Support package build with clang
* Wed Jan 10 2024 zhongtao <[email protected]> - 25.1-1
- Type:upgrade
- ID:NA
- SUG:NA
- DESC: update to 25.1
* Wed Dec 06 2023 konglidong <[email protected]> - 3.19.6-2
- Type:enhancement
- ID:NA
- SUG:NA
- DESC: obsolets protobuf2 for fix install conflict
* Mon Jul 17 2023 zhongtao <[email protected]> - 3.19.6-1
- Type:upgrade
- ID:NA
- SUG:NA
- DESC: update to 3.19.6
* Tue Oct 18 2022 chengzeruizhi <[email protected]> - 3.14.0-6
- Type:bugfix
- ID:NA
- SUG:NA
- DESC: fix CVE-2022-3171
* Tue Oct 11 2022 chengzeruizhi <[email protected]> - 3.14.0-5
- Type:bugfix
- ID:NA
- SUG:NA
- DESC: fix CVE-2022-1941
* Wed Apr 27 2022 wangxiaochao <[email protected]> - 3.14.0-4
- Type:bugfix
- ID:NA
- SUG:NA
- DESC: Improve performance of parsing unknown fields in Java
* Fri Mar 18 2022 wangxiaochao <[email protected]> - 3.14.0-3
- Type:bugfix
- ID:NA
- SUG:NA
- DESC: fix CVE-2021-22570
* Thu Mar 10 2022 wangxiaochao <[email protected]> - 3.14.0-2
- Type:bugfix
- ID:NA
- SUG:NA
- DESC: fix mainline compile failed
* Fri Jul 30 2021 liyanan <[email protected]> - 3.14.0-1
- update to 3.14.0
* Mon Apr 26 2021 haozi007 <[email protected]> - 3.12.3-16
- Type:enhancement
- ID:NA
- SUG:NA
- DESC: split compiler from devel
* Sat Feb 20 2021 haozi007 <[email protected]> - 3.12.3-15
- Type:enhancement
- ID:NA
- SUG:NA
- DESC: add fstack check
* Tue Sep 1 2020 wutao <[email protected]> - 3.12.3-14
- Type:enhancement
- ID:NA
- SUG:NA
- DESC: enhance java function and fix build errors
* Sat Aug 29 2020 openEuler Buildteam <[email protected]> - 3.12.3-13
- Type:bugfix
- ID:NA
- SUG:NA
- DESC: remove Conflicts
* Fri Aug 28 2020 openEuler Buildteam <[email protected]> - 3.12.3-12
- Type:bugfix
- ID:NA
- SUG:NA
- DESC: invalid version of Conflicts
* Thu Jul 23 2020 openEuler Buildteam <[email protected]> - 3.12.3-11
- Type:enhancement
- ID:NA
- SUG:NA
- DESC: drop python2-protobuf and refactor .spec file
* Thu Jul 16 2020 openEuler Buildteam <[email protected]> - 3.12.3-10
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:upgrade from 3.9.0 to 3.12.3
* Wed Apr 08 2020 openEuler Buildteam <[email protected]> - 3.9.0-9
- Type:enhancement
- ID:NA
- SUG:NA
- DESC: remove unnecessary files
* Thu Dec 12 2019 openEuler Buildteam <[email protected]> - 3.9.0-8.h3
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:add bind now secure compile option
* Wed Nov 27 2019 openEuler Buildteam <[email protected]> - 3.9.0-8.h2
- Type:enhancement
- ID:NA
- SUG:NA
- DESC:compatible to centos 7.5
* Tue Nov 26 2019 openEuler Buildteam <[email protected]> - 3.9.0-8.h1
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:upgrade from 3.5.0 to 3.9.0
* Fri Nov 01 2019 openEuler Buildteam <[email protected]> - 3.5.0-8.h1
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:change patch's names according to new rules
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zhangwenlong01/protobuf.git
[email protected]:zhangwenlong01/protobuf.git
zhangwenlong01
protobuf
protobuf
master

搜索帮助