Gentoo Archives: gentoo-commits

From: Jory Pratt <anarchy@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/musl:master commit in: net-misc/spice-gtk/files/, net-misc/spice-gtk/
Date: Wed, 08 Dec 2021 01:40:23
Message-Id: 1638927605.73bd49751f83e5423d405257713053b60d542b87.anarchy@gentoo
1 commit: 73bd49751f83e5423d405257713053b60d542b87
2 Author: Jory Pratt <anarchy <AT> gentoo <DOT> org>
3 AuthorDate: Wed Dec 8 01:40:05 2021 +0000
4 Commit: Jory Pratt <anarchy <AT> gentoo <DOT> org>
5 CommitDate: Wed Dec 8 01:40:05 2021 +0000
6 URL: https://gitweb.gentoo.org/proj/musl.git/commit/?id=73bd4975
7
8 net-misc/spice-gtk: we must use gthread for coroutine for musl users
9
10 Package-Manager: Portage-3.0.28, Repoman-3.0.3
11 Signed-off-by: Jory Pratt <anarchy <AT> gentoo.org>
12
13 net-misc/spice-gtk/Manifest | 1 +
14 net-misc/spice-gtk/files/README.gentoo | 14 +++
15 .../spice-gtk-0.37-adjust-to-window-scaling.patch | 132 +++++++++++++++++++++
16 .../spice-gtk-0.39-fix-finding-pyparsing.patch | 13 ++
17 net-misc/spice-gtk/metadata.xml | 18 +++
18 net-misc/spice-gtk/spice-gtk-0.39-r2.ebuild | 132 +++++++++++++++++++++
19 6 files changed, 310 insertions(+)
20
21 diff --git a/net-misc/spice-gtk/Manifest b/net-misc/spice-gtk/Manifest
22 new file mode 100644
23 index 00000000..5de07064
24 --- /dev/null
25 +++ b/net-misc/spice-gtk/Manifest
26 @@ -0,0 +1 @@
27 +DIST spice-gtk-0.39.tar.xz 845528 BLAKE2B c886c4c9f0e51d7f2bf6dbfe574f1a2bcab249f863cb7da1f009410572cdaa7a35ef98fc370a7e74f7e490ad3bfe8ffa832601f8bb0b0894b90ec1de76495ce9 SHA512 ff0f3ca6b10a2c415f2fa8d61464c5710aaa2a46c2c83909f146fa45f01151e756d9c3d79cb162dd3d0c1279b6ef55a67fc5c1266af2cb5b46ac1eaa0254c8d2
28
29 diff --git a/net-misc/spice-gtk/files/README.gentoo b/net-misc/spice-gtk/files/README.gentoo
30 new file mode 100644
31 index 00000000..e18b6d8e
32 --- /dev/null
33 +++ b/net-misc/spice-gtk/files/README.gentoo
34 @@ -0,0 +1,14 @@
35 +
36 +If you choose to enable the video streaming support of gstreamer,
37 +please try to install addtional gst-plugins which matching the video codecs
38 +
39 +One the client side:
40 + mjpeg,x264 media-plugins/gst-plugins-libav:1.0
41 + vpx media-plugins/gst-plugins-vpx:1.0
42 +
43 +One the server side (which app-emulation/qemu running), you should also install
44 +additional gstreamer plugins for the app-emulation/spice package:
45 + mjpeg media-plugins/gst-plugins-libav:1.0
46 + vpx media-plugins/gst-plugins-vpx:1.0
47 + x264 media-plugins/gst-plugins-x264:1.0
48 +
49
50 diff --git a/net-misc/spice-gtk/files/spice-gtk-0.37-adjust-to-window-scaling.patch b/net-misc/spice-gtk/files/spice-gtk-0.37-adjust-to-window-scaling.patch
51 new file mode 100644
52 index 00000000..504cb7c4
53 --- /dev/null
54 +++ b/net-misc/spice-gtk/files/spice-gtk-0.37-adjust-to-window-scaling.patch
55 @@ -0,0 +1,132 @@
56 +From 262c84081fbd3cfc3d92e6ae9a60a780549d6c2f Mon Sep 17 00:00:00 2001
57 +From: Snir Sheriber <ssheribe@××××××.com>
58 +Date: Thu, 28 Feb 2019 11:44:34 +0200
59 +Subject: [PATCH] Adjust to window scaling
60 +
61 +When GDK_SCALE is != 1 and egl is used, the image presented does not
62 +fit to the window (scale of 2 is often used with hidpi monitors).
63 +Usually this is not a problem since all components are adjusted by
64 +gdk/gtk but with egl, pixel-based data is not being scaled. In this
65 +case window's scale value can be used in order to determine whether
66 +to use a pixel resource with higher resolution data.
67 +
68 +In order to reproduce the problem set spice with virgl/Intel-vGPU
69 +and run spice-gtk with GDK_SCALE=2
70 +
71 +This issue was also reported at freedesktop gitlab repo:
72 +https://gitlab.freedesktop.org/spice/spice-gtk/issues/99
73 +
74 +Signed-off-by: Snir Sheriber <ssheribe@××××××.com>
75 +Acked-by: Victor Toso <victortoso@××××××.com>
76 +---
77 + src/spice-widget-egl.c | 7 ++++---
78 + src/spice-widget.c | 27 +++++++++++++++++++--------
79 + 2 files changed, 23 insertions(+), 11 deletions(-)
80 +
81 +diff --git a/src/spice-widget-egl.c b/src/spice-widget-egl.c
82 +index 43fccd7..7bae4e5 100644
83 +--- a/src/spice-widget-egl.c
84 ++++ b/src/spice-widget-egl.c
85 +@@ -360,9 +360,9 @@ gboolean spice_egl_realize_display(SpiceDisplay *display, GdkWindow *win, GError
86 + DISPLAY_DEBUG(display, "egl realize");
87 + if (!spice_widget_init_egl_win(display, win, err))
88 + return FALSE;
89 +-
90 +- spice_egl_resize_display(display, gdk_window_get_width(win),
91 +- gdk_window_get_height(win));
92 ++ gint scale_factor = gtk_widget_get_scale_factor(GTK_WIDGET(display));
93 ++ spice_egl_resize_display(display, gdk_window_get_width(win) * scale_factor,
94 ++ gdk_window_get_height(win) * scale_factor);
95 +
96 + return TRUE;
97 + }
98 +@@ -426,6 +426,7 @@ void spice_egl_unrealize_display(SpiceDisplay *display)
99 + #endif
100 + }
101 +
102 ++/* w and h should be adjusted to gdk scaling */
103 + G_GNUC_INTERNAL
104 + void spice_egl_resize_display(SpiceDisplay *display, int w, int h)
105 + {
106 +diff --git a/src/spice-widget.c b/src/spice-widget.c
107 +index 1f2a154..a9ba1f1 100644
108 +--- a/src/spice-widget.c
109 ++++ b/src/spice-widget.c
110 +@@ -1382,7 +1382,8 @@ static void set_egl_enabled(SpiceDisplay *display, bool enabled)
111 + }
112 +
113 + if (enabled && d->egl.context_ready) {
114 +- spice_egl_resize_display(display, d->ww, d->wh);
115 ++ gint scale_factor = gtk_widget_get_scale_factor(GTK_WIDGET(display));
116 ++ spice_egl_resize_display(display, d->ww * scale_factor, d->wh * scale_factor);
117 + }
118 +
119 + d->egl.enabled = enabled;
120 +@@ -1978,11 +1979,14 @@ static void transform_input(SpiceDisplay *display,
121 + SpiceDisplayPrivate *d = display->priv;
122 + int display_x, display_y, display_w, display_h;
123 + double is;
124 ++ gint scale_factor = 1;
125 +
126 + spice_display_get_scaling(display, NULL,
127 + &display_x, &display_y,
128 + &display_w, &display_h);
129 +-
130 ++ if (egl_enabled(d)) {
131 ++ scale_factor = gtk_widget_get_scale_factor(GTK_WIDGET(display));
132 ++ }
133 + /* For input we need a different scaling factor in order to
134 + be able to reach the full width of a display. For instance, consider
135 + a display of 100 pixels showing in a window 10 pixels wide. The normal
136 +@@ -1998,7 +2002,7 @@ static void transform_input(SpiceDisplay *display,
137 + coordinates in the inverse direction (window -> display) as the fb size
138 + (display -> window).
139 + */
140 +- is = (double)(d->area.width-1) / (double)(display_w-1);
141 ++ is = ((double)(d->area.width-1) / (double)(display_w-1)) * scale_factor;
142 +
143 + window_x -= display_x;
144 + window_y -= display_y;
145 +@@ -2183,8 +2187,10 @@ static void size_allocate(GtkWidget *widget, GtkAllocation *conf, gpointer data)
146 + d->wh = conf->height;
147 + recalc_geometry(widget);
148 + #if HAVE_EGL
149 +- if (egl_enabled(d))
150 +- spice_egl_resize_display(display, conf->width, conf->height);
151 ++ if (egl_enabled(d)) {
152 ++ gint scale_factor = gtk_widget_get_scale_factor(widget);
153 ++ spice_egl_resize_display(display, conf->width * scale_factor, conf->height * scale_factor);
154 ++ }
155 + #endif
156 + }
157 +
158 +@@ -2942,10 +2948,14 @@ void spice_display_get_scaling(SpiceDisplay *display,
159 + int ww, wh;
160 + int x, y, w, h;
161 + double s;
162 ++ gint scale_factor = 1;
163 +
164 + if (gtk_widget_get_realized (GTK_WIDGET(display))) {
165 +- ww = gtk_widget_get_allocated_width(GTK_WIDGET(display));
166 +- wh = gtk_widget_get_allocated_height(GTK_WIDGET(display));
167 ++ if (egl_enabled(d)) {
168 ++ scale_factor = gtk_widget_get_scale_factor(GTK_WIDGET(display));
169 ++ }
170 ++ ww = gtk_widget_get_allocated_width(GTK_WIDGET(display)) * scale_factor;
171 ++ wh = gtk_widget_get_allocated_height(GTK_WIDGET(display)) * scale_factor;
172 + } else {
173 + ww = fbw;
174 + wh = fbh;
175 +@@ -3091,7 +3101,8 @@ void spice_display_widget_gl_scanout(SpiceDisplay *display)
176 + g_clear_error(&err);
177 + }
178 +
179 +- spice_egl_resize_display(display, d->ww, d->wh);
180 ++ gint scale_factor = gtk_widget_get_scale_factor(GTK_WIDGET(display));
181 ++ spice_egl_resize_display(display, d->ww * scale_factor, d->wh * scale_factor);
182 + }
183 + #endif
184 +
185 +--
186 +2.21.0
187 +
188
189 diff --git a/net-misc/spice-gtk/files/spice-gtk-0.39-fix-finding-pyparsing.patch b/net-misc/spice-gtk/files/spice-gtk-0.39-fix-finding-pyparsing.patch
190 new file mode 100644
191 index 00000000..9a3cdd09
192 --- /dev/null
193 +++ b/net-misc/spice-gtk/files/spice-gtk-0.39-fix-finding-pyparsing.patch
194 @@ -0,0 +1,13 @@
195 +https://gitlab.freedesktop.org/spice/spice-common/-/issues/5
196 +https://bugs.gentoo.org/820074
197 +--- a/subprojects/spice-common/meson.build
198 ++++ b/subprojects/spice-common/meson.build
199 +@@ -132,7 +132,7 @@ if spice_common_generate_client_code or spice_common_generate_server_code
200 + if get_option('python-checks')
201 + foreach module : ['six', 'pyparsing']
202 + message('Checking for python module @0@'.format(module))
203 +- cmd = run_command(python, '-m', module)
204 ++ cmd = run_command(python, '-c', 'import @0@'.format(module))
205 + if cmd.returncode() != 0
206 + error('Python module @0@ not found'.format(module))
207 + endif
208
209 diff --git a/net-misc/spice-gtk/metadata.xml b/net-misc/spice-gtk/metadata.xml
210 new file mode 100644
211 index 00000000..8ad630bb
212 --- /dev/null
213 +++ b/net-misc/spice-gtk/metadata.xml
214 @@ -0,0 +1,18 @@
215 +<?xml version="1.0" encoding="UTF-8"?>
216 +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
217 +<pkgmetadata>
218 + <maintainer type="project">
219 + <email>virtualization@g.o</email>
220 + <name>Gentoo Virtualization Project</name>
221 + </maintainer>
222 + <use>
223 + <flag name="gtk3">Build the spice client (spicy), requires <pkg>x11-libs/gtk+</pkg>:3</flag>
224 + <flag name="policykit">Enable <pkg>sys-auth/polkit</pkg> support for the
225 + usbredir acl helper</flag>
226 + <flag name="usbredir">Use <pkg>sys-apps/usbredir</pkg> to redirect USB
227 + devices to another machine over TCP</flag>
228 + <flag name="mjpeg">Enable builtin mjpeg video decoder</flag>
229 + <flag name="webdav">Support for folder-sharing between guest and client
230 + using <pkg>net-libs/phodav</pkg></flag>
231 + </use>
232 +</pkgmetadata>
233
234 diff --git a/net-misc/spice-gtk/spice-gtk-0.39-r2.ebuild b/net-misc/spice-gtk/spice-gtk-0.39-r2.ebuild
235 new file mode 100644
236 index 00000000..6dea41b3
237 --- /dev/null
238 +++ b/net-misc/spice-gtk/spice-gtk-0.39-r2.ebuild
239 @@ -0,0 +1,132 @@
240 +# Copyright 1999-2021 Gentoo Authors
241 +# Distributed under the terms of the GNU General Public License v2
242 +
243 +EAPI=7
244 +
245 +VALA_MIN_API_VERSION="0.14"
246 +VALA_USE_DEPEND="vapigen"
247 +
248 +PYTHON_COMPAT=( python3_{7..9} )
249 +
250 +inherit desktop meson python-any-r1 readme.gentoo-r1 vala xdg-utils
251 +
252 +DESCRIPTION="Set of GObject and Gtk objects for connecting to Spice servers and a client GUI"
253 +HOMEPAGE="https://www.spice-space.org https://cgit.freedesktop.org/spice/spice-gtk/"
254 +
255 +LICENSE="LGPL-2.1"
256 +SLOT="0"
257 +SRC_URI="https://www.spice-space.org/download/gtk/${P}.tar.xz"
258 +KEYWORDS="~alpha amd64 ~arm ~arm64 ~ia64 ~ppc ~ppc64 ~sparc x86"
259 +IUSE="+gtk3 +introspection lz4 mjpeg policykit sasl smartcard usbredir vala wayland webdav"
260 +
261 +# TODO:
262 +# * check if sys-freebsd/freebsd-lib (from virtual/acl) provides acl/libacl.h
263 +# * use external pnp.ids as soon as that means not pulling in gnome-desktop
264 +RDEPEND="
265 + >=dev-libs/glib-2.46:2
266 + dev-libs/json-glib:0=
267 + media-libs/gst-plugins-base:1.0
268 + media-libs/gst-plugins-good:1.0
269 + media-libs/gstreamer:1.0[introspection?]
270 + media-libs/opus
271 + sys-libs/zlib
272 + virtual/jpeg:0=
273 + >=x11-libs/cairo-1.2
274 + >=x11-libs/pixman-0.17.7
275 + gtk3? ( x11-libs/gtk+:3[introspection?] )
276 + introspection? ( dev-libs/gobject-introspection )
277 + dev-libs/openssl:0=
278 + lz4? ( app-arch/lz4 )
279 + sasl? ( dev-libs/cyrus-sasl )
280 + smartcard? ( app-emulation/qemu[smartcard] )
281 + usbredir? (
282 + sys-apps/hwdata
283 + >=sys-apps/usbredir-0.4.2
284 + virtual/libusb:1
285 + policykit? (
286 + sys-apps/acl
287 + >=sys-auth/polkit-0.110-r1
288 + )
289 + )
290 + webdav? (
291 + net-libs/phodav:2.0
292 + >=net-libs/libsoup-2.49.91:2.4 )
293 +"
294 +# TODO: spice-gtk has an automagic dependency on x11-libs/libva without a
295 +# configure knob. The package is relatively lightweight so we just depend
296 +# on it unconditionally for now. It would be cleaner to transform this into
297 +# a USE="vaapi" conditional and patch the buildsystem...
298 +RDEPEND="${RDEPEND}
299 + amd64? ( x11-libs/libva:= )
300 + arm64? ( x11-libs/libva:= )
301 + x86? ( x11-libs/libva:= )
302 +"
303 +DEPEND="${RDEPEND}
304 + >=app-emulation/spice-protocol-0.14.3
305 + dev-perl/Text-CSV
306 + dev-util/glib-utils
307 + >=dev-util/gtk-doc-am-1.14
308 + >=dev-util/intltool-0.40.0
309 + >=sys-devel/gettext-0.17
310 + virtual/pkgconfig
311 + vala? ( $(vala_depend) )
312 +"
313 +
314 +BDEPEND="
315 + $(python_gen_any_dep '
316 + dev-python/six[${PYTHON_USEDEP}]
317 + dev-python/pyparsing[${PYTHON_USEDEP}]
318 + ')
319 +"
320 +
321 +PATCHES=(
322 + "${FILESDIR}"/${PN}-0.39-fix-finding-pyparsing.patch
323 +)
324 +
325 +python_check_deps() {
326 + has_version -b "dev-python/six[${PYTHON_USEDEP}]" &&
327 + has_version -b "dev-python/pyparsing[${PYTHON_USEDEP}]"
328 +}
329 +
330 +src_prepare() {
331 + default
332 + use vala && vala_src_prepare
333 +}
334 +
335 +src_configure() {
336 + local emesonargs=(
337 + $(meson_feature gtk3 gtk)
338 + $(meson_feature introspection)
339 + $(meson_use mjpeg builtin-mjpeg)
340 + $(meson_feature policykit polkit)
341 + $(meson_feature lz4)
342 + $(meson_feature sasl)
343 + $(meson_feature smartcard)
344 + $(meson_feature usbredir)
345 + $(meson_feature vala vapi)
346 + $(meson_feature webdav)
347 + $(meson_feature wayland wayland-protocols)
348 + )
349 +
350 + if use elibc_musl; then
351 + emesonargs+=(
352 + -Dcoroutine=gthread
353 + )
354 + fi
355 +
356 + if use usbredir; then
357 + emesonargs+=(
358 + -Dusb-acl-helper-dir=/usr/libexec
359 + -Dusb-ids-path="${EPREFIX}/usr/share/hwdata/usb.ids"
360 + )
361 + fi
362 +
363 + meson_src_configure
364 +}
365 +
366 +src_install() {
367 + meson_src_install
368 +
369 + make_desktop_entry spicy Spicy "utilities-terminal" "Network;RemoteAccess;"
370 + readme.gentoo_create_doc
371 +}