*/*: Clean PYTHON_COMPAT of obsolete impls
[gentoo.git] / media-gfx / exiv2 / exiv2-0.27.2.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 if [[ ${PV} = *9999 ]]; then
7         EGIT_REPO_URI="https://github.com/Exiv2/exiv2.git"
8         inherit git-r3
9 else
10         SRC_URI="https://exiv2.org/builds/${P}-Source.tar.gz"
11         KEYWORDS="alpha amd64 arm arm64 ~hppa ia64 ~mips ppc ppc64 ~s390 ~sh sparc x86 ~amd64-linux ~x86-linux ~x64-solaris ~x86-solaris"
12 fi
13
14 CMAKE_ECLASS=cmake
15 PYTHON_COMPAT=( python2_7 python3_{6,7} )
16 inherit cmake-multilib python-any-r1
17
18 DESCRIPTION="EXIF, IPTC and XMP metadata C++ library and command line utility"
19 HOMEPAGE="https://www.exiv2.org/"
20
21 LICENSE="GPL-2"
22 SLOT="0/27"
23 IUSE="doc examples nls +png webready +xmp"
24
25 BDEPEND="
26         doc? (
27                 ${PYTHON_DEPS}
28                 app-doc/doxygen
29                 dev-libs/libxslt
30                 media-gfx/graphviz
31                 virtual/pkgconfig
32         )
33         nls? ( sys-devel/gettext )
34 "
35 DEPEND="
36         >=virtual/libiconv-0-r1[${MULTILIB_USEDEP}]
37         nls? ( >=virtual/libintl-0-r1[${MULTILIB_USEDEP}] )
38         png? ( sys-libs/zlib[${MULTILIB_USEDEP}] )
39         webready? (
40                 net-libs/libssh[${MULTILIB_USEDEP}]
41                 net-misc/curl[${MULTILIB_USEDEP}]
42         )
43         xmp? ( dev-libs/expat[${MULTILIB_USEDEP}] )
44 "
45 RDEPEND="${DEPEND}"
46
47 DOCS=( README.md doc/ChangeLog doc/cmd.txt )
48
49 PATCHES=( "${FILESDIR}/${P}-libssh-0.9.2.patch" )
50
51 S="${S}-Source"
52
53 pkg_setup() {
54         use doc && python-any-r1_pkg_setup
55 }
56
57 src_prepare() {
58         # FIXME @upstream:
59         einfo "Converting doc/cmd.txt to UTF-8"
60         iconv -f LATIN1 -t UTF-8 doc/cmd.txt > doc/cmd.txt.tmp || die
61         mv -f doc/cmd.txt.tmp doc/cmd.txt || die
62
63         cmake_src_prepare
64
65         sed -e "/^include.*compilerFlags/s/^/#DONT /" -i CMakeLists.txt || die
66 }
67
68 multilib_src_configure() {
69         local mycmakeargs=(
70                 -DEXIV2_BUILD_SAMPLES=NO
71                 -DEXIV2_BUILD_PO=$(usex nls)
72                 -DEXIV2_ENABLE_NLS=$(usex nls)
73                 -DEXIV2_ENABLE_PNG=$(usex png)
74                 -DEXIV2_ENABLE_CURL=$(usex webready)
75                 -DEXIV2_ENABLE_SSH=$(usex webready)
76                 -DEXIV2_ENABLE_WEBREADY=$(usex webready)
77                 -DEXIV2_ENABLE_XMP=$(usex xmp)
78                 $(multilib_is_native_abi || echo -DEXIV2_BUILD_EXIV2_COMMAND=NO)
79                 $(multilib_is_native_abi && echo -DEXIV2_BUILD_DOC=$(usex doc))
80                 -DCMAKE_INSTALL_DOCDIR="${EPREFIX}"/usr/share/doc/${PF}/html
81         )
82
83         cmake_src_configure
84 }
85
86 multilib_src_compile() {
87         cmake_src_compile
88
89         if multilib_is_native_abi; then
90                 use doc && eninja doc
91         fi
92 }
93
94 multilib_src_install_all() {
95         use xmp && DOCS+=( doc/{COPYING-XMPSDK,README-XMP,cmdxmp.txt} )
96
97         einstalldocs
98         find "${D}" -name '*.la' -delete || die
99
100         if use examples; then
101                 docinto examples
102                 dodoc samples/*.cpp
103         fi
104 }