*/*: Clean PYTHON_COMPAT of obsolete impls
[gentoo.git] / x11-misc / redshift / redshift-1.12-r3.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5 PYTHON_COMPAT=( python3_{6,7} )
6
7 inherit systemd autotools eutils gnome2-utils python-r1
8
9 DESCRIPTION="A screen color temperature adjusting software"
10 HOMEPAGE="http://jonls.dk/redshift/"
11 SRC_URI="https://github.com/jonls/redshift/archive/v${PV}.tar.gz -> ${P}.tar.gz"
12
13 LICENSE="GPL-3"
14 SLOT="0"
15 KEYWORDS="amd64 arm64 x86"
16 IUSE="ayatana geoclue gtk nls"
17
18 COMMON_DEPEND=">=x11-libs/libX11-1.4
19         x11-libs/libXxf86vm
20         x11-libs/libxcb
21         x11-libs/libdrm
22         ayatana? ( dev-libs/libappindicator:3[introspection] )
23         geoclue? ( app-misc/geoclue:2.0 dev-libs/glib:2 )
24         gtk? ( ${PYTHON_DEPS} )"
25 RDEPEND="${COMMON_DEPEND}
26         gtk? ( dev-python/pygobject[${PYTHON_USEDEP}]
27                 x11-libs/gtk+:3[introspection]
28                 dev-python/pyxdg[${PYTHON_USEDEP}] )"
29 DEPEND="${COMMON_DEPEND}
30         >=dev-util/intltool-0.50
31         nls? ( sys-devel/gettext )
32 "
33 REQUIRED_USE="gtk? ( ${PYTHON_REQUIRED_USE} )"
34
35 src_prepare() {
36         default
37         eautoreconf
38 }
39
40 src_configure() {
41         use gtk && python_setup
42
43         econf \
44                 --disable-silent-rules \
45                 $(use_enable nls) \
46                 --enable-drm \
47                 --enable-randr \
48                 --enable-vidmode \
49                 --disable-wingdi \
50                 \
51                 --disable-corelocation \
52                 $(use_enable geoclue geoclue2) \
53                 \
54                 $(use_enable gtk gui) \
55                 --with-systemduserunitdir="$(systemd_get_userunitdir)" \
56                 --enable-apparmor \
57                 --disable-quartz \
58                 --disable-ubuntu
59 }
60
61 _impl_specific_src_install() {
62         emake DESTDIR="${D}" pythondir="$(python_get_sitedir)" \
63                         -C src/redshift-gtk install
64 }
65
66 src_install() {
67         emake DESTDIR="${D}" UPDATE_ICON_CACHE=/bin/true install
68
69         if use gtk; then
70                 python_foreach_impl _impl_specific_src_install
71                 python_replicate_script "${D}"/usr/bin/redshift-gtk
72                 dosym redshift-gtk /usr/bin/gtk-redshift
73
74                 python_foreach_impl python_optimize
75         fi
76 }
77
78 pkg_preinst() {
79         use gtk && gnome2_icon_savelist
80 }
81
82 pkg_postinst() {
83         use gtk && gnome2_icon_cache_update
84 }
85
86 pkg_postrm() {
87         use gtk && gnome2_icon_cache_update
88 }