diff --git a/5ec7f0c4a113e2f18ac2c6cc7df51ad6afc24081.zip b/5ec7f0c4a113e2f18ac2c6cc7df51ad6afc24081.zip new file mode 100644 index 0000000000000000000000000000000000000000..a1463746e9071cb7b6ea11dcd6bc8e9fea988936 Binary files /dev/null and b/5ec7f0c4a113e2f18ac2c6cc7df51ad6afc24081.zip differ diff --git a/ftdetect-proto.vim b/ftdetect-proto.vim new file mode 100644 index 0000000000000000000000000000000000000000..e9b063e8a9504dccda06427210f8848ef819a480 --- /dev/null +++ b/ftdetect-proto.vim @@ -0,0 +1,4 @@ +augroup filetype + au! BufRead,BufNewFile *.proto setfiletype proto +augroup end + diff --git a/protobuf-3.19.4-all.tar.gz b/protobuf-3.19.4-all.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..c65bee8069ecdc7b85170af7049957dc58766177 Binary files /dev/null and b/protobuf-3.19.4-all.tar.gz differ diff --git a/protobuf-3.19.4-jre17-add-opens.patch b/protobuf-3.19.4-jre17-add-opens.patch new file mode 100644 index 0000000000000000000000000000000000000000..2d159fa6771d398d610538a35a1fe19da9c38488 --- /dev/null +++ b/protobuf-3.19.4-jre17-add-opens.patch @@ -0,0 +1,10 @@ +--- protobuf-3.19.4/java/pom.xml.jre17 2022-02-13 11:45:39.367028268 +0900 ++++ protobuf-3.19.4/java/pom.xml 2022-02-13 12:43:18.212542147 +0900 +@@ -37,6 +37,7 @@ + src/test/proto + ${project.build.directory}/generated-sources + ${project.build.directory}/generated-test-sources ++ --add-opens java.base/java.lang=ALL-UNNAMED + + + diff --git a/protobuf-init.el b/protobuf-init.el new file mode 100644 index 0000000000000000000000000000000000000000..008bdeffc15187dada0840c7abcff26c9c0657fd --- /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 0000000000000000000000000000000000000000..c2ed8d38a31fa43b5ef1381249e173e1f9946317 --- /dev/null +++ b/protobuf.spec @@ -0,0 +1,369 @@ +%define anolis_release 1 +%define googletest_ver 5ec7f0c4a113e2f18ac2c6cc7df51ad6afc24081 +%bcond_without python +%bcond_without java + +Name: protobuf +Version: 3.19.4 +Release: %{anolis_release}%{?dist} +Summary: Protocol Buffers - Google's data interchange format + +License: BSD +URL: https://github.com/protocolbuffers/protobuf +Source0: https://github.com/protocolbuffers/protobuf/archive/refs/tags/%{name}-%{version}-all.tar.gz +# For tests (using exactly the same version as the release) +Source1: https://github.com/google/googletest/archive/%{googletest_ver}.zip + +Source2: ftdetect-proto.vim +Source3: protobuf-init.el + +# https://bugzilla.redhat.com/show_bug.cgi?id=2051202 +Patch1: protobuf-3.19.4-jre17-add-opens.patch + +BuildRequires: make +BuildRequires: autoconf +BuildRequires: automake +BuildRequires: emacs emacs-common +BuildRequires: gcc-c++ +BuildRequires: libtool +BuildRequires: pkgconfig +BuildRequires: zlib-devel + +%description +Protocol Buffers are a way of encoding structured data in an efficient +yet extensible format. Google uses Protocol Buffers for almost all of +its internal RPC protocols and file formats. + +Protocol buffers are a flexible, efficient, automated mechanism for +serializing structured data – think XML, but smaller, faster, and +simpler. You define how you want your data to be structured once, then +you can use special generated source code to easily write and read +your structured data to and from a variety of data streams and using a +variety of languages. You can even update your data structure without +breaking deployed programs that are compiled against the "old" format. + + +%package compiler +Summary: Protocol Buffers compiler +Requires: %{name} = %{version}-%{release} + +%description compiler +This package contains 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 +Requires: pkgconfig + +%description devel +This package contains Protocol Buffers compiler for all languages and +C++ headers and libraries + +%package static +Summary: Static development files for %{name} +Requires: %{name}-devel = %{version}-%{release} + +%description static +Static libraries for Protocol Buffers + +%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} + +%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. + +%package lite-static +Summary: Static development files for %{name}-lite +Requires: %{name}-devel = %{version}-%{release} + +%description lite-static +This package contains static 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 python3-%{name} +Summary: Python 3 bindings for Google Protocol Buffers +BuildArch: noarch +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-wheel +Requires: python3-six >= 1.9 +Conflicts: %{name}-compiler > %{version} +Conflicts: %{name}-compiler < %{version} +Provides: %{name}-python3 = %{version}-%{release} +%{?python_provide:%python_provide python3-%{name}} + +%description -n python3-%{name} +This package contains Python 3 libraries for Google Protocol Buffers +%endif + +%package vim +Summary: Vim syntax highlighting for Google Protocol Buffers descriptions +BuildArch: noarch +Requires: vim-enhanced + +%description vim +This package contains syntax highlighting for Google Protocol Buffers +descriptions in Vim editor + +%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(com.google.guava:guava-testlib) +BuildRequires: mvn(com.google.truth:truth) +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} +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 + +%package emacs +Summary: Emacs mode for Google Protocol Buffers descriptions +BuildArch: noarch +Requires: emacs-filesystem >= %{_emacs_version} +Obsoletes: protobuf-emacs-el < 3.6.1-4 + +%description emacs +This package contains syntax highlighting for Google Protocol Buffers +descriptions in the Emacs editor. + +%prep +%autosetup -n %{name}-%{version} -p1 -a 1 + +mv googletest-%{googletest_ver}/* third_party/googletest/ +find -name \*.cc -o -name \*.h | xargs chmod -x +chmod 644 examples/* + +%if %{with java} +%pom_remove_dep com.google.errorprone:error_prone_annotations java/util/pom.xml +%pom_remove_dep com.google.j2objc:j2objc-annotations java/util/pom.xml + +# Remove annotation libraries we don't have +annotations=$( + find -name '*.java' | + xargs grep -h -e '^import com\.google\.errorprone\.annotation' \ + -e '^import com\.google\.j2objc\.annotations' | + sort -u | sed 's/.*\.\([^.]*\);/\1/' | paste -sd\| +) +find -name '*.java' | xargs sed -ri \ + "s/^import .*\.($annotations);//;s/@($annotations)"'\>\s*(\((("[^"]*")|([^)]*))\))?//g' + +# 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} + +%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 + +# -Wno-error=type-limits: +# https://github.com/protocolbuffers/protobuf/issues/7514 +# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95148 +# (also set in %%check) +%make_build CXXFLAGS="%{build_cxxflags} -Wno-error=type-limits" + +%if %{with python} +pushd python +%py3_build +popd +%endif + +%if %{with java} +%pom_disable_module kotlin java/pom.xml +%pom_disable_module kotlin-lite java/pom.xml +%mvn_build -s -- -f java/pom.xml +%endif + +%{_emacs_bytecompile} editors/protobuf-mode.el + +%install +%make_install %{?_smp_mflags} STRIPBINARIES=no INSTALL="%{__install} -p" CPPROG="cp -p" +find %{buildroot} -type f -name "*.la" -exec rm -f {} \; + +%if %{with python} +pushd python +%py3_install +find %{buildroot}%{python3_sitelib} -name \*.py | + xargs sed -i -e '1{\@^#!@d}' +popd +%endif +install -p -m 644 -D %{SOURCE2} %{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 %{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 %{SOURCE3} %{buildroot}%{_emacs_sitestartdir} + +%check +fail=1 +%make_build check CXXFLAGS="%{build_cxxflags} -Wno-error=type-limits" || exit $fail + +%ldconfig_scriptlets +%ldconfig_scriptlets lite +%ldconfig_scriptlets compiler + +%files +%license LICENSE +%doc CHANGES.txt CONTRIBUTORS.txt README.md +%{_libdir}/libprotobuf.so.30* + +%files compiler +%doc README.md +%license LICENSE +%{_bindir}/protoc +%{_libdir}/libprotoc.so.30* + +%files devel +%doc examples/add_person.cc examples/addressbook.proto +%doc examples/list_people.cc examples/Makefile examples/README.md +%dir %{_includedir}/google +%{_includedir}/google/protobuf/ +%{_libdir}/libprotobuf.so +%{_libdir}/libprotoc.so +%{_libdir}/pkgconfig/protobuf.pc + +%files emacs +%{_emacs_sitelispdir}/%{name}/ +%{_emacs_sitestartdir}/protobuf-init.el + +%files static +%{_libdir}/libprotobuf.a +%{_libdir}/libprotoc.a + +%files lite +%{_libdir}/libprotobuf-lite.so.30* + +%files lite-devel +%{_libdir}/libprotobuf-lite.so +%{_libdir}/pkgconfig/protobuf-lite.pc + +%files lite-static +%{_libdir}/libprotobuf-lite.a + +%if %{with python} +%files -n python3-protobuf +%doc python/README.md +%doc examples/add_person.py examples/list_people.py examples/addressbook.proto +%dir %{python3_sitelib}/google +%{python3_sitelib}/google/protobuf/ +%{python3_sitelib}/protobuf-%{version}%{?rcver}-py3.*.egg-info/ +%{python3_sitelib}/protobuf-%{version}%{?rcver}-py3.*-nspkg.pth +%endif + +%files vim +%{_datadir}/vim/vimfiles/ftdetect/proto.vim +%{_datadir}/vim/vimfiles/syntax/proto.vim + +%if %{with java} +%files java -f .mfiles-protobuf-java +%license LICENSE +%doc examples/AddPerson.java examples/ListPeople.java +%doc java/README.md + +%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 +* Wed Apr 27 2022 happy_orange - 3.19.4-1 +- init from upstream