media-gfx/exiv2: Fix build against >=net-libs/libssh-0.9.2
[gentoo.git] / media-gfx / exiv2 / exiv2-0.27.2.ebuild
1 # Copyright 1999-2019 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 PYTHON_COMPAT=( python2_7 python3_{5,6,7} )
15 inherit cmake-multilib python-any-r1
16
17 DESCRIPTION="EXIF, IPTC and XMP metadata C++ library and command line utility"
18 HOMEPAGE="https://www.exiv2.org/"
19
20 LICENSE="GPL-2"
21 SLOT="0/27"
22 IUSE="doc examples nls +png webready +xmp"
23
24 BDEPEND="
25         doc? (
26                 ${PYTHON_DEPS}
27                 app-doc/doxygen
28                 dev-libs/libxslt
29                 media-gfx/graphviz
30                 virtual/pkgconfig
31         )
32         nls? ( sys-devel/gettext )
33 "
34 DEPEND="
35         >=virtual/libiconv-0-r1[${MULTILIB_USEDEP}]
36         nls? ( >=virtual/libintl-0-r1[${MULTILIB_USEDEP}] )
37         png? ( sys-libs/zlib[${MULTILIB_USEDEP}] )
38         webready? (
39                 net-libs/libssh[${MULTILIB_USEDEP}]
40                 net-misc/curl[${MULTILIB_USEDEP}]
41         )
42         xmp? ( dev-libs/expat[${MULTILIB_USEDEP}] )
43 "
44 RDEPEND="${DEPEND}"
45
46 DOCS=( README.md doc/ChangeLog doc/cmd.txt )
47
48 PATCHES=( "${FILESDIR}/${P}-libssh-0.9.2.patch" )
49
50 S="${S}-Source"
51
52 pkg_setup() {
53         use doc && python-any-r1_pkg_setup
54 }
55
56 src_prepare() {
57         # FIXME @upstream:
58         einfo "Converting doc/cmd.txt to UTF-8"
59         iconv -f LATIN1 -t UTF-8 doc/cmd.txt > doc/cmd.txt.tmp || die
60         mv -f doc/cmd.txt.tmp doc/cmd.txt || die
61
62         cmake-utils_src_prepare
63
64         sed -e "/^include.*compilerFlags/s/^/#DONT /" -i CMakeLists.txt || die
65 }
66
67 multilib_src_configure() {
68         local mycmakeargs=(
69                 -DEXIV2_BUILD_SAMPLES=NO
70                 -DEXIV2_BUILD_PO=$(usex nls)
71                 -DEXIV2_ENABLE_NLS=$(usex nls)
72                 -DEXIV2_ENABLE_PNG=$(usex png)
73                 -DEXIV2_ENABLE_CURL=$(usex webready)
74                 -DEXIV2_ENABLE_SSH=$(usex webready)
75                 -DEXIV2_ENABLE_WEBREADY=$(usex webready)
76                 -DEXIV2_ENABLE_XMP=$(usex xmp)
77                 $(multilib_is_native_abi || echo -DEXIV2_BUILD_EXIV2_COMMAND=NO)
78                 $(multilib_is_native_abi && echo -DEXIV2_BUILD_DOC=$(usex doc))
79                 -DCMAKE_INSTALL_DOCDIR="${EPREFIX}"/usr/share/doc/${PF}/html
80         )
81
82         cmake-utils_src_configure
83 }
84
85 multilib_src_compile() {
86         cmake-utils_src_compile
87
88         if multilib_is_native_abi; then
89                 use doc && eninja doc
90         fi
91 }
92
93 multilib_src_install_all() {
94         use xmp && DOCS+=( doc/{COPYING-XMPSDK,README-XMP,cmdxmp.txt} )
95
96         einstalldocs
97         find "${D}" -name '*.la' -delete || die
98
99         if use examples; then
100                 docinto examples
101                 dodoc samples/*.cpp
102         fi
103 }