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("//build/config/components/init/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 external_deps = [ "libphonenumber: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 = [ 44 "hilog:libhilog", 45 "init:libbegetutil", 46 ] 47 if (i18n_support_app_preferred_language) { 48 external_deps += [ 49 "ability_runtime:app_context", 50 "bundle_framework:appexecfwk_base", 51 "bundle_framework:appexecfwk_core", 52 "c_utils:utils", 53 "ipc:ipc_core", 54 "preferences:native_preferences", 55 "resource_management:global_resmgr", 56 "samgr:samgr_proxy", 57 ] 58 defines = [ "SUPPORT_APP_PREFERRED_LANGUAGE" ] 59 } 60 subsystem_name = "global" 61 innerapi_tags = [ "platformsdk" ] 62 part_name = "i18n" 63} 64 65config("intl_util_config") { 66 include_dirs = [ 67 "//base/global/i18n/frameworks/intl/entity_recognition/date_time_recognition/include", 68 "//base/global/i18n/frameworks/intl/entity_recognition/include", 69 "//base/global/i18n/frameworks/intl/entity_recognition/phone_number_recognition/include", 70 "//base/global/i18n/frameworks/intl/include", 71 "//base/global/i18n/interfaces/native/inner_api/i18n/include", 72 ] 73} 74ohos_shared_library("intl_util") { 75 branch_protector_ret = "pac_ret" 76 public_configs = [ ":intl_util_config" ] 77 include_dirs = [] 78 sources = [ "src/lunar_calendar.cpp" ] 79 external_deps = [ 80 "hilog:libhilog", 81 "icu:shared_icui18n", 82 "icu:shared_icuuc", 83 ] 84 cflags_cc = [ 85 "-Wall", 86 "-fPIC", 87 "-frtti", 88 ] 89 remove_configs = [ "//build/config/compiler:no_rtti" ] 90 use_exceptions = true 91 if (!build_ohos_sdk) { 92 sources += [ 93 "entity_recognition/date_time_recognition/src/date_rule_init.cpp", 94 "entity_recognition/date_time_recognition/src/date_time_filter.cpp", 95 "entity_recognition/date_time_recognition/src/date_time_matched.cpp", 96 "entity_recognition/date_time_recognition/src/date_time_rule.cpp", 97 "entity_recognition/date_time_recognition/src/date_time_sequence.cpp", 98 "entity_recognition/date_time_recognition/src/rules_engine.cpp", 99 "entity_recognition/phone_number_recognition/src/border_rule.cpp", 100 "entity_recognition/phone_number_recognition/src/code_rule.cpp", 101 "entity_recognition/phone_number_recognition/src/find_rule.cpp", 102 "entity_recognition/phone_number_recognition/src/negative_rule.cpp", 103 "entity_recognition/phone_number_recognition/src/phone_number_matched.cpp", 104 "entity_recognition/phone_number_recognition/src/phone_number_rule.cpp", 105 "entity_recognition/phone_number_recognition/src/positive_rule.cpp", 106 "entity_recognition/phone_number_recognition/src/regex_rule.cpp", 107 "entity_recognition/src/entity_recognizer.cpp", 108 "src/character.cpp", 109 "src/collator.cpp", 110 "src/date_time_format.cpp", 111 "src/holiday_manager.cpp", 112 "src/i18n_break_iterator.cpp", 113 "src/i18n_calendar.cpp", 114 "src/i18n_normalizer.cpp", 115 "src/i18n_timezone.cpp", 116 "src/index_util.cpp", 117 "src/locale_compare.cpp", 118 "src/locale_config.cpp", 119 "src/locale_data.cpp", 120 "src/locale_info.cpp", 121 "src/locale_matcher.cpp", 122 "src/locale_util.cpp", 123 "src/measure_data.cpp", 124 "src/number_format.cpp", 125 "src/phone_number_format.cpp", 126 "src/plural_rules.cpp", 127 "src/relative_time_format.cpp", 128 "src/signature_verifier.cpp", 129 "src/system_locale_manager.cpp", 130 "src/taboo.cpp", 131 "src/taboo_utils.cpp", 132 "src/utils.cpp", 133 ] 134 version_script = "libintl_util.map" 135 deps = [ 136 ":CN_phonenumber_xml", 137 ":GB_phonenumber_xml", 138 ":bo_lang_xml", 139 ":common_datetime_xml", 140 ":common_phonenumber_xml", 141 ":config_locales_xml", 142 ":dialect_languages_xml", 143 ":en_Latn_lang_xml", 144 ":en_datetime_xml", 145 ":i18n.para", 146 ":i18n.para.dac", 147 ":i18n_param_config_xml", 148 ":lang_supported_locales", 149 ":region_supported_locales_xml", 150 ":root_timezone_xml", 151 ":timezones_xml", 152 ":ug_lang_xml", 153 ":zh_Hans_lang_xml", 154 ":zh_Hans_timezone_xml", 155 ":zh_Hant_HK_lang_xml", 156 ":zh_Hant_lang_xml", 157 ":zh_datetime_xml", 158 ] 159 external_deps += [ 160 "access_token:libaccesstoken_sdk", 161 "access_token:libtokenid_sdk", 162 "c_utils:utils", 163 "config_policy:configpolicy_util", 164 "icu:icundk", 165 "init:libbegetutil", 166 "ipc:ipc_core", 167 "libphonenumber:phonenumber_standard", 168 "libpng:libpng", 169 "libxml2:libxml2", 170 "openssl:libcrypto_shared", 171 "openssl:libssl_shared", 172 "preferences:native_preferences", 173 ] 174 public_external_deps = [] 175 defines = [] 176 if (i18n_support_ui) { 177 public_external_deps += [ "ability_base:configuration" ] 178 external_deps += [ 179 "ability_base:configuration", 180 "ability_base:want", 181 "ability_runtime:ability_manager", 182 "ability_runtime:app_manager", 183 "common_event_service:cesfwk_innerkits", 184 ] 185 defines += [ "SUPPORT_GRAPHICS" ] 186 } 187 if (is_asan) { 188 defines += [ "SUPPORT_ASAN" ] 189 } 190 } 191 install_images = [ system_base_dir ] 192 relative_install_dir = "platformsdk" 193 subsystem_name = "global" 194 innerapi_tags = [ "platformsdk" ] 195 part_name = "i18n" 196} 197 198ohos_prebuilt_para("i18n.para") { 199 source = "//base/global/i18n/frameworks/intl/etc/i18n.para" 200 part_name = "i18n" 201 subsystem_name = "global" 202 module_install_dir = "etc/param" 203} 204 205ohos_prebuilt_para("i18n.para.dac") { 206 source = "//base/global/i18n/frameworks/intl/etc/i18n.para.dac" 207 part_name = "i18n" 208 subsystem_name = "global" 209 module_install_dir = "etc/param" 210} 211 212ohos_prebuilt_etc("config_locales_xml") { 213 source = "//base/global/i18n/frameworks/intl/etc/supported_locales.xml" 214 module_install_dir = "usr/ohos_locale_config/" 215 part_name = "i18n" 216 subsystem_name = "global" 217} 218 219ohos_prebuilt_etc("i18n_param_config_xml") { 220 source = "//base/global/i18n/frameworks/intl/etc/i18n_param_config.xml" 221 module_install_dir = "etc/xml/" 222 part_name = "i18n" 223 subsystem_name = "global" 224} 225 226ohos_prebuilt_etc("CN_phonenumber_xml") { 227 source = "//base/global/i18n/frameworks/intl/entity_recognition/etc/phonenumber/CN.xml" 228 module_install_dir = "usr/ohos_locale_config/phonenumber/" 229 part_name = "i18n" 230 subsystem_name = "global" 231} 232 233ohos_prebuilt_etc("GB_phonenumber_xml") { 234 source = "//base/global/i18n/frameworks/intl/entity_recognition/etc/phonenumber/GB.xml" 235 module_install_dir = "usr/ohos_locale_config/phonenumber/" 236 part_name = "i18n" 237 subsystem_name = "global" 238} 239 240ohos_prebuilt_etc("common_phonenumber_xml") { 241 source = "//base/global/i18n/frameworks/intl/entity_recognition/etc/phonenumber/common.xml" 242 module_install_dir = "usr/ohos_locale_config/phonenumber/" 243 part_name = "i18n" 244 subsystem_name = "global" 245} 246 247ohos_prebuilt_etc("zh_datetime_xml") { 248 source = "//base/global/i18n/frameworks/intl/entity_recognition/etc/datetime/zh.xml" 249 module_install_dir = "usr/ohos_locale_config/datetime/" 250 part_name = "i18n" 251 subsystem_name = "global" 252} 253 254ohos_prebuilt_etc("en_datetime_xml") { 255 source = "//base/global/i18n/frameworks/intl/entity_recognition/etc/datetime/en.xml" 256 module_install_dir = "usr/ohos_locale_config/datetime/" 257 part_name = "i18n" 258 subsystem_name = "global" 259} 260 261ohos_prebuilt_etc("common_datetime_xml") { 262 source = "//base/global/i18n/frameworks/intl/entity_recognition/etc/datetime/common.xml" 263 module_install_dir = "usr/ohos_locale_config/datetime/" 264 part_name = "i18n" 265 subsystem_name = "global" 266} 267 268ohos_prebuilt_etc("lang_supported_locales") { 269 source = "//base/global/i18n/frameworks/intl/etc/lang/supported_locales.xml" 270 module_install_dir = "etc/ohos_lang_config/" 271 part_name = "i18n" 272 subsystem_name = "global" 273} 274 275ohos_prebuilt_etc("zh_Hans_lang_xml") { 276 source = "//base/global/i18n/frameworks/intl/etc/lang/zh-Hans.xml" 277 module_install_dir = "etc/ohos_lang_config/" 278 part_name = "i18n" 279 subsystem_name = "global" 280} 281 282ohos_prebuilt_etc("zh_Hant_lang_xml") { 283 source = "//base/global/i18n/frameworks/intl/etc/lang/zh-Hant.xml" 284 module_install_dir = "etc/ohos_lang_config/" 285 part_name = "i18n" 286 subsystem_name = "global" 287} 288 289ohos_prebuilt_etc("zh_Hant_HK_lang_xml") { 290 source = "//base/global/i18n/frameworks/intl/etc/lang/zh-Hant-HK.xml" 291 module_install_dir = "etc/ohos_lang_config/" 292 part_name = "i18n" 293 subsystem_name = "global" 294} 295 296ohos_prebuilt_etc("bo_lang_xml") { 297 source = "//base/global/i18n/frameworks/intl/etc/lang/bo.xml" 298 module_install_dir = "etc/ohos_lang_config/" 299 part_name = "i18n" 300 subsystem_name = "global" 301} 302 303ohos_prebuilt_etc("ug_lang_xml") { 304 source = "//base/global/i18n/frameworks/intl/etc/lang/ug.xml" 305 module_install_dir = "etc/ohos_lang_config/" 306 part_name = "i18n" 307 subsystem_name = "global" 308} 309 310ohos_prebuilt_etc("zh_Hans_timezone_xml") { 311 source = "//base/global/i18n/frameworks/intl/etc/timezone/zh_Hans.xml" 312 module_install_dir = "usr/ohos_timezone/ohos_city_dispname/" 313 part_name = "i18n" 314 subsystem_name = "global" 315} 316 317ohos_prebuilt_etc("en_Latn_lang_xml") { 318 source = "//base/global/i18n/frameworks/intl/etc/lang/en-Latn.xml" 319 module_install_dir = "etc/ohos_lang_config/" 320 part_name = "i18n" 321 subsystem_name = "global" 322} 323 324ohos_prebuilt_etc("root_timezone_xml") { 325 source = "//base/global/i18n/frameworks/intl/etc/timezone/root.xml" 326 module_install_dir = "usr/ohos_timezone/ohos_city_dispname/" 327 part_name = "i18n" 328 subsystem_name = "global" 329} 330 331ohos_prebuilt_etc("timezones_xml") { 332 source = "//base/global/i18n/frameworks/intl/etc/timezone/ohos_timezones.xml" 333 module_install_dir = "usr/ohos_timezone/" 334 part_name = "i18n" 335 subsystem_name = "global" 336} 337 338ohos_prebuilt_etc("region_supported_locales_xml") { 339 source = "//base/global/i18n/frameworks/intl/etc/region/supported_regions.xml" 340 module_install_dir = "usr/ohos_locale_config/region/" 341 part_name = "i18n" 342 subsystem_name = "global" 343} 344 345ohos_prebuilt_etc("dialect_languages_xml") { 346 source = "//base/global/i18n/frameworks/intl/etc/dialect_languages.xml" 347 module_install_dir = "usr/ohos_locale_config/" 348 part_name = "i18n" 349 subsystem_name = "global" 350} 351