mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-07-16 12:45:18 +03:00
899 lines
29 KiB
Diff
899 lines
29 KiB
Diff
diff --git a/third_party/icu/BUILD.gn b/third_party/icu/BUILD.gn
|
|
index 1ac0afeb..61ca743a 100644
|
|
--- a/third_party/icu/BUILD.gn
|
|
+++ b/third_party/icu/BUILD.gn
|
|
@@ -2,9 +2,11 @@
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
# found in the LICENSE file.
|
|
|
|
+import("//build/config/features.gni")
|
|
import("//build/config/host_byteorder.gni")
|
|
-import("//third_party/icu/config.gni")
|
|
-import("//third_party/icu/sources.gni")
|
|
+import("config.gni")
|
|
+import("sources.gni")
|
|
+import("system.gni")
|
|
|
|
if (is_android) {
|
|
import("//build/config/android/rules.gni")
|
|
@@ -14,6 +16,11 @@ if (is_mac && !icu_is_in_fuchsia) {
|
|
import("//build/config/sanitizers/sanitizers.gni")
|
|
}
|
|
|
|
+if (use_system_icu) {
|
|
+ import("//build/config/linux/pkg_config.gni")
|
|
+ import("//build/shim_headers.gni")
|
|
+}
|
|
+
|
|
assert(!icu_disable_thin_archive || !is_component_build,
|
|
"icu_disable_thin_archive only works in static library builds")
|
|
|
|
@@ -37,15 +44,19 @@ config("icu_config") {
|
|
# NaCl-related builds also fail looking for dlfcn.h when it's enabled.
|
|
"U_ENABLE_DYLOAD=0",
|
|
|
|
- # v8/Blink need to know whether Chromium's copy of ICU is used or not.
|
|
- "USE_CHROMIUM_ICU=1",
|
|
-
|
|
# Enable tracing to connect to UMA but disable tracing of resource
|
|
# to avoid performance issues.
|
|
"U_ENABLE_TRACING=1",
|
|
"U_ENABLE_RESOURCE_TRACING=0",
|
|
]
|
|
|
|
+ # v8/Blink need to know whether Chromium's copy of ICU is used or not.
|
|
+ if (use_system_icu) {
|
|
+ defines += [ "USING_SYSTEM_ICU=1" ]
|
|
+ } else {
|
|
+ defines += [ "USE_CHROMIUM_ICU=1" ]
|
|
+ }
|
|
+
|
|
if (!is_component_build) {
|
|
defines += [ "U_STATIC_IMPLEMENTATION" ]
|
|
}
|
|
@@ -55,77 +66,12 @@ config("icu_config") {
|
|
"source/i18n",
|
|
]
|
|
|
|
- if (icu_use_data_file) {
|
|
- defines += [ "ICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_FILE" ]
|
|
- } else {
|
|
- defines += [ "ICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_STATIC" ]
|
|
- }
|
|
-}
|
|
-
|
|
-# Config used only by ICU code.
|
|
-config("icu_code") {
|
|
- cflags = []
|
|
- defines = [
|
|
- "HAVE_DLOPEN=0",
|
|
-
|
|
- # Only build encoding coverters and detectors necessary for HTML5.
|
|
- "UCONFIG_ONLY_HTML_CONVERSION=1",
|
|
-
|
|
- # TODO(jshin): do we still need this?
|
|
- "UCONFIG_USE_WINDOWS_LCID_MAPPING_API=0",
|
|
-
|
|
- # No dependency on the default platform encoding.
|
|
- # Will cut down the code size.
|
|
- "U_CHARSET_IS_UTF8=1",
|
|
- ]
|
|
-
|
|
- if (is_win) {
|
|
- # Disable some compiler warnings.
|
|
- cflags += [
|
|
- "/wd4005", # Macro redefinition.
|
|
- "/wd4068", # Unknown pragmas.
|
|
- "/wd4267", # Conversion from size_t on 64-bits.
|
|
- "/utf-8", # ICU source files are in UTF-8.
|
|
- ]
|
|
- } else if (is_linux || is_chromeos || is_android || icu_is_in_fuchsia) {
|
|
- cflags += [ "-Wno-unused-function" ]
|
|
- }
|
|
- if (is_clang) {
|
|
- cflags += [
|
|
- # ICU has some code with the pattern:
|
|
- # if (found = uprv_getWindowsTimeZoneInfo(...))
|
|
- "-Wno-parentheses",
|
|
-
|
|
- # ucnv2022.cpp contains three functions that are only used when
|
|
- # certain preprocessor defines are set.
|
|
- # unistr.cpp also has an unused function for non-component builds.
|
|
- "-Wno-unused-function",
|
|
-
|
|
- # putil.cpp contains unused variables when building for iOS simulators.
|
|
- "-Wno-unused-variable",
|
|
- ]
|
|
- }
|
|
- if (is_clang || is_linux || is_chromeos || is_android || icu_is_in_fuchsia) {
|
|
- cflags += [
|
|
- # ICU uses its own deprecated functions.
|
|
- "-Wno-deprecated-declarations",
|
|
- ]
|
|
- }
|
|
- if (icu_is_in_fuchsia) {
|
|
- cflags += [
|
|
- # Disable spurious thread safety errors in umutex.cpp
|
|
- "-Wno-thread-safety",
|
|
-
|
|
- # Can probably remove the below after
|
|
- # https://unicode-org.atlassian.net/projects/ICU/issues/ICU-20869
|
|
- # is fixed.
|
|
- "-Wno-implicit-int-float-conversion",
|
|
- "-Wno-conversion",
|
|
-
|
|
- # Used for conditional changes to the compilation process that
|
|
- # are only needed for the Fuchsia toolchain.
|
|
- "-DICU_IS_IN_FUCHSIA",
|
|
- ]
|
|
+ if (!use_system_icu) {
|
|
+ if (icu_use_data_file) {
|
|
+ defines += [ "ICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_FILE" ]
|
|
+ } else {
|
|
+ defines += [ "ICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_STATIC" ]
|
|
+ }
|
|
}
|
|
}
|
|
|
|
@@ -137,262 +83,488 @@ config("visibility_hidden") {
|
|
}
|
|
}
|
|
|
|
-template("generate_icu_component") {
|
|
- if (icu_is_in_fuchsia) {
|
|
- target(default_library_type, target_name) {
|
|
- forward_variables_from(invoker,
|
|
- "*",
|
|
- [
|
|
- "testonly",
|
|
- "visibility",
|
|
- ])
|
|
- assert(fuchsia_output_name_postfix == "")
|
|
+if (!use_system_icu) {
|
|
+ # Config used only by ICU code.
|
|
+ config("icu_code") {
|
|
+ cflags = []
|
|
+ defines = [
|
|
+ "HAVE_DLOPEN=0",
|
|
+
|
|
+ # Only build encoding coverters and detectors necessary for HTML5.
|
|
+ "UCONFIG_ONLY_HTML_CONVERSION=1",
|
|
|
|
- # ICU uses RTTI, replace the default "no rtti" config (if applied).
|
|
- configs += [
|
|
- "//build/config:no_rtti",
|
|
- "//build/config:symbol_visibility_hidden",
|
|
+ # TODO(jshin): do we still need this?
|
|
+ "UCONFIG_USE_WINDOWS_LCID_MAPPING_API=0",
|
|
+
|
|
+ # No dependency on the default platform encoding.
|
|
+ # Will cut down the code size.
|
|
+ "U_CHARSET_IS_UTF8=1",
|
|
+ ]
|
|
+
|
|
+ if (is_win) {
|
|
+ # Disable some compiler warnings.
|
|
+ cflags += [
|
|
+ "/wd4005", # Macro redefinition.
|
|
+ "/wd4068", # Unknown pragmas.
|
|
+ "/wd4267", # Conversion from size_t on 64-bits.
|
|
+ "/utf-8", # ICU source files are in UTF-8.
|
|
]
|
|
- configs -= [
|
|
- "//build/config:no_rtti",
|
|
- "//build/config:symbol_visibility_hidden",
|
|
+ if (!is_clang) {
|
|
+ cflags += [
|
|
+ # Ignore some msvc warnings here because V8 still supports msvc.
|
|
+ "/wd4244", # Conversion: possible loss of data.
|
|
+ ]
|
|
+ defines += [
|
|
+ # https://crbug.com/1274247
|
|
+ # <ctgmath> is deprecated in C++17, but ICU still uses it, so we should
|
|
+ # silence the warning for now.
|
|
+ "_SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING",
|
|
+ ]
|
|
+ }
|
|
+ } else if (is_linux || is_chromeos || is_android || icu_is_in_fuchsia) {
|
|
+ cflags += [ "-Wno-unused-function" ]
|
|
+ }
|
|
+ if (is_clang) {
|
|
+ cflags += [
|
|
+ # ICU has some code with the pattern:
|
|
+ # if (found = uprv_getWindowsTimeZoneInfo(...))
|
|
+ "-Wno-parentheses",
|
|
+
|
|
+ # ucnv2022.cpp contains three functions that are only used when
|
|
+ # certain preprocessor defines are set.
|
|
+ # unistr.cpp also has an unused function for non-component builds.
|
|
+ "-Wno-unused-function",
|
|
+
|
|
+ # putil.cpp contains unused variables when building for iOS simulators.
|
|
+ "-Wno-unused-variable",
|
|
+
|
|
+ # ICU has decided not to fix this warning as doing so would break its
|
|
+ # stable API.
|
|
+ "-Wno-ambiguous-reversed-operator",
|
|
]
|
|
+ }
|
|
+ if (is_clang || is_linux || is_chromeos || is_android ||
|
|
+ icu_is_in_fuchsia) {
|
|
+ cflags += [
|
|
+ # ICU uses its own deprecated functions.
|
|
+ "-Wno-deprecated-declarations",
|
|
+ ]
|
|
+ }
|
|
+ if (icu_is_in_fuchsia) {
|
|
+ cflags += [
|
|
+ # Disable spurious thread safety errors in umutex.cpp
|
|
+ "-Wno-thread-safety",
|
|
+
|
|
+ # Can probably remove the below after
|
|
+ # https://unicode-org.atlassian.net/projects/ICU/issues/ICU-20869
|
|
+ # is fixed.
|
|
+ "-Wno-implicit-int-float-conversion",
|
|
+ "-Wno-conversion",
|
|
+
|
|
+ # Needed for C++20
|
|
+ "-Wno-ambiguous-reversed-operator",
|
|
+ "-Wno-rewrite-not-bool",
|
|
+ "-Wno-deprecated-anon-enum-enum-conversion",
|
|
+ "-Wno-deprecated-array-compare",
|
|
+ "-Wno-deprecated-pragma",
|
|
+
|
|
+ # Used for conditional changes to the compilation process that
|
|
+ # are only needed for the Fuchsia toolchain.
|
|
+ "-DICU_IS_IN_FUCHSIA",
|
|
+ ]
|
|
+ }
|
|
+ if (current_cpu == "wasm") {
|
|
+ # Tell ICU that we are a 32 bit platform, otherwise,
|
|
+ # double-conversion-utils.h doesn't know how to operate.
|
|
+ defines += [ "__i386__" ]
|
|
+ }
|
|
+ }
|
|
|
|
- configs += [ "//build/config:rtti" ]
|
|
+ template("generate_icu_component") {
|
|
+ if (icu_is_in_fuchsia) {
|
|
+ target(default_library_type, target_name) {
|
|
+ forward_variables_from(invoker,
|
|
+ "*",
|
|
+ [
|
|
+ "testonly",
|
|
+ "visibility",
|
|
+ ])
|
|
+ assert(fuchsia_output_name_postfix == "")
|
|
|
|
- # These need to be applied after the main configs so the "-Wno-*" options
|
|
- # take effect.
|
|
- configs += [ ":icu_code" ]
|
|
- configs += extra_configs
|
|
- public_configs = [ ":icu_config" ]
|
|
+ # If icu_use_target_out_dir is defined and set, then the component
|
|
+ # will be output in the regular target_out_dir, rather than the default
|
|
+ # root_build_dir.
|
|
+ # See README.fuchsia for details.
|
|
+ if (defined(icu_use_target_out_dir) && icu_use_target_out_dir) {
|
|
+ output_dir = target_out_dir
|
|
+ }
|
|
+
|
|
+ # ICU uses RTTI, replace the default "no rtti" config (if applied).
|
|
+ configs += [
|
|
+ "//build/config:no_rtti",
|
|
+ "//build/config:symbol_visibility_hidden",
|
|
+ ]
|
|
+ configs -= [
|
|
+ "//build/config:no_rtti",
|
|
+ "//build/config:symbol_visibility_hidden",
|
|
+ ]
|
|
+
|
|
+ configs += [ "//build/config:rtti" ]
|
|
+
|
|
+ # These need to be applied after the main configs so the "-Wno-*" options
|
|
+ # take effect.
|
|
+ configs += [ ":icu_code" ]
|
|
+ configs += extra_configs
|
|
+ public_configs = [ ":icu_config" ]
|
|
+ }
|
|
+ } else {
|
|
+ component(target_name) {
|
|
+ forward_variables_from(invoker,
|
|
+ "*",
|
|
+ [
|
|
+ "testonly",
|
|
+ "visibility",
|
|
+ ])
|
|
+
|
|
+ # If icu_use_target_output_dir is defined and set, then the component
|
|
+ # will be output in the regular target_out_dir, rather than the default
|
|
+ # root_build_dir.
|
|
+ # See README.fuchsia for details.
|
|
+ if (defined(icu_use_target_output_dir) && icu_use_target_output_dir) {
|
|
+ output_dir = target_out_dir
|
|
+ }
|
|
+
|
|
+ if (is_fuchsia) {
|
|
+ base_output_name = target_name
|
|
+ if (defined(invoker.output_name)) {
|
|
+ base_output_name = invoker.output_name
|
|
+ }
|
|
+
|
|
+ # Fuchsia puts its own libicu*.so in /system/lib where we need to put our
|
|
+ # .so when doing component builds, so we need to give this a different name.
|
|
+ output_name = "${base_output_name}_cr${fuchsia_output_name_postfix}"
|
|
+ } else {
|
|
+ assert(fuchsia_output_name_postfix == "")
|
|
+ }
|
|
+
|
|
+ # ICU uses RTTI, replace the default "no rtti" config (if applied).
|
|
+ configs += [
|
|
+ "//build/config/compiler:no_rtti",
|
|
+ "//build/config/compiler:chromium_code",
|
|
+ ]
|
|
+ configs -= [
|
|
+ "//build/config/compiler:no_rtti",
|
|
+ "//build/config/compiler:chromium_code",
|
|
+ ]
|
|
+ configs += [
|
|
+ "//build/config/compiler:rtti",
|
|
+ "//build/config/compiler:no_chromium_code",
|
|
+ ]
|
|
+
|
|
+ # These need to be applied after the main configs so the "-Wno-*" options
|
|
+ # take effect.
|
|
+ configs += [ ":icu_code" ]
|
|
+ configs += extra_configs
|
|
+ public_configs = [ ":icu_config" ]
|
|
+
|
|
+ # Make icu into a standalone static library. Currently This is only useful
|
|
+ # on Chrome OS.
|
|
+ if (icu_disable_thin_archive) {
|
|
+ configs -= [ "//build/config/compiler:thin_archive" ]
|
|
+ complete_static_lib = true
|
|
+ }
|
|
+ }
|
|
}
|
|
- } else {
|
|
- component(target_name) {
|
|
+ }
|
|
+
|
|
+ template("generate_icui18n") {
|
|
+ generate_icu_component(target_name) {
|
|
+ assert(defined(invoker.icuuc_deps), "Need the 'icuuc_deps' parameter.")
|
|
+ icuuc_deps = invoker.icuuc_deps
|
|
+
|
|
+ fuchsia_output_name_postfix = ""
|
|
+ if (defined(invoker.fuchsia_output_name_postfix)) {
|
|
+ fuchsia_output_name_postfix = invoker.fuchsia_output_name_postfix
|
|
+ }
|
|
+
|
|
forward_variables_from(invoker,
|
|
"*",
|
|
[
|
|
"testonly",
|
|
"visibility",
|
|
])
|
|
- if (is_fuchsia) {
|
|
- # Fuchsia puts its own libicu*.so in /system/lib where we need to put our
|
|
- # .so when doing component builds, so we need to give this a different name.
|
|
- output_name = "${target_name}_cr${fuchsia_output_name_postfix}"
|
|
- } else {
|
|
- assert(fuchsia_output_name_postfix == "")
|
|
- }
|
|
|
|
- # ICU uses RTTI, replace the default "no rtti" config (if applied).
|
|
- configs += [
|
|
- "//build/config/compiler:no_rtti",
|
|
- "//build/config/compiler:chromium_code",
|
|
- ]
|
|
- configs -= [
|
|
- "//build/config/compiler:no_rtti",
|
|
- "//build/config/compiler:chromium_code",
|
|
- ]
|
|
- configs += [
|
|
- "//build/config/compiler:rtti",
|
|
- "//build/config/compiler:no_chromium_code",
|
|
- ]
|
|
+ sources = icu18n_sources
|
|
+ public = icu18n_public
|
|
|
|
- # These need to be applied after the main configs so the "-Wno-*" options
|
|
- # take effect.
|
|
- configs += [ ":icu_code" ]
|
|
- configs += extra_configs
|
|
- public_configs = [ ":icu_config" ]
|
|
-
|
|
- # Make icu into a standalone static library. Currently This is only useful
|
|
- # on Chrome OS.
|
|
- if (invoker.check_thin_archive && icu_disable_thin_archive) {
|
|
- configs -= [ "//build/config/compiler:thin_archive" ]
|
|
- complete_static_lib = true
|
|
+ defines = [ "U_I18N_IMPLEMENTATION" ]
|
|
+ deps = icuuc_deps
|
|
+
|
|
+ # TODO(fxbug.dev/98632): workaround for toolchain issues, see bug
|
|
+ if (icu_is_in_fuchsia && is_fuchsia) {
|
|
+ deps += [ "//build/config/fuchsia:uses-outline-atomics-fxbug98632" ]
|
|
}
|
|
}
|
|
}
|
|
-}
|
|
|
|
-template("generate_icui18n") {
|
|
- if (!icu_is_in_fuchsia) {
|
|
- check_thin_archive = true
|
|
+ generate_icui18n("icui18n") {
|
|
+ extra_configs = []
|
|
+ icuuc_deps = [ ":icuuc_private" ]
|
|
}
|
|
|
|
- generate_icu_component(target_name) {
|
|
- assert(defined(invoker.icuuc_deps), "Need the 'icuuc_deps' parameter.")
|
|
- icuuc_deps = invoker.icuuc_deps
|
|
-
|
|
- fuchsia_output_name_postfix = ""
|
|
- if (defined(invoker.fuchsia_output_name_postfix)) {
|
|
- fuchsia_output_name_postfix = invoker.fuchsia_output_name_postfix
|
|
+ generate_icui18n("icui18n_hidden_visibility") {
|
|
+ extra_configs = [ ":visibility_hidden" ]
|
|
+ icuuc_deps = [ ":icuuc_private_hidden_visibility" ]
|
|
+ if (is_fuchsia && !icu_is_in_fuchsia) {
|
|
+ fuchsia_output_name_postfix = "_hidden_visibility"
|
|
}
|
|
-
|
|
- forward_variables_from(invoker,
|
|
- "*",
|
|
- [
|
|
- "testonly",
|
|
- "visibility",
|
|
- ])
|
|
-
|
|
- sources = icu18n_sources
|
|
- public = icu18n_public
|
|
-
|
|
- defines = [ "U_I18N_IMPLEMENTATION" ]
|
|
- deps = icuuc_deps
|
|
}
|
|
-}
|
|
|
|
-generate_icui18n("icui18n") {
|
|
- extra_configs = []
|
|
- icuuc_deps = [ ":icuuc" ]
|
|
-}
|
|
+ template("generate_icuuc") {
|
|
+ generate_icu_component(target_name) {
|
|
+ fuchsia_output_name_postfix = ""
|
|
+ if (defined(invoker.fuchsia_output_name_postfix)) {
|
|
+ fuchsia_output_name_postfix = invoker.fuchsia_output_name_postfix
|
|
+ }
|
|
|
|
-generate_icui18n("icui18n_hidden_visibility") {
|
|
- extra_configs = [ ":visibility_hidden" ]
|
|
- icuuc_deps = [ ":icuuc_hidden_visibility" ]
|
|
- if (is_fuchsia && !icu_is_in_fuchsia) {
|
|
- fuchsia_output_name_postfix = "_hidden_visibility"
|
|
- }
|
|
-}
|
|
+ forward_variables_from(invoker,
|
|
+ "*",
|
|
+ [
|
|
+ "testonly",
|
|
+ "visibility",
|
|
+ ])
|
|
|
|
-template("generate_icuuc") {
|
|
- if (!icu_is_in_fuchsia) {
|
|
- check_thin_archive = false
|
|
- }
|
|
+ sources = icuuc_sources
|
|
+ public_deps = [ ":icuuc_public" ]
|
|
|
|
- generate_icu_component(target_name) {
|
|
- fuchsia_output_name_postfix = ""
|
|
- if (defined(invoker.fuchsia_output_name_postfix)) {
|
|
- fuchsia_output_name_postfix = invoker.fuchsia_output_name_postfix
|
|
- }
|
|
+ defines = [ "U_COMMON_IMPLEMENTATION" ]
|
|
+ deps = [ ":icudata" ]
|
|
|
|
- forward_variables_from(invoker,
|
|
- "*",
|
|
- [
|
|
- "testonly",
|
|
- "visibility",
|
|
- ])
|
|
+ if (is_chromeos) {
|
|
+ deps += [ ":icudata_hash" ]
|
|
+ }
|
|
|
|
- sources = icuuc_sources
|
|
- public = icuuc_public
|
|
+ if (icu_use_data_file && icu_use_stub_data) {
|
|
+ sources += [ "source/stubdata/stubdata.cpp" ]
|
|
+ }
|
|
|
|
- defines = [ "U_COMMON_IMPLEMENTATION" ]
|
|
- deps = [ ":icudata" ]
|
|
+ defines += [ "U_ICUDATAENTRY_IN_COMMON" ]
|
|
|
|
- if (icu_use_data_file) {
|
|
- sources += [ "source/stubdata/stubdata.cpp" ]
|
|
+ # TODO(fxbug.dev/98632): workaround for toolchain issues, see bug
|
|
+ if (icu_is_in_fuchsia && is_fuchsia) {
|
|
+ deps += [ "//build/config/fuchsia:uses-outline-atomics-fxbug98632" ]
|
|
+ }
|
|
}
|
|
+ }
|
|
|
|
- defines += [ "U_ICUDATAENTRY_IN_COMMON" ]
|
|
+ group("icuuc") {
|
|
+ public_deps = [ ":icuuc_private" ]
|
|
}
|
|
-}
|
|
|
|
-generate_icuuc("icuuc") {
|
|
- extra_configs = []
|
|
-}
|
|
-generate_icuuc("icuuc_hidden_visibility") {
|
|
- extra_configs = [ ":visibility_hidden" ]
|
|
- if (is_fuchsia && !icu_is_in_fuchsia) {
|
|
- fuchsia_output_name_postfix = "_hidden_visibility"
|
|
+ group("icuuc_hidden_visibility") {
|
|
+ public_deps = [ ":icuuc_private_hidden_visibility" ]
|
|
}
|
|
-}
|
|
|
|
-if (is_android && enable_java_templates) {
|
|
- android_assets("icu_assets") {
|
|
- if (icu_use_data_file) {
|
|
- sources = [ "$root_out_dir/icudtl.dat" ]
|
|
- deps = [ ":icudata" ]
|
|
- disable_compression = true
|
|
- }
|
|
+ source_set("icuuc_public") {
|
|
+ sources = icuuc_public
|
|
}
|
|
|
|
- android_assets("icu_extra_assets") {
|
|
- if (icu_use_data_file) {
|
|
- sources = [ "$root_out_dir/icudtl_extra.dat" ]
|
|
- deps = [ ":extra_icudata" ]
|
|
- disable_compression = true
|
|
+ generate_icuuc("icuuc_private") {
|
|
+ extra_configs = []
|
|
+ output_name = "icuuc"
|
|
+ visibility = [
|
|
+ ":icui18n",
|
|
+ ":icuuc",
|
|
+ ]
|
|
+ }
|
|
+
|
|
+ generate_icuuc("icuuc_private_hidden_visibility") {
|
|
+ extra_configs = [ ":visibility_hidden" ]
|
|
+ output_name = "icuuc_hidden_visibility"
|
|
+ visibility = [
|
|
+ ":icui18n_hidden_visibility",
|
|
+ ":icuuc_hidden_visibility",
|
|
+ ]
|
|
+ if (is_fuchsia && !icu_is_in_fuchsia) {
|
|
+ fuchsia_output_name_postfix = "_hidden_visibility"
|
|
}
|
|
}
|
|
-}
|
|
|
|
-if (is_android) {
|
|
- # Use android_small for now to keep the size till we decide to switch to the new one.
|
|
- data_dir = "android_small"
|
|
-} else if (is_ios) {
|
|
- data_dir = "ios"
|
|
-} else if (is_chromeos) {
|
|
- data_dir = "chromeos"
|
|
-} else {
|
|
- data_dir = "common"
|
|
-}
|
|
+ if (is_android && enable_java_templates) {
|
|
+ android_assets("icu_assets") {
|
|
+ if (icu_use_data_file) {
|
|
+ sources = [ "$root_out_dir/icudtl.dat" ]
|
|
+ deps = [ ":icudata" ]
|
|
+ disable_compression = true
|
|
+ }
|
|
+ }
|
|
+ }
|
|
|
|
-if (current_cpu == "mips" || current_cpu == "mips64" ||
|
|
- host_byteorder == "big") {
|
|
- data_bundle_prefix = "icudtb"
|
|
-} else {
|
|
- data_bundle_prefix = "icudtl"
|
|
-}
|
|
-data_bundle = "${data_bundle_prefix}.dat"
|
|
+ if (is_android) {
|
|
+ data_dir = "android"
|
|
+ } else if (is_ios && !use_blink) {
|
|
+ data_dir = "ios"
|
|
+ } else if (is_chromeos) {
|
|
+ data_dir = "chromeos"
|
|
+ } else if (current_cpu == "wasm") {
|
|
+ data_dir = "flutter"
|
|
+ } else if (icu_is_in_fuchsia && icu_fuchsia_override_data_dir != "") {
|
|
+ # See //config.gni for details.
|
|
+ data_dir = icu_fuchsia_override_data_dir
|
|
+ } else {
|
|
+ data_dir = "common"
|
|
+ }
|
|
|
|
-if (icu_use_data_file) {
|
|
- if (is_ios) {
|
|
- bundle_data("icudata") {
|
|
- sources = [ "$data_dir/$data_bundle" ]
|
|
- outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ]
|
|
- }
|
|
+ if (current_cpu == "mips" || current_cpu == "mips64" ||
|
|
+ host_byteorder == "big") {
|
|
+ data_bundle_prefix = "icudtb"
|
|
} else {
|
|
- copy("icudata") {
|
|
+ data_bundle_prefix = "icudtl"
|
|
+ }
|
|
+ data_bundle = "${data_bundle_prefix}.dat"
|
|
+
|
|
+ # Some code paths end up not using these, marking them to avoid build
|
|
+ # breaks.
|
|
+ # See README.fuchsia for details.
|
|
+ not_needed([
|
|
+ "data_bundle",
|
|
+ "data_bundle_prefix",
|
|
+ "data_dir",
|
|
+ ])
|
|
+
|
|
+ if (icu_copy_icudata_to_root_build_dir) {
|
|
+ copy("copy_icudata") {
|
|
sources = [ "$data_dir/$data_bundle" ]
|
|
outputs = [ "$root_out_dir/$data_bundle" ]
|
|
data = [ "$root_out_dir/$data_bundle" ]
|
|
}
|
|
}
|
|
|
|
- copy("extra_icudata") {
|
|
- sources = [ "//third_party/icu/android_small/icudtl_extra.dat" ]
|
|
- outputs = [ "$root_out_dir/icudtl_extra.dat" ]
|
|
- }
|
|
-} else {
|
|
- data_assembly = "$target_gen_dir/${data_bundle_prefix}_dat.S"
|
|
- inline_data_assembly = "$target_gen_dir/${data_bundle_prefix}_dat.cc"
|
|
- action("make_data_assembly") {
|
|
- script = "scripts/make_data_assembly.py"
|
|
- inputs = [ "$data_dir/$data_bundle" ]
|
|
- outputs = [ data_assembly ]
|
|
- args = [
|
|
- rebase_path(inputs[0], root_build_dir),
|
|
- rebase_path(data_assembly, root_build_dir),
|
|
- ]
|
|
- if (is_mac || is_ios) {
|
|
- args += [ "--mac" ]
|
|
- } else if (is_win) {
|
|
- args += [ "--win" ]
|
|
+ # icudata targets are intentionally only available with `use_system_icu`.
|
|
+ # Do not depend on them if `use_system_icu` is true.
|
|
+ #
|
|
+ # The system icu library knows where system icudata is at all times.
|
|
+ # (It knows this because it knows where it isn't.)
|
|
+ if (icu_use_data_file) {
|
|
+ if (is_ios) {
|
|
+ bundle_data("icudata") {
|
|
+ sources = [ "$data_dir/$data_bundle" ]
|
|
+ outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ]
|
|
+ }
|
|
+ } else {
|
|
+ group("icudata") {
|
|
+ if (icu_copy_icudata_to_root_build_dir) {
|
|
+ # Guarded by a flag, to avoid name clashes if other build processes
|
|
+ # also happen to generate the output file by the same name.
|
|
+ # See README.fuchsia for details.
|
|
+ public_deps = [ ":copy_icudata" ]
|
|
+ }
|
|
+ }
|
|
}
|
|
- }
|
|
|
|
- if (is_win) {
|
|
- action("make_inline_data_assembly") {
|
|
- deps = [ ":make_data_assembly" ]
|
|
- script = "scripts/asm_to_inline_asm.py"
|
|
- inputs = [ data_assembly ]
|
|
- outputs = [ inline_data_assembly ]
|
|
- args = rebase_path([
|
|
- data_assembly,
|
|
- inline_data_assembly,
|
|
- ],
|
|
- root_build_dir)
|
|
+ if (is_chromeos) {
|
|
+ copy("icudata_hash") {
|
|
+ sources = [ "chromeos/icudtl.dat.hash" ]
|
|
+ outputs = [ "$root_out_dir/icudtl.dat.hash" ]
|
|
+ }
|
|
}
|
|
} else {
|
|
- not_needed([ "inline_data_assembly" ])
|
|
- }
|
|
+ if (current_cpu == "wasm") {
|
|
+ data_assembly = "$target_gen_dir/${data_bundle_prefix}_dat.cpp"
|
|
+ } else {
|
|
+ data_assembly = "$target_gen_dir/${data_bundle_prefix}_dat.S"
|
|
+ }
|
|
+ inline_data_assembly = "$target_gen_dir/${data_bundle_prefix}_dat.cc"
|
|
+ action("make_data_assembly") {
|
|
+ if (current_cpu == "wasm") {
|
|
+ # See scripts/make_data_cpp.py for details on building ICU for wasm.
|
|
+ script = "scripts/make_data_cpp.py"
|
|
+ inputs = [ "$data_dir/$data_bundle" ]
|
|
+ outputs = [ data_assembly ]
|
|
+ args = [
|
|
+ rebase_path(inputs[0], root_build_dir),
|
|
+ rebase_path(data_assembly, root_build_dir),
|
|
+ ]
|
|
+ } else {
|
|
+ script = "scripts/make_data_assembly.py"
|
|
+ inputs = [ "$data_dir/$data_bundle" ]
|
|
+ outputs = [ data_assembly ]
|
|
+ args = [
|
|
+ rebase_path(inputs[0], root_build_dir),
|
|
+ rebase_path(data_assembly, root_build_dir),
|
|
+ ]
|
|
+ if (is_mac || is_ios) {
|
|
+ args += [ "--mac" ]
|
|
+ } else if (is_win) {
|
|
+ args += [ "--win" ]
|
|
+ }
|
|
+ }
|
|
+ }
|
|
|
|
- source_set("icudata") {
|
|
- defines = [ "U_HIDE_DATA_SYMBOL" ]
|
|
if (is_win) {
|
|
- sources = [ inline_data_assembly ]
|
|
- deps = [ ":make_inline_data_assembly" ]
|
|
+ action("make_inline_data_assembly") {
|
|
+ deps = [ ":make_data_assembly" ]
|
|
+ script = "scripts/asm_to_inline_asm.py"
|
|
+ inputs = [ data_assembly ]
|
|
+ outputs = [ inline_data_assembly ]
|
|
+ args = rebase_path([
|
|
+ data_assembly,
|
|
+ inline_data_assembly,
|
|
+ ],
|
|
+ root_build_dir)
|
|
+ }
|
|
} else {
|
|
- sources = [ data_assembly ]
|
|
- deps = [ ":make_data_assembly" ]
|
|
+ not_needed([ "inline_data_assembly" ])
|
|
+ }
|
|
+
|
|
+ source_set("icudata") {
|
|
+ defines = [ "U_HIDE_DATA_SYMBOL" ]
|
|
+ if (is_win) {
|
|
+ sources = [ inline_data_assembly ]
|
|
+ deps = [ ":make_inline_data_assembly" ]
|
|
+ } else {
|
|
+ sources = [ data_assembly ]
|
|
+ deps = [ ":make_data_assembly" ]
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+} else {
|
|
+ template("create_icu_lib") {
|
|
+ iculib = target_name
|
|
+ pkg_config("system_icu${iculib}") {
|
|
+ packages = [ "icu-${iculib}" ]
|
|
+ }
|
|
+ shim_headers("icu${iculib}_shim") {
|
|
+ root_path = "source/${iculib}"
|
|
+ headers = invoker.headers
|
|
}
|
|
+ source_set("icu${iculib}") {
|
|
+ deps = invoker.deps
|
|
+ deps += [ ":icu${iculib}_shim" ]
|
|
+ public_configs = [
|
|
+ ":icu_config",
|
|
+ ":system_icu${iculib}",
|
|
+ ]
|
|
+ }
|
|
+ source_set("icu${iculib}_hidden_visibility") {
|
|
+ deps = invoker.deps
|
|
+ deps += [ ":icu${iculib}_shim" ]
|
|
+ public_configs = [
|
|
+ ":icu_config",
|
|
+ ":system_icu${iculib}",
|
|
+ ]
|
|
+ configs += [ ":visibility_hidden" ]
|
|
+ if (is_fuchsia && !icu_is_in_fuchsia) {
|
|
+ fuchsia_output_name_postfix = "_hidden_visibility"
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ create_icu_lib("uc") {
|
|
+ deps = []
|
|
+ headers = icuuc_public
|
|
+ }
|
|
+ create_icu_lib("i18n") {
|
|
+ deps = [ ":icuuc" ]
|
|
+ headers = icu18n_public
|
|
}
|
|
}
|
|
diff --git a/third_party/icu/sources.gni b/third_party/icu/sources.gni
|
|
index 9af6b477..e0e624e3 100644
|
|
--- a/third_party/icu/sources.gni
|
|
+++ b/third_party/icu/sources.gni
|
|
@@ -105,6 +105,7 @@ icu18n_sources = [
|
|
"source/i18n/decNumber.cpp",
|
|
"source/i18n/decNumber.h",
|
|
"source/i18n/decNumberLocal.h",
|
|
+ "source/i18n/displayoptions.cpp",
|
|
"source/i18n/double-conversion-bignum.cpp",
|
|
"source/i18n/double-conversion-bignum-dtoa.cpp",
|
|
"source/i18n/double-conversion-bignum-dtoa.h",
|
|
@@ -443,6 +444,7 @@ icu18n_public = [
|
|
"source/i18n/unicode/datefmt.h",
|
|
"source/i18n/unicode/dcfmtsym.h",
|
|
"source/i18n/unicode/decimfmt.h",
|
|
+ "source/i18n/unicode/displayoptions.h",
|
|
"source/i18n/unicode/dtfmtsym.h",
|
|
"source/i18n/unicode/dtitvfmt.h",
|
|
"source/i18n/unicode/dtitvinf.h",
|
|
@@ -496,6 +498,7 @@ icu18n_public = [
|
|
"source/i18n/unicode/udateintervalformat.h",
|
|
"source/i18n/unicode/udat.h",
|
|
"source/i18n/unicode/udatpg.h",
|
|
+ "source/i18n/unicode/udisplayoptions.h",
|
|
"source/i18n/unicode/ufieldpositer.h",
|
|
"source/i18n/unicode/uformattable.h",
|
|
"source/i18n/unicode/uformattedvalue.h",
|
|
@@ -558,6 +561,8 @@ icuuc_sources = [
|
|
"source/common/dictionarydata.h",
|
|
"source/common/dtintrv.cpp",
|
|
"source/common/edits.cpp",
|
|
+ "source/common/emojiprops.cpp",
|
|
+ "source/common/emojiprops.h",
|
|
"source/common/errorcode.cpp",
|
|
"source/common/filteredbrk.cpp",
|
|
"source/common/filterednormalizer2.cpp",
|
|
@@ -567,6 +572,7 @@ icuuc_sources = [
|
|
"source/common/icuplugimp.h",
|
|
"source/common/loadednormalizer2impl.cpp",
|
|
"source/common/localebuilder.cpp",
|
|
+ "source/common/localefallback_data.h",
|
|
"source/common/localematcher.cpp",
|
|
"source/common/localeprioritylist.cpp",
|
|
"source/common/localeprioritylist.h",
|
|
@@ -589,6 +595,8 @@ icuuc_sources = [
|
|
"source/common/locutil.h",
|
|
"source/common/lsr.cpp",
|
|
"source/common/lsr.h",
|
|
+ "source/common/lstmbe.cpp",
|
|
+ "source/common/lstmbe.h",
|
|
"source/common/messageimpl.h",
|
|
"source/common/messagepattern.cpp",
|
|
"source/common/msvcres.h",
|
|
diff --git a/third_party/icu/system.gni b/third_party/icu/system.gni
|
|
new file mode 100644
|
|
index 00000000..c64f37e4
|
|
--- /dev/null
|
|
+++ b/third_party/icu/system.gni
|
|
@@ -0,0 +1,11 @@
|
|
+# Copyright 2023 The Chromium Authors. All rights reserved.
|
|
+# Use of this source code is governed by a BSD-style license that can be
|
|
+# found in the LICENSE file.
|
|
+
|
|
+# Separate file, so unbundle toolchains that replace gn files
|
|
+# can replace just this file and override the default
|
|
+declare_args() {
|
|
+ # If true, find icu with pkgconf and use as shared libraries.
|
|
+ # Useful for Linux distribution repository builds.
|
|
+ use_system_icu = false
|
|
+}
|
|
diff --git a/build/config/features.gni b/build/config/features.gni
|
|
new file mode 100644
|
|
index 00000000000..e69de29bb2d
|