protobuf-vl.spec 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406
  1. # build -python subpackage
  2. %define with_python %{?_without_python: 0} %{?!_without_python: 1}
  3. # build -java subpackages
  4. #%define with_java %{?_without_java: 0} %{?!_without_java: 1}
  5. # but currently diabled
  6. %define with_java 0
  7. # don't require gtest for building
  8. %define without_gtest %{?_without_gtest: 0} %{?!_without_gtest: 1}
  9. # don't build static subpackages
  10. %define with_static %{?_with_static: 1} %{?!_with_static: 0}
  11. %if %{with_python}
  12. %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")
  13. %endif
  14. Summary: Protocol Buffers - Google's data interchange format
  15. Name: protobuf
  16. Version: 2.3.0
  17. Release: 1%{?_dist_release}
  18. License: BSD
  19. Group: Development/Libraries
  20. Source: http://protobuf.googlecode.com/files/%{name}-%{version}.tar.bz2
  21. Source1: ftdetect-proto.vim
  22. Patch1: protobuf-2.3.0-fedora-gtest.patch
  23. Patch2: protobuf-java-fixes.patch
  24. URL: http://code.google.com/p/protobuf/
  25. BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
  26. BuildRequires: automake autoconf libtool pkgconfig
  27. %if !%{without_gtest}
  28. BuildRequires: gtest-devel
  29. %endif
  30. %description
  31. Protocol Buffers are a way of encoding structured data in an efficient
  32. yet extensible format. Google uses Protocol Buffers for almost all of
  33. its internal RPC protocols and file formats.
  34. Protocol buffers are a flexible, efficient, automated mechanism for
  35. serializing structured data – think XML, but smaller, faster, and
  36. simpler. You define how you want your data to be structured once, then
  37. you can use special generated source code to easily write and read
  38. your structured data to and from a variety of data streams and using a
  39. variety of languages. You can even update your data structure without
  40. breaking deployed programs that are compiled against the "old" format.
  41. %package compiler
  42. Summary: Protocol Buffers compiler
  43. Group: Development/Libraries
  44. Requires: %{name} = %{version}-%{release}
  45. %description compiler
  46. This package contains Protocol Buffers compiler for all programming
  47. languages
  48. %package devel
  49. Summary: Protocol Buffers C++ headers and libraries
  50. Group: Development/Libraries
  51. Requires: %{name} = %{version}-%{release}
  52. Requires: %{name}-compiler = %{version}-%{release}
  53. Requires: pkgconfig
  54. %description devel
  55. This package contains Protocol Buffers compiler for all languages and
  56. C++ headers and libraries
  57. %if %{with_static}
  58. %package static
  59. Summary: Static development files for %{name}
  60. Group: Development/Libraries
  61. Requires: %{name} = %{version}-%{release}
  62. %description static
  63. Static libraries for Protocol Buffers
  64. %endif
  65. %package lite
  66. Summary: Protocol Buffers LITE_RUNTIME libraries
  67. Group: Development/Libraries
  68. %description lite
  69. Protocol Buffers built with optimize_for = LITE_RUNTIME.
  70. The "optimize_for = LITE_RUNTIME" option causes the compiler to generate code
  71. which only depends libprotobuf-lite, which is much smaller than libprotobuf but
  72. lacks descriptors, reflection, and some other features.
  73. %package lite-devel
  74. Summary: Protocol Buffers LITE_RUNTIME development libraries
  75. Requires: %{name}-devel = %{version}-%{release}
  76. Requires: %{name}-lite = %{version}-%{release}
  77. %description lite-devel
  78. This package contains development libraries built with
  79. optimize_for = LITE_RUNTIME.
  80. The "optimize_for = LITE_RUNTIME" option causes the compiler to generate code
  81. which only depends libprotobuf-lite, which is much smaller than libprotobuf but
  82. lacks descriptors, reflection, and some other features.
  83. %if %{with_static}
  84. %package lite-static
  85. Summary: Static development files for %{name}-lite
  86. Group: Development/Libraries
  87. Requires: %{name}-devel = %{version}-%{release}
  88. %description lite-static
  89. This package contains static development libraries built with
  90. optimize_for = LITE_RUNTIME.
  91. The "optimize_for = LITE_RUNTIME" option causes the compiler to generate code
  92. which only depends libprotobuf-lite, which is much smaller than libprotobuf but
  93. lacks descriptors, reflection, and some other features.
  94. %endif
  95. %if %{with_python}
  96. %package python
  97. Summary: Python bindings for Google Protocol Buffers
  98. Group: Development/Languages
  99. BuildRequires: python-devel
  100. BuildRequires: python-setuptools
  101. Conflicts: %{name}-compiler > %{version}
  102. Conflicts: %{name}-compiler < %{version}
  103. %description python
  104. This package contains Python libraries for Google Protocol Buffers
  105. %endif
  106. %package vim
  107. Summary: Vim syntax highlighting for Google Protocol Buffers descriptions
  108. Group: Development/Libraries
  109. Requires: vim
  110. %description vim
  111. This package contains syntax highlighting for Google Protocol Buffers
  112. descriptions in Vim editor
  113. %if %{with_java}
  114. %package java
  115. Summary: Java Protocol Buffers runtime library
  116. Group: Development/Languages
  117. BuildRequires: java-devel >= 1.6
  118. BuildRequires: jpackage-utils
  119. BuildRequires: maven2
  120. BuildRequires: maven2-plugin-compiler
  121. BuildRequires: maven2-plugin-install
  122. BuildRequires: maven2-plugin-jar
  123. BuildRequires: maven2-plugin-javadoc
  124. BuildRequires: maven2-plugin-release
  125. BuildRequires: maven2-plugin-resources
  126. BuildRequires: maven2-plugin-surefire
  127. BuildRequires: maven2-plugin-antrun
  128. Requires: java
  129. Requires: jpackage-utils
  130. Requires(post): jpackage-utils
  131. Requires(postun): jpackage-utils
  132. Conflicts: %{name}-compiler > %{version}
  133. Conflicts: %{name}-compiler < %{version}
  134. %description java
  135. This package contains Java Protocol Buffers runtime library.
  136. %package javadoc
  137. Summary: Javadocs for %{name}-java
  138. Group: Documentation
  139. Requires: jpackage-utils
  140. Requires: %{name}-java = %{version}-%{release}
  141. %description javadoc
  142. This package contains the API documentation for %{name}-java.
  143. %endif
  144. %prep
  145. %setup -q
  146. %if !%{without_gtest}
  147. rm -rf gtest
  148. %patch1 -p1
  149. %endif
  150. chmod 644 examples/*
  151. %if %{with_java}
  152. %patch2
  153. rm -rf java/src/test
  154. %endif
  155. %build
  156. iconv -f iso8859-1 -t utf-8 CONTRIBUTORS.txt > CONTRIBUTORS.txt.utf8
  157. mv CONTRIBUTORS.txt.utf8 CONTRIBUTORS.txt
  158. export PTHREAD_LIBS="-lpthread"
  159. %configure \
  160. %if %{with_static}
  161. --enable-static
  162. %else
  163. --disable-static
  164. %endif
  165. make %{?_smp_mflags}
  166. %if %{with_python}
  167. pushd python
  168. python ./setup.py build
  169. sed -i -e 1d build/lib/google/protobuf/descriptor_pb2.py
  170. popd
  171. %endif
  172. %if %{with_java}
  173. pushd java
  174. export MAVEN_REPO_LOCAL=$(pwd)/.m2/repository
  175. mkdir -p $MAVEN_REPO_LOCAL
  176. mvn-jpp -Dmaven.repo.local=$MAVEN_REPO_LOCAL install javadoc:javadoc
  177. popd
  178. %endif
  179. %check
  180. make %{?_smp_mflags} check
  181. %install
  182. rm -rf %{buildroot}
  183. make %{?_smp_mflags} install DESTDIR=%{buildroot} STRIPBINARIES=no INSTALL="%{__install} -p" CPPROG="cp -p"
  184. find %{buildroot} -type f -name "*.la" -exec rm -f {} \;
  185. %if %{with_python}
  186. pushd python
  187. python ./setup.py install --root=%{buildroot} --single-version-externally-managed --record=INSTALLED_FILES --optimize=1
  188. popd
  189. %endif
  190. install -p -m 644 -D %{SOURCE1} %{buildroot}%{_datadir}/vim/vimfiles/ftdetect/proto.vim
  191. install -p -m 644 -D editors/proto.vim %{buildroot}%{_datadir}/vim/vimfiles/syntax/proto.vim
  192. %if %{with_java}
  193. pushd java
  194. install -d -m 755 %{buildroot}%{_javadir}
  195. install -pm 644 target/%{name}-java-%{version}.jar %{buildroot}%{_javadir}/%{name}-%{version}.jar
  196. install -d -m 755 %{buildroot}%{_javadocdir}/%{name}
  197. cp -rp target/site/apidocs %{buildroot}%{_javadocdir}/%{name}
  198. install -d -m 755 %{buildroot}%{_datadir}/maven2/poms
  199. install -pm 644 pom.xml %{buildroot}%{_datadir}/maven2/poms/JPP-%{name}.pom
  200. %add_to_maven_depmap org.apache.maven %{name} %{version} JPP %{name}
  201. %endif
  202. %post -p /sbin/ldconfig
  203. %postun -p /sbin/ldconfig
  204. %post lite -p /sbin/ldconfig
  205. %postun lite -p /sbin/ldconfig
  206. %post compiler -p /sbin/ldconfig
  207. %postun compiler -p /sbin/ldconfig
  208. %if %{with_java}
  209. %post java
  210. %update_maven_depmap
  211. %postun java
  212. %update_maven_depmap
  213. %endif
  214. %clean
  215. rm -rf %{buildroot}
  216. %files
  217. %defattr(-, root, root, -)
  218. %{_libdir}/libprotobuf.so.*
  219. %doc CHANGES.txt CONTRIBUTORS.txt COPYING.txt README.txt
  220. %files compiler
  221. %defattr(-, root, root, -)
  222. %{_bindir}/protoc
  223. %{_libdir}/libprotoc.so.*
  224. %doc COPYING.txt README.txt
  225. %files devel
  226. %defattr(-, root, root, -)
  227. %dir %{_includedir}/google
  228. %{_includedir}/google/protobuf/
  229. %{_libdir}/libprotobuf.so
  230. %{_libdir}/libprotoc.so
  231. %{_libdir}/pkgconfig/protobuf.pc
  232. %doc examples/add_person.cc examples/addressbook.proto examples/list_people.cc examples/Makefile examples/README.txt
  233. %if %{with_static}
  234. %files static
  235. %defattr(-, root, root, -)
  236. %{_libdir}/libprotobuf.a
  237. %{_libdir}/libprotoc.a
  238. %endif
  239. %files lite
  240. %defattr(-, root, root, -)
  241. %{_libdir}/libprotobuf-lite.so.*
  242. %files lite-devel
  243. %defattr(-, root, root, -)
  244. %{_libdir}/libprotobuf-lite.so
  245. %{_libdir}/pkgconfig/protobuf-lite.pc
  246. %if %{with_static}
  247. %files lite-static
  248. %defattr(-, root, root, -)
  249. %{_libdir}/libprotobuf-lite.a
  250. %endif
  251. %if %{with_python}
  252. %files python
  253. %defattr(-, root, root, -)
  254. %dir %{python_sitelib}/google
  255. %{python_sitelib}/google/protobuf/
  256. %{python_sitelib}/protobuf-%{version}-py2.6.egg-info/
  257. %{python_sitelib}/protobuf-%{version}-py2.6-nspkg.pth
  258. %doc python/README.txt
  259. %doc examples/add_person.py examples/list_people.py examples/addressbook.proto
  260. %endif
  261. %files vim
  262. %defattr(-, root, root, -)
  263. %{_datadir}/vim/vimfiles/ftdetect/proto.vim
  264. %{_datadir}/vim/vimfiles/syntax/proto.vim
  265. %if %{with_java}
  266. %files java
  267. %defattr(-, root, root, -)
  268. %{_datadir}/maven2/poms/JPP-protobuf.pom
  269. %{_mavendepmapfragdir}/protobuf
  270. %{_javadir}/*
  271. %doc examples/AddPerson.java examples/ListPeople.java
  272. %files javadoc
  273. %defattr(-, root, root, -)
  274. %{_javadocdir}/%{name}
  275. %endif
  276. %changelog
  277. * Sun May 23 2010 Kazutaka HARADA <kazutaka@vinelinux.org> 2.3.0-1
  278. - initial build for Vine Linux based on fedora development
  279. * Tue May 4 2010 Conrad Meyer <konrad@tylerc.org> - 2.3.0-1
  280. - bump to 2.3.0
  281. * Wed Sep 30 2009 Lev Shamardin <shamardin@gmail.com> - 2.2.0-2
  282. - added export PTHREAD_LIBS="-lpthread"
  283. * Fri Sep 18 2009 Lev Shamardin <shamardin@gmail.com> - 2.2.0-1
  284. - Upgraded to upstream protobuf-2.2.0
  285. - New -lite packages
  286. * Sun Mar 01 2009 Caolán McNamra <caolanm@redhat.com> - 2.0.2-8
  287. - add stdio.h for sprintf, perror, etc.
  288. * Thu Feb 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.2-7
  289. - Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
  290. * Tue Dec 23 2008 Lev Shamardin <shamardin@gmail.com> - 2.0.2-6
  291. - Small fixes for python 2.6 eggs.
  292. - Temporarily disabled java subpackage due to build problems, will be fixed and
  293. turned back on in future.
  294. * Thu Nov 27 2008 Lev Shamardin <shamardin@gmail.com> - 2.0.2-5
  295. - No problems with ppc & ppc64 arch in rawhide, had to do a release bump.
  296. * Sat Nov 22 2008 Lev Shamardin <shamardin@gmail.com> - 2.0.2-4
  297. - Added patch from subversion r70 to workaround gcc 4.3.0 bug (see
  298. http://code.google.com/p/protobuf/issues/detail?id=45 for more
  299. details).
  300. * Tue Nov 11 2008 Lev Shamardin <shamardin@gmail.com> - 2.0.2-3
  301. - Added conflicts to java and python subpackages to prevent using with
  302. wrong compiler versions.
  303. - Fixed license.
  304. - Fixed BuildRequires for -python subpackage.
  305. - Fixed Requires and Group for -javadoc subpackage.
  306. - Fixed Requires for -devel subpackage.
  307. - Fixed issue with wrong shebang in descriptor_pb2.py.
  308. - Specify build options via --with/--without.
  309. - Use Fedora-packaged gtest library instead of a bundled one by
  310. default (optional).
  311. * Fri Oct 31 2008 Lev Shamardin <shamardin@gmail.com> - 2.0.2-2
  312. - Use python_sitelib macro instead of INSTALLED_FILES.
  313. - Fix the license.
  314. - Fix redundant requirement for -devel subpackage.
  315. - Fix wrong dependences for -python subpackage.
  316. - Fix typo in requirements for -javadoc subpackage.
  317. - Use -p option for cp and install to preserve timestamps.
  318. - Remove unneeded ldconfig call for post scripts of -devel subpackage.
  319. - Fix directories ownership.
  320. * Sun Oct 12 2008 Lev Shamardin <shamardin@gmail.com> - 2.0.2-1
  321. - Update to version 2.0.2
  322. - New -java and -javadoc subpackages.
  323. - Options to disable building of -python and -java* subpackages
  324. * Mon Sep 15 2008 Lev Shamardin <shamardin@gmail.com> - 2.0.1-2
  325. - Added -p switch to install commands to preserve timestamps.
  326. - Fixed Version and Libs in pkgconfig script.
  327. - Added pkgconfig requires for -devel package.
  328. - Removed libtool archives from -devel package.
  329. * Thu Sep 04 2008 Lev Shamardin <shamardin@gmail.com> - 2.0.1-1
  330. - Updated to 2.0.1 version.
  331. * Wed Aug 13 2008 Lev Shamardin <shamardin@gmail.com> - 2.0.0-0.1.beta
  332. - Initial package version. Credits for vim subpackage and pkgconfig go
  333. to Rick L Vinyard Jr <rvinyard@cs.nmsu.edu>