PKGBUILD 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. # Maintainer (arch): Jelle van der Waa <jelle@vdwaa.nl>
  2. # Maintainer (arch): Eli Schwartz <eschwartz@archlinux.org>
  3. # Contributor: Daniel Wallace <danielwallace at gtmanfred dot com>
  4. # Contributor: Giovanni Scafora <giovanni@archlinux.org>
  5. # Contributor: Petrov Roman <nwhisper@gmail.com>
  6. # Contributor: Andrea Fagiani <andfagiani _at_ gmail dot com>
  7. # Contributor: Larry Hajali <larryhaja@gmail.com>
  8. # Maintainer: Andreas Grapentin <andreas@grapentin.org>
  9. # Contributor: David P.<megver83@parabola.nu>
  10. # Contributor: Jesús E.<heckyel@parabola.nu>
  11. # Contributor: Isaac David <isacdaavid@at@isacdaavid@dot@info>
  12. # Contributor: David Palma <dbpalma9@gmail.com>
  13. # parabola changes and rationale:
  14. # - removed de-compression engine for rar archives
  15. # - build without qt5-webengine
  16. # - frozen at v3.48.0 - v4 removed support for webkit
  17. pkgname=calibre3
  18. _srcname=calibre
  19. pkgver=3.48.0
  20. pkgrel=1
  21. pkgrel+=.parabola3
  22. pkgdesc="Ebook management application"
  23. arch=('x86_64')
  24. arch+=('i686' 'armv7h')
  25. url="https://calibre-ebook.com/"
  26. license=('GPL3')
  27. _py_deps=('apsw' 'beautifulsoup4' 'cssselect' 'css-parser' 'dateutil' 'dbus' 'dnspython' 'dukpy'
  28. 'feedparser' 'html2text' 'html5-parser' 'lxml' 'markdown' 'mechanize' 'msgpack'
  29. 'netifaces' 'pillow' 'psutil' 'pygments' 'pyqt5' 'regex')
  30. depends=('chmlib' 'hunspell' 'jxrlib' 'libmtp' 'libusbx' 'libwmf' 'mathjax2' 'mtdev' 'optipng'
  31. 'podofo' "${_py_deps[@]/#/python2-}" 'qt5-svg' 'qt5-webkit' 'udisks2')
  32. depends+=('libicui18n.so' 'libicuuc.so')
  33. makedepends=('qt5-x11extras' 'rapydscript-ng' 'sip' 'xdg-utils')
  34. checkdepends=('xorg-server-xvfb')
  35. optdepends=('ipython2: to use calibre-debug'
  36. 'poppler: required for converting pdf to html')
  37. replaces=('calibre')
  38. source=("https://download.calibre-ebook.com/${pkgver}/${_srcname}-${pkgver}.tar.xz"
  39. "https://calibre-ebook.com/signatures/${_srcname}-${pkgver}.tar.xz.sig"
  40. 'libre.patch'
  41. "devendor-hunspell.patch"
  42. "update-fontconfig-db-qt5.15.patch")
  43. sha256sums=('024528f0f913c78e121fb34beb3dae8dba3686f2334422c6450808796042950c'
  44. 'SKIP'
  45. '00c352f4a5b49da43f38e495e3a2d82144f753a3d797cec8b5870b872137a70b'
  46. 'ff9be7c1773c18ccf4acaff5598ad29cf1477a1d33ddde85184d97f9a44ace1a'
  47. 'ffd7aa6dab196420843064cd29454b56aa8c8bd014af3adc734b4f45f3c3baa7')
  48. b2sums=('9a7fae20487ae93120cfdc06a312a42d54d68935fdd2bc18dc41be5f8d359c79eae24e0409ba8e7f4df85e2f073f80ce6bab56cba0638cead6693600fa93cb41'
  49. 'SKIP'
  50. 'ce3d88839da2e838a4ed0bf141cfb1fd84cabe49537c1d8c98ecb1e14c6af2b050b4ce097d2a69cf9c80c6b1ccb89c01c3268d29391639207adf1dc1daa86069'
  51. '29a3597676fd8a26d286363ba5002d2c439faba6c8cd3d6c98fd10f8aa3cd41021dbda501f445ed94759dc17561c945488822ba4f9e17334481d3261a973787c'
  52. '14038b4ea5f87d9a8f645b5af8342da90337202b0247b07dccd8995f55bb965b5c2bbdddc24b55b6e92e899f91d5dec19c10ddea8fcc42c8ed3d74ee90eb09d6')
  53. validpgpkeys=('3CE1780F78DD88DF45194FD706BC317B515ACE7C') # Kovid Goyal
  54. prepare()
  55. {
  56. cd "${srcdir}"/${_srcname}-${pkgver}
  57. # fix freedom issues
  58. rm -v imgsrc/mimetypes/rar.svg
  59. rm -v src/calibre/ebooks/metadata/rar.py
  60. rm -v src/calibre/utils/unrar.py
  61. rm -v resources/images/mimetypes/{cbr,rar}.png
  62. patch -fNp1 -i "$srcdir/libre.patch"
  63. # Desktop integration (e.g. enforce arch defaults)
  64. sed -e "/import config_dir/,/os.rmdir(config_dir)/d" \
  65. -e "s/'ctc-posml'/'text' not in mt and 'pdf' not in mt and 'xhtml'/" \
  66. -e "s/^Name=calibre/Name=Calibre/g" \
  67. -i src/calibre/linux.py
  68. # cherry-picked bits of python2-backports.functools_lru_cache
  69. # needed for frozen builds + beautifulsoup4
  70. # see: https://github.com/kovidgoyal/calibre/commit/b177f0a1096b4fdabd8772dd9edc66662a69e683#commitcomment-33169700
  71. rm -r src/backports
  72. # de-vendor hunspell (back-ported from 4.x)
  73. # see: https://github.com/kovidgoyal/calibre/commit/420e9e121b67db197e0c5d0bf23b92c174f2678f.patch
  74. patch -p1 -i ../devendor-hunspell.patch
  75. # Update fontconfig database for Qt 5.15 (back-ported from 4.x)
  76. # see: https://github.com/kovidgoyal/calibre/commit/db7007a25faefb0cc90e64dda1c0793393b9512d.patch
  77. patch -p1 -i ../update-fontconfig-db-qt5.15.patch
  78. cd resources
  79. # Remove unneeded files
  80. rm ${_srcname}-portable.* mozilla-ca-certs.pem
  81. # tarball cache from calibre 4.x
  82. rm editor.js viewer.{js,html}
  83. # use system mathjax
  84. rm -r mathjax
  85. }
  86. build()
  87. {
  88. cd "${srcdir}"/${_srcname}-${pkgver}
  89. LANG='en_US.UTF-8' python2 setup.py build
  90. LANG='en_US.UTF-8' python2 setup.py gui
  91. LANG='en_US.UTF-8' python2 setup.py mathjax --path-to-mathjax /usr/share/mathjax2 --system-mathjax
  92. LANG='en_US.UTF-8' python2 setup.py rapydscript
  93. }
  94. check()
  95. {
  96. local is_network_enabled=1
  97. # tests require networking
  98. (( ${is_network_enabled} )) || return 0
  99. # 2 failing tests on armv7h
  100. [[ $CARCH = arm* ]] && return 0
  101. cd "${srcdir}"/${_srcname}-${pkgver}
  102. # without xvfb-run this fails with much "Control socket failed to recv(), resetting"
  103. # ERROR: test_websocket_perf (calibre.srv.tests.web_sockets.WebSocketTest)
  104. LANG='en_US.UTF-8' xvfb-run python2 setup.py test
  105. }
  106. package()
  107. {
  108. cd "${srcdir}"/${_srcname}-${pkgver}
  109. # If this directory doesn't exist, zsh completion won't install.
  110. install -d "${pkgdir}/usr/share/zsh/site-functions"
  111. LANG='en_US.UTF-8' python2 setup.py install \
  112. --staging-root="${pkgdir}/usr" \
  113. --prefix=/usr
  114. cp -a man-pages/ "${pkgdir}/usr/share/man"
  115. # not needed at runtime
  116. rm -r "${pkgdir}"/usr/share/calibre/rapydscript/
  117. # Compiling bytecode FS#33392
  118. # This is kind of ugly but removes traces of the build root.
  119. while read -rd '' _file; do
  120. _destdir="$(dirname "${_file#${pkgdir}}")"
  121. python2 -m compileall -d "${_destdir}" "${_file}"
  122. python2 -O -m compileall -d "${_destdir}" "${_file}"
  123. done < <(find "${pkgdir}"/usr/lib/ -name '*.py' -print0)
  124. }