git: ca9744daf326 - main - www/*chromium: enable PipeWire for screen sharing on Wayland

From: Jan Beich <jbeich_at_FreeBSD.org>
Date: Fri, 18 Aug 2023 21:02:39 UTC
The branch main has been updated by jbeich:

URL: https://cgit.FreeBSD.org/ports/commit/?id=ca9744daf3266b182a330b3fcbd4d6d5f85a6e22

commit ca9744daf3266b182a330b3fcbd4d6d5f85a6e22
Author:     Jan Beich <jbeich@FreeBSD.org>
AuthorDate: 2023-01-02 07:06:47 +0000
Commit:     Jan Beich <jbeich@FreeBSD.org>
CommitDate: 2023-08-18 21:00:52 +0000

    www/*chromium: enable PipeWire for screen sharing on Wayland
    
    PR:             268726
    Approved by:    maintainer timeout (7 months)
---
 www/chromium/Makefile                                      | 13 +++++++++++--
 ...c_modules_desktop__capture_linux_wayland_egl__dmabuf.cc | 14 ++++++++++++++
 www/iridium/Makefile                                       | 14 +++++++++++---
 ...c_modules_desktop__capture_linux_wayland_egl__dmabuf.cc | 14 ++++++++++++++
 www/ungoogled-chromium/Makefile                            | 13 +++++++++++--
 ...c_modules_desktop__capture_linux_wayland_egl__dmabuf.cc | 14 ++++++++++++++
 6 files changed, 75 insertions(+), 7 deletions(-)

diff --git a/www/chromium/Makefile b/www/chromium/Makefile
index c2c4d7e934e3..ceaa14ce2498 100644
--- a/www/chromium/Makefile
+++ b/www/chromium/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	chromium
 PORTVERSION=	116.0.5845.96
+PORTREVISION=	1
 CATEGORIES=	www wayland
 MASTER_SITES=	https://commondatastorage.googleapis.com/chromium-browser-official/ \
 		https://nerd.hu/distfiles/:external
@@ -137,8 +138,8 @@ GN_ARGS+=	google_api_key="AIzaSyBsp9n41JLW8jCokwn7vhoaMejDFRd1mp8"
 SUB_FILES=	chromium-browser.desktop chrome
 SUB_LIST+=	COMMENT="${COMMENT}"
 
-OPTIONS_DEFINE=		CODECS CUPS DEBUG DRIVER KERBEROS LTO TEST
-OPTIONS_DEFAULT=	CODECS CUPS DRIVER KERBEROS SNDIO
+OPTIONS_DEFINE=		CODECS CUPS DEBUG DRIVER KERBEROS LTO PIPEWIRE TEST
+OPTIONS_DEFAULT=	CODECS CUPS DRIVER KERBEROS PIPEWIRE SNDIO
 OPTIONS_EXCLUDE_aarch64=LTO
 OPTIONS_GROUP=		AUDIO
 OPTIONS_GROUP_AUDIO=	ALSA PULSEAUDIO SNDIO
@@ -192,6 +193,14 @@ LTO_VARS=		GN_ARGS+=use_thin_lto=true \
 LTO_VARS_OFF=		GN_ARGS+=use_thin_lto=false
 
 MIT_LIB_DEPENDS=	libkrb.so.3:security/krb5
+
+PIPEWIRE_DESC=		Screen capture via PipeWire
+PIPEWIRE_LIB_DEPENDS=	libpipewire-0.3.so:multimedia/pipewire
+PIPEWIRE_VARS=		GN_ARGS+=rtc_use_pipewire=true \
+			GN_ARGS+=rtc_link_pipewire=true
+PIPEWIRE_VARS_OFF=	GN_ARGS+=rtc_use_pipewire=false \
+			GN_ARGS+=rtc_link_pipewire=false
+
 PULSEAUDIO_LIB_DEPENDS=	libpulse.so:audio/pulseaudio
 PULSEAUDIO_VARS=	GN_ARGS+=use_pulseaudio=true
 PULSEAUDIO_VARS_OFF=	GN_ARGS+=use_pulseaudio=false
diff --git a/www/chromium/files/patch-third__party_webrtc_modules_desktop__capture_linux_wayland_egl__dmabuf.cc b/www/chromium/files/patch-third__party_webrtc_modules_desktop__capture_linux_wayland_egl__dmabuf.cc
new file mode 100644
index 000000000000..7f22e012c98a
--- /dev/null
+++ b/www/chromium/files/patch-third__party_webrtc_modules_desktop__capture_linux_wayland_egl__dmabuf.cc
@@ -0,0 +1,14 @@
+--- third_party/webrtc/modules/desktop_capture/linux/wayland/egl_dmabuf.cc.orig	2022-12-14 00:41:59 UTC
++++ third_party/webrtc/modules/desktop_capture/linux/wayland/egl_dmabuf.cc
+@@ -10,11 +10,9 @@
+ 
+ #include "modules/desktop_capture/linux/wayland/egl_dmabuf.h"
+ 
+-#include <asm/ioctl.h>
+ #include <dlfcn.h>
+ #include <fcntl.h>
+ #include <libdrm/drm_fourcc.h>
+-#include <linux/types.h>
+ #include <spa/param/video/format-utils.h>
+ #include <unistd.h>
+ #include <xf86drm.h>
diff --git a/www/iridium/Makefile b/www/iridium/Makefile
index c6cf786aeddd..afe9cde56158 100644
--- a/www/iridium/Makefile
+++ b/www/iridium/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	iridium
 PORTVERSION=	2023.07.115.1
-PORTREVISION=	2
+PORTREVISION=	3
 CATEGORIES=	www wayland
 MASTER_SITES=	https://downloads.iridiumbrowser.de/source/
 PKGNAMESUFFIX=	-browser
@@ -135,8 +135,8 @@ GN_BOOTSTRAP_FLAGS=	--no-clean --no-rebuild --skip-generate-buildfiles
 SUB_FILES=	iridium-browser.desktop iridium
 SUB_LIST+=	COMMENT="${COMMENT}"
 
-OPTIONS_DEFINE=		CODECS CUPS DEBUG KERBEROS LTO
-OPTIONS_DEFAULT=	CODECS CUPS KERBEROS SNDIO
+OPTIONS_DEFINE=		CODECS CUPS DEBUG KERBEROS LTO PIPEWIRE
+OPTIONS_DEFAULT=	CODECS CUPS KERBEROS PIPEWIRE SNDIO
 OPTIONS_EXCLUDE_aarch64=LTO
 OPTIONS_GROUP=		AUDIO
 OPTIONS_GROUP_AUDIO=	ALSA PULSEAUDIO SNDIO
@@ -186,6 +186,14 @@ LTO_VARS=		GN_ARGS+=use_thin_lto=true \
 LTO_VARS_OFF=		GN_ARGS+=use_thin_lto=false
 
 MIT_LIB_DEPENDS=	libkrb.so.3:security/krb5
+
+PIPEWIRE_DESC=		Screen capture via PipeWire
+PIPEWIRE_LIB_DEPENDS=	libpipewire-0.3.so:multimedia/pipewire
+PIPEWIRE_VARS=		GN_ARGS+=rtc_use_pipewire=true \
+			GN_ARGS+=rtc_link_pipewire=true
+PIPEWIRE_VARS_OFF=	GN_ARGS+=rtc_use_pipewire=false \
+			GN_ARGS+=rtc_link_pipewire=false
+
 PULSEAUDIO_LIB_DEPENDS=	libpulse.so:audio/pulseaudio
 PULSEAUDIO_VARS=	GN_ARGS+=use_pulseaudio=true
 PULSEAUDIO_VARS_OFF=	GN_ARGS+=use_pulseaudio=false
diff --git a/www/iridium/files/patch-third__party_webrtc_modules_desktop__capture_linux_wayland_egl__dmabuf.cc b/www/iridium/files/patch-third__party_webrtc_modules_desktop__capture_linux_wayland_egl__dmabuf.cc
new file mode 100644
index 000000000000..7f22e012c98a
--- /dev/null
+++ b/www/iridium/files/patch-third__party_webrtc_modules_desktop__capture_linux_wayland_egl__dmabuf.cc
@@ -0,0 +1,14 @@
+--- third_party/webrtc/modules/desktop_capture/linux/wayland/egl_dmabuf.cc.orig	2022-12-14 00:41:59 UTC
++++ third_party/webrtc/modules/desktop_capture/linux/wayland/egl_dmabuf.cc
+@@ -10,11 +10,9 @@
+ 
+ #include "modules/desktop_capture/linux/wayland/egl_dmabuf.h"
+ 
+-#include <asm/ioctl.h>
+ #include <dlfcn.h>
+ #include <fcntl.h>
+ #include <libdrm/drm_fourcc.h>
+-#include <linux/types.h>
+ #include <spa/param/video/format-utils.h>
+ #include <unistd.h>
+ #include <xf86drm.h>
diff --git a/www/ungoogled-chromium/Makefile b/www/ungoogled-chromium/Makefile
index 9f9c561cf300..511f244e36ec 100644
--- a/www/ungoogled-chromium/Makefile
+++ b/www/ungoogled-chromium/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	ungoogled-chromium
 PORTVERSION=	116.0.5845.96
+PORTREVISION=	1
 UGVERSION=	${DISTVERSION}-1
 CATEGORIES=	www wayland
 MASTER_SITES=	https://commondatastorage.googleapis.com/chromium-browser-official/ \
@@ -151,8 +152,8 @@ GN_BOOTSTRAP_FLAGS=	--no-clean --no-rebuild --skip-generate-buildfiles
 SUB_FILES=	ungoogled-chromium.desktop ungoogled-chromium
 SUB_LIST+=	COMMENT="${COMMENT}"
 
-OPTIONS_DEFINE=		CODECS CUPS DEBUG DRIVER KERBEROS LTO TEST
-OPTIONS_DEFAULT=	CODECS CUPS DRIVER KERBEROS SNDIO
+OPTIONS_DEFINE=		CODECS CUPS DEBUG DRIVER KERBEROS LTO PIPEWIRE TEST
+OPTIONS_DEFAULT=	CODECS CUPS DRIVER KERBEROS PIPEWIRE SNDIO
 OPTIONS_EXCLUDE_aarch64=LTO
 OPTIONS_GROUP=		AUDIO
 OPTIONS_GROUP_AUDIO=	ALSA PULSEAUDIO SNDIO
@@ -206,6 +207,14 @@ LTO_VARS=		GN_ARGS+=use_thin_lto=true \
 LTO_VARS_OFF=		GN_ARGS+=use_thin_lto=false
 
 MIT_LIB_DEPENDS=	libkrb.so.3:security/krb5
+
+PIPEWIRE_DESC=		Screen capture via PipeWire
+PIPEWIRE_LIB_DEPENDS=	libpipewire-0.3.so:multimedia/pipewire
+PIPEWIRE_VARS=		GN_ARGS+=rtc_use_pipewire=true \
+			GN_ARGS+=rtc_link_pipewire=true
+PIPEWIRE_VARS_OFF=	GN_ARGS+=rtc_use_pipewire=false \
+			GN_ARGS+=rtc_link_pipewire=false
+
 PULSEAUDIO_LIB_DEPENDS=	libpulse.so:audio/pulseaudio
 PULSEAUDIO_VARS=	GN_ARGS+=use_pulseaudio=true
 PULSEAUDIO_VARS_OFF=	GN_ARGS+=use_pulseaudio=false
diff --git a/www/ungoogled-chromium/files/patch-third__party_webrtc_modules_desktop__capture_linux_wayland_egl__dmabuf.cc b/www/ungoogled-chromium/files/patch-third__party_webrtc_modules_desktop__capture_linux_wayland_egl__dmabuf.cc
new file mode 100644
index 000000000000..7f22e012c98a
--- /dev/null
+++ b/www/ungoogled-chromium/files/patch-third__party_webrtc_modules_desktop__capture_linux_wayland_egl__dmabuf.cc
@@ -0,0 +1,14 @@
+--- third_party/webrtc/modules/desktop_capture/linux/wayland/egl_dmabuf.cc.orig	2022-12-14 00:41:59 UTC
++++ third_party/webrtc/modules/desktop_capture/linux/wayland/egl_dmabuf.cc
+@@ -10,11 +10,9 @@
+ 
+ #include "modules/desktop_capture/linux/wayland/egl_dmabuf.h"
+ 
+-#include <asm/ioctl.h>
+ #include <dlfcn.h>
+ #include <fcntl.h>
+ #include <libdrm/drm_fourcc.h>
+-#include <linux/types.h>
+ #include <spa/param/video/format-utils.h>
+ #include <unistd.h>
+ #include <xf86drm.h>