1From 8a0c927cdc9705e2a1c29d63c87d32e8cb089510 Mon Sep 17 00:00:00 2001
2From: Andrej Valek <andrej.valek@siemens.com>
3Date: Fri, 17 Apr 2020 09:43:32 +0200
4Subject: [PATCH] chromium: icu: use system library only targets
5
6 - use bundled one for native/v8 internal builds
7
8Complete system ICU library using requires ICU dev package
9be installed on host. Enabling dependency on native package
10is not enough due to V8 hosttools toolchain. V8 toolchain
11is not using native sysroot, only a host packages.
12On the other hand webenegine does not produce external
13native artifacts. So external system ICU linking is not
14needed.
15
16Upstream-Status: Pending
17Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
18Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
19---
20 chromium/third_party/icu/BUILD.gn | 18 ++++++++++++++----
21 1 file changed, 14 insertions(+), 4 deletions(-)
22
23diff --git a/chromium/third_party/icu/BUILD.gn b/chromium/third_party/icu/BUILD.gn
24index 2430d3e48e5..5d00226667d 100644
25--- a/chromium/third_party/icu/BUILD.gn
26+++ b/chromium/third_party/icu/BUILD.gn
27@@ -8,9 +8,13 @@ import("//build/config/linux/pkg_config.gni")
28 import("//build/shim_headers.gni")
29 import("//third_party/icu/config.gni")
30 import("//third_party/icu/sources.gni")
31+import("//v8/gni/snapshot_toolchain.gni")
32
33 declare_args() {
34   use_system_icu = false
35+
36+  # Use only target icu library, when system using is enabled
37+  use_system_icu_target_only = false
38 }
39
40 if (is_android) {
41@@ -24,6 +28,12 @@ if (is_mac && !icu_is_in_fuchsia) {
42 assert(!icu_disable_thin_archive || !is_component_build,
43        "icu_disable_thin_archive only works in static library builds")
44
45+if (use_system_icu) {
46+  # Use system library only for target, otherwise use bundled
47+  if ((current_toolchain != host_toolchain) && (current_toolchain != v8_snapshot_toolchain)) {
48+    use_system_icu_target_only = true
49+  }
50+}
51 # Meta target that includes both icuuc and icui18n. Most targets want both.
52 # You can depend on the individually if you need to.
53 group("icu") {
54@@ -413,7 +423,7 @@ config("system_icu_config") {
55   }
56 }
57
58-if (use_system_icu) {
59+if (use_system_icu_target_only) {
60   pkg_config("system_icui18n") {
61     packages = [ "icu-i18n" ]
62   }
63@@ -626,7 +636,7 @@ shim_headers("icuuc_shim") {
64 }
65
66 config("icu_config") {
67-  if (use_system_icu) {
68+  if (use_system_icu_target_only) {
69     configs = [ ":system_icu_config"]
70   } else {
71     configs = [ ":bundled_icu_config"]
72@@ -634,7 +644,7 @@ config("icu_config") {
73 }
74
75 group("icuuc") {
76-  if (use_system_icu) {
77+  if (use_system_icu_target_only) {
78     deps = [ ":icuuc_shim" ]
79     public_configs = [
80       ":system_icu_config",
81@@ -646,7 +656,7 @@ group("icuuc") {
82 }
83
84 group("icui18n") {
85-  if (use_system_icu) {
86+  if (use_system_icu_target_only) {
87     deps = [ ":icui18n_shim" ]
88     public_configs = [
89       ":system_icu_config",
90