commit:     73bd49751f83e5423d405257713053b60d542b87
Author:     Jory Pratt <anarchy <AT> gentoo <DOT> org>
AuthorDate: Wed Dec  8 01:40:05 2021 +0000
Commit:     Jory Pratt <anarchy <AT> gentoo <DOT> org>
CommitDate: Wed Dec  8 01:40:05 2021 +0000
URL:        https://gitweb.gentoo.org/proj/musl.git/commit/?id=73bd4975

net-misc/spice-gtk: we must use gthread for coroutine for musl users

Package-Manager: Portage-3.0.28, Repoman-3.0.3
Signed-off-by: Jory Pratt <anarchy <AT> gentoo.org>

 net-misc/spice-gtk/Manifest                        |   1 +
 net-misc/spice-gtk/files/README.gentoo             |  14 +++
 .../spice-gtk-0.37-adjust-to-window-scaling.patch  | 132 +++++++++++++++++++++
 .../spice-gtk-0.39-fix-finding-pyparsing.patch     |  13 ++
 net-misc/spice-gtk/metadata.xml                    |  18 +++
 net-misc/spice-gtk/spice-gtk-0.39-r2.ebuild        | 132 +++++++++++++++++++++
 6 files changed, 310 insertions(+)

diff --git a/net-misc/spice-gtk/Manifest b/net-misc/spice-gtk/Manifest
new file mode 100644
index 00000000..5de07064
--- /dev/null
+++ b/net-misc/spice-gtk/Manifest
@@ -0,0 +1 @@
+DIST spice-gtk-0.39.tar.xz 845528 BLAKE2B 
c886c4c9f0e51d7f2bf6dbfe574f1a2bcab249f863cb7da1f009410572cdaa7a35ef98fc370a7e74f7e490ad3bfe8ffa832601f8bb0b0894b90ec1de76495ce9
 SHA512 
ff0f3ca6b10a2c415f2fa8d61464c5710aaa2a46c2c83909f146fa45f01151e756d9c3d79cb162dd3d0c1279b6ef55a67fc5c1266af2cb5b46ac1eaa0254c8d2

