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.

126 lines
3.3 KiB

  1. # Copyright 2005-2021 Gentoo Authors
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=8
  4. inherit cmake toolchain-funcs xdg-utils
  5. if [[ ${PV} == *9999* ]] ; then
  6. inherit git-r3
  7. EGIT_REPO_URI="https://anongit.freedesktop.org/git/poppler/poppler.git"
  8. SLOT="0/9999"
  9. else
  10. SRC_URI="https://poppler.freedesktop.org/${P}.tar.xz"
  11. KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
  12. SLOT="0/114" # CHECK THIS WHEN BUMPING!!! SUBSLOT IS libpoppler.so SOVERSION
  13. fi
  14. DESCRIPTION="PDF rendering library based on the xpdf-3.0 code base"
  15. HOMEPAGE="https://poppler.freedesktop.org/"
  16. LICENSE="GPL-2"
  17. IUSE="boost cairo cjk curl +cxx debug doc +introspection +jpeg +jpeg2k +lcms nss png qt5 tiff +utils"
  18. # No test data provided
  19. RESTRICT="test"
  20. DEPEND="
  21. media-libs/fontconfig
  22. media-libs/freetype
  23. sys-libs/zlib
  24. cairo? (
  25. dev-libs/glib:2
  26. x11-libs/cairo
  27. introspection? ( dev-libs/gobject-introspection:= )
  28. )
  29. curl? ( net-misc/curl )
  30. jpeg? ( virtual/jpeg:0 )
  31. jpeg2k? ( >=media-libs/openjpeg-2.3.0-r1:2= )
  32. lcms? ( media-libs/lcms:2 )
  33. nss? ( >=dev-libs/nss-3.19:0 )
  34. png? ( media-libs/libpng:0= )
  35. qt5? (
  36. dev-qt/qtcore:5
  37. dev-qt/qtgui:5
  38. dev-qt/qtxml:5
  39. )
  40. tiff? ( media-libs/tiff:0 )
  41. "
  42. RDEPEND="${DEPEND}
  43. cjk? ( app-text/poppler-data )
  44. "
  45. DEPEND+="
  46. boost? ( dev-libs/boost )
  47. "
  48. BDEPEND="
  49. dev-util/glib-utils
  50. virtual/pkgconfig
  51. "
  52. DOCS=( AUTHORS NEWS README.md README-XPDF )
  53. PATCHES=(
  54. "${FILESDIR}/${PN}-20.12.1-qt5-deps.patch"
  55. "${FILESDIR}/${PN}-21.09.0-respect-cflags.patch"
  56. "${FILESDIR}/${PN}-0.57.0-disable-internal-jpx.patch"
  57. )
  58. src_prepare() {
  59. cmake_src_prepare
  60. # Clang doesn't grok this flag, the configure nicely tests that, but
  61. # cmake just uses it, so remove it if we use clang
  62. if tc-is-clang ; then
  63. sed -e 's/-fno-check-new//' -i cmake/modules/PopplerMacros.cmake || die
  64. fi
  65. if ! grep -Fq 'cmake_policy(SET CMP0002 OLD)' CMakeLists.txt ; then
  66. sed -e '/^cmake_minimum_required/acmake_policy(SET CMP0002 OLD)' \
  67. -i CMakeLists.txt || die
  68. else
  69. einfo "policy(SET CMP0002 OLD) - workaround can be removed"
  70. fi
  71. }
  72. src_configure() {
  73. xdg_environment_reset
  74. local mycmakeargs=(
  75. -DBUILD_GTK_TESTS=OFF
  76. -DBUILD_QT5_TESTS=OFF
  77. -DBUILD_CPP_TESTS=OFF
  78. -DBUILD_MANUAL_TESTS=OFF
  79. -DRUN_GPERF_IF_PRESENT=OFF
  80. -DENABLE_BOOST="$(usex boost)"
  81. -DENABLE_ZLIB=ON
  82. -DENABLE_ZLIB_UNCOMPRESS=OFF
  83. -DENABLE_UNSTABLE_API_ABI_HEADERS=ON
  84. -DUSE_FLOAT=OFF
  85. -DWITH_Cairo=$(usex cairo)
  86. -DENABLE_LIBCURL=$(usex curl)
  87. -DENABLE_CPP=$(usex cxx)
  88. -DWITH_JPEG=$(usex jpeg)
  89. -DENABLE_DCTDECODER=$(usex jpeg libjpeg none)
  90. -DENABLE_LIBOPENJPEG=$(usex jpeg2k openjpeg2 none)
  91. -DENABLE_CMS=$(usex lcms lcms2 none)
  92. -DWITH_NSS3=$(usex nss)
  93. -DWITH_PNG=$(usex png)
  94. $(cmake_use_find_package qt5 Qt5Core)
  95. -DWITH_TIFF=$(usex tiff)
  96. -DENABLE_UTILS=$(usex utils)
  97. -DENABLE_QT6=OFF
  98. )
  99. use cairo && mycmakeargs+=( -DWITH_GObjectIntrospection=$(usex introspection) )
  100. cmake_src_configure
  101. }
  102. src_install() {
  103. cmake_src_install
  104. # live version doesn't provide html documentation
  105. if use cairo && use doc && [[ ${PV} != *9999* ]]; then
  106. # For now install gtk-doc there
  107. insinto /usr/share/gtk-doc/html/poppler
  108. doins -r "${S}"/glib/reference/html/*
  109. fi
  110. }