You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
1.8 KiB

  1. # Copyright 1999-2021 Gentoo Authors
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=7
  4. WX_GTK_VER="3.0-gtk3"
  5. PLOCALES="bg cs de es hu pl ru uk"
  6. inherit cmake plocale wxwidgets xdg
  7. CR_PV=$(ver_rs 3 '-')
  8. SRC_URI="https://github.com/buggins/${PN}/archive/cr${CR_PV}.tar.gz -> ${P}.tar.gz"
  9. S="${WORKDIR}/${PN}-cr${CR_PV}"
  10. DESCRIPTION="CoolReader - reader of eBook files (fb2,epub,htm,rtf,txt)"
  11. HOMEPAGE="https://github.com/buggins/coolreader/"
  12. LICENSE="GPL-2"
  13. SLOT="0"
  14. KEYWORDS="~amd64 ~x86"
  15. IUSE="wxwidgets"
  16. CDEPEND="sys-libs/zlib
  17. media-libs/libpng:0
  18. virtual/jpeg:0
  19. media-libs/freetype
  20. dev-libs/fribidi
  21. media-libs/fontconfig
  22. media-libs/harfbuzz
  23. dev-libs/libunibreak
  24. wxwidgets? ( x11-libs/wxGTK:${WX_GTK_VER} )
  25. !wxwidgets? ( dev-qt/qtcore:5 dev-qt/qtgui:5 dev-qt/qtwidgets:5 )"
  26. BDEPEND="${CDEPEND}
  27. !wxwidgets? ( dev-qt/linguist-tools:5 )"
  28. RDEPEND="${CDEPEND}
  29. wxwidgets? ( || ( media-fonts/liberation-fonts media-fonts/corefonts ) )"
  30. src_prepare() {
  31. cmake_src_prepare
  32. xdg_src_prepare
  33. # locales
  34. plocale_find_changes "${S}"/cr3qt/src/i18n 'cr3_' '.ts'
  35. sed -e "s|SET(LANGUAGES .*)|SET(LANGUAGES $(plocale_get_locales))|" \
  36. -i "${S}"/cr3qt/CMakeLists.txt \
  37. || die "sed CMakeLists.txt failed"
  38. }
  39. src_configure() {
  40. CMAKE_USE_DIR="${S}"
  41. CMAKE_BUILD_TYPE="Release"
  42. if use wxwidgets; then
  43. setup-wxwidgets
  44. local mycmakeargs=(-D GUI=WX)
  45. else
  46. local mycmakeargs=(-D GUI=QT5)
  47. fi
  48. cmake_src_configure
  49. }
  50. src_install() {
  51. cmake_src_install
  52. if ! use wxwidgets; then
  53. mv "${D}"/usr/share/doc/cr3/changelog.gz "${D}"/usr/share/doc/${PF}/ || die "mv changelog.gz failed"
  54. rmdir "${D}"/usr/share/doc/cr3 || die "rmdir doc/cr3 failed"
  55. gunzip "${D}"/usr/share/doc/${PF}/changelog.gz || die "gunzip changelog.gz failed"
  56. gunzip "${D}"/usr/share/man/man1/cr3.1.gz || die "gunzip cr3.1.gz failed"
  57. fi
  58. }