media-plugins/gst-plugins-gdkpixbuf: x86 stable (bug #624180)
[gentoo.git] / app-text / poppler / poppler-0.60.1.ebuild
1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 inherit cmake-utils toolchain-funcs xdg-utils
7
8 if [[ "${PV}" == "9999" ]] ; then
9         inherit git-r3
10         EGIT_REPO_URI="git://git.freedesktop.org/git/${PN}/${PN}"
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 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
15         SLOT="0/71"   # 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 qt4 qt5 tiff +utils"
23
24 # No test data provided
25 RESTRICT="test"
26
27 COMMON_DEPEND="
28         >=media-libs/fontconfig-2.6.0
29         >=media-libs/freetype-2.3.9
30         sys-libs/zlib
31         cairo? (
32                 dev-libs/glib:2
33                 >=x11-libs/cairo-1.10.0
34                 introspection? ( >=dev-libs/gobject-introspection-1.32.1:= )
35         )
36         curl? ( net-misc/curl )
37         jpeg? ( virtual/jpeg:0 )
38         jpeg2k? ( media-libs/openjpeg:2= )
39         lcms? ( media-libs/lcms:2 )
40         nss? ( >=dev-libs/nss-3.19:0 )
41         png? ( media-libs/libpng:0= )
42         qt4? (
43                 dev-qt/qtcore:4
44                 dev-qt/qtgui:4
45         )
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 DEPEND="${COMMON_DEPEND}
54         virtual/pkgconfig
55 "
56 RDEPEND="${COMMON_DEPEND}
57         cjk? ( >=app-text/poppler-data-0.4.7 )
58 "
59
60 DOCS=(AUTHORS NEWS README README-XPDF)
61
62 PATCHES=(
63         "${FILESDIR}/${PN}-0.60.1-qt5-dependencies.patch"
64         "${FILESDIR}/${PN}-0.28.1-fix-multilib-configuration.patch"
65         "${FILESDIR}/${PN}-0.60.1-respect-cflags.patch"
66         "${FILESDIR}/${PN}-0.33.0-openjpeg2.patch"
67         "${FILESDIR}/${PN}-0.40-FindQt4.patch"
68 )
69
70 src_prepare() {
71         cmake-utils_src_prepare
72
73         # Clang doesn't grok this flag, the configure nicely tests that, but
74         # cmake just uses it, so remove it if we use clang
75         if [[ ${CC} == clang ]] ; then
76                 sed -i -e 's/-fno-check-new//' cmake/modules/PopplerMacros.cmake || die
77         fi
78
79         if ! grep -Fq 'cmake_policy(SET CMP0002 OLD)' CMakeLists.txt ; then
80                 sed '/^cmake_minimum_required/acmake_policy(SET CMP0002 OLD)' \
81                         -i CMakeLists.txt || die
82         else
83                 einfo "policy(SET CMP0002 OLD) - workaround can be removed"
84         fi
85
86         if tc-is-clang && [[ ${CHOST} == *-darwin* ]] ; then
87                 # we need to up the C++ version, bug #622526
88                 export CXX="$(tc-getCXX) -std=c++11"
89         fi
90 }
91
92 src_configure() {
93         xdg_environment_reset
94         local mycmakeargs=(
95                 -DBUILD_GTK_TESTS=OFF
96                 -DBUILD_QT4_TESTS=OFF
97                 -DBUILD_QT5_TESTS=OFF
98                 -DBUILD_CPP_TESTS=OFF
99                 -DENABLE_SPLASH=ON
100                 -DENABLE_ZLIB=ON
101                 -DENABLE_ZLIB_UNCOMPRESS=OFF
102                 -DENABLE_XPDF_HEADERS=ON
103                 -DENABLE_LIBCURL="$(usex curl)"
104                 -DENABLE_CPP="$(usex cxx)"
105                 -DENABLE_UTILS="$(usex utils)"
106                 -DSPLASH_CMYK=OFF
107                 -DUSE_FIXEDPOINT=OFF
108                 -DUSE_FLOAT=OFF
109                 -DWITH_Cairo="$(usex cairo)"
110                 -DWITH_GObjectIntrospection="$(usex introspection)"
111                 -DWITH_JPEG="$(usex jpeg)"
112                 -DWITH_NSS3="$(usex nss)"
113                 -DWITH_PNG="$(usex png)"
114                 -DWITH_Qt4="$(usex qt4)"
115                 $(cmake-utils_use_find_package qt5 Qt5Core)
116                 -DWITH_TIFF="$(usex tiff)"
117         )
118         if use jpeg; then
119                 mycmakeargs+=(-DENABLE_DCTDECODER=libjpeg)
120         else
121                 mycmakeargs+=(-DENABLE_DCTDECODER=none)
122         fi
123         if use jpeg2k; then
124                 mycmakeargs+=(-DENABLE_LIBOPENJPEG=openjpeg2)
125         else
126                 mycmakeargs+=(-DENABLE_LIBOPENJPEG=none)
127         fi
128         if use lcms; then
129                 mycmakeargs+=(-DENABLE_CMS=lcms2)
130         else
131                 mycmakeargs+=(-DENABLE_CMS=)
132         fi
133
134         cmake-utils_src_configure
135 }
136
137 src_install() {
138         cmake-utils_src_install
139
140         # live version doesn't provide html documentation
141         if use cairo && use doc && [[ ${PV} != 9999 ]]; then
142                 # For now install gtk-doc there
143                 insinto /usr/share/gtk-doc/html/poppler
144                 doins -r "${S}"/glib/reference/html/*
145         fi
146 }