git: cdaa56f46ba7 - main - www/iridium: enable suppport for Wayland

From: Rene Ladan <rene_at_FreeBSD.org>
Date: Thu, 31 Mar 2022 12:17:11 UTC
The branch main has been updated by rene:

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

commit cdaa56f46ba7308278fc655f7467983a481502ee
Author:     Robert Nagy <robert@openbsd.org>
AuthorDate: 2022-03-31 12:16:32 +0000
Commit:     Rene Ladan <rene@FreeBSD.org>
CommitDate: 2022-03-31 12:16:48 +0000

    www/iridium: enable suppport for Wayland
---
 www/iridium/Makefile                               |  2 ++
 www/iridium/files/patch-build_config_ozone.gni     | 14 +++++------
 .../files/patch-third__party_wayland_features.gni  | 17 +++++++++++++
 ...ch-ui_events_keycodes_dom_keycode__converter.cc | 29 +++++++++++++++++++++-
 ...tch-ui_events_keycodes_dom_keycode__converter.h | 11 ++++++++
 5 files changed, 64 insertions(+), 9 deletions(-)

diff --git a/www/iridium/Makefile b/www/iridium/Makefile
index e89c8ce41d51..d60528c33260 100644
--- a/www/iridium/Makefile
+++ b/www/iridium/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	iridium
 PORTVERSION=	2022.03.99.1
+PORTREVISION=	1
 CATEGORIES=	www
 MASTER_SITES=	https://downloads.iridiumbrowser.de/source/
 PKGNAMESUFFIX=	-browser
@@ -106,6 +107,7 @@ GN_ARGS+=	clang_use_chrome_plugins=false \
 		use_system_freetype=false \
 		use_system_harfbuzz=true \
 		use_system_libjpeg=true \
+		use_system_wayland_scanner=true \
 		use_udev=false \
 		extra_cxxflags="${CXXFLAGS}" \
 		extra_ldflags="${LDFLAGS}"
diff --git a/www/iridium/files/patch-build_config_ozone.gni b/www/iridium/files/patch-build_config_ozone.gni
index 68386f36fa87..75e60dc7adf7 100644
--- a/www/iridium/files/patch-build_config_ozone.gni
+++ b/www/iridium/files/patch-build_config_ozone.gni
@@ -1,21 +1,19 @@
---- build/config/ozone.gni.orig	2022-03-28 18:11:04 UTC
+--- build/config/ozone.gni.orig	2022-03-31 09:38:28 UTC
 +++ build/config/ozone.gni
