1# Copyright (c) 2021-2022 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13 14import("//base/global/i18n/i18n.gni") 15import("//base/startup/init/services/etc/param/param_fixer.gni") 16import("//build/ohos.gni") 17 18group("build_module") { 19 deps = [ 20 ":intl_util", 21 ":preferred_language", 22 ] 23} 24 25group("geocoding_depends") { 26 deps = [ "//third_party/libphonenumber/cpp:geocoding" ] 27} 28 29config("preferred_language_config") { 30 include_dirs = [ 31 "//base/global/i18n/interfaces/native/inner_api/preferred_language/include", 32 ] 33} 34ohos_shared_library("preferred_language") { 35 public_configs = [ ":preferred_language_config" ] 36 include_dirs = [ "include" ] 37 sources = [ "src/preferred_language.cpp" ] 38 cflags_cc = [ 39 "-Wall", 40 "-fPIC", 41 ] 42 deps = [ "//base/global/i18n/frameworks/intl:intl_util" ] 43 external_deps = [ "init:libbegetutil" ] 44 if (i18n_support_app_preferred_language) { 45 include_dirs += [ 46 "//base/global/resource_management/frameworks/resmgr/include", 47 "//foundation/bundlemanager/bundle_framework/interfaces/inner_api/appexecfwk_base/include/", 48 "//foundation/bundlemanager/bundle_framework/interfaces/inner_api/appexecfwk_core/include/bundlemgr/", 49 "//foundation/systemabilitymgr/samgr/interfaces/innerkits/samgr_proxy/include/", 50 ] 51 external_deps += [ 52 "ability_runtime:app_context", 53 "bundle_framework:appexecfwk_base", 54 "bundle_framework:appexecfwk_core", 55 "c_utils:utils", 56 "hilog:libhilog", 57 "ipc:ipc_core", 58 "preferences:native_preferences", 59 "resource_management:global_resmgr", 60 "samgr:samgr_proxy", 61 ] 62 defines = [ "SUPPORT_APP_PREFERRED_LANGUAGE" ] 63 } 64 subsystem_name = "global" 65 innerapi_tags = [ "platformsdk" ] 66 part_name = "i18n" 67} 68 69config("intl_util_config") { 70 include_dirs = [ 71 "//third_party/icu/icu4c/source", 72 "//third_party/icu/icu4c/source/common", 73 "//third_party/icu/icu4c/source/i18n", 74 "//third_party/icu/icu4c/source/common/unicode", 75 "//base/global/i18n/frameworks/intl/include", 76 "//base/global/i18n/interfaces/native/inner_api/i18n/include", 77 ] 78 if (i18n_support_ui) { 79 include_dirs += [ "//foundation/ability/ability_base/interfaces/kits/native/configuration/include" ] 80 } 81} 82ohos_shared_library("intl_util") { 83 public_configs = [ ":intl_util_config" ] 84 include_dirs = [ 85 "//commonlibrary/c_utils/base/include", 86 "//third_party/libxml2/include", 87 "//third_party/libphonenumber/cpp/src", 88 "//third_party/libphonenumber", 89 "//third_party/protobuf/src", 90 ] 91 sources = [ 92 "src/character.cpp", 93 "src/collator.cpp", 94 "src/date_rule_init.cpp", 95 "src/date_time_filter.cpp", 96 "src/date_time_format.cpp", 97 "src/date_time_matched.cpp", 98 "src/date_time_rule.cpp", 99 "src/entity_recognizer.cpp", 100 "src/holiday_manager.cpp", 101 "src/i18n_break_iterator.cpp", 102 "src/i18n_calendar.cpp", 103 "src/i18n_normalizer.cpp", 104 "src/i18n_timezone.cpp", 105 "src/index_util.cpp", 106 "src/locale_compare.cpp", 107 "src/locale_config.cpp", 108 "src/locale_info.cpp", 109 "src/measure_data.cpp", 110 "src/number_format.cpp", 111 "src/phone_number_format.cpp", 112 "src/phone_number_matched.cpp", 113 "src/phone_number_rule.cpp", 114 "src/plural_rules.cpp", 115 "src/regex_rule.cpp", 116 "src/relative_time_format.cpp", 117 "src/rules_engine.cpp", 118 "src/system_locale_manager.cpp", 119 "src/taboo.cpp", 120 "src/taboo_utils.cpp", 121 "src/utils.cpp", 122 ] 123 version_script = "libintl_util.map" 124 cflags_cc = [ 125 "-Wall", 126 "-fPIC", 127 ] 128 deps = [ 129 ":CN_phonenumber_xml", 130 ":GB_phonenumber_xml", 131 ":common_datetime_xml", 132 ":common_phonenumber_xml", 133 ":config_locales_xml", 134 ":config_regions_xml", 135 ":dialect_languages_xml", 136 ":en_Latn_lang_xml", 137 ":en_Latn_region_xml", 138 ":en_datetime_xml", 139 ":forbidden_languages_xml", 140 ":forbidden_regions_xml", 141 ":i18n.para", 142 ":i18n.para.dac", 143 ":lang_supported_locales", 144 ":region_supported_locales_xml", 145 ":root_timezone_xml", 146 ":timezones_xml", 147 ":tz_pixel_dat", 148 ":white_languages_xml", 149 ":zh_Hans_lang_xml", 150 ":zh_Hans_region_xml", 151 ":zh_Hans_timezone_xml", 152 ":zh_datetime_xml", 153 "//third_party/icu/icu4c:ohos_icudat", 154 "//third_party/icu/icu4c:shared_icui18n", 155 "//third_party/icu/icu4c:shared_icuuc", 156 "//third_party/libphonenumber/cpp:phonenumber_standard", 157 "//third_party/libpng:libpng", 158 "//third_party/libxml2:xml2", 159 ] 160 use_exceptions = true 161 external_deps = [ 162 "access_token:libaccesstoken_sdk", 163 "access_token:libtokenid_sdk", 164 "c_utils:utils", 165 "hilog:libhilog", 166 "init:libbegetutil", 167 "ipc:ipc_core", 168 ] 169 defines = [] 170 if (i18n_support_ui) { 171 include_dirs += [ 172 "//foundation/ability/ability_runtime/interfaces/inner_api/app_manager/include/appmgr", 173 "//foundation/ability/ability_runtime/interfaces/inner_api/ability_manager/include", 174 "//foundation/multimodalinput/input/interfaces/native/innerkits/event/include/", 175 ] 176 external_deps += [ 177 "ability_base:configuration", 178 "ability_base:want", 179 "ability_runtime:ability_manager", 180 "ability_runtime:app_manager", 181 "common_event_service:cesfwk_innerkits", 182 ] 183 defines += [ "SUPPORT_GRAPHICS" ] 184 } 185 if (is_asan) { 186 defines += [ "SUPPORT_ASAN" ] 187 } 188 install_images = [ system_base_dir ] 189 relative_install_dir = "platformsdk" 190 subsystem_name = "global" 191 innerapi_tags = [ "platformsdk" ] 192 part_name = "i18n" 193} 194 195ohos_prebuilt_para("i18n.para") { 196 source = "//base/global/i18n/frameworks/intl/etc/i18n.para" 197 part_name = "i18n" 198 module_install_dir = "etc/param" 199} 200 201ohos_prebuilt_para("i18n.para.dac") { 202 source = "//base/global/i18n/frameworks/intl/etc/i18n.para.dac" 203 part_name = "i18n" 204 module_install_dir = "etc/param" 205} 206 207ohos_prebuilt_etc("config_locales_xml") { 208 source = "//base/global/i18n/frameworks/intl/etc/supported_locales.xml" 209 module_install_dir = "usr/ohos_locale_config/" 210 part_name = "i18n" 211 subsystem_name = "global" 212} 213 214ohos_prebuilt_etc("config_regions_xml") { 215 source = "//base/global/i18n/frameworks/intl/etc/supported_regions.xml" 216 module_install_dir = "usr/ohos_locale_config/" 217 part_name = "i18n" 218 subsystem_name = "global" 219} 220 221ohos_prebuilt_etc("white_languages_xml") { 222 source = "//base/global/i18n/frameworks/intl/etc/white_languages.xml" 223 module_install_dir = "usr/ohos_locale_config/" 224 part_name = "i18n" 225 subsystem_name = "global" 226} 227 228ohos_prebuilt_etc("forbidden_languages_xml") { 229 source = "//base/global/i18n/frameworks/intl/etc/forbidden_languages.xml" 230 module_install_dir = "usr/ohos_locale_config/" 231 part_name = "i18n" 232 subsystem_name = "global" 233} 234 235ohos_prebuilt_etc("CN_phonenumber_xml") { 236 source = "//base/global/i18n/frameworks/intl/etc/phonenumber/CN.xml" 237 module_install_dir = "usr/ohos_locale_config/phonenumber/" 238 part_name = "i18n" 239 subsystem_name = "global" 240} 241 242ohos_prebuilt_etc("GB_phonenumber_xml") { 243 source = "//base/global/i18n/frameworks/intl/etc/phonenumber/GB.xml" 244 module_install_dir = "usr/ohos_locale_config/phonenumber/" 245 part_name = "i18n" 246 subsystem_name = "global" 247} 248 249ohos_prebuilt_etc("common_phonenumber_xml") { 250 source = "//base/global/i18n/frameworks/intl/etc/phonenumber/common.xml" 251 module_install_dir = "usr/ohos_locale_config/phonenumber/" 252 part_name = "i18n" 253 subsystem_name = "global" 254} 255 256ohos_prebuilt_etc("zh_datetime_xml") { 257 source = "//base/global/i18n/frameworks/intl/etc/datetime/zh.xml" 258 module_install_dir = "usr/ohos_locale_config/datetime/" 259 part_name = "i18n" 260 subsystem_name = "global" 261} 262 263ohos_prebuilt_etc("en_datetime_xml") { 264 source = "//base/global/i18n/frameworks/intl/etc/datetime/en.xml" 265 module_install_dir = "usr/ohos_locale_config/datetime/" 266 part_name = "i18n" 267 subsystem_name = "global" 268} 269 270ohos_prebuilt_etc("common_datetime_xml") { 271 source = "//base/global/i18n/frameworks/intl/etc/datetime/common.xml" 272 module_install_dir = "usr/ohos_locale_config/datetime/" 273 part_name = "i18n" 274 subsystem_name = "global" 275} 276 277ohos_prebuilt_etc("forbidden_regions_xml") { 278 source = "//base/global/i18n/frameworks/intl/etc/forbidden_regions.xml" 279 module_install_dir = "usr/ohos_locale_config/" 280 part_name = "i18n" 281 subsystem_name = "global" 282} 283 284ohos_prebuilt_etc("lang_supported_locales") { 285 source = "//base/global/i18n/frameworks/intl/etc/lang/supported_locales.xml" 286 module_install_dir = "etc/ohos_lang_config/" 287 part_name = "i18n" 288 subsystem_name = "global" 289} 290 291ohos_prebuilt_etc("zh_Hans_lang_xml") { 292 source = "//base/global/i18n/frameworks/intl/etc/lang/zh-Hans.xml" 293 module_install_dir = "etc/ohos_lang_config/" 294 part_name = "i18n" 295 subsystem_name = "global" 296} 297 298ohos_prebuilt_etc("zh_Hans_timezone_xml") { 299 source = "//base/global/i18n/frameworks/intl/etc/timezone/zh_Hans.xml" 300 module_install_dir = "usr/ohos_timezone/ohos_city_dispname/" 301 part_name = "i18n" 302 subsystem_name = "global" 303} 304 305ohos_prebuilt_etc("en_Latn_lang_xml") { 306 source = "//base/global/i18n/frameworks/intl/etc/lang/en-Latn.xml" 307 module_install_dir = "etc/ohos_lang_config/" 308 part_name = "i18n" 309 subsystem_name = "global" 310} 311 312ohos_prebuilt_etc("root_timezone_xml") { 313 source = "//base/global/i18n/frameworks/intl/etc/timezone/root.xml" 314 module_install_dir = "usr/ohos_timezone/ohos_city_dispname/" 315 part_name = "i18n" 316 subsystem_name = "global" 317} 318 319ohos_prebuilt_etc("timezones_xml") { 320 source = "//base/global/i18n/frameworks/intl/etc/timezone/ohos_timezones.xml" 321 module_install_dir = "usr/ohos_timezone/" 322 part_name = "i18n" 323 subsystem_name = "global" 324} 325 326ohos_prebuilt_etc("tz_pixel_dat") { 327 source = 328 "//base/global/i18n/frameworks/intl/etc/timezone/tz_2023001-000360.dat" 329 module_install_dir = "usr/ohos_timezone/" 330 part_name = "i18n" 331 subsystem_name = "global" 332} 333 334ohos_prebuilt_etc("region_supported_locales_xml") { 335 source = "//base/global/i18n/frameworks/intl/etc/region/supported_regions.xml" 336 module_install_dir = "usr/ohos_locale_config/region/" 337 part_name = "i18n" 338 subsystem_name = "global" 339} 340 341ohos_prebuilt_etc("zh_Hans_region_xml") { 342 source = "//base/global/i18n/frameworks/intl/etc/region/zh-Hans.xml" 343 module_install_dir = "usr/ohos_locale_config/region/" 344 part_name = "i18n" 345 subsystem_name = "global" 346} 347 348ohos_prebuilt_etc("en_Latn_region_xml") { 349 source = "//base/global/i18n/frameworks/intl/etc/region/en-Latn-US.xml" 350 module_install_dir = "usr/ohos_locale_config/region/" 351 part_name = "i18n" 352 subsystem_name = "global" 353} 354 355ohos_prebuilt_etc("dialect_languages_xml") { 356 source = "//base/global/i18n/frameworks/intl/etc/dialect_languages.xml" 357 module_install_dir = "usr/ohos_locale_config/" 358 part_name = "i18n" 359 subsystem_name = "global" 360} 361