9aa6302ffd0d106c147899c3f9663942180bcc33
[gentoo.git] / media-gfx / exiv2 / exiv2-0.26_p20171013.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 COMMIT=269370863ecd61dd038eed3b96ecd65898d3bb6e
7 LINGUAS="bs de es fi fr gl ms pl pt ru sk sv ug uk vi"
8 PYTHON_COMPAT=( python{2_7,3_4,3_5,3_6} )
9 inherit cmake-multilib python-any-r1 vcs-snapshot
10
11 DESCRIPTION="EXIF, IPTC and XMP metadata C++ library and command line utility"
12 HOMEPAGE="http://www.exiv2.org/"
13 SRC_URI="https://github.com/Exiv2/${PN}/tarball/${COMMIT} -> ${P}.tar.gz"
14
15 LICENSE="GPL-2"
16 SLOT="0/26"
17 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~x64-solaris ~x86-solaris"
18 IUSE="doc examples nls png webready xmp $(printf 'linguas_%s ' ${LINGUAS})"
19
20 RDEPEND="
21         >=virtual/libiconv-0-r1[${MULTILIB_USEDEP}]
22         nls? ( >=virtual/libintl-0-r1[${MULTILIB_USEDEP}] )
23         png? ( >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] )
24         webready? (
25                 net-libs/libssh[${MULTILIB_USEDEP}]
26                 net-misc/curl[${MULTILIB_USEDEP}]
27         )
28         xmp? ( >=dev-libs/expat-2.1.0-r3[${MULTILIB_USEDEP}] )
29 "
30
31 DEPEND="${RDEPEND}
32         doc? (
33                 ${PYTHON_DEPS}
34                 app-doc/doxygen
35                 dev-libs/libxslt
36                 media-gfx/graphviz
37                 virtual/pkgconfig
38         )
39         nls? ( sys-devel/gettext )
40 "
41
42 DOCS=( README.md doc/ChangeLog doc/cmd.txt )
43
44 PATCHES=( "${FILESDIR}/${P}-cmake.patch" )
45
46 pkg_setup() {
47         use doc && python-any-r1_pkg_setup
48 }
49
50 src_prepare() {
51         if [[ ${PV} != *9999 ]] ; then
52                 if [[ -d po ]] ; then
53                         pushd po > /dev/null || die
54                         local lang
55                         for lang in *.po; do
56                                 if [[ -e ${lang} ]] && ! has ${lang/.po/} ${LINGUAS} ; then
57                                         case ${lang} in
58                                                 CMakeLists.txt | \
59                                                 ${PN}.pot)      ;;
60                                                 *) rm -r ${lang} || die ;;
61                                         esac
62                                 fi
63                         done
64                         popd > /dev/null || die
65                 else
66                         die "Failed to prepare LINGUAS - po directory moved?"
67                 fi
68         fi
69
70         # FIXME @upstream:
71         einfo "Converting doc/cmd.txt to UTF-8"
72         iconv -f LATIN1 -t UTF-8 doc/cmd.txt > doc/cmd.txt.tmp || die
73         mv -f doc/cmd.txt.tmp doc/cmd.txt || die
74
75         if use doc; then
76                 einfo "Updating doxygen config"
77                 doxygen &>/dev/null -u config/Doxyfile || die
78         fi
79
80         cmake-utils_src_prepare
81 }
82
83 multilib_src_configure() {
84         local mycmakeargs=(
85                 -DEXIV2_BUILD_SAMPLES=NO
86                 -DEXIV2_BUILD_PO=$(usex nls)
87                 -DEXIV2_ENABLE_NLS=$(usex nls)
88                 -DEXIV2_ENABLE_PNG=$(usex png)
89                 -DEXIV2_ENABLE_CURL=$(usex webready)
90                 -DEXIV2_ENABLE_SSH=$(usex webready)
91                 -DEXIV2_ENABLE_WEBREADY=$(usex webready)
92                 -DEXIV2_ENABLE_XMP=$(usex xmp)
93                 $(multilib_is_native_abi || echo -DEXIV2_BUILD_EXIV2_COMMAND=NO)
94         )
95
96         cmake-utils_src_configure
97 }
98
99 multilib_src_compile() {
100         cmake-utils_src_compile
101
102         if multilib_is_native_abi; then
103                 use doc && emake -j1 doc
104         fi
105 }
106
107 multilib_src_install_all() {
108         use xmp && DOCS+=( doc/{COPYING-XMPSDK,README-XMP,cmdxmp.txt} )
109         use doc && HTML_DOCS=( "${S}"/doc/html/. )
110
111         einstalldocs
112         find "${D}" -name '*.la' -delete || die
113
114         if use examples; then
115                 docinto examples
116                 dodoc samples/*.cpp
117         fi
118 }