-@@ -91,9 +91,17 @@ declare_args() {
+@@ -91,7 +91,15 @@ declare_args() {
      } else if (is_chromeos_lacros) {
        ozone_platform = "wayland"
        ozone_platform_wayland = true
 -    } else if (is_linux) {
 +    } else if (is_linux && !is_bsd) {
-       ozone_platform = "x11"
-       ozone_platform_wayland = true
++      ozone_platform = "x11"
++      ozone_platform_wayland = true
 +      ozone_platform_x11 = true
 +    } else if (is_openbsd) {
 +      ozone_platform = "x11"
 +      ozone_platform_wayland = false
 +      ozone_platform_x11 = true
 +    } else if (is_freebsd) {
-+      ozone_platform = "x11"
-+      ozone_platform_wayland = false
+       ozone_platform = "x11"
+       ozone_platform_wayland = true
        ozone_platform_x11 = true
-     } else if (is_win) {
-       ozone_platform = "windows"
diff --git a/www/iridium/files/patch-third__party_wayland_features.gni b/www/iridium/files/patch-third__party_wayland_features.gni
new file mode 100644
index 000000000000..654328e54f36
--- /dev/null
+++ b/www/iridium/files/patch-third__party_wayland_features.gni
@@ -0,0 +1,17 @@
+--- third_party/wayland/features.gni.orig	2022-03-31 09:38:28 UTC
++++ third_party/wayland/features.gni
+@@ -13,8 +13,12 @@ declare_args() {
+                           default_toolchain != "//build/toolchain/cros:target"
+ 
+   # Path to wayland-scanner. Has effect only when the system libwayland is used.
+-  assert(host_os == "linux")
+-  system_wayland_scanner_path = "/usr/bin/wayland-scanner"
++  assert(host_os == "linux" || host_os == "freebsd")
++  if (is_bsd) {
++    system_wayland_scanner_path = "/usr/local/bin/wayland-scanner"
++  } else {
++    system_wayland_scanner_path = "/usr/bin/wayland-scanner"
++  }
+ 
+   # This may be set by Chromium packagers who do not wish to use the bundled
+   # wayland scanner.
diff --git a/www/iridium/files/patch-ui_events_keycodes_dom_keycode__converter.cc b/www/iridium/files/patch-ui_events_keycodes_dom_keycode__converter.cc
index b79b1ef3f8f7..aca72b59d75d 100644
--- a/www/iridium/files/patch-ui_events_keycodes_dom_keycode__converter.cc
+++ b/www/iridium/files/patch-ui_events_keycodes_dom_keycode__converter.cc
@@ -1,5 +1,14 @@
---- ui/events/keycodes/dom/keycode_converter.cc.orig	2022-03-28 18:11:04 UTC
+--- ui/events/keycodes/dom/keycode_converter.cc.orig	2022-03-31 09:38:28 UTC
 +++ ui/events/keycodes/dom/keycode_converter.cc
+@@ -11,7 +11,7 @@
+ #include "ui/events/keycodes/dom/dom_code.h"
+ #include "ui/events/keycodes/dom/dom_key.h"
+ 
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FREEBSD)
+ #include <linux/input.h>
+ #endif
+ 
 @@ -24,7 +24,7 @@ namespace {
  #if BUILDFLAG(IS_WIN)
  #define DOM_CODE(usb, evdev, xkb, win, mac, code, id) \
@@ -9,3 +18,21 @@
  #define DOM_CODE(usb, evdev, xkb, win, mac, code, id) \
    { usb, xkb, code }
  #elif BUILDFLAG(IS_APPLE)
+@@ -67,7 +67,7 @@ struct DomKeyMapEntry {
+ #undef DOM_KEY_MAP
+ #undef DOM_KEY_UNI
+ 
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FREEBSD)
+ 
+ // The offset between XKB Keycode and evdev code.
+ constexpr int kXkbKeycodeOffset = 8;
+@@ -148,7 +148,7 @@ int KeycodeConverter::DomCodeToNativeKeycode(DomCode c
+   return UsbKeycodeToNativeKeycode(static_cast<uint32_t>(code));
+ }
+ 
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FREEBSD)
+ // static
+ DomCode KeycodeConverter::XkbKeycodeToDomCode(uint32_t xkb_keycode) {
+   // Currently XKB keycode is the native keycode.
diff --git a/www/iridium/files/patch-ui_events_keycodes_dom_keycode__converter.h b/www/iridium/files/patch-ui_events_keycodes_dom_keycode__converter.h
new file mode 100644
index 000000000000..28ab75435bc5
--- /dev/null
+++ b/www/iridium/files/patch-ui_events_keycodes_dom_keycode__converter.h
@@ -0,0 +1,11 @@
+--- ui/events/keycodes/dom/keycode_converter.h.orig	2022-03-31 09:38:28 UTC
++++ ui/events/keycodes/dom/keycode_converter.h
+@@ -63,7 +63,7 @@ class KeycodeConverter {
+   // Convert a DomCode into a native keycode.
+   static int DomCodeToNativeKeycode(DomCode code);
+ 
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FREEBSD)
+   // Convert a XKB keycode into a DomCode.
+   static DomCode XkbKeycodeToDomCode(uint32_t xkb_keycode);
+