testing/dart: reworked dependency unbundling

This commit is contained in:
Lauren N. Liberda 2023-05-15 17:51:30 +02:00
parent 00ce8e8fe0
commit ac486d263e
No known key found for this signature in database
GPG Key ID: 734C629FD04BD319
4 changed files with 445 additions and 1740 deletions

View File

@ -2,7 +2,7 @@
# Maintainer: Lauren N. Liberda <lauren@selfisekai.rocks> # Maintainer: Lauren N. Liberda <lauren@selfisekai.rocks>
pkgname=dart pkgname=dart
pkgver=3.0.0 pkgver=3.0.0
pkgrel=2 pkgrel=3
_bootstrap=3.0.0_alpha369-r0 _bootstrap=3.0.0_alpha369-r0
pkgdesc="Dart is a client-optimized language for fast apps on any platform" pkgdesc="Dart is a client-optimized language for fast apps on any platform"
url="https://dart.dev/" url="https://dart.dev/"
@ -47,8 +47,7 @@ source="
no-analytics.patch no-analytics.patch
no-werror.patch no-werror.patch
shim-headers.patch shim-headers.patch
unbundle-icu.patch unbundle.patch
unbundle-zlib.patch
use-lld.patch use-lld.patch
where-we-are-heading-prefixes-are-not-needed.patch where-we-are-heading-prefixes-are-not-needed.patch
" "
@ -153,7 +152,9 @@ prepare() {
\! -regex '.*\.\(gn\|gni\|isolate\|py\)' \ \! -regex '.*\.\(gn\|gni\|isolate\|py\)' \
-delete -delete
done done
# no workflow replacement - handled by `use_system_*` gn args msg "Replacing gn files"
python3 build/linux/unbundle/replace_gn_files.py --system-libraries \
$use_system
} }
build() { build() {
@ -163,8 +164,6 @@ build() {
dart_snapshot_kind=\"app-jit\" dart_snapshot_kind=\"app-jit\"
dart_sysroot=\"\" dart_sysroot=\"\"
dart_use_tcmalloc=false dart_use_tcmalloc=false
use_system_icu=true
use_system_zlib=true
" "
msg "Building" msg "Building"
@ -234,8 +233,7 @@ sha512sums="
d008eda9fcf5fb3f53d59ecbaec3920f942e129d7a166fd4255415ac960c91e69d367fb2c07f8cd27cb14813791d7cde45c94e43c054e9185d66562872a12eaf no-analytics.patch d008eda9fcf5fb3f53d59ecbaec3920f942e129d7a166fd4255415ac960c91e69d367fb2c07f8cd27cb14813791d7cde45c94e43c054e9185d66562872a12eaf no-analytics.patch
e7f5c715d9ed01c36e8b60892332b1bc763a3f98ca87905e2102491c469db60ab21dba9b3e116e1a7ec3faef7d65b8fdd60d7148cfb848ef5a2b411a06f425cf no-werror.patch e7f5c715d9ed01c36e8b60892332b1bc763a3f98ca87905e2102491c469db60ab21dba9b3e116e1a7ec3faef7d65b8fdd60d7148cfb848ef5a2b411a06f425cf no-werror.patch
f15e70279d383ebd2b202a123d7dd452ae0212022b372795cdfac530476d017c59352db136e673a06b9cacdbda0c152ce6c19735da637ebd366616f23a752ce4 shim-headers.patch f15e70279d383ebd2b202a123d7dd452ae0212022b372795cdfac530476d017c59352db136e673a06b9cacdbda0c152ce6c19735da637ebd366616f23a752ce4 shim-headers.patch
6bd02f8a597c823021f8c5ec4e1f739dd8bceaf9817dd292245c01c5d25b5cc7ac6b9dac3c13e553e1b6fc81cf436b3f161973ff3a76188143b223dfbb48a9f8 unbundle-icu.patch 14b6b024688110631dfce6d51b895e84d4306a00e66c0e5306126f6d27cbd13894bf2c50faffab99e57107901ec3977a4b0038bee9e165f733ef9e4ccc14af1a unbundle.patch
cbad6df474d6db74668cd49cf9a55d6899af2e9d40203fa1945339da0e66e90e1265440b83927a97ac9cf07d102347bbdc90b96cd27f5229207b389ccc70ef3e unbundle-zlib.patch
72f4badf219264efee219338fd1e4f6cf7f1c4f84d03c5cb33832282df0a1a14f4941fb59037028a6a231956936e582d554efc7a34e88cb2d110a10bf0f727c7 use-lld.patch 72f4badf219264efee219338fd1e4f6cf7f1c4f84d03c5cb33832282df0a1a14f4941fb59037028a6a231956936e582d554efc7a34e88cb2d110a10bf0f727c7 use-lld.patch
9199d8d64c503d4a482ead55f8b895618b302db2d25d0340134dc6885444698176d1a53ce6c6d50c77b7cea1227a2ea3d7d9cb97b6368c43d8712f5cfdbfb818 where-we-are-heading-prefixes-are-not-needed.patch 9199d8d64c503d4a482ead55f8b895618b302db2d25d0340134dc6885444698176d1a53ce6c6d50c77b7cea1227a2ea3d7d9cb97b6368c43d8712f5cfdbfb818 where-we-are-heading-prefixes-are-not-needed.patch
" "

View File

@ -1,899 +0,0 @@
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

View File

@ -1,833 +0,0 @@
upstream status: https://github.com/dart-lang/sdk/issues/51535
diff --git a/third_party/zlib/BUILD.gn b/third_party/zlib/BUILD.gn
index 3a71693..ce9fb5c 100644
--- a/third_party/zlib/BUILD.gn
+++ b/third_party/zlib/BUILD.gn
@@ -1,8 +1,9 @@
-# Copyright (c) 2013 The Chromium Authors. All rights reserved.
+# Copyright 2013 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config/compiler/compiler.gni")
+import("system.gni")
if (build_with_chromium) {
import("//testing/test.gni")
@@ -12,417 +13,471 @@ if (current_cpu == "arm" || current_cpu == "arm64") {
import("//build/config/arm.gni")
}
-config("zlib_config") {
- include_dirs = [ "." ]
+if (use_system_zlib) {
+ import("//build/shim_headers.gni")
}
-config("zlib_internal_config") {
- defines = [ "ZLIB_IMPLEMENTATION" ]
-
- if (!is_debug) {
- # Build code using -O3, see: crbug.com/1084371.
- configs = [ "//build/config/compiler:optimize_speed" ]
- }
- if (is_debug || use_libfuzzer) {
- # Enable zlib's asserts in debug and fuzzer builds.
- defines += [ "ZLIB_DEBUG" ]
- }
-
- if (is_win && !is_clang) {
- # V8 supports building with msvc, these silence some warnings that
- # causes compilation to fail (https://crbug.com/1255096).
- cflags = [
- "/wd4244",
- "/wd4100",
- "/wd4702",
- "/wd4127",
- ]
- }
-}
-
-source_set("zlib_common_headers") {
- sources = [
- "chromeconf.h",
- "deflate.h",
- "inffast.h",
- "inffixed.h",
- "inflate.h",
- "inftrees.h",
- "zconf.h",
- "zlib.h",
- "zutil.h",
- ]
+config("system_zlib") {
+ defines = [ "USE_SYSTEM_ZLIB=1" ]
}
-use_arm_neon_optimizations = false
-if ((current_cpu == "arm" || current_cpu == "arm64") &&
- !(is_win && !is_clang)) {
- # TODO(richard.townsend@arm.com): Optimizations temporarily disabled for
- # Windows on Arm MSVC builds, see http://crbug.com/v8/10012.
- if (arm_use_neon) {
- use_arm_neon_optimizations = true
+config("zlib_config") {
+ if (use_system_zlib) {
+ configs = [ ":system_zlib" ]
+ } else {
+ include_dirs = [ "." ]
}
}
-use_x86_x64_optimizations =
- (current_cpu == "x86" || current_cpu == "x64") && !is_ios
+if (!use_system_zlib) {
+ config("zlib_internal_config") {
+ defines = [ "ZLIB_IMPLEMENTATION" ]
-config("zlib_adler32_simd_config") {
- if (use_x86_x64_optimizations) {
- defines = [ "ADLER32_SIMD_SSSE3" ]
- if (is_win) {
- defines += [ "X86_WINDOWS" ]
- } else {
- defines += [ "X86_NOT_WINDOWS" ]
+ if (!is_debug) {
+ # Build code using -O3, see: crbug.com/1084371.
+ configs = [ "//build/config/compiler:optimize_speed" ]
+ }
+ if (is_debug || use_libfuzzer) {
+ # Enable zlib's asserts in debug and fuzzer builds.
+ defines += [ "ZLIB_DEBUG" ]
}
- }
- if (use_arm_neon_optimizations) {
- defines = [ "ADLER32_SIMD_NEON" ]
+ if (is_win && !is_clang) {
+ # V8 supports building with msvc, these silence some warnings that
+ # causes compilation to fail (https://crbug.com/1255096).
+ cflags = [
+ "/wd4244",
+ "/wd4100",
+ "/wd4702",
+ "/wd4127",
+ ]
+ }
}
-}
-source_set("zlib_adler32_simd") {
- visibility = [ ":*" ]
+ source_set("zlib_common_headers") {
+ visibility = [ ":*" ]
- if (use_x86_x64_optimizations) {
sources = [
- "adler32_simd.c",
- "adler32_simd.h",
+ "chromeconf.h",
+ "deflate.h",
+ "inffast.h",
+ "inffixed.h",
+ "inflate.h",
+ "inftrees.h",
+ "zconf.h",
+ "zlib.h",
+ "zutil.h",
]
-
- if (!is_win || is_clang) {
- cflags = [ "-mssse3" ]
- }
}
- if (use_arm_neon_optimizations) {
- sources = [
- "adler32_simd.c",
- "adler32_simd.h",
- ]
+ use_arm_neon_optimizations = false
+ if ((current_cpu == "arm" || current_cpu == "arm64") &&
+ !(is_win && !is_clang)) {
+ # TODO(richard.townsend@arm.com): Optimizations temporarily disabled for
+ # Windows on Arm MSVC builds, see http://crbug.com/v8/10012.
+ if (arm_use_neon) {
+ use_arm_neon_optimizations = true
+ }
}
- configs += [ ":zlib_internal_config" ]
+ use_x86_x64_optimizations =
+ (current_cpu == "x86" || current_cpu == "x64") && !is_ios
- public_configs = [ ":zlib_adler32_simd_config" ]
-
- public_deps = [ ":zlib_common_headers" ]
-}
-
-if (use_arm_neon_optimizations) {
- config("zlib_arm_crc32_config") {
- # Disabled for iPhone, as described in DDI0487C_a_armv8_arm:
- # "All implementations of the ARMv8.1 architecture are required to
- # implement the CRC32* instructions. These are optional in ARMv8.0."
- if (!is_ios) {
- defines = [ "CRC32_ARMV8_CRC32" ]
- if (is_android) {
- defines += [ "ARMV8_OS_ANDROID" ]
- } else if (is_linux || is_chromeos) {
- defines += [ "ARMV8_OS_LINUX" ]
- } else if (is_mac) {
- defines += [ "ARMV8_OS_MACOS" ]
- } else if (is_fuchsia) {
- defines += [ "ARMV8_OS_FUCHSIA" ]
- } else if (is_win) {
- defines += [ "ARMV8_OS_WINDOWS" ]
+ config("zlib_adler32_simd_config") {
+ if (use_x86_x64_optimizations) {
+ defines = [ "ADLER32_SIMD_SSSE3" ]
+ if (is_win) {
+ defines += [ "X86_WINDOWS" ]
} else {
- assert(false, "Unsupported ARM OS")
+ defines += [ "X86_NOT_WINDOWS" ]
}
}
+
+ if (use_arm_neon_optimizations) {
+ defines = [ "ADLER32_SIMD_NEON" ]
+ }
}
- source_set("zlib_arm_crc32") {
+ source_set("zlib_adler32_simd") {
visibility = [ ":*" ]
- if (!is_ios) {
- include_dirs = [ "." ]
+ if (use_x86_x64_optimizations) {
+ sources = [
+ "adler32_simd.c",
+ "adler32_simd.h",
+ ]
- if (!is_win && !is_clang) {
- assert(!use_thin_lto,
- "ThinLTO fails mixing different module-level targets")
- cflags_c = [ "-march=armv8-a+crc" ]
+ if (!is_win || is_clang) {
+ cflags = [ "-mssse3" ]
}
+ }
+ if (use_arm_neon_optimizations) {
sources = [
- "crc32_simd.c",
- "crc32_simd.h",
+ "adler32_simd.c",
+ "adler32_simd.h",
]
}
configs += [ ":zlib_internal_config" ]
- public_configs = [ ":zlib_arm_crc32_config" ]
+ public_configs = [ ":zlib_adler32_simd_config" ]
public_deps = [ ":zlib_common_headers" ]
}
-}
-
-config("zlib_inflate_chunk_simd_config") {
- if (use_x86_x64_optimizations) {
- defines = [ "INFLATE_CHUNK_SIMD_SSE2" ]
- if (current_cpu == "x64") {
- defines += [ "INFLATE_CHUNK_READ_64LE" ]
+ if (use_arm_neon_optimizations) {
+ config("zlib_arm_crc32_config") {
+ # Disabled for iPhone, as described in DDI0487C_a_armv8_arm:
+ # "All implementations of the ARMv8.1 architecture are required to
+ # implement the CRC32* instructions. These are optional in ARMv8.0."
+ if (!is_ios) {
+ defines = [ "CRC32_ARMV8_CRC32" ]
+ if (is_android) {
+ defines += [ "ARMV8_OS_ANDROID" ]
+ } else if (is_linux || is_chromeos) {
+ defines += [ "ARMV8_OS_LINUX" ]
+ } else if (is_mac) {
+ defines += [ "ARMV8_OS_MACOS" ]
+ } else if (is_fuchsia) {
+ defines += [ "ARMV8_OS_FUCHSIA" ]
+ } else if (is_win) {
+ defines += [ "ARMV8_OS_WINDOWS" ]
+ } else {
+ assert(false, "Unsupported ARM OS")
+ }
+ }
}
- }
- if (use_arm_neon_optimizations) {
- defines = [ "INFLATE_CHUNK_SIMD_NEON" ]
+ source_set("zlib_arm_crc32") {
+ visibility = [ ":*" ]
- if (current_cpu == "arm64") {
- defines += [ "INFLATE_CHUNK_READ_64LE" ]
- }
- }
-}
+ if (!is_ios) {
+ include_dirs = [ "." ]
-source_set("zlib_inflate_chunk_simd") {
- visibility = [ ":*" ]
+ if (!is_win && !is_clang) {
+ assert(!use_thin_lto,
+ "ThinLTO fails mixing different module-level targets")
+ cflags_c = [ "-march=armv8-a+aes+crc" ]
+ }
- if (use_x86_x64_optimizations || use_arm_neon_optimizations) {
- include_dirs = [ "." ]
+ sources = [
+ "crc32_simd.c",
+ "crc32_simd.h",
+ ]
+ }
- sources = [
- "contrib/optimizations/chunkcopy.h",
- "contrib/optimizations/inffast_chunk.c",
- "contrib/optimizations/inffast_chunk.h",
- "contrib/optimizations/inflate.c",
- ]
- }
+ configs += [ ":zlib_internal_config" ]
- configs += [ ":zlib_internal_config" ]
+ public_configs = [ ":zlib_arm_crc32_config" ]
- # Needed for MSVC, which is still supported by V8 and PDFium. zlib uses K&R C
- # style function declarations, which triggers warning C4131.
- configs -= [ "//build/config/compiler:chromium_code" ]
- configs += [ "//build/config/compiler:no_chromium_code" ]
+ public_deps = [ ":zlib_common_headers" ]
+ }
+ }
- public_configs = [ ":zlib_inflate_chunk_simd_config" ]
+ config("zlib_inflate_chunk_simd_config") {
+ if (use_x86_x64_optimizations) {
+ defines = [ "INFLATE_CHUNK_SIMD_SSE2" ]
- public_deps = [ ":zlib_common_headers" ]
-}
+ if (current_cpu == "x64") {
+ defines += [ "INFLATE_CHUNK_READ_64LE" ]
+ }
+ }
+
+ if (use_arm_neon_optimizations) {
+ defines = [ "INFLATE_CHUNK_SIMD_NEON" ]
-config("zlib_crc32_simd_config") {
- if (use_x86_x64_optimizations) {
- defines = [ "CRC32_SIMD_SSE42_PCLMUL" ]
+ if (current_cpu == "arm64") {
+ defines += [ "INFLATE_CHUNK_READ_64LE" ]
+ }
+ }
}
-}
-source_set("zlib_crc32_simd") {
- visibility = [ ":*" ]
+ source_set("zlib_inflate_chunk_simd") {
+ visibility = [ ":*" ]
- if (use_x86_x64_optimizations) {
- sources = [
- "crc32_simd.c",
- "crc32_simd.h",
- "crc_folding.c",
- ]
+ if (use_x86_x64_optimizations || use_arm_neon_optimizations) {
+ include_dirs = [ "." ]
- if (!is_win || is_clang) {
- cflags = [
- "-msse4.2",
- "-mpclmul",
+ sources = [
+ "contrib/optimizations/chunkcopy.h",
+ "contrib/optimizations/inffast_chunk.c",
+ "contrib/optimizations/inffast_chunk.h",
+ "contrib/optimizations/inflate.c",
]
}
- }
- configs += [ ":zlib_internal_config" ]
+ configs += [ ":zlib_internal_config" ]
- public_configs = [ ":zlib_crc32_simd_config" ]
+ # Needed for MSVC, which is still supported by V8 and PDFium. zlib uses K&R C
+ # style function declarations, which triggers warning C4131.
+ configs -= [ "//build/config/compiler:chromium_code" ]
+ configs += [ "//build/config/compiler:no_chromium_code" ]
+ configs += [ ":zlib_warnings" ]
- public_deps = [ ":zlib_common_headers" ]
-}
+ public_configs = [ ":zlib_inflate_chunk_simd_config" ]
-config("zlib_slide_hash_simd_config") {
- if (use_x86_x64_optimizations) {
- defines = [ "DEFLATE_SLIDE_HASH_SSE2" ]
+ public_deps = [ ":zlib_common_headers" ]
}
- if (use_arm_neon_optimizations) {
- defines = [ "DEFLATE_SLIDE_HASH_NEON" ]
+ config("zlib_crc32_simd_config") {
+ if (use_x86_x64_optimizations) {
+ defines = [ "CRC32_SIMD_SSE42_PCLMUL" ]
+ }
}
-}
-source_set("zlib_slide_hash_simd") {
- visibility = [ ":*" ]
+ source_set("zlib_crc32_simd") {
+ visibility = [ ":*" ]
- if (use_x86_x64_optimizations) {
- sources = [ "slide_hash_simd.h" ]
+ if (use_x86_x64_optimizations) {
+ sources = [
+ "crc32_simd.c",
+ "crc32_simd.h",
+ "crc_folding.c",
+ ]
+
+ if (!is_win || is_clang) {
+ cflags = [
+ "-msse4.2",
+ "-mpclmul",
+ ]
+ }
+ }
+
+ configs += [ ":zlib_internal_config" ]
+
+ public_configs = [ ":zlib_crc32_simd_config" ]
+
+ public_deps = [ ":zlib_common_headers" ]
}
- if (use_arm_neon_optimizations) {
- sources = [ "slide_hash_simd.h" ]
+ config("zlib_slide_hash_simd_config") {
+ if (use_x86_x64_optimizations) {
+ defines = [ "DEFLATE_SLIDE_HASH_SSE2" ]
+ }
+
+ if (use_arm_neon_optimizations) {
+ defines = [ "DEFLATE_SLIDE_HASH_NEON" ]
+ }
}
- configs += [ ":zlib_internal_config" ]
+ source_set("zlib_slide_hash_simd") {
+ visibility = [ ":*" ]
- public_configs = [ ":zlib_slide_hash_simd_config" ]
+ if (use_x86_x64_optimizations) {
+ sources = [ "slide_hash_simd.h" ]
+ }
- public_deps = [ ":zlib_common_headers" ]
-}
+ if (use_arm_neon_optimizations) {
+ sources = [ "slide_hash_simd.h" ]
+ }
-config("zlib_warnings") {
- if (is_clang && use_x86_x64_optimizations) {
- cflags = [ "-Wno-incompatible-pointer-types" ]
- }
-}
+ configs += [ ":zlib_internal_config" ]
-component("zlib") {
- if (!is_win) {
- # Don't stomp on "libzlib" on other platforms.
- output_name = "chrome_zlib"
- }
+ public_configs = [ ":zlib_slide_hash_simd_config" ]
- sources = [
- "adler32.c",
- "chromeconf.h",
- "compress.c",
- "contrib/optimizations/insert_string.h",
- "cpu_features.c",
- "cpu_features.h",
- "crc32.c",
- "crc32.h",
- "deflate.c",
- "deflate.h",
- "gzclose.c",
- "gzguts.h",
- "gzlib.c",
- "gzread.c",
- "gzwrite.c",
- "infback.c",
- "inffast.c",
- "inffast.h",
- "inffixed.h",
- "inflate.h",
- "inftrees.c",
- "inftrees.h",
- "trees.c",
- "trees.h",
- "uncompr.c",
- "zconf.h",
- "zlib.h",
- "zutil.c",
- "zutil.h",
- ]
-
- defines = []
- deps = []
-
- if (!use_x86_x64_optimizations && !use_arm_neon_optimizations) {
- # Apparently android_cronet bot builds with NEON disabled and
- # we also should disable optimizations for iOS@x86 (a.k.a. simulator).
- defines += [ "CPU_NO_SIMD" ]
+ public_deps = [ ":zlib_common_headers" ]
}
- if (is_ios) {
- # iOS@ARM is a special case where we always have NEON but don't check
- # for crypto extensions.
- # TODO(cavalcantii): verify what is the current state of CPU features
- # shipped on latest iOS devices.
- defines += [ "ARM_OS_IOS" ]
+ config("zlib_warnings") {
+ if (is_clang) {
+ cflags = [
+ "-Wno-deprecated-non-prototype",
+ "-Wno-incompatible-pointer-types",
+ "-Wunused-variable",
+ ]
+ }
}
- if (use_x86_x64_optimizations || use_arm_neon_optimizations) {
- deps += [
- ":zlib_adler32_simd",
- ":zlib_inflate_chunk_simd",
- ":zlib_slide_hash_simd",
+ component("zlib") {
+ if (!is_win) {
+ # Don't stomp on "libzlib" on other platforms.
+ output_name = "chrome_zlib"
+ }
+
+ sources = [
+ "adler32.c",
+ "chromeconf.h",
+ "compress.c",
+ "contrib/optimizations/insert_string.h",
+ "cpu_features.c",
+ "cpu_features.h",
+ "crc32.c",
+ "crc32.h",
+ "deflate.c",
+ "deflate.h",
+ "gzclose.c",
+ "gzguts.h",
+ "gzlib.c",
+ "gzread.c",
+ "gzwrite.c",
+ "infback.c",
+ "inffast.c",
+ "inffast.h",
+ "inffixed.h",
+ "inflate.h",
+ "inftrees.c",
+ "inftrees.h",
+ "trees.c",
+ "trees.h",
+ "uncompr.c",
+ "zconf.h",
+ "zlib.h",
+ "zutil.c",
+ "zutil.h",
]
- if (use_x86_x64_optimizations) {
- deps += [ ":zlib_crc32_simd" ]
- } else if (use_arm_neon_optimizations) {
- deps += [ ":zlib_arm_crc32" ]
+ defines = []
+ deps = []
+
+ if (!use_x86_x64_optimizations && !use_arm_neon_optimizations) {
+ # Apparently android_cronet bot builds with NEON disabled and
+ # we also should disable optimizations for iOS@x86 (a.k.a. simulator).
+ defines += [ "CPU_NO_SIMD" ]
}
- } else {
- sources += [ "inflate.c" ]
- }
- if (is_android) {
- import("//build/config/android/config.gni")
- if (defined(android_ndk_root) && android_ndk_root != "") {
- deps += [ "//third_party/android_ndk:cpu_features" ]
+ if (is_ios) {
+ # iOS@ARM is a special case where we always have NEON but don't check
+ # for crypto extensions.
+ # TODO(cavalcantii): verify what is the current state of CPU features
+ # shipped on latest iOS devices.
+ defines += [ "ARM_OS_IOS" ]
+ }
+
+ if (use_x86_x64_optimizations || use_arm_neon_optimizations) {
+ deps += [
+ ":zlib_adler32_simd",
+ ":zlib_inflate_chunk_simd",
+ ":zlib_slide_hash_simd",
+ ]
+
+ if (use_x86_x64_optimizations) {
+ deps += [ ":zlib_crc32_simd" ]
+ } else if (use_arm_neon_optimizations) {
+ deps += [ ":zlib_arm_crc32" ]
+ }
} else {
- assert(false, "CPU detection requires the Android NDK")
+ sources += [ "inflate.c" ]
}
- }
- configs -= [ "//build/config/compiler:chromium_code" ]
- configs += [ "//build/config/compiler:no_chromium_code" ]
+ if (is_android) {
+ import("//build/config/android/config.gni")
+ if (defined(android_ndk_root) && android_ndk_root != "") {
+ deps += [ "//third_party/android_ndk:cpu_features" ]
+ } else {
+ assert(false, "CPU detection requires the Android NDK")
+ }
+ }
+
+ configs -= [ "//build/config/compiler:chromium_code" ]
+ configs += [ "//build/config/compiler:no_chromium_code" ]
- public_configs = [ ":zlib_config" ]
+ public_configs = [ ":zlib_config" ]
- configs += [
- ":zlib_internal_config",
+ configs += [
+ ":zlib_internal_config",
- # Must be after no_chromium_code for warning flags to be ordered correctly.
- ":zlib_warnings",
- ]
+ # Must be after no_chromium_code for warning flags to be ordered correctly.
+ ":zlib_warnings",
+ ]
- allow_circular_includes_from = deps
+ allow_circular_includes_from = deps
+ }
+} else {
+ shim_headers("zlib_shim") {
+ root_path = "//zlib"
+ headers = [ "zlib.h" ]
+ }
+ source_set("zlib") {
+ deps = [ ":zlib_shim" ]
+ libs = [ "z" ]
+ public_configs = [ ":system_zlib" ]
+ }
}
-config("minizip_warnings") {
- visibility = [ ":*" ]
+if (!use_system_zlib) {
+ config("minizip_warnings") {
+ visibility = [ ":*" ]
- if (is_clang) {
- # zlib uses `if ((a == b))` for some reason.
- cflags = [ "-Wno-parentheses-equality" ]
+ if (is_clang) {
+ cflags = [
+ # zlib uses `if ((a == b))` for some reason.
+ "-Wno-parentheses-equality",
+ "-Wno-deprecated-non-prototype",
+ ]
+ }
}
-}
-static_library("minizip") {
- sources = [
- "contrib/minizip/ioapi.c",
- "contrib/minizip/ioapi.h",
- "contrib/minizip/iowin32.c",
- "contrib/minizip/iowin32.h",
- "contrib/minizip/unzip.c",
- "contrib/minizip/unzip.h",
- "contrib/minizip/zip.c",
- "contrib/minizip/zip.h",
- ]
-
- if (!is_win) {
- sources -= [
+ static_library("minizip") {
+ sources = [
+ "contrib/minizip/ioapi.c",
+ "contrib/minizip/ioapi.h",
"contrib/minizip/iowin32.c",
"contrib/minizip/iowin32.h",
+ "contrib/minizip/unzip.c",
+ "contrib/minizip/unzip.h",
+ "contrib/minizip/zip.c",
+ "contrib/minizip/zip.h",
]
- }
- if (is_apple || is_android || is_nacl) {
- # Mac, Android and the BSDs don't have fopen64, ftello64, or fseeko64. We
- # use fopen, ftell, and fseek instead on these systems.
- defines = [ "USE_FILE32API" ]
- }
+ if (!is_win) {
+ sources -= [
+ "contrib/minizip/iowin32.c",
+ "contrib/minizip/iowin32.h",
+ ]
+ }
+
+ if (is_apple || is_android || is_nacl) {
+ # Mac, Android and the BSDs don't have fopen64, ftello64, or fseeko64. We
+ # use fopen, ftell, and fseek instead on these systems.
+ defines = [ "USE_FILE32API" ]
+ }
- deps = [ ":zlib" ]
+ deps = [ ":zlib" ]
- configs -= [ "//build/config/compiler:chromium_code" ]
- configs += [ "//build/config/compiler:no_chromium_code" ]
+ configs -= [ "//build/config/compiler:chromium_code" ]
+ configs += [ "//build/config/compiler:no_chromium_code" ]
- public_configs = [ ":zlib_config" ]
+ public_configs = [ ":zlib_config" ]
- configs += [
- # Must be after no_chromium_code for warning flags to be ordered correctly.
- ":minizip_warnings",
- ]
+ configs += [
+ # Must be after no_chromium_code for warning flags to be ordered correctly.
+ ":minizip_warnings",
+ ]
+ }
+} else {
+ shim_headers("minizip_shim") {
+ root_path = "contrib"
+ headers = [
+ "minizip/crypt.h",
+ "minizip/ioapi.h",
+ "minizip/iowin32.h",
+ "minizip/mztools.h",
+ "minizip/unzip.h",
+ "minizip/zip.h",
+ ]
+ }
+ source_set("minizip") {
+ deps = [ ":minizip_shim" ]
+ libs = [ "minizip" ]
+ }
}
-executable("zlib_bench") {
- include_dirs = [ "." ]
+if (!use_system_zlib) {
+ executable("zlib_bench") {
+ include_dirs = [ "." ]
- sources = [ "contrib/bench/zlib_bench.cc" ]
- if (!is_debug) {
- configs -= [ "//build/config/compiler:default_optimization" ]
- configs += [ "//build/config/compiler:optimize_speed" ]
- }
+ sources = [ "contrib/bench/zlib_bench.cc" ]
+ if (!is_debug) {
+ configs -= [ "//build/config/compiler:default_optimization" ]
+ configs += [ "//build/config/compiler:optimize_speed" ]
+ }
- deps = [ ":zlib" ]
+ deps = [ ":zlib" ]
- configs -= [ "//build/config/compiler:chromium_code" ]
- configs += [ "//build/config/compiler:no_chromium_code" ]
+ configs -= [ "//build/config/compiler:chromium_code" ]
+ configs += [ "//build/config/compiler:no_chromium_code" ]
+ }
}
if (!is_win || target_os != "winuwp") {
@@ -432,7 +487,11 @@ if (!is_win || target_os != "winuwp") {
sources = [ "contrib/minizip/minizip.c" ]
if (is_clang) {
- cflags = [ "-Wno-incompatible-pointer-types-discards-qualifiers" ]
+ cflags = [
+ "-Wno-incompatible-pointer-types-discards-qualifiers",
+
+ "-Wno-deprecated-non-prototype",
+ ]
}
if (!is_debug) {
@@ -452,7 +511,10 @@ if (!is_win || target_os != "winuwp") {
sources = [ "contrib/minizip/miniunz.c" ]
if (is_clang) {
- cflags = [ "-Wno-incompatible-pointer-types-discards-qualifiers" ]
+ cflags = [
+ "-Wno-incompatible-pointer-types-discards-qualifiers",
+ "-Wno-deprecated-non-prototype",
+ ]
}
if (!is_debug) {
diff --git a/third_party/zlib/system.gni b/third_party/zlib/system.gni
new file mode 100644
index 0000000..74604f9
--- /dev/null
+++ b/third_party/zlib/system.gni
@@ -0,0 +1,11 @@
+# Copyright 2023 The Chromium Authors
+# 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 zlib and use as shared libraries.
+ # Useful for Linux distribution repository builds.
+ use_system_zlib = false
+}

439
testing/dart/unbundle.patch Normal file
View File

@ -0,0 +1,439 @@
diff --git a/build/linux/unbundle/icu.gn b/build/linux/unbundle/icu.gn
new file mode 100644
index 00000000000..9e54d4efe4e
--- /dev/null
+++ b/build/linux/unbundle/icu.gn
@@ -0,0 +1,262 @@
+# Copyright 2016 The Chromium Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("//build/config/linux/pkg_config.gni")
+import("//build/shim_headers.gni")
+
+group("icu") {
+ public_deps = [
+ ":icui18n",
+ ":icuuc",
+ ]
+}
+
+config("icu_config") {
+ defines = [
+ "USING_SYSTEM_ICU=1",
+ "ICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_STATIC",
+
+ # U_EXPORT (defined in unicode/platform.h) is used to set public visibility
+ # on classes through the U_COMMON_API and U_I18N_API macros (among others).
+ # When linking against the system ICU library, we want its symbols to have
+ # public LTO visibility. This disables CFI checks for the ICU classes and
+ # allows whole-program optimization to be applied to the rest of Chromium.
+ #
+ # Both U_COMMON_API and U_I18N_API macros would be defined to U_EXPORT only
+ # when U_COMBINED_IMPLEMENTATION is defined (see unicode/utypes.h). Because
+ # we override the default system UCHAR_TYPE (char16_t), it is not possible
+ # to use U_COMBINED_IMPLEMENTATION at this moment, meaning the U_COMMON_API
+ # and U_I18N_API macros are set to U_IMPORT which is an empty definition.
+ #
+ # Until building with UCHAR_TYPE=char16_t is supported, one way to apply
+ # public visibility (and thus public LTO visibility) to all ICU classes is
+ # to define U_IMPORT to have the same value as U_EXPORT. For more details,
+ # please see: https://crbug.com/822820
+ "U_IMPORT=U_EXPORT",
+ ]
+}
+
+pkg_config("system_icui18n") {
+ packages = [ "icu-i18n" ]
+}
+
+pkg_config("system_icuuc") {
+ packages = [ "icu-uc" ]
+}
+
+source_set("icui18n") {
+ public_deps = [ ":icui18n_shim" ]
+ public_configs = [
+ ":icu_config",
+ ":system_icui18n",
+ ]
+}
+
+source_set("icuuc") {
+ public_deps = [ ":icuuc_shim" ]
+ public_configs = [
+ ":icu_config",
+ ":system_icuuc",
+ ]
+}
+
+group("icui18n_hidden_visibility") {
+ public_deps = [ ":icui18n" ]
+}
+
+group("icuuc_hidden_visibility") {
+ public_deps = [ ":icuuc" ]
+}
+
+shim_headers("icui18n_shim") {
+ root_path = "source/i18n"
+ headers = [
+ # This list can easily be updated using the commands below:
+ # cd third_party/icu/source/i18n
+ # find unicode -iname '*.h' -printf ' "%p",\n' | LC_ALL=C sort -u
+ "unicode/alphaindex.h",
+ "unicode/basictz.h",
+ "unicode/calendar.h",
+ "unicode/choicfmt.h",
+ "unicode/coleitr.h",
+ "unicode/coll.h",
+ "unicode/compactdecimalformat.h",
+ "unicode/curramt.h",
+ "unicode/currpinf.h",
+ "unicode/currunit.h",
+ "unicode/datefmt.h",
+ "unicode/dcfmtsym.h",
+ "unicode/decimfmt.h",
+ "unicode/dtfmtsym.h",
+ "unicode/dtitvfmt.h",
+ "unicode/dtitvinf.h",
+ "unicode/dtptngen.h",
+ "unicode/dtrule.h",
+ "unicode/fieldpos.h",
+ "unicode/fmtable.h",
+ "unicode/format.h",
+ "unicode/fpositer.h",
+ "unicode/gender.h",
+ "unicode/gregocal.h",
+ "unicode/listformatter.h",
+ "unicode/measfmt.h",
+ "unicode/measunit.h",
+ "unicode/measure.h",
+ "unicode/msgfmt.h",
+ "unicode/numfmt.h",
+ "unicode/numsys.h",
+ "unicode/plurfmt.h",
+ "unicode/plurrule.h",
+ "unicode/rbnf.h",
+ "unicode/rbtz.h",
+ "unicode/regex.h",
+ "unicode/region.h",
+ "unicode/reldatefmt.h",
+ "unicode/scientificnumberformatter.h",
+ "unicode/search.h",
+ "unicode/selfmt.h",
+ "unicode/simpletz.h",
+ "unicode/smpdtfmt.h",
+ "unicode/sortkey.h",
+ "unicode/stsearch.h",
+ "unicode/tblcoll.h",
+ "unicode/timezone.h",
+ "unicode/tmunit.h",
+ "unicode/tmutamt.h",
+ "unicode/tmutfmt.h",
+ "unicode/translit.h",
+ "unicode/tzfmt.h",
+ "unicode/tznames.h",
+ "unicode/tzrule.h",
+ "unicode/tztrans.h",
+ "unicode/ucal.h",
+ "unicode/ucol.h",
+ "unicode/ucoleitr.h",
+ "unicode/ucsdet.h",
+ "unicode/udat.h",
+ "unicode/udateintervalformat.h",
+ "unicode/udatpg.h",
+ "unicode/ufieldpositer.h",
+ "unicode/uformattable.h",
+ "unicode/ugender.h",
+ "unicode/ulocdata.h",
+ "unicode/umsg.h",
+ "unicode/unirepl.h",
+ "unicode/unum.h",
+ "unicode/unumsys.h",
+ "unicode/upluralrules.h",
+ "unicode/uregex.h",
+ "unicode/uregion.h",
+ "unicode/ureldatefmt.h",
+ "unicode/usearch.h",
+ "unicode/uspoof.h",
+ "unicode/utmscale.h",
+ "unicode/utrans.h",
+ "unicode/vtzone.h",
+ ]
+}
+
+shim_headers("icuuc_shim") {
+ root_path = "source/common"
+ headers = [
+ # This list can easily be updated using the commands below:
+ # cd third_party/icu/source/common
+ # find unicode -iname '*.h' -printf ' "%p",\n' | LC_ALL=C sort -u
+ "unicode/appendable.h",
+ "unicode/brkiter.h",
+ "unicode/bytestream.h",
+ "unicode/bytestrie.h",
+ "unicode/bytestriebuilder.h",
+ "unicode/caniter.h",
+ "unicode/casemap.h",
+ "unicode/char16ptr.h",
+ "unicode/chariter.h",
+ "unicode/dbbi.h",
+ "unicode/docmain.h",
+ "unicode/dtintrv.h",
+ "unicode/edits.h",
+ "unicode/enumset.h",
+ "unicode/errorcode.h",
+ "unicode/filteredbrk.h",
+ "unicode/icudataver.h",
+ "unicode/icuplug.h",
+ "unicode/idna.h",
+ "unicode/localematcher.h",
+ "unicode/localpointer.h",
+ "unicode/locdspnm.h",
+ "unicode/locid.h",
+ "unicode/messagepattern.h",
+ "unicode/normalizer2.h",
+ "unicode/normlzr.h",
+ "unicode/parseerr.h",
+ "unicode/parsepos.h",
+ "unicode/platform.h",
+ "unicode/ptypes.h",
+ "unicode/putil.h",
+ "unicode/rbbi.h",
+ "unicode/rep.h",
+ "unicode/resbund.h",
+ "unicode/schriter.h",
+ "unicode/simpleformatter.h",
+ "unicode/std_string.h",
+ "unicode/strenum.h",
+ "unicode/stringpiece.h",
+ "unicode/stringtriebuilder.h",
+ "unicode/symtable.h",
+ "unicode/ubidi.h",
+ "unicode/ubiditransform.h",
+ "unicode/ubrk.h",
+ "unicode/ucasemap.h",
+ "unicode/ucat.h",
+ "unicode/uchar.h",
+ "unicode/ucharstrie.h",
+ "unicode/ucharstriebuilder.h",
+ "unicode/uchriter.h",
+ "unicode/uclean.h",
+ "unicode/ucnv.h",
+ "unicode/ucnv_cb.h",
+ "unicode/ucnv_err.h",
+ "unicode/ucnvsel.h",
+ "unicode/uconfig.h",
+ "unicode/ucurr.h",
+ "unicode/udata.h",
+ "unicode/udisplaycontext.h",
+ "unicode/uenum.h",
+ "unicode/uidna.h",
+ "unicode/uiter.h",
+ "unicode/uldnames.h",
+ "unicode/ulistformatter.h",
+ "unicode/uloc.h",
+ "unicode/umachine.h",
+ "unicode/umisc.h",
+ "unicode/unifilt.h",
+ "unicode/unifunct.h",
+ "unicode/unimatch.h",
+ "unicode/uniset.h",
+ "unicode/unistr.h",
+ "unicode/unorm.h",
+ "unicode/unorm2.h",
+ "unicode/uobject.h",
+ "unicode/urename.h",
+ "unicode/urep.h",
+ "unicode/ures.h",
+ "unicode/uscript.h",
+ "unicode/uset.h",
+ "unicode/usetiter.h",
+ "unicode/ushape.h",
+ "unicode/usprep.h",
+ "unicode/ustring.h",
+ "unicode/ustringtrie.h",
+ "unicode/utext.h",
+ "unicode/utf.h",
+ "unicode/utf16.h",
+ "unicode/utf32.h",
+ "unicode/utf8.h",
+ "unicode/utf_old.h",
+ "unicode/utrace.h",
+ "unicode/utypes.h",
+ "unicode/uvernum.h",
+ "unicode/uversion.h",
+ ]
+}
diff --git a/build/linux/unbundle/replace_gn_files.py b/build/linux/unbundle/replace_gn_files.py
new file mode 100755
index 00000000000..1aed7bca99d
--- /dev/null
+++ b/build/linux/unbundle/replace_gn_files.py
@@ -0,0 +1,65 @@
+#!/usr/bin/env python3
+# Copyright 2016 The Chromium Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Replaces GN files in tree with files from here that
+make the build use system libraries.
+"""
+
+import argparse
+import os
+import shutil
+import sys
+
+
+REPLACEMENTS = {
+ 'icu': 'third_party/icu/BUILD.gn',
+ 'protobuf': 'build/secondary/third_party/protobuf/BUILD.gn',
+ 'zlib': 'third_party/zlib/BUILD.gn',
+}
+
+
+def DoMain(argv):
+ my_dirname = os.path.dirname(__file__)
+ source_tree_root = os.path.abspath(
+ os.path.join(my_dirname, '..', '..', '..'))
+
+ parser = argparse.ArgumentParser()
+ parser.add_argument('--system-libraries', nargs='*', default=[])
+ parser.add_argument('--undo', action='store_true')
+
+ args = parser.parse_args(argv)
+
+ handled_libraries = set()
+ for lib, path in REPLACEMENTS.items():
+ if lib not in args.system_libraries:
+ continue
+ handled_libraries.add(lib)
+
+ if args.undo:
+ # Restore original file, and also remove the backup.
+ # This is meant to restore the source tree to its original state.
+ os.rename(os.path.join(source_tree_root, path + '.orig'),
+ os.path.join(source_tree_root, path))
+ else:
+ # Create a backup copy for --undo.
+ shutil.copyfile(os.path.join(source_tree_root, path),
+ os.path.join(source_tree_root, path + '.orig'))
+
+ # Copy the GN file from directory of this script to target path.
+ shutil.copyfile(os.path.join(my_dirname, '%s.gn' % lib),
+ os.path.join(source_tree_root, path))
+
+ unhandled_libraries = set(args.system_libraries) - handled_libraries
+ if unhandled_libraries:
+ print('Unrecognized system libraries requested: %s' % ', '.join(
+ sorted(unhandled_libraries)), file=sys.stderr)
+ return 1
+
+ return 0
+
+
+if __name__ == '__main__':
+ sys.exit(DoMain(sys.argv[1:]))
diff --git a/build/linux/unbundle/zlib.gn b/build/linux/unbundle/zlib.gn
new file mode 100644
index 00000000000..fa2bbffd25f
--- /dev/null
+++ b/build/linux/unbundle/zlib.gn
@@ -0,0 +1,63 @@
+# Copyright 2016 The Chromium Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("//build/shim_headers.gni")
+
+shim_headers("zlib_shim") {
+ root_path = "."
+ headers = [ "zlib.h" ]
+ additional_includes = [ "third_party" ]
+
+}
+
+config("system_zlib") {
+ defines = [ "USE_SYSTEM_ZLIB=1" ]
+}
+
+config("zlib_config") {
+ configs = [ ":system_zlib" ]
+}
+
+source_set("zlib") {
+ public_deps = [ ":zlib_shim" ]
+ libs = [ "z" ]
+ public_configs = [ ":system_zlib" ]
+}
+
+shim_headers("minizip_shim") {
+ root_path = "contrib"
+ headers = [
+ "minizip/crypt.h",
+ "minizip/ioapi.h",
+ "minizip/iowin32.h",
+ "minizip/mztools.h",
+ "minizip/unzip.h",
+ "minizip/zip.h",
+ ]
+}
+
+source_set("minizip") {
+ deps = [ ":minizip_shim" ]
+ libs = [ "minizip" ]
+}
+
+static_library("zip") {
+ sources = [
+ "google/zip.cc",
+ "google/zip.h",
+ "google/zip_internal.cc",
+ "google/zip_internal.h",
+ "google/zip_reader.cc",
+ "google/zip_reader.h",
+ ]
+ deps = [ ":minizip" ]
+}
+
+static_library("compression_utils") {
+ sources = [
+ "google/compression_utils.cc",
+ "google/compression_utils.h",
+ ]
+ deps = [ ":zlib" ]
+}
diff --git a/build/shim_headers.gni b/build/shim_headers.gni
index dc57d12ed0c..1d24e0ad00e 100644
--- a/build/shim_headers.gni
+++ b/build/shim_headers.gni
@@ -7,6 +7,11 @@ template("shim_headers") {
shim_headers_path = "${root_gen_dir}/shim_headers/${target_name}"
config(config_name) {
include_dirs = [ shim_headers_path ]
+ if (defined(invoker.additional_includes)) {
+ foreach(i, invoker.additional_includes) {
+ include_dirs += [ shim_headers_path + "/" + i ]
+ }
+ }
}
action(action_name) {
script = "//tools/generate_shim_headers.py"
@@ -26,11 +31,12 @@ template("shim_headers") {
args += invoker.headers
outputs = []
foreach(h, invoker.headers) {
- outputs += [ shim_headers_path + "/" + rebase_path(invoker.root_path,"//") + "/" + h ]
+ outputs += [ shim_headers_path + "/" +
+ rebase_path(invoker.root_path, "//") + "/" + h ]
}
}
group(target_name) {
- deps = [ ":${action_name}" ]
+ public_deps = [ ":${action_name}" ]
all_dependent_configs = [ ":${config_name}" ]
}
}