1# Copyright (c) 2024 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("//build/ohos.gni") 15import("//build/ohos/ndk/ndk.gni") 16import("//third_party/icu/icu.gni") 17 18ohos_shared_library("icundk") { 19 ldflags = [ 20 "-shared", 21 "-lm", 22 ] 23 configs = [ 24 "//third_party/icu/icu4c:icu_config", 25 "//build/config/compiler:rtti", 26 ] 27 include_dirs = [ "//third_party/icu/icu4c/source/common" ] 28 29 sources = [ "src/icu_addon.cpp" ] 30 31 deps = [ 32 ":ohos_icudat", 33 "//third_party/icu/icu4c:shared_icui18n", 34 "//third_party/icu/icu4c:shared_icuuc", 35 ] 36 external_deps = [] 37 defines = [] 38 if (icu_support_libbegetutil && is_ohos) { 39 defines += [ "ICU_SUPPORT_LIBBEGETUTIL" ] 40 external_deps += [ "init:libbegetutil" ] 41 } 42 43 version_script = "libicu.map" 44 output_name = "icu" 45 output_extension = "so" 46 relative_install_dir = "ndk" 47 subsystem_name = "thirdparty" 48 part_name = "icu" 49} 50 51action("pkg_icudata") { 52 script = "build_data/pkgdata.sh" 53 sources = [ "//third_party/icu/ohos_icu4c/build_data/pkgdata.sh" ] 54 deps = [ "//third_party/icu/icu4c/source:bin_host" ] 55 56 icu_bin_root_out_dir = 57 get_label_info( 58 "//third_party/icu/icu4c/source:bin_host(${host_toolchain})", 59 "root_out_dir") 60 if ("${build_feature}" == "lite") { 61 icu_data_filter_dir = "lite" 62 } 63 args = [ 64 "-o", 65 "$root_out_dir", 66 "-b", 67 "$icu_bin_root_out_dir", 68 "-f", 69 "$icu_data_filter_dir", 70 "-v", 71 "$icu_dat_name", 72 ] 73 outputs = [ "$root_out_dir/thirdparty/icu/out/$icu_dat_name.dat" ] 74} 75 76ohos_prebuilt_etc("ohos_icudat") { 77 source = "$root_out_dir/thirdparty/icu/out/$icu_dat_name.dat" 78 79 deps = [ ":pkg_icudata" ] 80 module_install_dir = "usr/ohos_icu/" 81 part_name = "icu" 82 subsystem_name = "thirdparty" 83} 84