media-gfx/exiv2: Add 0.26_p20171013 snapshot
[gentoo.git] / media-gfx / exiv2 / exiv2-0.25-r2.ebuild
1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=5
5 PYTHON_COMPAT=( python{2_7,3_4,3_5,3_6} )
6
7 inherit eutils cmake-multilib python-any-r1
8
9 DESCRIPTION="EXIF, IPTC and XMP metadata C++ library and command line utility"
10 HOMEPAGE="http://www.exiv2.org/"
11 SRC_URI="http://www.exiv2.org/${P}.tar.gz"
12
13 LICENSE="GPL-2"
14 SLOT="0/14"
15 KEYWORDS="alpha amd64 arm hppa ia64 ~mips ppc ppc64 ~s390 ~sh sparc x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~x64-solaris ~x86-solaris"
16 IUSE_LINGUAS="bs de es fi fr gl ms pl pt ru sk sv ug uk vi"
17 IUSE="doc examples nls png webready xmp $(printf 'linguas_%s ' ${IUSE_LINGUAS})"
18
19 RDEPEND="
20         >=virtual/libiconv-0-r1[${MULTILIB_USEDEP}]
21         nls? ( >=virtual/libintl-0-r1[${MULTILIB_USEDEP}] )
22         png? ( >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] )
23         webready? (
24                 net-libs/libssh[${MULTILIB_USEDEP}]
25                 net-misc/curl[${MULTILIB_USEDEP}]
26         )
27         xmp? ( >=dev-libs/expat-2.1.0-r3[${MULTILIB_USEDEP}] )
28 "
29
30 DEPEND="${RDEPEND}
31         doc? (
32                 app-doc/doxygen
33                 dev-libs/libxslt
34                 virtual/pkgconfig
35                 media-gfx/graphviz
36                 ${PYTHON_DEPS}
37         )
38         nls? ( sys-devel/gettext )
39 "
40
41 DOCS=( README doc/ChangeLog doc/cmd.txt )
42
43 PATCHES=(
44         "${FILESDIR}/${PN}-0.25-fix-install-dirs.patch"
45         "${FILESDIR}/${PN}-0.25-fix-without-zlib.patch"
46         "${FILESDIR}/${PN}-0.25-hide-symbols.patch"
47         "${FILESDIR}/${PN}-0.25-fvisibility-hidden.patch"
48         # TODO: Take to upstream
49         "${FILESDIR}/${PN}-0.25-fix-docs.patch"
50         "${FILESDIR}/${PN}-0.25-tools-optional.patch"
51 )
52
53 pkg_setup() {
54         use doc && python-any-r1_pkg_setup
55 }
56
57 src_prepare() {
58         rm -r msvc* build || die "Failed to remove msvc dirs"
59
60         if [[ ${PV} != *9999 ]] ; then
61                 if [[ -d po ]] ; then
62                         pushd po > /dev/null || die
63                         for lang in *.po; do
64                                 if ! has ${lang%.po} ${LINGUAS} ; then
65                                         rm -rf ${lang} || die
66                                 fi
67                         done
68                         popd > /dev/null || die
69                 else
70                         die "Failed to prepare LINGUAS - po directory moved?"
71                 fi
72         fi
73
74         # convert docs to UTF-8
75         local i
76         for i in doc/cmd.txt; do
77                 einfo "Converting "${i}" to UTF-8"
78                 iconv -f LATIN1 -t UTF-8 "${i}" > "${i}.tmp" || die
79                 mv -f "${i}.tmp" "${i}" || die
80         done
81
82         if use doc; then
83                 einfo "Updating doxygen config"
84                 doxygen &>/dev/null -u config/Doxyfile || die
85         fi
86
87         cmake-utils_src_prepare
88 }
89
90 multilib_src_configure() {
91         local mycmakeargs=(
92                 -DEXIV2_ENABLE_BUILD_PO=YES
93                 -DEXIV2_ENABLE_BUILD_SAMPLES=NO
94                 -DEXIV2_ENABLE_CURL=$(usex webready)
95                 -DEXIV2_ENABLE_NLS=$(usex nls)
96                 -DEXIV2_ENABLE_PNG=$(usex png)
97                 -DEXIV2_ENABLE_SSH=$(usex webready)
98                 -DEXIV2_ENABLE_WEBREADY=$(usex webready)
99                 -DEXIV2_ENABLE_XMP=$(usex xmp)
100                 -DEXIV2_ENABLE_LIBXMP=NO
101                 $(multilib_is_native_abi || \
102                         echo -DEXIV2_ENABLE_TOOLS=NO)
103         )
104
105         cmake-utils_src_configure
106 }
107
108 multilib_src_compile() {
109         cmake-utils_src_compile
110
111         if multilib_is_native_abi; then
112                 use doc && emake -j1 doc
113         fi
114 }
115
116 multilib_src_install_all() {
117         einstalldocs
118         prune_libtool_files --all
119
120         use xmp && dodoc doc/{COPYING-XMPSDK,README-XMP,cmdxmp.txt}
121         use doc && dodoc -r "${S}"/doc/html
122
123         if use examples; then
124                 docinto examples
125                 dodoc samples/*.cpp
126         fi
127 }