*/*: Clean PYTHON_COMPAT of obsolete impls
[gentoo.git] / gnome-extra / cinnamon / cinnamon-4.0.3-r2.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5 GNOME2_LA_PUNT="yes"
6 PYTHON_COMPAT=( python{2_7,3_6} )
7 PYTHON_REQ_USE="xml"
8
9 inherit autotools eutils flag-o-matic gnome2 multilib pax-utils python-r1
10
11 DESCRIPTION="A fork of GNOME Shell with layout similar to GNOME 2"
12 HOMEPAGE="http://developer.linuxmint.com/projects/cinnamon-projects.html"
13
14 MY_PV="${PV/_p/-UP}"
15 MY_P="${PN}-${MY_PV}"
16
17 SRC_URI="https://github.com/linuxmint/Cinnamon/archive/${MY_PV}.tar.gz -> ${MY_P}.tar.gz"
18
19 LICENSE="GPL-2+"
20 SLOT="0"
21
22 IUSE="+nls"
23
24 # We need *both* python 2.x and 3.x
25 REQUIRED_USE="${PYTHON_REQUIRED_USE}
26         || ( $(python_gen_useflags 'python2*') )
27         || ( $(python_gen_useflags 'python3*') )
28 "
29
30 KEYWORDS="amd64 x86"
31
32 COMMON_DEPEND="${PYTHON_DEPS}
33         app-accessibility/at-spi2-atk:2
34         app-misc/ca-certificates
35         dev-libs/dbus-glib
36         >=dev-libs/glib-2.35.0:2[dbus]
37         >=dev-libs/gobject-introspection-0.10.1:=
38         >=dev-libs/json-glib-0.13.2
39         >=dev-libs/libcroco-0.6.2:0.6
40         dev-libs/libxml2:2
41         gnome-base/librsvg
42         >=gnome-extra/cinnamon-desktop-4.0:0=[introspection]
43         >=gnome-extra/cinnamon-menus-4.0[introspection]
44         >=gnome-extra/cjs-4.0.0[cairo]
45         >=media-libs/clutter-1.10:1.0[introspection]
46         media-libs/cogl:1.0=[introspection]
47         >=gnome-base/gsettings-desktop-schemas-2.91.91
48         media-libs/gstreamer:1.0
49         media-libs/gst-plugins-base:1.0
50         net-libs/libsoup:2.4[introspection]
51         >=sys-auth/polkit-0.100[introspection]
52         x11-libs/gdk-pixbuf:2[introspection]
53         >=x11-libs/gtk+-3.12.0:3[introspection]
54         x11-libs/pango[introspection]
55         >=x11-libs/startup-notification-0.11
56         x11-libs/libX11
57         >=x11-libs/libXfixes-5.0
58         >=x11-wm/muffin-4.0.0[introspection]
59         dev-libs/keybinder:3[introspection]
60         >=x11-libs/libnotify-0.7.3:0=[introspection]
61 "
62 # Runtime-only deps are probably incomplete and approximate.
63 # Each block:
64 # 2. Introspection stuff + dconf needed via imports.gi.*
65 # 3. gnome-session is needed for gnome-session-quit
66 # 4. Control shell settings
67 # 5. accountsservice is needed for GdmUserManager (0.6.14 needed for fast
68 #    user switching with gdm-3.1.x)
69 # 6. caribou needed for on-screen keyboard
70 # 7. xdg-utils needed for xdg-open, used by extension tool
71 # 8. imaging, lxml needed for cinnamon-settings
72 # 9. gnome-icon-theme-symbolic needed for various icons
73 # 10. pygobject needed for menu editor
74 # 11. nemo - default file manager, tightly integrated with cinnamon
75 # 12. polkit-gnome - explicitly autostarted by us
76 # TODO(lxnay): fix error: libgnome-desktop/gnome-rr-labeler.h: No such file or directory
77 RDEPEND="${COMMON_DEPEND}
78         >=gnome-base/dconf-0.4.1
79         >=gnome-base/libgnomekbd-2.91.4[introspection]
80         sys-power/upower[introspection]
81
82         >=gnome-extra/cinnamon-session-4.0
83         >=gnome-extra/cinnamon-settings-daemon-4.0
84
85         >=app-accessibility/caribou-0.3
86
87         x11-misc/xdg-utils
88         x11-libs/xapps[introspection]
89
90         dev-python/dbus-python[${PYTHON_USEDEP}]
91         dev-python/pygobject:3[${PYTHON_USEDEP}]
92         $(python_gen_cond_dep 'dev-python/lxml[${PYTHON_USEDEP}]' 'python2*')
93         $(python_gen_cond_dep 'dev-python/pexpect[${PYTHON_USEDEP}]' 'python2*')
94         $(python_gen_cond_dep 'dev-python/pycairo[${PYTHON_USEDEP}]' 'python2*')
95         $(python_gen_cond_dep 'dev-python/pyinotify[${PYTHON_USEDEP}]' 'python2*')
96         $(python_gen_cond_dep 'dev-python/pypam[${PYTHON_USEDEP}]' 'python2*')
97         $(python_gen_cond_dep 'dev-python/pillow[${PYTHON_USEDEP}]' 'python2*')
98
99         x11-themes/gnome-themes-standard
100         x11-themes/adwaita-icon-theme
101
102         >=gnome-extra/nemo-4.0
103         >=gnome-extra/cinnamon-control-center-4.0
104         >=gnome-extra/cinnamon-screensaver-4.0
105
106         gnome-extra/polkit-gnome
107
108         nls? ( >=gnome-extra/cinnamon-translations-4.0 )
109 "
110 DEPEND="${COMMON_DEPEND}
111         $(python_gen_cond_dep 'dev-python/polib[${PYTHON_USEDEP}]' 'python2*')
112         dev-util/gtk-doc
113         >=dev-util/intltool-0.4
114         >=sys-devel/gettext-0.17
115         virtual/pkgconfig
116         gnome-base/gnome-common
117         !!=dev-lang/spidermonkey-1.8.2*
118 "
119 # libmozjs.so is picked up from /usr/lib while compiling, so block at build-time
120 # https://bugs.gentoo.org/show_bug.cgi?id=360413
121
122 S="${WORKDIR}/Cinnamon-${PV}"
123
124 pkg_setup() {
125         python_setup
126 }
127
128 src_prepare() {
129         # Fix backgrounds path as cinnamon doesn't provide them
130         # https://github.com/linuxmint/Cinnamon/issues/3575
131         eapply "${FILESDIR}"/${PN}-3.8.0-gnome-background-compatibility.patch
132
133         # Use wheel group instead of sudo (from Fedora/Arch)
134         # https://github.com/linuxmint/Cinnamon/issues/3576
135         eapply "${FILESDIR}"/${PN}-3.6.6-wheel-sudo.patch
136
137         eapply -p0 "${FILESDIR}"/${PN}-4.0-fix-pillow-settings.patch
138
139         # Use pkexec instead of gksu (from Arch)
140         # https://github.com/linuxmint/Cinnamon/issues/3565
141         sed -i 's/gksu/pkexec/' files/usr/bin/cinnamon-settings-users || die
142
143         # Add polkit agent to required components (from Fedora/Arch), bug #523958
144         # https://github.com/linuxmint/Cinnamon/issues/3579
145         sed -i 's/RequiredComponents=\(.*\)$/RequiredComponents=\1polkit-gnome-authentication-agent-1;/' \
146                 files/usr/share/cinnamon-session/sessions/cinnamon*.session || die
147
148         # python 2-and-3 shebang fixing craziness
149         local p
150         python_setup 'python3*'
151         for p in $(grep -rl '#!.*python3'); do
152                 python_fix_shebang "${p}"
153         done
154
155         python_setup 'python2*'
156         for p in $(grep -rl '#!.*python[^3]'); do
157                 python_fix_shebang "${p}"
158         done
159
160         eautoreconf
161         gnome2_src_prepare
162 }
163
164 src_configure() {
165         gnome2_src_configure \
166                 --libdir="${EPREFIX}/usr/$(get_libdir)" \
167                 --with-ca-certificates="${EPREFIX}/etc/ssl/certs/ca-certificates.crt" \
168                 BROWSER_PLUGIN_DIR="${EPREFIX}/usr/$(get_libdir)/nsbrowser/plugins"
169 }
170
171 src_install() {
172         gnome2_src_install
173         python_optimize "${ED}"usr/$(get_libdir)/cinnamon-*
174
175         # Required for gnome-shell on hardened/PaX, bug #398941
176         pax-mark mr "${ED}usr/bin/cinnamon"
177
178         # Doesn't exist on Gentoo, causing this to be a dead symlink
179         rm -f "${ED}etc/xdg/menus/cinnamon-applications-merged" || die
180
181         # Ensure authentication-agent is started, bug #523958
182         # https://github.com/linuxmint/Cinnamon/issues/3579
183         insinto /etc/xdg/autostart/
184         doins "${FILESDIR}"/polkit-cinnamon-authentication-agent-1.desktop
185 }
186
187 pkg_postinst() {
188         gnome2_pkg_postinst
189
190         if ! has_version 'media-libs/gst-plugins-good:1.0' || \
191            ! has_version 'media-plugins/gst-plugins-vpx:1.0'; then
192                 ewarn "To make use of Cinnamon's built-in screen recording utility,"
193                 ewarn "you need to either install media-libs/gst-plugins-good:1.0"
194                 ewarn "and media-plugins/gst-plugins-vpx:1.0, or use dconf-editor to change"
195                 ewarn "org.cinnamon.recorder/pipeline to what you want to use."
196         fi
197
198         if ! has_version ">=x11-base/xorg-server-1.11"; then
199                 ewarn "If you use multiple screens, it is highly recommended that you"
200                 ewarn "upgrade to >=x11-base/xorg-server-1.11 to be able to make use of"
201                 ewarn "pointer barriers which will make it easier to use hot corners."
202         fi
203
204         if has_version "<x11-drivers/ati-drivers-12"; then
205                 ewarn "Cinnamon has been reported to show graphical corruption under"
206                 ewarn "x11-drivers/ati-drivers-11.*; you may want to switch to"
207                 ewarn "open-source drivers."
208         fi
209 }