protobuf-vl.spec 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417
  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.4.1
  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. Group: Development/Libraries
  76. Requires: %{name}-devel = %{version}-%{release}
  77. Requires: %{name}-lite = %{version}-%{release}
  78. %description lite-devel
  79. This package contains development libraries built with
  80. optimize_for = LITE_RUNTIME.
  81. The "optimize_for = LITE_RUNTIME" option causes the compiler to generate code
  82. which only depends libprotobuf-lite, which is much smaller than libprotobuf but
  83. lacks descriptors, reflection, and some other features.
  84. %if %{with_static}
  85. %package lite-static
  86. Summary: Static development files for %{name}-lite
  87. Group: Development/Libraries
  88. Requires: %{name}-devel = %{version}-%{release}
  89. %description lite-static
  90. This package contains static development libraries built with
  91. optimize_for = LITE_RUNTIME.
  92. The "optimize_for = LITE_RUNTIME" option causes the compiler to generate code
  93. which only depends libprotobuf-lite, which is much smaller than libprotobuf but
  94. lacks descriptors, reflection, and some other features.
  95. %endif
  96. %if %{with_python}
  97. %package python
  98. Summary: Python bindings for Google Protocol Buffers
  99. Group: Development/Languages
  100. BuildRequires: python-devel
  101. BuildRequires: python-setuptools
  102. Conflicts: %{name}-compiler > %{version}
  103. Conflicts: %{name}-compiler < %{version}
  104. %description python
  105. This package contains Python libraries for Google Protocol Buffers
  106. %endif
  107. %package vim
  108. Summary: Vim syntax highlighting for Google Protocol Buffers descriptions
  109. Group: Development/Libraries
  110. Requires: vim
  111. %description vim
  112. This package contains syntax highlighting for Google Protocol Buffers
  113. descriptions in Vim editor
  114. %if %{with_java}
  115. %package java
  116. Summary: Java Protocol Buffers runtime library
  117. Group: Development/Languages
  118. BuildRequires: java-devel >= 1.6
  119. BuildRequires: jpackage-utils
  120. BuildRequires: maven2
  121. BuildRequires: maven2-plugin-compiler
  122. BuildRequires: maven2-plugin-install
  123. BuildRequires: maven2-plugin-jar
  124. BuildRequires: maven2-plugin-javadoc
  125. BuildRequires: maven2-plugin-release
  126. BuildRequires: maven2-plugin-resources
  127. BuildRequires: maven2-plugin-surefire
  128. BuildRequires: maven2-plugin-antrun
  129. Requires: java
  130. Requires: jpackage-utils
  131. Requires(post): jpackage-utils
  132. Requires(postun): jpackage-utils
  133. Conflicts: %{name}-compiler > %{version}
  134. Conflicts: %{name}-compiler < %{version}
  135. %description java
  136. This package contains Java Protocol Buffers runtime library.
  137. %package javadoc
  138. Summary: Javadocs for %{name}-java
  139. Group: Documentation
  140. Requires: jpackage-utils
  141. Requires: %{name}-java = %{version}-%{release}
  142. %description javadoc
  143. This package contains the API documentation for %{name}-java.
  144. %endif
  145. %prep
  146. %setup -q
  147. %if !%{without_gtest}
  148. rm -rf gtest
  149. %patch1 -p1
  150. %endif
  151. chmod 644 examples/*
  152. %if %{with_java}
  153. %patch2
  154. rm -rf java/src/test
  155. %endif
  156. %build
  157. iconv -f iso8859-1 -t utf-8 CONTRIBUTORS.txt > CONTRIBUTORS.txt.utf8
  158. mv CONTRIBUTORS.txt.utf8 CONTRIBUTORS.txt
  159. export PTHREAD_LIBS="-lpthread"
  160. %configure \
  161. %if %{with_static}
  162. --enable-static
  163. %else
  164. --disable-static
  165. %endif
  166. make %{?_smp_mflags}
  167. %if %{with_python}
  168. pushd python
  169. python ./setup.py build
  170. sed -i -e 1d build/lib/google/protobuf/descriptor_pb2.py
  171. popd
  172. %endif
  173. %if %{with_java}
  174. pushd java
  175. export MAVEN_REPO_LOCAL=$(pwd)/.m2/repository
  176. mkdir -p $MAVEN_REPO_LOCAL
  177. mvn-jpp -Dmaven.repo.local=$MAVEN_REPO_LOCAL install javadoc:javadoc
  178. popd
  179. %endif
  180. %check
  181. make %{?_smp_mflags} check
  182. %install
  183. rm -rf %{buildroot}
  184. make %{?_smp_mflags} install DESTDIR=%{buildroot} STRIPBINARIES=no INSTALL="%{__install} -p" CPPROG="cp -p"
  185. find %{buildroot} -type f -name "*.la" -exec rm -f {} \;
  186. %if %{with_python}
  187. pushd python
  188. python ./setup.py install --root=%{buildroot} --single-version-externally-managed --record=INSTALLED_FILES --optimize=1
  189. popd
  190. %endif
  191. install -p -m 644 -D %{SOURCE1} %{buildroot}%{_datadir}/vim/vimfiles/ftdetect/proto.vim
  192. install -p -m 644 -D editors/proto.vim %{buildroot}%{_datadir}/vim/vimfiles/syntax/proto.vim
  193. %if %{with_java}
  194. pushd java
  195. install -d -m 755 %{buildroot}%{_javadir}
  196. install -pm 644 target/%{name}-java-%{version}.jar %{buildroot}%{_javadir}/%{name}-%{version}.jar
  197. install -d -m 755 %{buildroot}%{_javadocdir}/%{name}
  198. cp -rp target/site/apidocs %{buildroot}%{_javadocdir}/%{name}
  199. install -d -m 755 %{buildroot}%{_datadir}/maven2/poms
  200. install -pm 644 pom.xml %{buildroot}%{_datadir}/maven2/poms/JPP-%{name}.pom
  201. %add_to_maven_depmap org.apache.maven %{name} %{version} JPP %{name}
  202. %endif
  203. %post -p /sbin/ldconfig
  204. %postun -p /sbin/ldconfig
  205. %post lite -p /sbin/ldconfig
  206. %postun lite -p /sbin/ldconfig
  207. %post compiler -p /sbin/ldconfig
  208. %postun compiler -p /sbin/ldconfig
  209. %if %{with_java}
  210. %post java
  211. %update_maven_depmap
  212. %postun java
  213. %update_maven_depmap
  214. %endif
  215. %clean
  216. rm -rf %{buildroot}
  217. %files
  218. %defattr(-, root, root, -)
  219. %{_libdir}/libprotobuf.so.*
  220. %doc CHANGES.txt CONTRIBUTORS.txt COPYING.txt README.txt
  221. %files compiler
  222. %defattr(-, root, root, -)
  223. %{_bindir}/protoc
  224. %{_libdir}/libprotoc.so.*
  225. %doc COPYING.txt README.txt
  226. %files devel
  227. %defattr(-, root, root, -)
  228. %dir %{_includedir}/google
  229. %{_includedir}/google/protobuf/
  230. %{_libdir}/libprotobuf.so
  231. %{_libdir}/libprotoc.so
  232. %{_libdir}/pkgconfig/protobuf.pc
  233. %doc examples/add_person.cc examples/addressbook.proto examples/list_people.cc examples/Makefile examples/README.txt
  234. %if %{with_static}
  235. %files static
  236. %defattr(-, root, root, -)
  237. %{_libdir}/libprotobuf.a
  238. %{_libdir}/libprotoc.a
  239. %endif
  240. %files lite
  241. %defattr(-, root, root, -)
  242. %{_libdir}/libprotobuf-lite.so.*
  243. %files lite-devel
  244. %defattr(-, root, root, -)
  245. %{_libdir}/libprotobuf-lite.so
  246. %{_libdir}/pkgconfig/protobuf-lite.pc
  247. %if %{with_static}
  248. %files lite-static
  249. %defattr(-, root, root, -)
  250. %{_libdir}/libprotobuf-lite.a
  251. %endif
  252. %if %{with_python}
  253. %files python
  254. %defattr(-, root, root, -)
  255. %dir %{python_sitelib}/google
  256. %{python_sitelib}/google/protobuf/
  257. %{python_sitelib}/protobuf-%{version}-py*.egg-info/
  258. %{python_sitelib}/protobuf-%{version}-py*-nspkg.pth
  259. %doc python/README.txt
  260. %doc examples/add_person.py examples/list_people.py examples/addressbook.proto
  261. %endif
  262. %files vim
  263. %defattr(-, root, root, -)
  264. %{_datadir}/vim/vimfiles/ftdetect/proto.vim
  265. %{_datadir}/vim/vimfiles/syntax/proto.vim
  266. %if %{with_java}
  267. %files java
  268. %defattr(-, root, root, -)
  269. %{_datadir}/maven2/poms/JPP-protobuf.pom
  270. %{_mavendepmapfragdir}/protobuf
  271. %{_javadir}/*
  272. %doc examples/AddPerson.java examples/ListPeople.java
  273. %files javadoc
  274. %defattr(-, root, root, -)
  275. %{_javadocdir}/%{name}
  276. %endif
  277. %changelog
  278. * Thu Feb 16 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.4.1-1
  279. - update to 2.4.1
  280. * Thu Sep 30 2010 Shu KONNO <owa@bg.wakwak.com> 2.3.0-3
  281. - rebuilt with rpm-4.8.1 for pkg-config
  282. * Tue May 25 2010 IWAI, Masaharu <iwai@alib.jp> 2.3.0-2
  283. - add missing Group tag for protobuf-lite-devel
  284. - fix files list in python sub package
  285. * Sun May 23 2010 Kazutaka HARADA <kazutaka@vinelinux.org> 2.3.0-1
  286. - initial build for Vine Linux based on fedora development
  287. * Tue May 4 2010 Conrad Meyer <konrad@tylerc.org> - 2.3.0-1
  288. - bump to 2.3.0
  289. * Wed Sep 30 2009 Lev Shamardin <shamardin@gmail.com> - 2.2.0-2
  290. - added export PTHREAD_LIBS="-lpthread"
  291. * Fri Sep 18 2009 Lev Shamardin <shamardin@gmail.com> - 2.2.0-1
  292. - Upgraded to upstream protobuf-2.2.0
  293. - New -lite packages
  294. * Sun Mar 01 2009 Caolán McNamra <caolanm@redhat.com> - 2.0.2-8
  295. - add stdio.h for sprintf, perror, etc.
  296. * Thu Feb 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.2-7
  297. - Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
  298. * Tue Dec 23 2008 Lev Shamardin <shamardin@gmail.com> - 2.0.2-6
  299. - Small fixes for python 2.6 eggs.
  300. - Temporarily disabled java subpackage due to build problems, will be fixed and
  301. turned back on in future.
  302. * Thu Nov 27 2008 Lev Shamardin <shamardin@gmail.com> - 2.0.2-5
  303. - No problems with ppc & ppc64 arch in rawhide, had to do a release bump.
  304. * Sat Nov 22 2008 Lev Shamardin <shamardin@gmail.com> - 2.0.2-4
  305. - Added patch from subversion r70 to workaround gcc 4.3.0 bug (see
  306. http://code.google.com/p/protobuf/issues/detail?id=45 for more
  307. details).
  308. * Tue Nov 11 2008 Lev Shamardin <shamardin@gmail.com> - 2.0.2-3
  309. - Added conflicts to java and python subpackages to prevent using with
  310. wrong compiler versions.
  311. - Fixed license.
  312. - Fixed BuildRequires for -python subpackage.
  313. - Fixed Requires and Group for -javadoc subpackage.
  314. - Fixed Requires for -devel subpackage.
  315. - Fixed issue with wrong shebang in descriptor_pb2.py.
  316. - Specify build options via --with/--without.
  317. - Use Fedora-packaged gtest library instead of a bundled one by
  318. default (optional).
  319. * Fri Oct 31 2008 Lev Shamardin <shamardin@gmail.com> - 2.0.2-2
  320. - Use python_sitelib macro instead of INSTALLED_FILES.
  321. - Fix the license.
  322. - Fix redundant requirement for -devel subpackage.
  323. - Fix wrong dependences for -python subpackage.
  324. - Fix typo in requirements for -javadoc subpackage.
  325. - Use -p option for cp and install to preserve timestamps.
  326. - Remove unneeded ldconfig call for post scripts of -devel subpackage.
  327. - Fix directories ownership.
  328. * Sun Oct 12 2008 Lev Shamardin <shamardin@gmail.com> - 2.0.2-1
  329. - Update to version 2.0.2
  330. - New -java and -javadoc subpackages.
  331. - Options to disable building of -python and -java* subpackages
  332. * Mon Sep 15 2008 Lev Shamardin <shamardin@gmail.com> - 2.0.1-2
  333. - Added -p switch to install commands to preserve timestamps.
  334. - Fixed Version and Libs in pkgconfig script.
  335. - Added pkgconfig requires for -devel package.
  336. - Removed libtool archives from -devel package.
  337. * Thu Sep 04 2008 Lev Shamardin <shamardin@gmail.com> - 2.0.1-1
  338. - Updated to 2.0.1 version.
  339. * Wed Aug 13 2008 Lev Shamardin <shamardin@gmail.com> - 2.0.0-0.1.beta
  340. - Initial package version. Credits for vim subpackage and pkgconfig go
  341. to Rick L Vinyard Jr <rvinyard@cs.nmsu.edu>