git: 8fc70d7e9054 - main - www/chromium: enable support for Wayland

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

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

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

    www/chromium: enable support for Wayland
---
 www/chromium/Makefile                              |  2 ++
 www/chromium/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/chromium/Makefile b/www/chromium/Makefile
index 34b4f0f659c3..eaa5b232ef93 100644
--- a/www/chromium/Makefile
+++ b/www/chromium/Makefile
@@ -2,6 +2,7 @@
 
 PORTNAME=	chromium
 PORTVERSION=	100.0.4896.60
+PORTREVISION=	1
 CATEGORIES=	www
 MASTER_SITES=	https://commondatastorage.googleapis.com/chromium-browser-official/ \
 		https://nerd.hu/distfiles/:fonts
@@ -108,6 +109,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/chromium/files/patch-build_config_ozone.gni b/www/chromium/files/patch-build_config_ozone.gni
index 97366e428630..26cc1361547f 100644
--- a/www/chromium/files/patch-build_config_ozone.gni
+++ b/www/chromium/files/patch-build_config_ozone.gni
@@ -1,21 +1,19 @@
---- build/config/ozone.gni.orig	2022-02-07 13:39:41 UTC
+--- build/config/ozone.gni.orig	2022-03-31 09:33:37 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/chromium/files/patch-third__party_wayland_features.gni b/www/chromium/files/patch-third__party_wayland_features.gni
new file mode 100644
index 000000000000..bf1ec10baf80
--- /dev/null
+++ b/www/chromium/files/patch-third__party_wayland_features.gni
@@ -0,0 +1,17 @@
+--- third_party/wayland/features.gni.orig	2022-03-31 09:33:37 UTC
++++ third_party/wayland/features.gni
+@@ -13,8 +13,13 @@ 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")
++  assert(host_os == "linux" || host_os == "freebsd")
+   system_wayland_scanner_path = "/usr/bin/wayland-scanner"
++  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/chromium/files/patch-ui_events_keycodes_dom_keycode__converter.cc b/www/chromium/files/patch-ui_events_keycodes_dom_keycode__converter.cc
index bb40cb5171b0..b2b3317b8a18 100644
--- a/www/chromium/files/patch-ui_events_keycodes_dom_keycode__converter.cc
+++ b/www/chromium/files/patch-ui_events_keycodes_dom_keycode__converter.cc
@@ -1,5 +1,14 @@
---- ui/events/keycodes/dom/keycode_converter.cc.orig	2022-02-28 16:54:41 UTC
+--- ui/events/keycodes/dom/keycode_converter.cc.orig	2022-03-31 09:33:37 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)
+@@ -58,7 +58,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;
+@@ -139,7 +139,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/chromium/files/patch-ui_events_keycodes_dom_keycode__converter.h b/www/chromium/files/patch-ui_events_keycodes_dom_keycode__converter.h
new file mode 100644
index 000000000000..ced3f885b636
--- /dev/null
+++ b/www/chromium/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:33:37 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);
+