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