commit 9090f9fa7d3bf6d369a0432becf898dda0375ce8 Author: overweight <5324761+overweight@user.noreply.gitee.com> Date: Mon Sep 30 11:14:14 2019 -0400 Package init diff --git a/0001-fix-build-on-s390x.patch b/0001-fix-build-on-s390x.patch new file mode 100644 index 0000000..611a177 --- /dev/null +++ b/0001-fix-build-on-s390x.patch @@ -0,0 +1,26 @@ +From 3db1323d1d6132f08d0bafbd8602da7d71456745 Mon Sep 17 00:00:00 2001 +From: Igor Gnatenko +Date: Tue, 28 Nov 2017 20:58:00 +0100 +Subject: [PATCH] fix build on s390x + +Signed-off-by: Igor Gnatenko +--- + src/google/protobuf/stubs/atomicops.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/google/protobuf/stubs/atomicops.h b/src/google/protobuf/stubs/atomicops.h +index cb4553b1..34278f3a 100644 +--- a/src/google/protobuf/stubs/atomicops.h ++++ b/src/google/protobuf/stubs/atomicops.h +@@ -214,7 +214,7 @@ Atomic64 Release_Load(volatile const Atomic64* ptr); + #elif defined(GOOGLE_PROTOBUF_ARCH_PPC) + #include + #elif (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)) +-#include ++#include + #elif defined(__clang__) + #if __has_extension(c_atomic) + #include +-- +2.15.0 + diff --git a/ftdetect-proto.vim b/ftdetect-proto.vim new file mode 100644 index 0000000..e9b063e --- /dev/null +++ b/ftdetect-proto.vim @@ -0,0 +1,4 @@ +augroup filetype + au! BufRead,BufNewFile *.proto setfiletype proto +augroup end + diff --git a/googlemock-1.7.0.tar.gz b/googlemock-1.7.0.tar.gz new file mode 100644 index 0000000..91e50e1 Binary files /dev/null and b/googlemock-1.7.0.tar.gz differ diff --git a/googletest-1.7.0.tar.gz b/googletest-1.7.0.tar.gz new file mode 100644 index 0000000..88afbae Binary files /dev/null and b/googletest-1.7.0.tar.gz differ diff --git a/protobuf-init.el b/protobuf-init.el new file mode 100644 index 0000000..008bdef --- /dev/null +++ b/protobuf-init.el @@ -0,0 +1,6 @@ +; Protobuf major mode, init file by Tim Niemueller [www.niemueller.de], BSD +; Add mode to automatically recognized modes +(setq auto-mode-alist (cons '("\\.proto$" . protobuf-mode) auto-mode-alist)) +(autoload 'protobuf-mode "protobuf-mode" "Google protobuf editing mode." t) +; Turn on colorization by default +(add-hook 'protobuf-mode-hook 'turn-on-font-lock) diff --git a/protobuf.spec b/protobuf.spec new file mode 100644 index 0000000..d2a0f57 --- /dev/null +++ b/protobuf.spec @@ -0,0 +1,322 @@ +# Build -python subpackage +%bcond_without python +# Build -java subpackage +%bcond_without java + +%global emacs_version %(pkg-config emacs --modversion) +%global emacs_lispdir %(pkg-config emacs --variable sitepkglispdir) +%global emacs_startdir %(pkg-config emacs --variable sitestartdir) + +Summary: Protocol Buffers - Google's data interchange format +Name: protobuf +Version: 3.5.0 +Release: 8%{?dist} +License: BSD +URL: https://github.com/protocolbuffers/protobuf +Source: https://github.com/protocolbuffers/protobuf/archive/v%{version}.tar.gz +Source1: ftdetect-proto.vim +Source2: protobuf-init.el +Source3: https://github.com/google/googlemock/archive/release-1.7.0.tar.gz#/googlemock-1.7.0.tar.gz +Source4: https://github.com/google/googletest/archive/release-1.7.0.tar.gz#/googletest-1.7.0.tar.gz + + +Patch0: 0001-fix-build-on-s390x.patch + + +BuildRequires: autoconf automake emacs(bin) emacs-el +BuildRequires: gcc-c++ libtool pkgconfig zlib-devel +Provides: %{name}-vim +Provides: %{name}-emacs +Provides: %{name}-emacs-el +Obsoletes: %{name}-vim +Obsoletes: %{name}-emacs +Obsoletes: %{name}-emacs-el + +%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 devel +Summary: Protocol Buffers C++ headers and libraries +Requires: %{name} = %{version}-%{release} +Requires: zlib-devel pkgconfig +Provides: %{name}-compiler +Provides: %{name}-static +Obsoletes: %{name}-compiler +Obsoletes: %{name}-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 + +%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 python2-%{name} +Summary: Python 2 bindings for Google Protocol Buffers +BuildArch: noarch +BuildRequires: python2-devel python2-setuptools python2-google-apputils +Requires: python2-six +Conflicts: %{name}-compiler > %{version} +Conflicts: %{name}-compiler < %{version} +Provides: %{name}-python = %{version}-%{release} +%{?python_provide:%python_provide python2-%{name}} + +%description -n python2-%{name} +This package contains Python 2 libraries for Google Protocol Buffers + +%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}-google-apputils +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 + + +%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} + +%description java +This package contains Java Protocol Buffers 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 javanano +Summary: Protocol Buffer JavaNano API +BuildArch: noarch + +%description javanano +JavaNano is a special code generator and runtime +library designed specially for resource-restricted +systems, like Android. + +%package parent +Summary: Protocol Buffer Parent POM +BuildArch: noarch + +%description parent +Protocol Buffer Parent POM. + +%endif + +%prep +%setup -q -n %{name}-%{version}%{?rcver} -a 3 -a 4 +%autopatch -p1 + +mv googlemock-release-1.7.0 gmock +mv googletest-release-1.7.0 gmock/gtest +find -name \*.cc -o -name \*.h | xargs chmod -x +chmod 644 examples/* + +%if %{with java} +%pom_remove_parent java/pom.xml +%pom_remove_dep org.easymock:easymockclassextension java/pom.xml java/*/pom.xml +# These use easymockclassextension +rm java/core/src/test/java/com/google/protobuf/ServiceTest.java + +# used by https://github.com/google/libphonenumber +%pom_xpath_inject "pom:project/pom:modules" "../javanano" java +%pom_remove_parent javanano +%pom_remove_dep org.easymock:easymockclassextension javanano + +# 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/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 +%endif +%endif + +rm -f src/solaris/libstdc++.la + +%build +iconv -f iso8859-1 -t utf-8 CONTRIBUTORS.txt > CONTRIBUTORS.txt.utf8 +mv CONTRIBUTORS.txt.utf8 CONTRIBUTORS.txt +export PTHREAD_LIBS="-lpthread" +./autogen.sh +%configure + +make %{?_smp_mflags} + +%if %{with python} +pushd python +%py2_build +%py3_build +popd +%endif + +%if %{with java} +%mvn_build -s -- -f java/pom.xml +%endif + +emacs -batch -f batch-byte-compile editors/protobuf-mode.el + +%check +# TODO: failures; get them fixed and remove || : +# https://github.com/protocolbuffers/protobuf/issues/631 +make %{?_smp_mflags} check || : + +%install +make %{?_smp_mflags} install DESTDIR=%{buildroot} STRIPBINARIES=no INSTALL="%{__install} -p" CPPROG="cp -p" +find %{buildroot} -type f -name "*.la" -exec rm -f {} \; + +%if %{with python} +pushd python +#python ./setup.py install --root=%{buildroot} --single-version-externally-managed --record=INSTALLED_FILES --optimize=1 +%py2_install +%py3_install +find %{buildroot}%{python2_sitelib} %{buildroot}%{python3_sitelib} -name \*.py | + xargs sed -i -e '1{\@^#!@d}' +popd +%endif +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 + +%if %{with java} +%mvn_install +%endif + +mkdir -p $RPM_BUILD_ROOT%{emacs_lispdir} +mkdir -p $RPM_BUILD_ROOT%{emacs_startdir} +install -p -m 0644 editors/protobuf-mode.el $RPM_BUILD_ROOT%{emacs_lispdir} +install -p -m 0644 editors/protobuf-mode.elc $RPM_BUILD_ROOT%{emacs_lispdir} +install -p -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{emacs_startdir} + +%ldconfig_scriptlets +%ldconfig_scriptlets lite + +%files +%{_libdir}/libprotobuf.so.15* +%{_datadir}/vim/vimfiles/ftdetect/proto.vim +%{_datadir}/vim/vimfiles/syntax/proto.vim +%{emacs_startdir}/protobuf-init.el +%{emacs_lispdir}/protobuf-mode.elc +%{emacs_lispdir}/protobuf-mode.el +%doc CHANGES.txt CONTRIBUTORS.txt README.md +%license LICENSE + +%files devel +%dir %{_includedir}/google +%{_includedir}/google/protobuf/ +%{_bindir}/protoc +%{_libdir}/libprotoc.so.15* +%{_libdir}/libprotobuf.so +%{_libdir}/libprotoc.so +%{_libdir}/pkgconfig/protobuf.pc +%{_libdir}/libprotobuf.a +%{_libdir}/libprotoc.a +%doc README.md examples/add_person.cc examples/addressbook.proto examples/list_people.cc examples/Makefile examples/README.md + +%files lite +%{_libdir}/libprotobuf-lite.so.15* + +%files lite-devel +%{_libdir}/libprotobuf-lite.so +%{_libdir}/pkgconfig/protobuf-lite.pc +%{_libdir}/libprotobuf-lite.a + +%if %{with python} +%files -n python2-protobuf +%dir %{python2_sitelib}/google +%{python2_sitelib}/google/protobuf/ +%{python2_sitelib}/protobuf-%{version}%{?rcver}-py2.?.egg-info/ +%{python2_sitelib}/protobuf-%{version}%{?rcver}-py2.?-nspkg.pth +%doc python/README.md +%doc examples/add_person.py examples/list_people.py examples/addressbook.proto + +%files -n python%{python3_pkgversion}-protobuf +%dir %{python3_sitelib}/google +%{python3_sitelib}/google/protobuf/ +%{python3_sitelib}/protobuf-%{version}%{?rcver}-py3.?.egg-info/ +%{python3_sitelib}/protobuf-%{version}%{?rcver}-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 + +%files java-util -f .mfiles-protobuf-java-util + +%files javadoc -f .mfiles-javadoc +%license LICENSE + +%files javanano -f .mfiles-protobuf-javanano +%doc javanano/README.md +%license LICENSE + +%files parent -f .mfiles-protobuf-parent +%license LICENSE +%endif + +%changelog diff --git a/v3.5.0.tar.gz b/v3.5.0.tar.gz new file mode 100644 index 0000000..c3b91c3 Binary files /dev/null and b/v3.5.0.tar.gz differ