calibre-vl.spec 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  1. %{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
  2. Name: calibre
  3. Version: 0.7.15
  4. Release: 1%{?dist}
  5. Summary: E-book converter and library management
  6. Group: Applications/Multimedia
  7. License: GPLv3
  8. URL: http://calibre-ebook.com/
  9. # SourceURL: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
  10. # Upstream packages some unfree fonts which we cannot redistribute.
  11. # While we're at it, also delete the liberation fonts which we already have.
  12. #
  13. # Download the upstream tarball and invoke this script while in the tarball's
  14. # directory:
  15. # ./generate-tarball.sh %{version}
  16. Source0: %{name}-%{version}-nofonts.tar.xz
  17. Source1: generate-tarball.sh
  18. Patch0: %{name}-manpages.patch
  19. Patch1: %{name}-no-update.patch
  20. Patch2: %{name}-0.6.53-mounthelper.patch
  21. Patch3: %{name}-0.6.47-python-fix.patch
  22. BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
  23. BuildRequires: python >= 2.6
  24. BuildRequires: python-devel >= 2.6
  25. BuildRequires: ImageMagick-devel >= 6.5.9
  26. BuildRequires: python-setuptools
  27. BuildRequires: qt4-devel >= 4.6.0
  28. BuildRequires: PyQt4-devel >= 4.7.0
  29. BuildRequires: poppler-qt4-devel >= 0.12
  30. BuildRequires: podofo-devel
  31. BuildRequires: desktop-file-utils
  32. BuildRequires: python-mechanize >= 0.1.1
  33. BuildRequires: python-lxml >= 2.2.1
  34. BuildRequires: python-cssutils >= 0.9.6
  35. BuildRequires: python-dateutil >= 1.4.1
  36. BuildRequires: python-imaging >= 1.1.6
  37. BuildRequires: xdg-utils >= 1.0.2
  38. BuildRequires: python-BeautifulSoup >= 3.0.5
  39. BuildRequires: xz
  40. BuildRequires: unzip
  41. BuildRequires: libwmf-devel >= 0.2.8
  42. BuildRequires: chmlib-devel >= 0.40
  43. Requires: PyQt4
  44. Requires: pyPdf
  45. Requires: python-cherrypy
  46. Requires: python-cssutils
  47. Requires: ImageMagick
  48. Requires: python-odf
  49. Requires: python-django-tagging
  50. Requires: python-lxml
  51. Requires: python-imaging
  52. Requires: python-mechanize
  53. Requires: python-dateutil
  54. Requires: python-genshi
  55. Requires: python-BeautifulSoup
  56. ## vine
  57. Requires: TrueType-liberation
  58. %description
  59. Calibre is meant to be a complete e-library solution. It includes library
  60. management, format conversion, news feeds to ebook conversion as well as
  61. e-book reader sync features.
  62. Calibre is primarily a ebook cataloging program. It manages your ebook
  63. collection for you. It is designed around the concept of the logical book,
  64. i.e. a single entry in the database that may correspond to ebooks in several
  65. formats. It also supports conversion to and from a dozen different ebook
  66. formats.
  67. Supported input formats are: MOBI, LIT, PRC, EPUB, CHM, ODT, HTML, CBR, CBZ,
  68. RTF, TXT, PDF and LRS.
  69. %prep
  70. %setup -q -n %{name}
  71. # # remove redundant / non-free fonts
  72. # %__rm -rf resources/fonts/*
  73. # don't append calibre1 to the name of the manpages. No need to compress either
  74. # upstream won't fix: http://bugs.calibre-ebook.com/ticket/3770#comment:7
  75. %patch0 -p1 -b .manpages
  76. # don't check for new upstream version (that's what packagers do)
  77. %patch1 -p1 -b .no-update
  78. # Enable mount helper
  79. %patch2 -p1 -b .mounthelper
  80. #% patch3 -p1 -b .python-fix
  81. # dos2unix newline conversion
  82. %{__sed} -i 's/\r//' src/calibre/web/feeds/recipes/*
  83. # remove shebangs
  84. %{__sed} -i -e '/^#!\//, 1d' src/calibre/*/*/*/*.py
  85. %{__sed} -i -e '/^#!\//, 1d' src/calibre/*/*/*.py
  86. %{__sed} -i -e '/^#![ ]*\//, 1d' src/calibre/*/*.py
  87. %{__sed} -i -e '/^#!\//, 1d' src/calibre/*.py
  88. %{__sed} -i -e '/^#!\//, 1d' resources/recipes/*
  89. %{__sed} -i -e '/^#!\//, 1d' resources/default_tweaks.py
  90. %{__chmod} -x src/calibre/*/*/*/*.py
  91. %{__chmod} -x src/calibre/*/*/*.py
  92. %{__chmod} -x src/calibre/*/*.py
  93. %{__chmod} -x src/calibre/*.py
  94. %{__chmod} -x resources/recipes/*
  95. %build
  96. OVERRIDE_CFLAGS="%{optflags}" QMAKE=%{_libdir}/qt4/bin/qmake python setup.py build
  97. %install
  98. %__rm -rf %{buildroot}
  99. %__mkdir -p %{buildroot}%{_datadir}
  100. # create directories for xdg-utils
  101. %__mkdir_p %{buildroot}%{_datadir}/icons
  102. %__mkdir_p %{buildroot}%{_datadir}/icons/hicolor
  103. %__mkdir_p %{buildroot}%{_datadir}/packages
  104. %__mkdir_p %{buildroot}%{_datadir}/mime
  105. %__mkdir_p %{buildroot}%{_datadir}/mime/packages
  106. %__mkdir_p %{buildroot}%{_datadir}/applications
  107. %__mkdir_p %{buildroot}%{_datadir}/desktop-directories
  108. # create directory for calibre environment module
  109. # the install script assumes it's there.
  110. %__mkdir_p %{buildroot}%{python_sitelib}
  111. XDG_DATA_DIRS="%{buildroot}%{_datadir}" \
  112. XDG_UTILS_INSTALL_MODE="system" \
  113. LIBPATH="%{_libdir}" \
  114. python setup.py install --root=%{buildroot}%{_prefix} \
  115. --prefix=%{_prefix} \
  116. --libdir=%{_libdir} \
  117. --staging-libdir=%{buildroot}%{_libdir}
  118. # remove shebang from init_calibre.py here because
  119. # it just got spawned by the install script
  120. %{__sed} -i -e '/^#!\//, 1d' %{buildroot}%{python_sitelib}/init_calibre.py
  121. # icons
  122. %__mkdir_p %{buildroot}%{_datadir}/pixmaps/
  123. %__cp -p resources/images/library.png \
  124. %{buildroot}%{_datadir}/pixmaps/%{name}-gui.png
  125. %__cp -p resources/images/viewer.svg \
  126. %{buildroot}%{_datadir}/pixmaps/calibre-viewer.svg
  127. # every file is empty here
  128. find %{buildroot}%{_datadir}/mime -maxdepth 1 -type f|xargs %__rm -f
  129. # packages aren't allowed to register mimetypes like this
  130. %__rm -f %{buildroot}%{_datadir}/applications/{defaults.list,mimeinfo.cache}
  131. desktop-file-validate \
  132. %{buildroot}%{_datadir}/applications/calibre-ebook-viewer.desktop
  133. desktop-file-validate \
  134. %{buildroot}%{_datadir}/applications/calibre-gui.desktop
  135. desktop-file-validate \
  136. %{buildroot}%{_datadir}/applications/calibre-lrfviewer.desktop
  137. %__mv %{buildroot}%{_datadir}/mime/packages/calibre-mimetypes \
  138. %{buildroot}%{_datadir}/mime/packages/calibre-mimetypes.xml
  139. # mimetype icon for lrf
  140. %__rm -rf %{buildroot}%{_datadir}/icons/hicolor/128x128
  141. %__mkdir_p %{buildroot}%{_datadir}/icons/hicolor/scalable
  142. %__mkdir_p %{buildroot}%{_datadir}/icons/hicolor/scalable/mimetypes
  143. %__mkdir_p %{buildroot}%{_datadir}/icons/hicolor/scalable/apps
  144. %__cp -p resources/images/mimetypes/lrf.svg \
  145. %{buildroot}%{_datadir}/icons/hicolor/scalable/mimetypes/application-x-sony-bbeb.svg
  146. %__cp -p resources/images/viewer.svg \
  147. %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/calibre-viewer.svg
  148. # don't put bash completions in /usr/etc
  149. %__mv %{buildroot}%{_prefix}%{_sysconfdir} %{buildroot}
  150. # these are provided as separate packages
  151. %__rm -rf %{buildroot}%{_libdir}/%{name}/{odf,cherrypy,pyPdf,encutils,cssutils}
  152. %__rm -rf %{buildroot}%{_libdir}/%{name}/cal/utils/genshi
  153. %__rm -rf %{buildroot}%{_libdir}/%{name}/cal/trac
  154. # link to system fonts after we have deleted (see Source0) the non-free ones
  155. # http://bugs.calibre-ebook.com/ticket/3832
  156. %__mkdir_p %{buildroot}%{_datadir}/%{name}/fonts/prs500/
  157. %__ln_s %{_datadir}/fonts/TrueType-liberation/LiberationSans-Regular.ttf \
  158. %{buildroot}%{_datadir}/%{name}/fonts/prs500/tt0003m_.ttf
  159. %__ln_s %{_datadir}/fonts/TrueType-liberation/LiberationSerif-Regular.ttf \
  160. %{buildroot}%{_datadir}/%{name}/fonts/prs500/tt0011m_.ttf
  161. %__ln_s %{_datadir}/fonts/TrueType-liberation/LiberationMono-Regular.ttf \
  162. %{buildroot}%{_datadir}/%{name}/fonts/prs500/tt0419m_.ttf
  163. # http://bugs.calibre-ebook.com/ticket/3770#comment:7
  164. # man pages
  165. %__mv %{buildroot}%{_datadir}/%{name}/man %{buildroot}%{_mandir}
  166. # move locales
  167. %__mv %{buildroot}%{_datadir}/%{name}/localization/locales \
  168. %{buildroot}%{_datadir}/locale
  169. for file in %{buildroot}%{_datadir}/locale/*/LC_MESSAGES/messages.mo; do
  170. lang=$(echo $file|%{__sed} 's:.*locale/\(.*\)/LC_MESSAGES.*:\1:')
  171. %__mv %{buildroot}%{_datadir}/locale/$lang/LC_MESSAGES/messages.mo \
  172. %{buildroot}%{_datadir}/locale/$lang/LC_MESSAGES/%{name}.mo
  173. done;
  174. for file in %{buildroot}%{_datadir}/locale/*/LC_MESSAGES/iso639.mo; do
  175. lang=$(echo $file|%{__sed} 's:.*locale/\(.*\)/LC_MESSAGES.*:\1:')
  176. %__mv %{buildroot}%{_datadir}/locale/$lang/LC_MESSAGES/iso639.mo \
  177. %{buildroot}%{_datadir}/locale/$lang/LC_MESSAGES/%{name}_iso639.mo
  178. done;
  179. for file in %{buildroot}%{_datadir}/locale/*/LC_MESSAGES/qt.qm; do
  180. lang=$(echo $file|%{__sed} 's:.*locale/\(.*\)/LC_MESSAGES.*:\1:')
  181. %__mv $file %{buildroot}%{_datadir}/locale/$lang/LC_MESSAGES/%{name}_$lang.qm
  182. done;
  183. %find_lang %{name} --with-qt --all-name
  184. # locales should be looked for in the proper place
  185. %{__sed} -i -e "s:P('localization/locales:('/usr/share/locale:" \
  186. -e "s/messages.mo/calibre.mo/" \
  187. -e "s/iso639.mo/calibre_iso639.mo/" \
  188. %{buildroot}%{_libdir}/%{name}/%{name}/utils/localization.py
  189. %{__rm} -f %{buildroot}%{_bindir}/%{name}-uninstall
  190. %clean
  191. %{__rm} -rf %{buildroot}
  192. %post
  193. update-desktop-database &> /dev/null ||:
  194. update-mime-database %{_datadir}/mime &> /dev/null || :
  195. touch --no-create %{_datadir}/icons/hicolor || :
  196. if [ -x %{_bindir}/gtk-update-icon-cache ] ; then
  197. %{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
  198. fi
  199. %postun
  200. update-desktop-database &> /dev/null ||:
  201. update-mime-database %{_datadir}/mime &> /dev/null || :
  202. touch --no-create %{_datadir}/icons/hicolor || :
  203. if [ -x %{_bindir}/gtk-update-icon-cache ] ; then
  204. %{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
  205. fi
  206. %files -f %{name}.lang
  207. %defattr(-,root,root,-)
  208. %doc COPYRIGHT LICENSE Changelog.yaml
  209. %{_bindir}/*
  210. %config(noreplace) %{_sysconfdir}/bash_completion.d/
  211. %{_libdir}/%{name}
  212. %{_datadir}/%{name}
  213. %{_datadir}/pixmaps/*
  214. %{_datadir}/applications/*
  215. %{_datadir}/mime/packages/*
  216. %{_datadir}/icons/hicolor/scalable/mimetypes/*
  217. %{_datadir}/icons/hicolor/scalable/apps/*
  218. %{python_sitelib}/init_calibre.py*
  219. %{_mandir}/man1/*
  220. %changelog
  221. * Mon Aug 23 2010 Munehiro Yamamoto <munepi@vinelinux.org> 0.7.15-1
  222. - initial build based on Fedora development
  223. * Sun Aug 08 2010 Ahmad Samir <ahmadsamir@mandriva.org> 0.7.13-1mdv2010.1
  224. + Revision: 567781
  225. - update to 0.7.13
  226. * Fri Aug 06 2010 Ahmad Samir <ahmadsamir@mandriva.org> 0.7.12-1mdv2011.0
  227. + Revision: 567146
  228. - update to 0.7.12
  229. * Thu Aug 05 2010 Funda Wang <fwang@mandriva.org> 0.7.10-3mdv2011.0
  230. + Revision: 566253
  231. - rebuild for new poppler
  232. * Fri Jul 30 2010 Ahmad Samir <ahmadsamir@mandriva.org> 0.7.10-2mdv2011.0
  233. + Revision: 563265
  234. - update manpage and no-update patches (from Fedora)
  235. - drop SOURCE1 and python-cssutils hack, it's not needed anymore as
  236. python-cssutils has been updated to 0.9.7b3
  237. - build with optflags
  238. - delete mimeinfo.cache too
  239. + Juan Luis Baptiste <juancho@mandriva.org>
  240. - Updated to 0.7.10, redo diff calibre-no-update.patch.
  241. * Sat Jul 10 2010 Funda Wang <fwang@mandriva.org> 0.6.54-2mdv2011.0
  242. + Revision: 549995
  243. - rebuild for new imagemagick
  244. + Tomas Kindl <supp@mandriva.org>
  245. - various minor SPEC fixes and clean-ups
  246. + Juan Luis Baptiste <juancho@mandriva.org>
  247. - Updated to 0.6.54.
  248. * Tue Apr 20 2010 Tomas Kindl <supp@mandriva.org> 0.6.48-1mdv2010.1
  249. + Revision: 537127
  250. - update to 0.6.48
  251. - fix python-odf and python-django-tagging dependency'
  252. * Tue Apr 20 2010 Tomas Kindl <supp@mandriva.org> 0.6.47-3mdv2010.1
  253. + Revision: 536983
  254. - fix incorrect odf-py require & bump release
  255. - fix incorrect odf-py require
  256. * Mon Apr 19 2010 Tomas Kindl <supp@mandriva.org> 0.6.47-2mdv2010.1
  257. + Revision: 536555
  258. - enable PoDoFo dependency as we have PoDoFo in MDV now
  259. * Sun Apr 18 2010 Tomas Kindl <supp@mandriva.org> 0.6.47-1mdv2010.1
  260. + Revision: 536529
  261. - initial import containing all pertinent fixes to ensure it will build on Mandriva...
  262. - create calibre