<commit_before>From fe811323fbe787264b15b83d027947926477f0c2 Mon Sep 17 00:00:00 2001
From: <NAME> <<EMAIL>>
Date: Fri, 17 Apr 2020 09:43:32 +0200
Subject: [PATCH] icu: use system library only targets

 - use bundled one for native/v8 internal builds

Complete system ICU library using requires ICU dev package
be installed on host. Enabling dependency on native package
is not enough due to V8 hosttools toolchain. V8 toolchain
is not using native sysroot, only a host packages.
On the other hand webenegine does not produce external
native artifacts. So external system ICU linking is not
needed.

Signed-off-by: <NAME> <<EMAIL>>
---
 src/3rdparty/chromium/third_party/icu/BUILD.gn | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/src/3rdparty/chromium/third_party/icu/BUILD.gn b/src/3rdparty/chromium/third_party/icu/BUILD.gn
index 97073f09787..5d293ca628d 100644
--- a/src/3rdparty/chromium/third_party/icu/BUILD.gn
+++ b/src/3rdparty/chromium/third_party/icu/BUILD.gn
@@ -7,9 +7,13 @@ import("//build/config/host_byteorder.gni")
 import("//build/config/linux/pkg_config.gni")
 import("//build/shim_headers.gni")
 import("//third_party/icu/config.gni")
+import("//v8/snapshot_toolchain.gni")
 
 declare_args() {
   use_system_icu = false
+
+  # Use only target icu library, when system using is enabled
+  use_system_icu_target_only = false
 }
 
 if (is_android) {
@@ -20,6 +24,12 @@ if (is_mac) {
   import("//build/config/sanitizers/sanitizers.gni")
 }
 
+if (use_system_icu) {
+  # Use system library only for target, otherwise use bundled
+  if ((current_toolchain != host_toolchain) && (current_toolchain != v8_snapshot_toolchain)) {
+    use_system_icu_target_only = true
+  }
+}
 # Meta target that includes both icuuc and icui18n. Most targets want both.
 # You can depend on the individually if you need to.
 group("icu") {
@@ -1137,7 +1147,7 @@ config("system_icu_config") {
   ]
 }
 
-if (use_system_icu) {<commit_msg>qtwebengine: Fix build by setting correct import path<commit_after>From fe811323fbe787264b15b83d027947926477f0c2 Mon Sep 17 00:00:00 2001
From: <NAME> <<EMAIL>>
Date: Fri, 17 Apr 2020 09:43:32 +0200
Subject: [PATCH] icu: use system library only targets

 - use bundled one for native/v8 internal builds

Complete system ICU library using requires ICU dev package
be installed on host. Enabling dependency on native package
is not enough due to V8 hosttools toolchain. V8 toolchain
is not using native sysroot, only a host packages.
On the other hand webenegine does not produce external
native artifacts. So external system ICU linking is not
needed.

Signed-off-by: <NAME> <<EMAIL>>
---
 src/3rdparty/chromium/third_party/icu/BUILD.gn | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/src/3rdparty/chromium/third_party/icu/BUILD.gn b/src/3rdparty/chromium/third_party/icu/BUILD.gn
index 97073f09787..5d293ca628d 100644
--- a/src/3rdparty/chromium/third_party/icu/BUILD.gn
+++ b/src/3rdparty/chromium/third_party/icu/BUILD.gn
@@ -7,9 +7,13 @@ import("//build/config/host_byteorder.gni")
 import("//build/config/linux/pkg_config.gni")
 import("//build/shim_headers.gni")
 import("//third_party/icu/config.gni")
+import("//v8/gni/snapshot_toolchain.gni")
 
 declare_args() {
   use_system_icu = false
+
+  # Use only target icu library, when system using is enabled
+  use_system_icu_target_only = false
 }
 
 if (is_android) {
@@ -20,6 +24,12 @@ if (is_mac) {
   import("//build/config/sanitizers/sanitizers.gni")
 }
 
+if (use_system_icu) {
+  # Use system library only for target, otherwise use bundled
+  if ((current_toolchain != host_toolchain) && (current_toolchain != v8_snapshot_toolchain)) {
+    use_system_icu_target_only = true
+  }
+}
 # Meta target that includes both icuuc and icui18n. Most targets want both.
 # You can depend on the individually if you need to.
 group("icu") {
@@ -1137,7 +1147,7 @@ config("system_icu_config") {
   ]
 }
 
-if (use_system_icu) {
{'fraction_non_alphanumeric': 0.12938816449348045, 'fraction_numerical': 0.06068204613841525, 'mean_word_length': 4.412483039348711, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6616637', 'n_tokens_mistral': 1590, 'n_tokens_neox': 1388, 'n_words': 375}