3fdee4
# Build -python subpackage
3fdee4
%bcond_without python
3fdee4
# Build -java subpackage
3fdee4
%bcond_without java
3fdee4
# Don't require gtest
3fdee4
%bcond_with gtest
3fdee4
3fdee4
%if %{with python}
3fdee4
%define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")
3fdee4
%endif
3fdee4
3fdee4
%global emacs_version %(pkg-config emacs --modversion)
3fdee4
%global emacs_lispdir %(pkg-config emacs --variable sitepkglispdir)
3fdee4
%global emacs_startdir %(pkg-config emacs --variable sitestartdir)
3fdee4
3fdee4
Summary:        Protocol Buffers - Google's data interchange format
3fdee4
Name:           protobuf
3fdee4
Version:        2.5.0
3fdee4
Release:        8%{?dist}
3fdee4
License:        BSD
3fdee4
Group:          Development/Libraries
3fdee4
Source:         http://protobuf.googlecode.com/files/protobuf-%{version}.tar.bz2
3fdee4
Source1:        ftdetect-proto.vim
3fdee4
Source2:        protobuf-init.el
3fdee4
Patch1:         protobuf-2.5.0-fedora-gtest.patch
3fdee4
Patch2:         protobuf-2.5.0-java-fixes.patch
3fdee4
Patch3:         0001-Add-generic-GCC-support-for-atomic-operations.patch
3fdee4
Patch4:         protobuf-2.5.0-makefile.patch
3fdee4
URL:            http://code.google.com/p/protobuf/
3fdee4
BuildRequires:  automake autoconf libtool pkgconfig zlib-devel
3fdee4
BuildRequires:  emacs
3fdee4
BuildRequires:  emacs-el >= 24.1
3fdee4
%if %{with gtest}
3fdee4
BuildRequires:  gtest-devel
3fdee4
%endif
3fdee4
3fdee4
%description
3fdee4
Protocol Buffers are a way of encoding structured data in an efficient
3fdee4
yet extensible format. Google uses Protocol Buffers for almost all of
3fdee4
its internal RPC protocols and file formats.
3fdee4
3fdee4
Protocol buffers are a flexible, efficient, automated mechanism for
3fdee4
serializing structured data – think XML, but smaller, faster, and
3fdee4
simpler. You define how you want your data to be structured once, then
3fdee4
you can use special generated source code to easily write and read
3fdee4
your structured data to and from a variety of data streams and using a
3fdee4
variety of languages. You can even update your data structure without
3fdee4
breaking deployed programs that are compiled against the "old" format.
3fdee4
3fdee4
%package compiler
3fdee4
Summary: Protocol Buffers compiler
3fdee4
Group: Development/Libraries
3fdee4
Requires: %{name} = %{version}-%{release}
3fdee4
3fdee4
%description compiler
3fdee4
This package contains Protocol Buffers compiler for all programming
3fdee4
languages
3fdee4
3fdee4
%package devel
3fdee4
Summary: Protocol Buffers C++ headers and libraries
3fdee4
Group: Development/Libraries
3fdee4
Requires: %{name} = %{version}-%{release}
3fdee4
Requires: %{name}-compiler = %{version}-%{release}
3fdee4
Requires: zlib-devel
3fdee4
Requires: pkgconfig
3fdee4
3fdee4
%description devel
3fdee4
This package contains Protocol Buffers compiler for all languages and
3fdee4
C++ headers and libraries
3fdee4
3fdee4
%package static
3fdee4
Summary: Static development files for %{name}
3fdee4
Group: Development/Libraries
3fdee4
Requires: %{name} = %{version}-%{release}
3fdee4
3fdee4
%description static
3fdee4
Static libraries for Protocol Buffers
3fdee4
3fdee4
%package lite
3fdee4
Summary: Protocol Buffers LITE_RUNTIME libraries
3fdee4
Group: Development/Libraries
3fdee4
3fdee4
%description lite
3fdee4
Protocol Buffers built with optimize_for = LITE_RUNTIME.
3fdee4
3fdee4
The "optimize_for = LITE_RUNTIME" option causes the compiler to generate code
3fdee4
which only depends libprotobuf-lite, which is much smaller than libprotobuf but
3fdee4
lacks descriptors, reflection, and some other features.
3fdee4
3fdee4
%package lite-devel
3fdee4
Summary: Protocol Buffers LITE_RUNTIME development libraries
3fdee4
Requires: %{name}-devel = %{version}-%{release}
3fdee4
Requires: %{name}-lite = %{version}-%{release}
3fdee4
3fdee4
%description lite-devel
3fdee4
This package contains development libraries built with
3fdee4
optimize_for = LITE_RUNTIME.
3fdee4
3fdee4
The "optimize_for = LITE_RUNTIME" option causes the compiler to generate code
3fdee4
which only depends libprotobuf-lite, which is much smaller than libprotobuf but
3fdee4
lacks descriptors, reflection, and some other features.
3fdee4
3fdee4
%package lite-static
3fdee4
Summary: Static development files for %{name}-lite
3fdee4
Group: Development/Libraries
3fdee4
Requires: %{name}-devel = %{version}-%{release}
3fdee4
3fdee4
%description lite-static
3fdee4
This package contains static development libraries built with
3fdee4
optimize_for = LITE_RUNTIME.
3fdee4
3fdee4
The "optimize_for = LITE_RUNTIME" option causes the compiler to generate code
3fdee4
which only depends libprotobuf-lite, which is much smaller than libprotobuf but
3fdee4
lacks descriptors, reflection, and some other features.
3fdee4
3fdee4
%if %{with python}
3fdee4
%package python
3fdee4
Summary: Python bindings for Google Protocol Buffers
3fdee4
Group: Development/Languages
3fdee4
BuildRequires: python-devel
3fdee4
BuildRequires: python-setuptools
3fdee4
Conflicts: %{name}-compiler > %{version}
3fdee4
Conflicts: %{name}-compiler < %{version}
3fdee4
3fdee4
%description python
3fdee4
This package contains Python libraries for Google Protocol Buffers
3fdee4
%endif
3fdee4
3fdee4
%package vim
3fdee4
Summary: Vim syntax highlighting for Google Protocol Buffers descriptions
3fdee4
Group: Development/Libraries
3fdee4
Requires: vim-enhanced
3fdee4
3fdee4
%description vim
3fdee4
This package contains syntax highlighting for Google Protocol Buffers
3fdee4
descriptions in Vim editor
3fdee4
3fdee4
%package emacs
3fdee4
Summary: Emacs mode for Google Protocol Buffers descriptions
3fdee4
Group: Applications/Editors
3fdee4
Requires: emacs >= 0%{emacs_version}
3fdee4
3fdee4
%description emacs
3fdee4
This package contains syntax highlighting for Google Protocol Buffers
3fdee4
descriptions in the Emacs editor.
3fdee4
3fdee4
%package emacs-el
3fdee4
Summary: Elisp source files for Google protobuf Emacs mode
3fdee4
Group: Applications/Editors
3fdee4
Requires: protobuf-emacs = %{version}
3fdee4
3fdee4
%description emacs-el
3fdee4
This package contains the elisp source files for %{name}-emacs
3fdee4
under GNU Emacs. You do not need to install this package to use
3fdee4
%{name}-emacs.
3fdee4
3fdee4
3fdee4
%if %{with java}
3fdee4
%package java
3fdee4
Summary: Java Protocol Buffers runtime library
3fdee4
Group:   Development/Languages
3fdee4
BuildRequires:    java-devel >= 1.6
3fdee4
BuildRequires:    jpackage-utils
3fdee4
BuildRequires:    maven-local
3fdee4
BuildRequires:    maven-compiler-plugin
3fdee4
BuildRequires:    maven-install-plugin
3fdee4
BuildRequires:    maven-jar-plugin
3fdee4
BuildRequires:    maven-javadoc-plugin
3fdee4
BuildRequires:    maven-resources-plugin
3fdee4
BuildRequires:    maven-surefire-plugin
3fdee4
BuildRequires:    maven-antrun-plugin
3fdee4
Conflicts:        %{name}-compiler > %{version}
3fdee4
Conflicts:        %{name}-compiler < %{version}
3fdee4
3fdee4
%description java
3fdee4
This package contains Java Protocol Buffers runtime library.
3fdee4
3fdee4
%package javadoc
3fdee4
Summary: Javadocs for %{name}-java
3fdee4
Group:   Documentation
3fdee4
Requires: %{name}-java = %{version}-%{release}
3fdee4
3fdee4
%description javadoc
3fdee4
This package contains the API documentation for %{name}-java.
3fdee4
3fdee4
%endif
3fdee4
3fdee4
%prep
3fdee4
%setup -q
3fdee4
%if %{with gtest}
3fdee4
rm -rf gtest
3fdee4
%patch1 -p1 -b .gtest
3fdee4
%endif
3fdee4
chmod 644 examples/*
3fdee4
%if %{with java}
3fdee4
%patch2 -p1 -b .java-fixes
3fdee4
rm -rf java/src/test
3fdee4
%endif
3fdee4
3fdee4
%patch3 -p1 -b .generic-atomics
3fdee4
%patch4 -p1 -b .generic-atomics-makefile
3fdee4
3fdee4
%build
3fdee4
iconv -f iso8859-1 -t utf-8 CONTRIBUTORS.txt > CONTRIBUTORS.txt.utf8
3fdee4
mv CONTRIBUTORS.txt.utf8 CONTRIBUTORS.txt
3fdee4
export PTHREAD_LIBS="-lpthread"
3fdee4
./autogen.sh
3fdee4
%configure
3fdee4
3fdee4
make %{?_smp_mflags}
3fdee4
3fdee4
%if %{with python}
3fdee4
pushd python
3fdee4
python ./setup.py build
3fdee4
sed -i -e 1d build/lib/google/protobuf/descriptor_pb2.py
3fdee4
popd
3fdee4
%endif
3fdee4
3fdee4
%if %{with java}
3fdee4
pushd java
3fdee4
%mvn_file : %{name}
3fdee4
%mvn_build
3fdee4
popd
3fdee4
%endif
3fdee4
3fdee4
emacs -batch -f batch-byte-compile editors/protobuf-mode.el
3fdee4
3fdee4
%check
3fdee4
#make %{?_smp_mflags} check
3fdee4
3fdee4
%install
3fdee4
rm -rf %{buildroot}
3fdee4
make %{?_smp_mflags} install DESTDIR=%{buildroot} STRIPBINARIES=no INSTALL="%{__install} -p" CPPROG="cp -p"
3fdee4
find %{buildroot} -type f -name "*.la" -exec rm -f {} \;
3fdee4
3fdee4
%if %{with python}
3fdee4
pushd python
3fdee4
python ./setup.py install --root=%{buildroot} --single-version-externally-managed --record=INSTALLED_FILES --optimize=1
3fdee4
popd
3fdee4
%endif
3fdee4
install -p -m 644 -D %{SOURCE1} %{buildroot}%{_datadir}/vim/vimfiles/ftdetect/proto.vim
3fdee4
install -p -m 644 -D editors/proto.vim %{buildroot}%{_datadir}/vim/vimfiles/syntax/proto.vim
3fdee4
3fdee4
%if %{with java}
3fdee4
pushd java
3fdee4
%mvn_install
3fdee4
popd
3fdee4
%endif
3fdee4
3fdee4
mkdir -p $RPM_BUILD_ROOT%{emacs_lispdir}
3fdee4
mkdir -p $RPM_BUILD_ROOT%{emacs_startdir}
3fdee4
install -p -m 0644 editors/protobuf-mode.el $RPM_BUILD_ROOT%{emacs_lispdir}
3fdee4
install -p -m 0644 editors/protobuf-mode.elc $RPM_BUILD_ROOT%{emacs_lispdir}
3fdee4
install -p -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{emacs_startdir}
3fdee4
3fdee4
3fdee4
%post -p /sbin/ldconfig
3fdee4
%postun -p /sbin/ldconfig
3fdee4
3fdee4
%post lite -p /sbin/ldconfig
3fdee4
%postun lite -p /sbin/ldconfig
3fdee4
3fdee4
%post compiler -p /sbin/ldconfig
3fdee4
%postun compiler -p /sbin/ldconfig
3fdee4
3fdee4
%files
3fdee4
%defattr(-, root, root, -)
3fdee4
%{_libdir}/libprotobuf.so.*
3fdee4
%doc CHANGES.txt CONTRIBUTORS.txt COPYING.txt README.txt
3fdee4
3fdee4
%files compiler
3fdee4
%defattr(-, root, root, -)
3fdee4
%{_bindir}/protoc
3fdee4
%{_libdir}/libprotoc.so.*
3fdee4
%doc COPYING.txt README.txt
3fdee4
3fdee4
%files devel
3fdee4
%defattr(-, root, root, -)
3fdee4
%dir %{_includedir}/google
3fdee4
%{_includedir}/google/protobuf/
3fdee4
%{_libdir}/libprotobuf.so
3fdee4
%{_libdir}/libprotoc.so
3fdee4
%{_libdir}/pkgconfig/protobuf.pc
3fdee4
%doc examples/add_person.cc examples/addressbook.proto examples/list_people.cc examples/Makefile examples/README.txt
3fdee4
3fdee4
%files static
3fdee4
%defattr(-, root, root, -)
3fdee4
%{_libdir}/libprotobuf.a
3fdee4
%{_libdir}/libprotoc.a
3fdee4
3fdee4
%files lite
3fdee4
%defattr(-, root, root, -)
3fdee4
%{_libdir}/libprotobuf-lite.so.*
3fdee4
3fdee4
%files lite-devel
3fdee4
%defattr(-, root, root, -)
3fdee4
%{_libdir}/libprotobuf-lite.so
3fdee4
%{_libdir}/pkgconfig/protobuf-lite.pc
3fdee4
3fdee4
%files lite-static
3fdee4
%defattr(-, root, root, -)
3fdee4
%{_libdir}/libprotobuf-lite.a
3fdee4
3fdee4
%if %{with python}
3fdee4
%files python
3fdee4
%defattr(-, root, root, -)
3fdee4
%dir %{python_sitelib}/google
3fdee4
%{python_sitelib}/google/protobuf/
3fdee4
%{python_sitelib}/protobuf-%{version}-py2.?.egg-info/
3fdee4
%{python_sitelib}/protobuf-%{version}-py2.?-nspkg.pth
3fdee4
%doc python/README.txt
3fdee4
%doc examples/add_person.py examples/list_people.py examples/addressbook.proto
3fdee4
%endif
3fdee4
3fdee4
%files vim
3fdee4
%defattr(-, root, root, -)
3fdee4
%{_datadir}/vim/vimfiles/ftdetect/proto.vim
3fdee4
%{_datadir}/vim/vimfiles/syntax/proto.vim
3fdee4
3fdee4
%files emacs
3fdee4
%defattr(-,root,root,-)
3fdee4
%{emacs_startdir}/protobuf-init.el
3fdee4
%{emacs_lispdir}/protobuf-mode.elc
3fdee4
3fdee4
%files emacs-el
3fdee4
%defattr(-,root,root,-)
3fdee4
%{emacs_lispdir}/protobuf-mode.el
3fdee4
3fdee4
%if %{with java}
3fdee4
%files java -f java/.mfiles
3fdee4
%doc examples/AddPerson.java examples/ListPeople.java
3fdee4
3fdee4
%files javadoc -f java/.mfiles-javadoc
3fdee4
%endif
3fdee4
3fdee4
%changelog
3fdee4
* Mon Jul 27 2015 Adrian Reber <areber@redhat.com> - 2.5.0-8
3fdee4
- Merge specfiles
3fdee4
3fdee4
* Wed Dec 17 2014 Peter Lemenkov <lemenkov@gmail.com> - 2.5.0-7
3fdee4
- Added missing Requires zlib-devel to protobuf-devel (see rhbz #1173343). See
3fdee4
  also rhbz #732087.
3fdee4
3fdee4
* Thu Dec 12 2013 Conrad Meyer <cemeyer@uw.edu> - 2.5.0-6.1
3fdee4
- BR python-setuptools-devel -> python-setuptools
3fdee4
3fdee4
* Mon Aug 26 2013 Michal Srb <msrb@redhat.com> - 2.5.0-6
3fdee4
- Migrate away from mvn-rpmbuild (Resolves: #997515)
3fdee4
3fdee4
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.5.0-5.1
3fdee4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
3fdee4
3fdee4
* Fri Jun 28 2013 Mikolaj Izdebski <mizdebsk@redhat.com> - 2.5.0-5
3fdee4
- Rebuild to regenerate API documentation
3fdee4
- Resolv: CVE-2013-1571
3fdee4
3fdee4
* Thu May 16 2013 Dan Horák <dan[at]danny.cz> - 2.5.0-4
3fdee4
- export the new generic atomics header (rh #926374)
3fdee4
3fdee4
* Mon May 6 2013 Stanislav Ochotnicky <sochotnicky@redhat.com> - 2.5.0-3
3fdee4
- Add support for generic gcc atomic operations (rh #926374)
3fdee4
3fdee4
* Sat Apr 27 2013 Conrad Meyer <cemeyer@uw.edu> - 2.5.0-2
3fdee4
- Remove changelog history from before 2010
3fdee4
- This spec already runs autoreconf -fi during %%build, but bump build for
3fdee4
  rhbz #926374
3fdee4
3fdee4
* Sat Mar 9 2013 Conrad Meyer <cemeyer@uw.edu> - 2.5.0-1
3fdee4
- Bump to latest upstream (#883822)
3fdee4
- Rebase gtest, maven patches on 2.5.0
3fdee4
3fdee4
* Tue Feb 26 2013 Conrad Meyer <cemeyer@uw.edu> - 2.4.1-12
3fdee4
- Nuke BR on maven-doxia, maven-doxia-sitetools (#915620)
3fdee4
3fdee4
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.4.1-11
3fdee4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
3fdee4
3fdee4
* Wed Feb 06 2013 Java SIG <java-devel@lists.fedoraproject.org> - 2.4.1-10
3fdee4
- Update for https://fedoraproject.org/wiki/Fedora_19_Maven_Rebuild
3fdee4
- Replace maven BuildRequires with maven-local
3fdee4
3fdee4
* Sun Jan 20 2013 Conrad Meyer <konrad@tylerc.org> - 2.4.1-9
3fdee4
- Fix packaging bug, -emacs-el subpackage should depend on -emacs subpackage of
3fdee4
  the same version (%%version), not the emacs version number...
3fdee4
3fdee4
* Thu Jan 17 2013 Tim Niemueller <tim@niemueller.de> - 2.4.1-8
3fdee4
- Added sub-package for Emacs editing mode
3fdee4
3fdee4
* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.4.1-7
3fdee4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
3fdee4
3fdee4
* Mon Mar 19 2012 Dan Horák <dan[at]danny.cz> - 2.4.1-6
3fdee4
- disable test-suite until g++ 4.7 issues are resolved
3fdee4
3fdee4
* Mon Mar 19 2012 Stanislav Ochotnicky <sochotnicky@redhat.com> - 2.4.1-5
3fdee4
- Update to latest java packaging guidelines
3fdee4
3fdee4
* Tue Feb 28 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.4.1-4
3fdee4
- Rebuilt for c++ ABI breakage
3fdee4
3fdee4
* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.4.1-3
3fdee4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
3fdee4
3fdee4
* Tue Sep 27 2011 Pierre-Yves Chibon <pingou@pingoured.fr> - 2.4.1-2
3fdee4
- Adding zlib-devel as BR (rhbz: #732087)
3fdee4
3fdee4
* Thu Jun 09 2011 BJ Dierkes <wdierkes@rackspace.com> - 2.4.1-1
3fdee4
- Latest sources from upstream.
3fdee4
- Rewrote Patch2 as protobuf-2.4.1-java-fixes.patch
3fdee4
3fdee4
* Wed Feb 09 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.3.0-7
3fdee4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
3fdee4
3fdee4
* Thu Jan 13 2011 Stanislav Ochotnicky <sochotnicky@redhat.com> - 2.3.0-6
3fdee4
- Fix java subpackage bugs #669345 and #669346
3fdee4
- Use new maven plugin names
3fdee4
- Use mavenpomdir macro for pom installation
3fdee4
3fdee4
* Mon Jul 26 2010 David Malcolm <dmalcolm@redhat.com> - 2.3.0-5
3fdee4
- generalize hardcoded reference to 2.6 in python subpackage %%files manifest
3fdee4
3fdee4
* Wed Jul 21 2010 David Malcolm <dmalcolm@redhat.com> - 2.3.0-4
3fdee4
- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild
3fdee4
3fdee4
* Thu Jul 15 2010 James Laska <jlaska@redhat.com> - 2.3.0-3
3fdee4
- Correct use of %bcond macros
3fdee4
3fdee4
* Wed Jul 14 2010 James Laska <jlaska@redhat.com> - 2.3.0-2
3fdee4
- Enable python and java sub-packages
3fdee4
3fdee4
* Tue May 4 2010 Conrad Meyer <konrad@tylerc.org> - 2.3.0-1
3fdee4
- bump to 2.3.0