diff --git a/net-misc/spice-gtk/files/README.gentoo 
b/net-misc/spice-gtk/files/README.gentoo
new file mode 100644
index 00000000..e18b6d8e
--- /dev/null
+++ b/net-misc/spice-gtk/files/README.gentoo
@@ -0,0 +1,14 @@
+
+If you choose to enable the video streaming support of gstreamer,
+please try to install addtional gst-plugins which matching the video codecs
+
+One the client side:
+       mjpeg,x264      media-plugins/gst-plugins-libav:1.0
+       vpx             media-plugins/gst-plugins-vpx:1.0
+
+One the server side (which app-emulation/qemu running), you should also install
+additional gstreamer plugins for the app-emulation/spice package:
+       mjpeg           media-plugins/gst-plugins-libav:1.0
+       vpx             media-plugins/gst-plugins-vpx:1.0
+       x264            media-plugins/gst-plugins-x264:1.0
+

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
new file mode 100644
index 00000000..504cb7c4
--- /dev/null
+++ b/net-misc/spice-gtk/files/spice-gtk-0.37-adjust-to-window-scaling.patch
@@ -0,0 +1,132 @@
+From 262c84081fbd3cfc3d92e6ae9a60a780549d6c2f Mon Sep 17 00:00:00 2001
+From: Snir Sheriber <[email protected]>
+Date: Thu, 28 Feb 2019 11:44:34 +0200
+Subject: [PATCH] Adjust to window scaling
+
+When GDK_SCALE is != 1 and egl is used, the image presented does not
+fit to the window (scale of 2 is often used with hidpi monitors).
+Usually this is not a problem since all components are adjusted by
+gdk/gtk but with egl, pixel-based data is not being scaled. In this
+case window's scale value can be used in order to determine whether
+to use a pixel resource with higher resolution data.
+
+In order to reproduce the problem set spice with virgl/Intel-vGPU
+and run spice-gtk with GDK_SCALE=2
+
+This issue was also reported at freedesktop gitlab repo:
+https://gitlab.freedesktop.org/spice/spice-gtk/issues/99
+
+Signed-off-by: Snir Sheriber <[email protected]>
+Acked-by: Victor Toso <[email protected]>
+---
+ src/spice-widget-egl.c |  7 ++++---
+ src/spice-widget.c     | 27 +++++++++++++++++++--------
+ 2 files changed, 23 insertions(+), 11 deletions(-)
+
+diff --git a/src/spice-widget-egl.c b/src/spice-widget-egl.c
+index 43fccd7..7bae4e5 100644
+--- a/src/spice-widget-egl.c
++++ b/src/spice-widget-egl.c
+@@ -360,9 +360,9 @@ gboolean spice_egl_realize_display(SpiceDisplay *display, 
GdkWindow *win, GError
+     DISPLAY_DEBUG(display, "egl realize");
+     if (!spice_widget_init_egl_win(display, win, err))
+         return FALSE;
+-
+-    spice_egl_resize_display(display, gdk_window_get_width(win),
+-                             gdk_window_get_height(win));
++    gint scale_factor = gtk_widget_get_scale_factor(GTK_WIDGET(display));
++    spice_egl_resize_display(display, gdk_window_get_width(win) * 
scale_factor,
++                             gdk_window_get_height(win) * scale_factor);
+ 
+     return TRUE;
+ }
+@@ -426,6 +426,7 @@ void spice_egl_unrealize_display(SpiceDisplay *display)
+ #endif
+ }
+ 
++/* w and h should be adjusted to gdk scaling */
+ G_GNUC_INTERNAL
+ void spice_egl_resize_display(SpiceDisplay *display, int w, int h)
+ {
+diff --git a/src/spice-widget.c b/src/spice-widget.c
+index 1f2a154..a9ba1f1 100644
+--- a/src/spice-widget.c
++++ b/src/spice-widget.c
+@@ -1382,7 +1382,8 @@ static void set_egl_enabled(SpiceDisplay *display, bool 
enabled)
+     }
+ 
+     if (enabled && d->egl.context_ready) {
+-        spice_egl_resize_display(display, d->ww, d->wh);
++        gint scale_factor = gtk_widget_get_scale_factor(GTK_WIDGET(display));
++        spice_egl_resize_display(display, d->ww * scale_factor, d->wh * 
scale_factor);
+     }
+ 
+     d->egl.enabled = enabled;
+@@ -1978,11 +1979,14 @@ static void transform_input(SpiceDisplay *display,
+     SpiceDisplayPrivate *d = display->priv;
+     int display_x, display_y, display_w, display_h;
+     double is;
++    gint scale_factor = 1;
+ 
+     spice_display_get_scaling(display, NULL,
+                               &display_x, &display_y,
+                               &display_w, &display_h);
+-
++    if (egl_enabled(d)) {
++        scale_factor = gtk_widget_get_scale_factor(GTK_WIDGET(display));
++    }
+     /* For input we need a different scaling factor in order to
+        be able to reach the full width of a display. For instance, consider
+        a display of 100 pixels showing in a window 10 pixels wide. The normal
+@@ -1998,7 +2002,7 @@ static void transform_input(SpiceDisplay *display,
+        coordinates in the inverse direction (window -> display) as the fb size
+        (display -> window).
+     */
+-    is = (double)(d->area.width-1) / (double)(display_w-1);
++    is = ((double)(d->area.width-1) / (double)(display_w-1)) * scale_factor;
+ 
+     window_x -= display_x;
+     window_y -= display_y;
+@@ -2183,8 +2187,10 @@ static void size_allocate(GtkWidget *widget, 
GtkAllocation *conf, gpointer data)
+         d->wh = conf->height;
+         recalc_geometry(widget);
+ #if HAVE_EGL
+-        if (egl_enabled(d))
+-            spice_egl_resize_display(display, conf->width, conf->height);
++        if (egl_enabled(d)) {
++            gint scale_factor = gtk_widget_get_scale_factor(widget);
++            spice_egl_resize_display(display, conf->width * scale_factor, 
conf->height * scale_factor);
++        }
+ #endif
+     }
+ 
+@@ -2942,10 +2948,14 @@ void spice_display_get_scaling(SpiceDisplay *display,
+     int ww, wh;
+     int x, y, w, h;
+     double s;
++    gint scale_factor = 1;
+ 
+     if (gtk_widget_get_realized (GTK_WIDGET(display))) {
+-        ww = gtk_widget_get_allocated_width(GTK_WIDGET(display));
+-        wh = gtk_widget_get_allocated_height(GTK_WIDGET(display));
++        if (egl_enabled(d)) {
++            scale_factor = gtk_widget_get_scale_factor(GTK_WIDGET(display));
++        }
++        ww = gtk_widget_get_allocated_width(GTK_WIDGET(display)) * 
scale_factor;
++        wh = gtk_widget_get_allocated_height(GTK_WIDGET(display)) * 
scale_factor;
+     } else {
+         ww = fbw;
+         wh = fbh;
+@@ -3091,7 +3101,8 @@ void spice_display_widget_gl_scanout(SpiceDisplay 
*display)
+             g_clear_error(&err);
+         }
+ 
+-        spice_egl_resize_display(display, d->ww, d->wh);
++        gint scale_factor = gtk_widget_get_scale_factor(GTK_WIDGET(display));
++        spice_egl_resize_display(display, d->ww * scale_factor, d->wh * 
scale_factor);
+     }
+ #endif
+ 
+-- 
+2.21.0
+

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
new file mode 100644
index 00000000..9a3cdd09
--- /dev/null
+++ b/net-misc/spice-gtk/files/spice-gtk-0.39-fix-finding-pyparsing.patch
@@ -0,0 +1,13 @@
+https://gitlab.freedesktop.org/spice/spice-common/-/issues/5
+https://bugs.gentoo.org/820074
+--- a/subprojects/spice-common/meson.build
++++ b/subprojects/spice-common/meson.build
+@@ -132,7 +132,7 @@ if spice_common_generate_client_code or 
spice_common_generate_server_code
+   if get_option('python-checks')
+     foreach module : ['six', 'pyparsing']
+       message('Checking for python module @0@'.format(module))
+-      cmd = run_command(python, '-m', module)
++      cmd = run_command(python, '-c', 'import @0@'.format(module))
+       if cmd.returncode() != 0
+         error('Python module @0@ not found'.format(module))
+       endif

