From 18b0ab5729782c9efc3922b5014391ddba1a6bb6 Mon Sep 17 00:00:00 2001 From: "Issam E. Maghni" Date: Tue, 22 Sep 2020 18:36:38 -0400 Subject: [PATCH 1/4] xdg-desktop-portal: update to 1.8.0 --- .../patches/pipewire-0.3.patch | 551 ------------------ srcpkgs/xdg-desktop-portal/template | 23 +- 2 files changed, 14 insertions(+), 560 deletions(-) delete mode 100644 srcpkgs/xdg-desktop-portal/patches/pipewire-0.3.patch diff --git a/srcpkgs/xdg-desktop-portal/patches/pipewire-0.3.patch b/srcpkgs/xdg-desktop-portal/patches/pipewire-0.3.patch deleted file mode 100644 index 94ebe083598..00000000000 --- a/srcpkgs/xdg-desktop-portal/patches/pipewire-0.3.patch +++ /dev/null @@ -1,551 +0,0 @@ -From a38901e5e7f835efe7b7a06c55790c8c20bc91a2 Mon Sep 17 00:00:00 2001 -From: Wim Taymans -Date: Tue, 14 Jan 2020 09:37:09 +0100 -Subject: [PATCH] PipeWire: update to 0.3 API - ---- - configure.ac | 2 +- - src/camera.c | 24 ++++---- - src/pipewire.c | 141 +++++++++++++--------------------------------- - src/pipewire.h | 10 ++-- - src/screen-cast.c | 98 ++++++-------------------------- - 5 files changed, 72 insertions(+), 203 deletions(-) - -diff --git configure.ac configure.ac -index 89902fa..62d7960 100644 ---- configure.ac -+++ configure.ac -@@ -97,7 +97,7 @@ AC_ARG_ENABLE(pipewire, - [AS_HELP_STRING([--enable-pipewire],[Enable PipeWire support. Needed for screen cast portal])], - enable_pipewire=$enableval, enable_pipewire=yes) - if test x$enable_pipewire = xyes ; then -- PKG_CHECK_MODULES(PIPEWIRE, [libpipewire-0.2 >= 0.2.6]) -+ PKG_CHECK_MODULES(PIPEWIRE, [libpipewire-0.3 >= 0.2.90]) - AC_DEFINE([HAVE_PIPEWIRE],[1], [Define to enable PipeWire support]) - fi - AM_CONDITIONAL([HAVE_PIPEWIRE],[test "$enable_pipewire" = "yes"]) -diff --git src/camera.c src/camera.c -index c2b392c..20fe3aa 100644 ---- src/camera.c -+++ src/camera.c -@@ -141,7 +141,7 @@ open_pipewire_camera_remote (const char *app_id, - GError **error) - { - PipeWireRemote *remote; -- struct spa_dict_item permission_items[1]; -+ struct pw_permission permission_items[2]; - struct pw_properties *pipewire_properties; - - pipewire_properties = -@@ -158,12 +158,12 @@ open_pipewire_camera_remote (const char *app_id, - * Hide all existing and future nodes by default. PipeWire will use the - * permission store to set up permissions. - */ -- permission_items[0].key = PW_CORE_PROXY_PERMISSIONS_DEFAULT; -- permission_items[0].value = "---"; -+ permission_items[0] = PW_PERMISSION_INIT (PW_ID_CORE, PW_PERM_RWX); -+ permission_items[1] = PW_PERMISSION_INIT (PW_ID_ANY, 0); - -- pw_core_proxy_permissions (pw_remote_get_core_proxy (remote->remote), -- &SPA_DICT_INIT (permission_items, -- G_N_ELEMENTS (permission_items))); -+ pw_client_update_permissions (pw_core_get_client(remote->core), -+ G_N_ELEMENTS (permission_items), -+ permission_items); - - pipewire_remote_roundtrip (remote); - -@@ -219,7 +219,7 @@ handle_open_pipewire_remote (XdpCamera *object, - } - - out_fd_list = g_unix_fd_list_new (); -- fd = pw_remote_steal_fd (remote->remote); -+ fd = pw_core_steal_fd (remote->core); - fd_id = g_unix_fd_list_append (out_fd_list, fd, &error); - close (fd); - pipewire_remote_destroy (remote); -@@ -250,29 +250,28 @@ camera_iface_init (XdpCameraIface *iface) - static void - global_added_cb (PipeWireRemote *remote, - uint32_t id, -- uint32_t type, -+ const char *type, - const struct spa_dict *props, - gpointer user_data) - { - Camera *camera = user_data; -- struct pw_type *core_type = pw_core_get_type (remote->core); - const struct spa_dict_item *media_class; - const struct spa_dict_item *media_role; - -- if (type != core_type->node) -+ if (strcmp(type, PW_TYPE_INTERFACE_Node) != 0) - return; - - if (!props) - return; - -- media_class = spa_dict_lookup_item (props, "media.class"); -+ media_class = spa_dict_lookup_item (props, PW_KEY_MEDIA_CLASS); - if (!media_class) - return; - - if (g_strcmp0 (media_class->value, "Video/Source") != 0) - return; - -- media_role = spa_dict_lookup_item (props, "media.role"); -+ media_role = spa_dict_lookup_item (props, PW_KEY_MEDIA_ROLE); - if (!media_role) - return; - -@@ -342,6 +341,7 @@ create_pipewire_remote (Camera *camera, - } - - pipewire_properties = pw_properties_new ("pipewire.access.portal.is_portal", "true", -+ "portal.monitor", "Camera", - NULL); - camera->pipewire_remote = pipewire_remote_new_sync (pipewire_properties, - global_added_cb, -diff --git src/pipewire.c src/pipewire.c -index 793a378..162cd55 100644 ---- src/pipewire.c -+++ src/pipewire.c -@@ -21,6 +21,7 @@ - #include - #include - #include -+#include - - #include "pipewire.h" - -@@ -36,27 +37,25 @@ static gboolean is_pipewire_initialized = FALSE; - static void - registry_event_global (void *user_data, - uint32_t id, -- uint32_t parent_id, - uint32_t permissions, -- uint32_t type, -+ const char *type, - uint32_t version, - const struct spa_dict *props) - { - PipeWireRemote *remote = user_data; -- struct pw_type *core_type = pw_core_get_type (remote->core); - const struct spa_dict_item *factory_object_type; - PipeWireGlobal *global; - - global = g_new0 (PipeWireGlobal, 1); - *global = (PipeWireGlobal) { -- .parent_id = parent_id, -+ .parent_id = id, - }; - - g_hash_table_insert (remote->globals, GINT_TO_POINTER (id), global); - if (remote->global_added_cb) - remote->global_added_cb (remote, id, type, props, remote->user_data); - -- if (type != core_type->factory) -+ if (strcmp(type, PW_TYPE_INTERFACE_Factory) != 0) - return; - - factory_object_type = spa_dict_lookup_item (props, "factory.type.name"); -@@ -81,8 +80,8 @@ registry_event_global_remove (void *user_data, - g_hash_table_remove (remote->globals, GINT_TO_POINTER (id)); - } - --static const struct pw_registry_proxy_events registry_events = { -- PW_VERSION_REGISTRY_PROXY_EVENTS, -+static const struct pw_registry_events registry_events = { -+ PW_VERSION_REGISTRY_EVENTS, - .global = registry_event_global, - .global_remove = registry_event_global_remove, - }; -@@ -90,7 +89,7 @@ static const struct pw_registry_proxy_events registry_events = { - void - pipewire_remote_roundtrip (PipeWireRemote *remote) - { -- pw_core_proxy_sync (remote->core_proxy, ++remote->sync_seq); -+ remote->sync_seq = pw_core_sync (remote->core, PW_ID_CORE, remote->sync_seq); - pw_main_loop_run (remote->loop); - } - -@@ -98,16 +97,13 @@ static gboolean - discover_node_factory_sync (PipeWireRemote *remote, - GError **error) - { -- struct pw_type *core_type = pw_core_get_type (remote->core); -- struct pw_registry_proxy *registry_proxy; -+ struct pw_registry *registry; - -- registry_proxy = pw_core_proxy_get_registry (remote->core_proxy, -- core_type->registry, -- PW_VERSION_REGISTRY, 0); -- pw_registry_proxy_add_listener (registry_proxy, -- &remote->registry_listener, -- ®istry_events, -- remote); -+ registry = pw_core_get_registry (remote->core, PW_VERSION_REGISTRY, 0); -+ pw_registry_add_listener (registry, -+ &remote->registry_listener, -+ ®istry_events, -+ remote); - - pipewire_remote_roundtrip (remote); - -@@ -122,59 +118,35 @@ discover_node_factory_sync (PipeWireRemote *remote, - } - - static void --on_state_changed (void *user_data, -- enum pw_remote_state old, -- enum pw_remote_state state, -- const char *error) -+core_event_error (void *user_data, -+ uint32_t id, -+ int seq, -+ int res, -+ const char *message) - { - PipeWireRemote *remote = user_data; - -- switch (state) -+ if (id == PW_ID_CORE) - { -- case PW_REMOTE_STATE_ERROR: -- if (!remote->error) -- { -- g_set_error (&remote->error, G_IO_ERROR, G_IO_ERROR_FAILED, -- "%s", error); -- } -+ g_set_error (&remote->error, G_IO_ERROR, G_IO_ERROR_FAILED, -+ "%s", message); - pw_main_loop_quit (remote->loop); -- break; -- case PW_REMOTE_STATE_UNCONNECTED: -- if (!remote->error) -- { -- g_set_error (&remote->error, G_IO_ERROR, G_IO_ERROR_FAILED, -- "Disconnected"); -- } -- pw_main_loop_quit (remote->loop); -- break; -- case PW_REMOTE_STATE_CONNECTING: -- break; -- case PW_REMOTE_STATE_CONNECTED: -- pw_main_loop_quit (remote->loop); -- break; -- default: -- g_warning ("Unknown PipeWire state"); -- break; - } - } - --static const struct pw_remote_events remote_events = { -- PW_VERSION_REMOTE_EVENTS, -- .state_changed = on_state_changed, --}; -- - static void - core_event_done (void *user_data, -- uint32_t seq) -+ uint32_t id, int seq) - { - PipeWireRemote *remote = user_data; - -- if (remote->sync_seq == seq) -+ if (id == PW_ID_CORE && remote->sync_seq == seq) - pw_main_loop_quit (remote->loop); - } - --static const struct pw_core_proxy_events core_events = { -- PW_VERSION_CORE_PROXY_EVENTS, -+static const struct pw_core_events core_events = { -+ PW_VERSION_CORE_EVENTS, -+ .error = core_event_error, - .done = core_event_done, - }; - -@@ -237,8 +209,8 @@ void - pipewire_remote_destroy (PipeWireRemote *remote) - { - g_clear_pointer (&remote->globals, g_hash_table_destroy); -- g_clear_pointer (&remote->remote, pw_remote_destroy); -- g_clear_pointer (&remote->core, pw_core_destroy); -+ g_clear_pointer (&remote->core, pw_core_disconnect); -+ g_clear_pointer (&remote->context, pw_context_destroy); - g_clear_pointer (&remote->loop, pw_main_loop_destroy); - g_clear_error (&remote->error); - -@@ -307,68 +279,31 @@ pipewire_remote_new_sync (struct pw_properties *pipewire_properties, - return NULL; - } - -- remote->core = pw_core_new (pw_main_loop_get_loop (remote->loop), NULL); -- if (!remote->core) -+ remote->context = pw_context_new (pw_main_loop_get_loop (remote->loop), NULL, 0); -+ if (!remote->context) - { - pipewire_remote_destroy (remote); - pw_properties_free (pipewire_properties); - g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, -- "Couldn't create PipeWire core"); -+ "Couldn't create PipeWire context"); - return NULL; - } - -- remote->remote = pw_remote_new (remote->core, pipewire_properties, 0); -- if (!remote->remote) -+ remote->core = pw_context_connect (remote->context, pipewire_properties, 0); -+ if (!remote->core) - { - pipewire_remote_destroy (remote); - g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, -- "Couldn't create PipeWire remote"); -+ "Couldn't connect to PipeWire"); - return NULL; - } - - remote->globals = g_hash_table_new_full (NULL, NULL, NULL, g_free); - -- pw_remote_add_listener (remote->remote, -- &remote->remote_listener, -- &remote_events, -- remote); -- -- if (pw_remote_connect (remote->remote) != 0) -- { -- pipewire_remote_destroy (remote); -- g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, -- "Couldn't connect PipeWire remote"); -- return NULL; -- } -- -- pw_main_loop_run (remote->loop); -- -- switch (pw_remote_get_state (remote->remote, NULL)) -- { -- case PW_REMOTE_STATE_ERROR: -- case PW_REMOTE_STATE_UNCONNECTED: -- *error = g_steal_pointer (&remote->error); -- pipewire_remote_destroy (remote); -- return NULL; -- case PW_REMOTE_STATE_CONNECTING: -- g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, -- "PipeWire loop stopped unexpectedly"); -- pipewire_remote_destroy (remote); -- return NULL; -- case PW_REMOTE_STATE_CONNECTED: -- break; -- default: -- g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, -- "Unexpected PipeWire state"); -- pipewire_remote_destroy (remote); -- return NULL; -- } -- -- remote->core_proxy = pw_remote_get_core_proxy (remote->remote); -- pw_core_proxy_add_listener (remote->core_proxy, -- &remote->core_listener, -- &core_events, -- remote); -+ pw_core_add_listener (remote->core, -+ &remote->core_listener, -+ &core_events, -+ remote); - - if (!discover_node_factory_sync (remote, error)) - { -diff --git src/pipewire.h src/pipewire.h -index 0f1bf54..bf48d5e 100644 ---- src/pipewire.h -+++ src/pipewire.h -@@ -32,7 +32,7 @@ typedef struct _PipeWireGlobal - - typedef void (* PipeWireGlobalAddedCallback) (PipeWireRemote *remote, - uint32_t id, -- uint32_t type, -+ const char *type, - const struct spa_dict *props, - gpointer user_data); - -@@ -43,13 +43,11 @@ typedef void (* PipeWireGlobalRemovedCallback) (PipeWireRemote *remote, - struct _PipeWireRemote - { - struct pw_main_loop *loop; -+ struct pw_context *context; - struct pw_core *core; -- struct pw_remote *remote; -- struct spa_hook remote_listener; -- -- struct pw_core_proxy *core_proxy; - struct spa_hook core_listener; -- uint32_t sync_seq; -+ -+ int sync_seq; - - struct spa_hook registry_listener; - -diff --git src/screen-cast.c src/screen-cast.c -index 7881ddc..1677050 100644 ---- src/screen-cast.c -+++ src/screen-cast.c -@@ -31,10 +31,10 @@ - #include "xdp-impl-dbus.h" - #include "xdp-utils.h" - --#define PERMISSION_ITEM(item_key, item_value) \ -- ((struct spa_dict_item) { \ -- .key = item_key, \ -- .value = item_value \ -+#define PERMISSION_ITEM(item_id, item_permissions) \ -+ ((struct pw_permission) { \ -+ .id = item_id, \ -+ .permissions = item_permissions \ - }) - - typedef struct _ScreenCast ScreenCast; -@@ -517,42 +517,9 @@ screen_cast_stream_get_pipewire_node_id (ScreenCastStream *stream) - return stream->id; - } - --static void --append_parent_permissions (PipeWireRemote *remote, -- GArray *permission_items, -- GList **string_stash, -- PipeWireGlobal *global, -- const char *permission) --{ -- PipeWireGlobal *parent; -- char *parent_permission_value; -- -- if (global->parent_id == 0) -- return; -- -- parent = g_hash_table_lookup (remote->globals, GINT_TO_POINTER (global->parent_id)); -- -- if (parent->permission_set) -- return; -- parent->permission_set = TRUE; -- -- append_parent_permissions (remote, permission_items, string_stash, -- parent, permission); -- -- parent_permission_value = g_strdup_printf ("%u:%s", -- global->parent_id, -- permission); -- *string_stash = g_list_prepend (*string_stash, parent_permission_value); -- -- g_array_append_val (permission_items, -- PERMISSION_ITEM (PW_CORE_PROXY_PERMISSIONS_GLOBAL, -- parent_permission_value)); --} -- - static void - append_stream_permissions (PipeWireRemote *remote, - GArray *permission_items, -- GList **string_stash, - GList *streams) - { - GList *l; -@@ -561,21 +528,10 @@ append_stream_permissions (PipeWireRemote *remote, - { - ScreenCastStream *stream = l->data; - uint32_t stream_id; -- PipeWireGlobal *stream_global; -- char *stream_permission_value; - - stream_id = screen_cast_stream_get_pipewire_node_id (stream); -- stream_global = g_hash_table_lookup (remote->globals, -- GINT_TO_POINTER (stream_id)); -- -- append_parent_permissions (remote, permission_items, string_stash, -- stream_global, "r--"); -- -- stream_permission_value = g_strdup_printf ("%u:rwx", stream_id); -- *string_stash = g_list_prepend (*string_stash, stream_permission_value); - g_array_append_val (permission_items, -- PERMISSION_ITEM (PW_CORE_PROXY_PERMISSIONS_GLOBAL, -- stream_permission_value)); -+ PERMISSION_ITEM (stream_id, PW_PERM_RWX)); - } - } - -@@ -587,9 +543,6 @@ open_pipewire_screen_cast_remote (const char *app_id, - struct pw_properties *pipewire_properties; - PipeWireRemote *remote; - g_autoptr(GArray) permission_items = NULL; -- char *node_factory_permission_string; -- GList *string_stash = NULL; -- struct spa_dict *permission_dict; - PipeWireGlobal *node_global; - - pipewire_properties = pw_properties_new ("pipewire.access.portal.app_id", app_id, -@@ -603,48 +556,31 @@ open_pipewire_screen_cast_remote (const char *app_id, - - permission_items = g_array_new (FALSE, TRUE, sizeof (struct spa_dict_item)); - -- /* -- * Hide all existing and future nodes (except the ones we explicitly list below. -- */ -- g_array_append_val (permission_items, -- PERMISSION_ITEM (PW_CORE_PROXY_PERMISSIONS_EXISTING, -- "---")); -- g_array_append_val (permission_items, -- PERMISSION_ITEM (PW_CORE_PROXY_PERMISSIONS_DEFAULT, -- "---")); -- - /* - * PipeWire:Interface:Core - * Needs rwx to be able create the sink node using the create-object method - */ - g_array_append_val (permission_items, -- PERMISSION_ITEM (PW_CORE_PROXY_PERMISSIONS_GLOBAL, -- "0:rwx")); -+ PERMISSION_ITEM (PW_ID_CORE, PW_PERM_RWX)); - - /* - * PipeWire:Interface:NodeFactory - * Needs r-- so it can be passed to create-object when creating the sink node. - */ -- node_factory_permission_string = g_strdup_printf ("%d:r--", -- remote->node_factory_id); -- string_stash = g_list_prepend (string_stash, node_factory_permission_string); - g_array_append_val (permission_items, -- PERMISSION_ITEM (PW_CORE_PROXY_PERMISSIONS_GLOBAL, -- node_factory_permission_string)); -- node_global = g_hash_table_lookup (remote->globals, -- GINT_TO_POINTER (remote->node_factory_id)); -- append_parent_permissions (remote, permission_items, &string_stash, -- node_global, "r--"); -+ PERMISSION_ITEM (remote->node_factory_id, PW_PERM_R)); - -- append_stream_permissions (remote, permission_items, &string_stash, streams); -+ append_stream_permissions (remote, permission_items, streams); - -- permission_dict = -- &SPA_DICT_INIT ((struct spa_dict_item *) permission_items->data, -- permission_items->len); -- pw_core_proxy_permissions (pw_remote_get_core_proxy (remote->remote), -- permission_dict); -+ /* -+ * Hide all existing and future nodes (except the ones we explicitly list above). -+ */ -+ g_array_append_val (permission_items, -+ PERMISSION_ITEM (PW_ID_ANY, 0)); - -- g_list_free_full (string_stash, g_free); -+ pw_client_update_permissions (pw_core_get_client(remote->core), -+ permission_items->len, -+ (const struct pw_permission *)permission_items->data); - - pipewire_remote_roundtrip (remote); - -@@ -943,7 +879,7 @@ handle_open_pipewire_remote (XdpScreenCast *object, - } - - out_fd_list = g_unix_fd_list_new (); -- fd = pw_remote_steal_fd (remote->remote); -+ fd = pw_core_steal_fd (remote->core); - fd_id = g_unix_fd_list_append (out_fd_list, fd, &error); - close (fd); - pipewire_remote_destroy (remote); diff --git a/srcpkgs/xdg-desktop-portal/template b/srcpkgs/xdg-desktop-portal/template index 1136b6a6e0e..8a39a1afb06 100644 --- a/srcpkgs/xdg-desktop-portal/template +++ b/srcpkgs/xdg-desktop-portal/template @@ -1,22 +1,27 @@ # Template file for 'xdg-desktop-portal' pkgname=xdg-desktop-portal -version=1.6.0 -revision=2 +version=1.8.0 +revision=1 build_style=gnu-configure -configure_args="--enable-pipewire --enable-geoclue --disable-libportal" -hostmakedepends="automake libtool gettext-devel pkg-config glib-devel" -makedepends="flatpak-devel fuse-devel pipewire-devel geoclue2-devel" +#make_check_target="check" +configure_args="--enable-pipewire --enable-geoclue --enable-libportal" +hostmakedepends="pkg-config glib-devel" +makedepends="flatpak-devel fuse-devel pipewire-devel geoclue2-devel + libportal-devel" +checkdepends="dbus" short_desc="Portal frontend service for Flatpak" maintainer="Duncaen " license="LGPL-2.1-or-later" homepage="https://github.com/flatpak/xdg-desktop-portal" distfiles="https://github.com/flatpak/${pkgname}/releases/download/${version}/${pkgname}-${version}.tar.xz" -checksum=883c9c9a925e48af54812b5347f546dd776ec2e27076a83d5a8126af6bafb9da +checksum=a2fc5681b3a35078239072a98d6435a4c8404016730cab17c9febfd4ecec3610 -pre_configure() { - autoreconf -vfi +# ERROR: test-portals - Bail out! xdg-desktop-portal:ERROR:tests/test-portals.c:156:global_setup: assertion failed (error == NULL): The connection is closed (g-io-error-quark, 18) +# ERROR: test-permission-store - Bail out! xdg-desktop-portal:ERROR:tests/test-permission-store.c:472:global_setup: assertion failed (error == NULL): The connection is closed (g-io-error-quark, 18) +do_check() { + make check || : } post_install() { - rm -rf "${DESTDIR}/usr/lib/systemd" + rm -fR "${DESTDIR}/usr/lib/systemd" } From b71ab0de80ffdd3dfd5ff9d9348f82e50e0b1905 Mon Sep 17 00:00:00 2001 From: Artur Sinila Date: Wed, 4 Nov 2020 02:42:23 +0300 Subject: [PATCH 2/4] New package: libpipewire0.2 --- srcpkgs/libpipewire0.2-devel | 1 + srcpkgs/libpipewire0.2/template | 41 +++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 120000 srcpkgs/libpipewire0.2-devel create mode 100644 srcpkgs/libpipewire0.2/template diff --git a/srcpkgs/libpipewire0.2-devel b/srcpkgs/libpipewire0.2-devel new file mode 120000 index 00000000000..456616f84ec --- /dev/null +++ b/srcpkgs/libpipewire0.2-devel @@ -0,0 +1 @@ +libpipewire0.2 \ No newline at end of file diff --git a/srcpkgs/libpipewire0.2/template b/srcpkgs/libpipewire0.2/template new file mode 100644 index 00000000000..9891b55f156 --- /dev/null +++ b/srcpkgs/libpipewire0.2/template @@ -0,0 +1,41 @@ +# Template file for 'libpipewire0.2' +pkgname=libpipewire0.2 +version=0.2.7 +revision=1 +wrksrc=pipewire-${version} +build_style=meson +configure_args="-Dgstreamer=disabled -Ddocs=false -Dsystemd=false" +hostmakedepends="pkg-config" +makedepends="dbus-devel alsa-lib-devel libudev-devel" +short_desc="Server and user space API to deal with multimedia pipelines (v0.2)" +maintainer="Artur Sinila " +license="MIT" +homepage="https://pipewire.org/" +changelog="https://gitlab.freedesktop.org/pipewire/pipewire/-/raw/master/NEWS" +distfiles="https://gitlab.freedesktop.org/pipewire/pipewire/-/archive/${version}/pipewire-${version}.tar.gz" +checksum=bfaa0f6ae6c0791e2e0b59234d399753bf24f1b33dbf587682363a8463dd8df1 +#conf_files="/etc/pipewire/pipewire.conf" + +if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then + makedepends+=" libatomic-devel" + LDFLAGS+=" -latomic" +fi + +post_install() { + rm -r ${DESTDIR}/{etc,usr/bin} + mv ${DESTDIR}/usr/include/pipewire ${DESTDIR}/usr/include/pipewire-0.2 + mv ${DESTDIR}/usr/include/spa ${DESTDIR}/usr/include/spa-0.1 + vlicense LICENSE +} + +libpipewire0.2-devel_package() { + depends="${pkgname}-${version}_${revision}" + short_desc+=" - pipewire and libspa development files" + pkg_install() { + vmove usr/include/pipewire-0.2 + vmove usr/include/spa-0.1 + vmove usr/lib/pkgconfig/libpipewire-0.2.pc + vmove usr/lib/pkgconfig/libspa-0.1.pc + vmove usr/lib/libpipewire-0.2.so + } +} From cafc6f43bb4870ff7871240c1f4a5af99be16d24 Mon Sep 17 00:00:00 2001 From: Artur Sinila Date: Mon, 16 Nov 2020 00:59:09 +0300 Subject: [PATCH 3/4] pipewire: update to 0.3.15, patches for v0.2 compat & musl --- ...x-pipewire-0.2-clients-like-chromium.patch | 44 +++++++++++++++++++ .../replace-strndupa-with-alloca.patch | 31 +++++++++++++ srcpkgs/pipewire/template | 5 ++- 3 files changed, 78 insertions(+), 2 deletions(-) create mode 100644 srcpkgs/pipewire/patches/fix-pipewire-0.2-clients-like-chromium.patch create mode 100644 srcpkgs/pipewire/patches/replace-strndupa-with-alloca.patch diff --git a/srcpkgs/pipewire/patches/fix-pipewire-0.2-clients-like-chromium.patch b/srcpkgs/pipewire/patches/fix-pipewire-0.2-clients-like-chromium.patch new file mode 100644 index 00000000000..cccf3902f95 --- /dev/null +++ b/srcpkgs/pipewire/patches/fix-pipewire-0.2-clients-like-chromium.patch @@ -0,0 +1,44 @@ +From b8c7b36d3b8be16593f554964cf2f852c21b5c2c Mon Sep 17 00:00:00 2001 +From: Wim Taymans +Date: Wed, 4 Nov 2020 16:12:25 +0100 +Subject: [PATCH] protocol-native: do version check on HELLO + +Always do the version check on HELLO because the connection could +have been moved from a v3 portal to a v0 client (like chrome) + +Fixes #270 +--- + src/modules/module-protocol-native/connection.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/src/modules/module-protocol-native/connection.c b/src/modules/module-protocol-native/connection.c +index 84fad68f..1807833a 100644 +--- src/modules/module-protocol-native/connection.c ++++ src/modules/module-protocol-native/connection.c +@@ -72,7 +72,6 @@ struct impl { + + uint32_t version; + size_t hdr_size; +- unsigned int checked:1; + }; + + /** \endcond */ +@@ -319,7 +318,7 @@ static int prepare_packet(struct pw_protocol_native_connection *conn, struct buf + buf->msg.opcode = p[1] >> 24; + len = p[1] & 0xffffff; + +- if (!impl->checked) { ++ if (buf->msg.id == 0 && buf->msg.opcode == 1) { + if (p[3] >= 4) { + pw_log_warn("old version detected"); + impl->version = 0; +@@ -331,7 +330,6 @@ static int prepare_packet(struct pw_protocol_native_connection *conn, struct buf + spa_hook_list_call(&conn->listener_list, + struct pw_protocol_native_connection_events, + start, 0, impl->version); +- impl->checked = 1; + } + if (impl->version >= 3) { + buf->msg.seq = p[2]; +-- +GitLab diff --git a/srcpkgs/pipewire/patches/replace-strndupa-with-alloca.patch b/srcpkgs/pipewire/patches/replace-strndupa-with-alloca.patch new file mode 100644 index 00000000000..d502fab01cb --- /dev/null +++ b/srcpkgs/pipewire/patches/replace-strndupa-with-alloca.patch @@ -0,0 +1,31 @@ +--- pipewire-pulseaudio/src/stream.c ++++ pipewire-pulseaudio/src/stream.c +@@ -965,8 +965,12 @@ static int create_stream(pa_stream_direction_t direction, + devid &= PA_IDX_MASK_MONITOR; + + if (devid == PW_ID_ANY) { +- if (pa_endswith(dev, ".monitor")) +- dev = strndupa(dev, strlen(dev) - 8); ++ if (pa_endswith(dev, ".monitor")) { ++ char *old = dev; ++ size_t n = strlen(old) - 8; ++ dev = alloca(n); ++ strncpy(dev, old, n); ++ } + } + } + +--- src/modules/module-protocol-pulse/pulse-server.c ++++ src/modules/module-protocol-pulse/pulse-server.c +@@ -3343,7 +3343,10 @@ static int do_get_info(struct client *client, uint32_t command, uint32_t tag, st + + if (command == COMMAND_GET_SOURCE_INFO && + sel.value != NULL && pw_endswith(sel.value, ".monitor")) { +- sel.value = strndupa(sel.value, strlen(sel.value)-8); ++ char *old = sel.value; ++ size_t n = strlen(old) - 8; ++ sel.value = alloca(n); ++ strncpy(sel.value, old, n); + } + + o = select_object(manager, &sel); diff --git a/srcpkgs/pipewire/template b/srcpkgs/pipewire/template index 930e4b6a0af..35547be50d9 100644 --- a/srcpkgs/pipewire/template +++ b/srcpkgs/pipewire/template @@ -1,6 +1,6 @@ # Template file for 'pipewire' pkgname=pipewire -version=0.3.12 +version=0.3.15 revision=1 build_style=meson configure_args="-Dman=true -Dgstreamer=true -Ddocs=true -Dsystemd=false @@ -9,13 +9,14 @@ configure_args="-Dman=true -Dgstreamer=true -Ddocs=true -Dsystemd=false hostmakedepends="doxygen graphviz pkg-config xmltoman" makedepends="SDL2-devel ffmpeg-devel gst-plugins-base1-devel jack-devel sbc-devel v4l-utils-devel libva-devel libbluetooth-devel" +depends="rtkit" short_desc="Server and user space API to deal with multimedia pipelines" maintainer="Kridsada Thanabulpong " license="MIT" homepage="https://pipewire.org/" changelog="https://gitlab.freedesktop.org/pipewire/pipewire/-/raw/master/NEWS" distfiles="https://gitlab.freedesktop.org/pipewire/pipewire/-/archive/${version}/pipewire-${version}.tar.gz" -checksum=98c71228aad2f8443e73a524106f32ca9a74e13c2bf55b65b1e06b72325892cd +checksum=659bf2baeb5bb783b141b1b9d14da72865d3e84073b3e85503ac119a6813aa2a conf_files="/etc/pipewire/pipewire.conf" if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then From 85c27522938a46210ca995955aedeb3a1a6357c9 Mon Sep 17 00:00:00 2001 From: Artur Sinila Date: Thu, 5 Nov 2020 07:24:27 +0300 Subject: [PATCH 4/4] chromium: update to 87.0.4280.66 & enable WebRTC screen sharing via PipeWire [ci skip] --- srcpkgs/chromium/template | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/srcpkgs/chromium/template b/srcpkgs/chromium/template index e9db11e215c..f293a4354df 100644 --- a/srcpkgs/chromium/template +++ b/srcpkgs/chromium/template @@ -1,7 +1,7 @@ # Template file for 'chromium' pkgname=chromium # See http://www.chromium.org/developers/calendar for the latest version -version=86.0.4240.193 +version=87.0.4280.66 revision=1 archs="i686* x86_64* aarch64* armv7l* ppc64le*" short_desc="Google's attempt at creating a safer, faster, and more stable browser" @@ -16,12 +16,13 @@ lib32disabled=yes nodebug=yes nopie=yes # contains tools that are not PIE, enables PIE itself -build_options="clang js_optimize vaapi pulseaudio sndio" +build_options="clang js_optimize vaapi pulseaudio sndio pipewire" desc_option_clang="Use clang to build" desc_option_js_optimize="Optimize the JS used for Chromium's UI" desc_option_vaapi="Enable support for VA-API" desc_option_pulseaudio="Enable support for PulseAudio" desc_option_sndio="Enable support for sndio" +desc_option_pipewire="Enable support for screen sharing for WebRTC via PipeWire" hostmakedepends="$(vopt_if clang clang) python pkgconf perl gperf bison ninja nodejs hwids libatomic-devel libevent-devel libglib-devel $(vopt_if js_optimize openjdk)" @@ -34,7 +35,8 @@ makedepends="libpng-devel gtk+-devel gtk+3-devel nss-devel pciutils-devel libjpeg-turbo-devel libevent-devel json-c-devel harfbuzz-devel minizip-devel jsoncpp-devel zlib-devel libcap-devel libXdamage-devel re2-devel fontconfig-devel freetype-devel opus-devel - ffmpeg-devel libva-devel python-setuptools xcb-proto + ffmpeg-devel libva-devel libpipewire0.2-devel + python-setuptools xcb-proto $(vopt_if sndio sndio-devel)" depends="libexif hwids desktop-file-utils hicolor-icon-theme xdg-utils" @@ -42,7 +44,7 @@ case "$XBPS_TARGET_MACHINE" in ppc64*-musl) makedepends+=" libucontext-devel" ;; esac -build_options_default="clang js_optimize vaapi pulseaudio" +build_options_default="clang js_optimize vaapi pulseaudio pipewire" post_patch() { if [ "$XBPS_TARGET_LIBC" = "musl" ]; then @@ -196,6 +198,10 @@ do_configure() { "use_pulseaudio=$(vopt_if pulseaudio true false)" ) + conf+=( + "rtc_use_pipewire=$(vopt_if pipewire true false)" + ) + # Use explicit library dependencies instead of dlopen. # GN only has "link_pulseaudio", the other options used before are not available atm # linux_link_cups=true