9e05606a22259d21d9eaffccf8ad1374e69e65d7
[gentoo.git] / media-gfx / darktable / darktable-2.2.5.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 flag-o-matic toolchain-funcs gnome2-utils fdo-mime pax-utils eutils
7
8 DOC_PV="2.2.0"
9 MY_PV="${PV/_/}"
10 MY_P="${P/_/.}"
11
12 DESCRIPTION="A virtual lighttable and darkroom for photographers"
13 HOMEPAGE="https://www.darktable.org/"
14 SRC_URI="https://github.com/darktable-org/${PN}/releases/download/release-${MY_PV}/${MY_P}.tar.xz
15         doc? ( https://github.com/darktable-org/${PN}/releases/download/release-${DOC_PV}/${PN}-usermanual.pdf -> ${PN}-usermanual-${DOC_PV}.pdf )"
16
17 LICENSE="GPL-3 CC-BY-3.0"
18 SLOT="0"
19 KEYWORDS="~amd64 x86"
20 LANGS=" ca cs da de es fr he hu it ja nl pl ru sk sl sv uk"
21 # TODO add lua once dev-lang/lua-5.2 is unmasked
22 IUSE="colord cups cpu_flags_x86_sse3 doc flickr geo gphoto2 graphicsmagick jpeg2k kwallet libsecret
23 nls opencl openmp openexr pax_kernel webp
24 ${LANGS// / l10n_}"
25
26 # sse3 support is required to build darktable
27 REQUIRED_USE="cpu_flags_x86_sse3"
28
29 CDEPEND="
30         dev-db/sqlite:3
31         dev-libs/json-glib
32         dev-libs/libxml2:2
33         dev-libs/pugixml:0=
34         gnome-base/librsvg:2
35         >=media-gfx/exiv2-0.25-r2:0=[xmp]
36         media-libs/lcms:2
37         >=media-libs/lensfun-0.2.3:0=
38         media-libs/libpng:0=
39         media-libs/tiff:0
40         net-libs/libsoup:2.4
41         net-misc/curl
42         virtual/jpeg:0
43         virtual/glu
44         virtual/opengl
45         x11-libs/cairo
46         >=x11-libs/gtk+-3.14:3
47         x11-libs/pango
48         colord? ( x11-libs/colord-gtk:0= )
49         cups? ( net-print/cups )
50         flickr? ( media-libs/flickcurl )
51         geo? ( >=sci-geosciences/osm-gps-map-1.1.0 )
52         gphoto2? ( media-libs/libgphoto2:= )
53         graphicsmagick? ( media-gfx/graphicsmagick )
54         jpeg2k? ( media-libs/openjpeg:0 )
55         libsecret? ( >=app-crypt/libsecret-0.18 )
56         opencl? ( virtual/opencl )
57         openexr? ( media-libs/openexr:0= )
58         webp? ( media-libs/libwebp:0= )"
59 RDEPEND="${CDEPEND}
60         kwallet? ( || (
61                 >=kde-frameworks/kwallet-5.34.0-r1
62                 kde-apps/kwalletd:4
63         ) )"
64 DEPEND="${CDEPEND}
65         dev-util/intltool
66         virtual/pkgconfig
67         nls? ( sys-devel/gettext )"
68
69 S="${WORKDIR}/${P/_/~}"
70
71 pkg_pretend() {
72         if use openmp ; then
73                 tc-has-openmp || die "Please switch to an openmp compatible compiler"
74         fi
75 }
76
77 src_prepare() {
78         use cpu_flags_x86_sse3 && append-flags -msse3
79
80         cmake-utils_src_prepare
81 }
82
83 src_configure() {
84         local mycmakeargs=(
85                 -DBUILD_PRINT=$(usex cups)
86                 -DCMAKE_INSTALL_DOCDIR="/usr/share/doc/${PF}"
87                 -DCUSTOM_CFLAGS=ON
88                 -DUSE_CAMERA_SUPPORT=$(usex gphoto2)
89                 -DUSE_COLORD=$(usex colord)
90                 -DUSE_FLICKR=$(usex flickr)
91                 -DUSE_GRAPHICSMAGICK=$(usex graphicsmagick)
92                 -DUSE_KWALLET=$(usex kwallet)
93                 -DUSE_LIBSECRET=$(usex libsecret)
94                 -DUSE_LUA=OFF
95                 -DUSE_MAP=$(usex geo)
96                 -DUSE_NLS=$(usex nls)
97                 -DUSE_OPENCL=$(usex opencl)
98                 -DUSE_OPENEXR=$(usex openexr)
99                 -DUSE_OPENJPEG=$(usex jpeg2k)
100                 -DUSE_OPENMP=$(usex openmp)
101                 -DUSE_WEBP=$(usex webp)
102         )
103         cmake-utils_src_configure
104 }
105
106 src_install() {
107         cmake-utils_src_install
108         use doc && dodoc "${DISTDIR}"/${PN}-usermanual-${DOC_PV}.pdf
109
110         for lang in ${LANGS} ; do
111                 use l10n_${lang} || rm -r "${ED}"/usr/share/locale/${lang/-/_}
112         done
113
114         if use pax_kernel && use opencl ; then
115                 pax-mark Cm "${ED}"/usr/bin/${PN} || die
116                 eqawarn "USE=pax_kernel is set meaning that ${PN} will be run"
117                 eqawarn "under a PaX enabled kernel. To do so, the ${PN} binary"
118                 eqawarn "must be modified and this *may* lead to breakage! If"
119                 eqawarn "you suspect that ${PN} is broken by this modification,"
120                 eqawarn "please open a bug."
121         fi
122 }
123
124 pkg_preinst() {
125         gnome2_icon_savelist
126 }
127
128 pkg_postinst() {
129         gnome2_icon_cache_update
130         fdo-mime_desktop_database_update
131
132         elog "when updating from the currently stable 1.6 series,"
133         elog "please bear in mind that your edits will be preserved during this process,"
134         elog "but it will not be possible to downgrade from 2.0 to 1.6 any more."
135         echo
136         ewarn "It will not be possible to downgrade!"
137 }
138
139 pkg_postrm() {
140         gnome2_icon_cache_update
141         fdo-mime_desktop_database_update
142 }