diff --git a/net-misc/spice-gtk/metadata.xml b/net-misc/spice-gtk/metadata.xml
new file mode 100644
index 00000000..8ad630bb
--- /dev/null
+++ b/net-misc/spice-gtk/metadata.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd";>
+<pkgmetadata>
+       <maintainer type="project">
+               <email>[email protected]</email>
+               <name>Gentoo Virtualization Project</name>
+       </maintainer>
+       <use>
+               <flag name="gtk3">Build the spice client (spicy), requires 
<pkg>x11-libs/gtk+</pkg>:3</flag>
+               <flag name="policykit">Enable <pkg>sys-auth/polkit</pkg> 
support for the
+                       usbredir acl helper</flag>
+               <flag name="usbredir">Use <pkg>sys-apps/usbredir</pkg> to 
redirect USB
+                       devices to another machine over TCP</flag>
+               <flag name="mjpeg">Enable builtin mjpeg video decoder</flag>
+               <flag name="webdav">Support for folder-sharing between guest 
and client
+                       using <pkg>net-libs/phodav</pkg></flag>
+       </use>
+</pkgmetadata>

diff --git a/net-misc/spice-gtk/spice-gtk-0.39-r2.ebuild 
b/net-misc/spice-gtk/spice-gtk-0.39-r2.ebuild
new file mode 100644
index 00000000..6dea41b3
--- /dev/null
+++ b/net-misc/spice-gtk/spice-gtk-0.39-r2.ebuild
@@ -0,0 +1,132 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+VALA_MIN_API_VERSION="0.14"
+VALA_USE_DEPEND="vapigen"
+
+PYTHON_COMPAT=( python3_{7..9} )
+
+inherit desktop meson python-any-r1 readme.gentoo-r1 vala xdg-utils
+
+DESCRIPTION="Set of GObject and Gtk objects for connecting to Spice servers 
and a client GUI"
+HOMEPAGE="https://www.spice-space.org 
https://cgit.freedesktop.org/spice/spice-gtk/";
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+SRC_URI="https://www.spice-space.org/download/gtk/${P}.tar.xz";
+KEYWORDS="~alpha amd64 ~arm ~arm64 ~ia64 ~ppc ~ppc64 ~sparc x86"
+IUSE="+gtk3 +introspection lz4 mjpeg policykit sasl smartcard usbredir vala 
wayland webdav"
+
+# TODO:
+# * check if sys-freebsd/freebsd-lib (from virtual/acl) provides acl/libacl.h
+# * use external pnp.ids as soon as that means not pulling in gnome-desktop
+RDEPEND="
+       >=dev-libs/glib-2.46:2
+       dev-libs/json-glib:0=
+       media-libs/gst-plugins-base:1.0
+       media-libs/gst-plugins-good:1.0
+       media-libs/gstreamer:1.0[introspection?]
+       media-libs/opus
+       sys-libs/zlib
+       virtual/jpeg:0=
+       >=x11-libs/cairo-1.2
+       >=x11-libs/pixman-0.17.7
+       gtk3? ( x11-libs/gtk+:3[introspection?] )
+       introspection? ( dev-libs/gobject-introspection )
+       dev-libs/openssl:0=
+       lz4? ( app-arch/lz4 )
+       sasl? ( dev-libs/cyrus-sasl )
+       smartcard? ( app-emulation/qemu[smartcard] )
+       usbredir? (
+               sys-apps/hwdata
+               >=sys-apps/usbredir-0.4.2
+               virtual/libusb:1
+               policykit? (
+                       sys-apps/acl
+                       >=sys-auth/polkit-0.110-r1
+               )
+       )
+       webdav? (
+               net-libs/phodav:2.0
+               >=net-libs/libsoup-2.49.91:2.4 )
+"
+# TODO: spice-gtk has an automagic dependency on x11-libs/libva without a
+# configure knob. The package is relatively lightweight so we just depend
+# on it unconditionally for now. It would be cleaner to transform this into
+# a USE="vaapi" conditional and patch the buildsystem...
+RDEPEND="${RDEPEND}
+       amd64? ( x11-libs/libva:= )
+       arm64? ( x11-libs/libva:= )
+       x86? ( x11-libs/libva:= )
+"
+DEPEND="${RDEPEND}
+       >=app-emulation/spice-protocol-0.14.3
+       dev-perl/Text-CSV
+       dev-util/glib-utils
+       >=dev-util/gtk-doc-am-1.14
+       >=dev-util/intltool-0.40.0
+       >=sys-devel/gettext-0.17
+       virtual/pkgconfig
+       vala? ( $(vala_depend) )
+"
+
+BDEPEND="
+       $(python_gen_any_dep '
+               dev-python/six[${PYTHON_USEDEP}]
+               dev-python/pyparsing[${PYTHON_USEDEP}]
+       ')
+"
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-0.39-fix-finding-pyparsing.patch
+)
+
+python_check_deps() {
+       has_version -b "dev-python/six[${PYTHON_USEDEP}]" &&
+       has_version -b "dev-python/pyparsing[${PYTHON_USEDEP}]"
+}
+
+src_prepare() {
+       default
+       use vala && vala_src_prepare
+}
+
+src_configure() {
+       local emesonargs=(
+               $(meson_feature gtk3 gtk)
+               $(meson_feature introspection)
+               $(meson_use mjpeg builtin-mjpeg)
+               $(meson_feature policykit polkit)
+               $(meson_feature lz4)
+               $(meson_feature sasl)
+               $(meson_feature smartcard)
+               $(meson_feature usbredir)
+               $(meson_feature vala vapi)
+               $(meson_feature webdav)
+               $(meson_feature wayland wayland-protocols)
+       )
+
+       if use elibc_musl; then
+               emesonargs+=(
+                       -Dcoroutine=gthread
+               )
+       fi
+
+       if use usbredir; then
+               emesonargs+=(
+                       -Dusb-acl-helper-dir=/usr/libexec
+                       -Dusb-ids-path="${EPREFIX}/usr/share/hwdata/usb.ids"
+               )
+       fi
+
+       meson_src_configure
+}
+
+src_install() {
+       meson_src_install
+
+       make_desktop_entry spicy Spicy "utilities-terminal" 
"Network;RemoteAccess;"
+       readme.gentoo_create_doc
+}

Reply via email to