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