From f9bdef857ccbdba8e3cce0736be9355b6d7cda15 Mon Sep 17 00:00:00 2001 From: mengjingzhimo Date: Tue, 20 Aug 2024 14:04:17 +0800 Subject: [PATCH 1/7] icu compile Signed-off-by: mengjingzhimo --- icu4c/BUILD.gn | 21 +- icu4c/source/BUILD.gn | 102 +++-- ohos_icu4c/BUILD.gn | 42 ++ ohos_icu4c/build_data/full/data_filter.json | 3 + ohos_icu4c/build_data/lite/data_filter.json | 455 ++++++++++++++++++++ ohos_icu4c/build_data/pkgdata.sh | 92 ++++ 6 files changed, 670 insertions(+), 45 deletions(-) create mode 100644 ohos_icu4c/build_data/full/data_filter.json create mode 100644 ohos_icu4c/build_data/lite/data_filter.json create mode 100644 ohos_icu4c/build_data/pkgdata.sh diff --git a/icu4c/BUILD.gn b/icu4c/BUILD.gn index 465f2ac0..a4defcbc 100644 --- a/icu4c/BUILD.gn +++ b/icu4c/BUILD.gn @@ -54,22 +54,6 @@ ohos_static_library("static_icustubdata") { subsystem_name = "thirdparty" } -ohos_prebuilt_etc("ohos_icudat") { - if ("${product_name}" == "ohcore") { - source = "//third_party/icu/ohos_icu4j/data/icudt68l.dat" - } else if ("${build_feature}" == "lite") { - source = "//third_party/icu/ohos_icu4j/data/lite/icudt72l.dat" - } else if (icu_support_locales) { - source = "//third_party/icu/ohos_icu4j/data/icudt72l.dat" - } else { - source = "//third_party/icu/ohos_icu4j/data/lite/icudt72l.dat" - } - - module_install_dir = "usr/ohos_icu/" - part_name = "icu" - subsystem_name = "thirdparty" -} - icu_common_source = [ "//third_party/icu/icu4c/source/common/ubiditransform.cpp", "//third_party/icu/icu4c/source/common/locutil.cpp", @@ -542,10 +526,7 @@ ohos_shared_library("shared_icuuc") { "SYSTEM_TZDATA_DIR=${system_tzdata_dir}", ] sources = icu_common_source - deps = [ - ":ohos_icudat", - ":static_icustubdata", - ] + deps = [ ":static_icustubdata" ] cflags_cc = [ "-O3", "-W", diff --git a/icu4c/source/BUILD.gn b/icu4c/source/BUILD.gn index c6957c98..dc09a289 100644 --- a/icu4c/source/BUILD.gn +++ b/icu4c/source/BUILD.gn @@ -262,7 +262,8 @@ ohos_shared_library("shared_icuuc_host") { "-shared", "-lm", ] - subsystem_name = "$icu_lib_host_subsystem_name" + part_name = "$icu_part_name" + subsystem_name = "$icu_subsystem_name" output_name = "hmicuuchost" } @@ -347,7 +348,8 @@ ohos_shared_library("shared_icutu") { "-shared", "-lm", ] - subsystem_name = "$icu_lib_host_subsystem_name" + part_name = "$icu_part_name" + subsystem_name = "$icu_subsystem_name" output_name = "hmicutuhost" } @@ -398,7 +400,8 @@ ohos_shared_library("shared_icuio") { "-shared", "-lm", ] - subsystem_name = "$icu_lib_host_subsystem_name" + part_name = "$icu_part_name" + subsystem_name = "$icu_subsystem_name" output_name = "hmicuio" } @@ -412,7 +415,10 @@ group("lib_host") { } ohos_executable("genbrk") { - configs = [ ":icu_config" ] + configs = [ + ":icu_config", + "//build/config/compiler:rtti", + ] deps = [ ":lib_host" ] sources = [ "//third_party/icu/icu4c/source/tools/genbrk/genbrk.cpp" ] cflags_cc = [ @@ -428,12 +434,16 @@ ohos_executable("genbrk") { "-ldl", "-lm", ] - subsystem_name = "$icu_bin_host_subsystem_name" + part_name = "$icu_part_name" + subsystem_name = "$icu_subsystem_name" output_name = "genbrk" } ohos_executable("genccode") { - configs = [ ":icu_config" ] + configs = [ + ":icu_config", + "//build/config/compiler:rtti", + ] deps = [ ":lib_host" ] sources = [ "//third_party/icu/icu4c/source/tools/genccode/genccode.c" ] cflags_cc = [ @@ -449,12 +459,16 @@ ohos_executable("genccode") { "-ldl", "-lm", ] - subsystem_name = "$icu_bin_host_subsystem_name" + part_name = "$icu_part_name" + subsystem_name = "$icu_subsystem_name" output_name = "genccode" } ohos_executable("gencfu") { - configs = [ ":icu_config" ] + configs = [ + ":icu_config", + "//build/config/compiler:rtti", + ] deps = [ ":lib_host" ] sources = [ "//third_party/icu/icu4c/source/tools/gencfu/gencfu.cpp" ] cflags_cc = [ @@ -470,12 +484,16 @@ ohos_executable("gencfu") { "-ldl", "-lm", ] - subsystem_name = "$icu_bin_host_subsystem_name" + part_name = "$icu_part_name" + subsystem_name = "$icu_subsystem_name" output_name = "gencfu" } ohos_executable("gencnval") { - configs = [ ":icu_config" ] + configs = [ + ":icu_config", + "//build/config/compiler:rtti", + ] deps = [ ":lib_host" ] sources = [ "//third_party/icu/icu4c/source/tools/gencnval/gencnval.c" ] cflags_cc = [ @@ -491,12 +509,16 @@ ohos_executable("gencnval") { "-ldl", "-lm", ] - subsystem_name = "$icu_bin_host_subsystem_name" + part_name = "$icu_part_name" + subsystem_name = "$icu_subsystem_name" output_name = "gencnval" } ohos_executable("gendict") { - configs = [ ":icu_config" ] + configs = [ + ":icu_config", + "//build/config/compiler:rtti", + ] deps = [ ":lib_host" ] sources = [ "//third_party/icu/icu4c/source/tools/gendict/gendict.cpp" ] cflags_cc = [ @@ -512,12 +534,16 @@ ohos_executable("gendict") { "-ldl", "-lm", ] - subsystem_name = "$icu_bin_host_subsystem_name" + part_name = "$icu_part_name" + subsystem_name = "$icu_subsystem_name" output_name = "gendict" } ohos_static_library("genrb_c") { - configs = [ ":icu_config" ] + configs = [ + ":icu_config", + "//build/config/compiler:rtti", + ] deps = [ ":lib_host" ] sources = [ "//third_party/icu/icu4c/source/tools/genrb/errmsg.c", @@ -540,11 +566,15 @@ ohos_static_library("genrb_c") { "-DUNISTR_FROM_STRING_EXPLICIT=explicit", "-DU_ATTRIBUTE_DEPRECATED=", "-Wno-sign-compare", + "-Wno-error=strict-prototypes", + "-Wno-error=unused-but-set-variable" ] ldflags = [ "-ldl", "-lm", ] + part_name = "$icu_part_name" + subsystem_name = "$icu_subsystem_name" } ohos_executable("genrb") { configs = [ @@ -579,17 +609,22 @@ ohos_executable("genrb") { "-DUNISTR_FROM_CHAR_EXPLICIT=explicit", "-DUNISTR_FROM_STRING_EXPLICIT=explicit", "-DU_ATTRIBUTE_DEPRECATED=", + "-Wno-unused-but-set-variable", ] ldflags = [ "-ldl", "-lm", ] - subsystem_name = "$icu_bin_host_subsystem_name" + part_name = "$icu_part_name" + subsystem_name = "$icu_subsystem_name" output_name = "genrb" } ohos_executable("derb") { - configs = [ ":icu_config" ] + configs = [ + ":icu_config", + "//build/config/compiler:rtti", + ] deps = [ ":lib_host" ] sources = [ "//third_party/icu/icu4c/source/tools/genrb/derb.cpp" ] cflags_cc = [ @@ -605,12 +640,16 @@ ohos_executable("derb") { "-ldl", "-lm", ] - subsystem_name = "$icu_bin_host_subsystem_name" + part_name = "$icu_part_name" + subsystem_name = "$icu_subsystem_name" output_name = "derb" } ohos_executable("makeconv") { - configs = [ ":icu_config" ] + configs = [ + ":icu_config", + "//build/config/compiler:rtti", + ] deps = [ ":lib_host" ] sources = [ "//third_party/icu/icu4c/source/tools/makeconv/gencnvex.c", @@ -631,12 +670,16 @@ ohos_executable("makeconv") { "-ldl", "-lm", ] - subsystem_name = "$icu_bin_host_subsystem_name" + part_name = "$icu_part_name" + subsystem_name = "$icu_subsystem_name" output_name = "makeconv" } ohos_executable("gensprep") { - configs = [ ":icu_config" ] + configs = [ + ":icu_config", + "//build/config/compiler:rtti", + ] deps = [ ":lib_host" ] sources = [ "//third_party/icu/icu4c/source/tools/gensprep/gensprep.c", @@ -655,12 +698,16 @@ ohos_executable("gensprep") { "-ldl", "-lm", ] - subsystem_name = "$icu_bin_host_subsystem_name" + part_name = "$icu_part_name" + subsystem_name = "$icu_subsystem_name" output_name = "gensprep" } ohos_executable("icupkg") { - configs = [ ":icu_config" ] + configs = [ + ":icu_config", + "//build/config/compiler:rtti", + ] deps = [ ":lib_host" ] sources = [ "//third_party/icu/icu4c/source/tools/icupkg/icupkg.cpp" ] cflags_cc = [ @@ -676,12 +723,16 @@ ohos_executable("icupkg") { "-ldl", "-lm", ] - subsystem_name = "$icu_bin_host_subsystem_name" + part_name = "$icu_part_name" + subsystem_name = "$icu_subsystem_name" output_name = "icupkg" } ohos_executable("pkgdata") { - configs = [ ":icu_config" ] + configs = [ + ":icu_config", + "//build/config/compiler:rtti", + ] deps = [ ":lib_host", ":shared_icutu(${host_toolchain})", @@ -703,7 +754,8 @@ ohos_executable("pkgdata") { "-ldl", "-lm", ] - subsystem_name = "$icu_bin_host_subsystem_name" + part_name = "$icu_part_name" + subsystem_name = "$icu_subsystem_name" output_name = "pkgdata" } group("bin_host") { diff --git a/ohos_icu4c/BUILD.gn b/ohos_icu4c/BUILD.gn index 8c3a75ae..83dae09b 100644 --- a/ohos_icu4c/BUILD.gn +++ b/ohos_icu4c/BUILD.gn @@ -15,6 +15,9 @@ import("//build/ohos.gni") import("//build/ohos/ndk/ndk.gni") import("//third_party/icu/icu.gni") +icu_dat_name = "icudt72l" +icu_data_filter_dir = "full" + ohos_shared_library("icundk") { ldflags = [ "-shared", @@ -31,6 +34,7 @@ ohos_shared_library("icundk") { deps = [ "//third_party/icu/icu4c:shared_icui18n", "//third_party/icu/icu4c:shared_icuuc", + ":ohos_icudat" ] external_deps = [] defines = [] @@ -46,3 +50,41 @@ ohos_shared_library("icundk") { subsystem_name = "thirdparty" part_name = "icu" } + +action("pkg_icudata") { + script = "build_data/pkgdata.sh" + sources = [ "//third_party/icu/ohos_icu4c/build_data/pkgdata.sh" ] + deps = [ "//third_party/icu/icu4c/source:bin_host" ] + + icu_bin_root_out_dir = + get_label_info( + "//third_party/icu/icu4c/source:bin_host(${host_toolchain})", + "root_out_dir") + if ("${build_feature}" == "lite") { + icu_data_filter_dir = "lite" + } + args = [ + "-o", + "$root_out_dir", + "-b", + "$icu_bin_root_out_dir", + "-f", + "$icu_data_filter_dir", + "-v", + "$icu_dat_name" + ] + outputs = [ "$root_out_dir/thirdparty/icu/out/$icu_dat_name.dat" ] +} + +ohos_prebuilt_etc("ohos_icudat") { + if ("${product_name}" == "ohcore") { + source = "//third_party/icu/ohos_icu4j/data/icudt68l.dat" + } else { + source = "$root_out_dir/thirdparty/icu/out/$icu_dat_name.dat" + } + + deps = [ ":pkg_icudata" ] + module_install_dir = "usr/ohos_icu/" + part_name = "icu" + subsystem_name = "thirdparty" +} diff --git a/ohos_icu4c/build_data/full/data_filter.json b/ohos_icu4c/build_data/full/data_filter.json new file mode 100644 index 00000000..59255370 --- /dev/null +++ b/ohos_icu4c/build_data/full/data_filter.json @@ -0,0 +1,3 @@ +{ + "strategy": "subtractive" +} \ No newline at end of file diff --git a/ohos_icu4c/build_data/lite/data_filter.json b/ohos_icu4c/build_data/lite/data_filter.json new file mode 100644 index 00000000..402a776a --- /dev/null +++ b/ohos_icu4c/build_data/lite/data_filter.json @@ -0,0 +1,455 @@ +{ + "strategy": "subtractive", + "localeFilter" : { + "filterType" : "locale", + "includeChildren": false, + "includelist":[ + "root", + "ar", + "ar_001", + "agq", + "agq_CM", + "ja", + "ja_JP", + "fr", + "fr_FR", + "de", + "de_DE", + "en_IN", + "pt", + "pt_PT", + "id", + "id_ID", + "es", + "it", + "it_IT", + "tr", + "tr_TR", + "lt", + "lt_LT", + "ko", + "ko_KR", + "th", + "th_TH", + "en", + "en_001", + "en_US", + "en_GB", + "zh", + "zh_CN", + "zh_Hans", + "zh_Hant", + "zh_Hant_MO", + "zh_Hant_HK", + "zh_Hant_TW", + "zh_Hans_CN", + "ug", + "ug_CN", + "bo", + "bo_CN", + "bo_IN", + "sv", + "sv_AX", + "sv_FI", + "sv_SE" + ] + }, + "featureFilters": { + "conversion_mappings" : { + "includelist":[ + "gb18030", + "ibm-1386_P100-2001", + "windows-936-2000", + "ibm-1383_P110-1999", + "ibm-5478_P100-1995" + ] + }, + "brkitr_dictionaries": { + "whitelist": [ + "dictionaries/cjdict" + ] + }, + "brkitr_lstm": "exclude", + "brkitr_tree": { + "includelist":[ + "root", + "ja", + "fr", + "de", + "pt", + "id", + "es", + "it", + "en", + "en_US", + "zh", + "zh_Hant", + "sv" + ] + }, + "lang_tree": { + "includelist":[ + "root", + "ar", + "ar_001", + "agq", + "agq_CM", + "ja", + "ja_JP", + "fr", + "fr_FR", + "de", + "de_DE", + "en_IN", + "pt", + "pt_PT", + "id", + "id_ID", + "es", + "it", + "it_IT", + "tr", + "tr_TR", + "lt", + "lt_LT", + "ko", + "ko_KR", + "th", + "th_TH", + "en", + "en_001", + "en_US", + "en_GB", + "zh", + "zh_CN", + "zh_Hans", + "zh_Hant", + "zh_Hant_MO", + "zh_Hant_HK", + "zh_Hant_TW", + "zh_Hans_CN", + "ug", + "ug_CN", + "bo", + "bo_CN", + "bo_IN", + "sv", + "sv_AX", + "sv_FI", + "sv_SE" + ] + }, + "unit_tree": { + "includelist":[ + "root", + "ar", + "ar_001", + "agq", + "agq_CM", + "ja", + "ja_JP", + "fr", + "fr_FR", + "de", + "de_DE", + "id", + "id_ID", + "es", + "it", + "it_IT", + "tr", + "tr_TR", + "lt", + "lt_LT", + "ko", + "ko_KR", + "th", + "th_TH", + "en_IN", + "pt", + "pt_PT", + "en", + "en_001", + "en_US", + "en_GB", + "zh", + "zh_CN", + "zh_Hans", + "zh_Hant", + "zh_Hant_MO", + "zh_Hant_HK", + "zh_Hant_TW", + "zh_Hans_CN", + "ug", + "ug_CN", + "bo", + "bo_CN", + "bo_IN", + "sv", + "sv_AX", + "sv_FI", + "sv_SE" + ] + }, + "rbnf_tree": { + "includelist":[ + "root", + "ar", + "ar_001", + "agq", + "agq_CM", + "ja", + "ja_JP", + "fr", + "fr_FR", + "de", + "de_DE", + "id", + "id_ID", + "es", + "it", + "it_IT", + "tr", + "tr_TR", + "lt", + "lt_LT", + "ko", + "ko_KR", + "th", + "th_TH", + "en_IN", + "pt", + "pt_PT", + "en", + "en_001", + "en_US", + "en_GB", + "zh", + "zh_CN", + "zh_Hans", + "zh_Hant", + "zh_Hant_MO", + "zh_Hant_HK", + "zh_Hant_TW", + "zh_Hans_CN", + "ug", + "ug_CN", + "bo", + "bo_CN", + "bo_IN", + "sv", + "sv_AX", + "sv_FI", + "sv_SE" + ] + }, + "zone_tree": { + "includelist":[ + "root", + "ar", + "ar_001", + "agq", + "agq_CM", + "ja", + "ja_JP", + "fr", + "fr_FR", + "de", + "de_DE", + "id", + "id_ID", + "es", + "it", + "it_IT", + "tr", + "tr_TR", + "lt", + "lt_LT", + "ko", + "ko_KR", + "th", + "th_TH", + "en_IN", + "pt", + "pt_PT", + "en", + "en_001", + "en_US", + "en_GB", + "zh", + "zh_CN", + "zh_Hans", + "zh_Hant", + "zh_Hant_MO", + "zh_Hant_HK", + "zh_Hant_TW", + "zh_Hans_CN", + "ug", + "ug_CN", + "bo", + "bo_CN", + "bo_IN", + "sv", + "sv_AX", + "sv_FI", + "sv_SE" + ] + }, + "curr_tree": { + "includelist":[ + "root", + "ar", + "ar_001", + "agq", + "agq_CM", + "ja", + "ja_JP", + "fr", + "fr_FR", + "de", + "de_DE", + "id", + "id_ID", + "es", + "it", + "it_IT", + "tr", + "tr_TR", + "lt", + "lt_LT", + "ko", + "ko_KR", + "th", + "th_TH", + "en_IN", + "pt", + "pt_PT", + "en", + "en_001", + "en_US", + "en_GB", + "zh", + "zh_CN", + "zh_Hans", + "zh_Hant", + "zh_Hant_MO", + "zh_Hant_HK", + "zh_Hant_TW", + "zh_Hans_CN", + "ug", + "ug_CN", + "bo", + "bo_CN", + "bo_IN", + "sv", + "sv_AX", + "sv_FI", + "sv_SE" + ] + }, + "coll_tree": { + "includelist":[ + "root", + "ar", + "ar_001", + "agq", + "agq_CM", + "ja", + "ja_JP", + "fr", + "fr_FR", + "de", + "de_DE", + "id", + "id_ID", + "es", + "it", + "it_IT", + "tr", + "tr_TR", + "lt", + "lt_LT", + "ko", + "ko_KR", + "th", + "th_TH", + "en_IN", + "pt", + "pt_PT", + "en", + "en_001", + "en_US", + "en_GB", + "zh", + "zh_CN", + "zh_Hans", + "zh_Hant", + "zh_Hant_MO", + "zh_Hant_HK", + "zh_Hant_TW", + "zh_Hans_CN", + "ug", + "ug_CN", + "bo", + "bo_CN", + "bo_IN", + "sv", + "sv_AX", + "sv_FI", + "sv_SE" + ] + }, + "region_tree": { + "includelist":[ + "root", + "ar", + "ar_001", + "agq", + "agq_CM", + "ja", + "ja_JP", + "fr", + "fr_FR", + "de", + "de_DE", + "id", + "id_ID", + "es", + "it", + "it_IT", + "tr", + "tr_TR", + "lt", + "lt_LT", + "ko", + "ko_KR", + "th", + "th_TH", + "en_IN", + "pt", + "pt_PT", + "en", + "en_001", + "en_US", + "en_GB", + "zh", + "zh_CN", + "zh_Hans", + "zh_Hant", + "zh_Hant_MO", + "zh_Hant_HK", + "zh_Hant_TW", + "zh_Hans_CN", + "ug", + "ug_CN", + "bo", + "bo_CN", + "bo_IN", + "sv", + "sv_AX", + "sv_FI", + "sv_SE" + ] + } + } +} \ No newline at end of file diff --git a/ohos_icu4c/build_data/pkgdata.sh b/ohos_icu4c/build_data/pkgdata.sh new file mode 100644 index 00000000..3fd3dbd4 --- /dev/null +++ b/ohos_icu4c/build_data/pkgdata.sh @@ -0,0 +1,92 @@ +#!/bin/bash +# Copyright (c) 2024 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -e + +echo "[ICUData]++++++++++++++++++Pkg icu data start.++++++++++++++++++++++" +date +%F' '%H:%M:%S +echo $@ + +script_path=$(cd $(dirname $0); pwd) + +while getopts "o:b:v:f:h" arg; +do + case "${arg}" in + "o") + out_put_root_path=${OPTARG} + ;; + "b") + tool_bin_dir=${OPTARG} + ;; + "v") + icu_dat_name=${OPTARG} + ;; + "f") + icu_data_filter_dir=${OPTARG} + ;; + "h") + exit 0 + ;; + ?) + echo "unkonw argument" + exit 1 + ;; + esac +done + +script_path=$(cd $(dirname $0); pwd) +root_path="$script_path/../../../.." + +if ! root_path=$(realpath "$root_path"); then + echo "Cannot find real path for root_path '$root_path'." + exit 1 +fi + +out_put_root_path="$root_path/$out_put_root_path" +tool_bin_dir="$root_path/$tool_bin_dir/thirdparty/icu" +icu_source_path="$root_path/third_party/icu/icu4c" +res_out_root_dir="$out_put_root_path/thirdparty/icu" +icu_data_filter_file="$script_path/$icu_data_filter_dir/data_filter.json" + +rm -rf "$out_put_root_path/thirdparty/icu/out/*" + +gen_icu_data() { + + # compile to res file + PYTHONPATH=$icu_source_path/source/python python3 -m icutools.databuilder \ + --src_dir $icu_source_path/source/data \ + --include_uni_core_data \ + --seqmode sequential \ + --filter_file $icu_data_filter_file \ + --mode unix-exec \ + --tool_dir $tool_bin_dir \ + --out_dir $res_out_root_dir/out/build/$icu_dat_name \ + --tmp_dir $res_out_root_dir/out/tmp \ + + # package to one dat file + export LD_LIBRARY_PATH=$tool_bin_dir:$LD_LIBRARY_PATH + $tool_bin_dir/pkgdata \ + -s $res_out_root_dir/out/build/$icu_dat_name \ + -T $res_out_root_dir/out/tmp -p $icu_dat_name \ + -d $res_out_root_dir/out \ + $res_out_root_dir/out/tmp/icudata.lst +} + +if ! gen_icu_data; then + echo "[ICUData] gen icudata res failed." + exit 1 +fi +echo "[ICUData] gen icudata res success." + +exit 0 From 33f823276cfe13c8a1a5facccd8be0fff22b9582 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BD=97=E5=8D=9A=E6=98=8E?= Date: Tue, 20 Aug 2024 06:06:12 +0000 Subject: [PATCH 2/7] fix gn MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 罗博明 --- icu4c/source/BUILD.gn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/icu4c/source/BUILD.gn b/icu4c/source/BUILD.gn index dc09a289..88ce731e 100644 --- a/icu4c/source/BUILD.gn +++ b/icu4c/source/BUILD.gn @@ -567,7 +567,7 @@ ohos_static_library("genrb_c") { "-DU_ATTRIBUTE_DEPRECATED=", "-Wno-sign-compare", "-Wno-error=strict-prototypes", - "-Wno-error=unused-but-set-variable" + "-Wno-error=unused-but-set-variable", ] ldflags = [ "-ldl", From 463e10f805575268f31d266240431313807aec8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BD=97=E5=8D=9A=E6=98=8E?= Date: Tue, 20 Aug 2024 06:18:41 +0000 Subject: [PATCH 3/7] fix gn format MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 罗博明 --- ohos_icu4c/BUILD.gn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ohos_icu4c/BUILD.gn b/ohos_icu4c/BUILD.gn index 83dae09b..8a9780d4 100644 --- a/ohos_icu4c/BUILD.gn +++ b/ohos_icu4c/BUILD.gn @@ -32,9 +32,9 @@ ohos_shared_library("icundk") { sources = [ "src/icu_addon.cpp" ] deps = [ + ":ohos_icudat", "//third_party/icu/icu4c:shared_icui18n", "//third_party/icu/icu4c:shared_icuuc", - ":ohos_icudat" ] external_deps = [] defines = [] @@ -71,7 +71,7 @@ action("pkg_icudata") { "-f", "$icu_data_filter_dir", "-v", - "$icu_dat_name" + "$icu_dat_name", ] outputs = [ "$root_out_dir/thirdparty/icu/out/$icu_dat_name.dat" ] } From f22e57919c91b476c650ef372eea9855c61a3df3 Mon Sep 17 00:00:00 2001 From: mengjingzhimo Date: Tue, 20 Aug 2024 15:04:15 +0800 Subject: [PATCH 4/7] change mode Signed-off-by: mengjingzhimo --- ohos_icu4c/build_data/pkgdata.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 ohos_icu4c/build_data/pkgdata.sh diff --git a/ohos_icu4c/build_data/pkgdata.sh b/ohos_icu4c/build_data/pkgdata.sh old mode 100644 new mode 100755 From 80cf7826ce704525f8a41d7e23218bb549066c20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BD=97=E5=8D=9A=E6=98=8E?= Date: Tue, 20 Aug 2024 08:16:44 +0000 Subject: [PATCH 5/7] update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 罗博明 --- icu.gni | 2 ++ icu4c/BUILD.gn | 14 +++++++++++++- ohos_icu4c/BUILD.gn | 17 ----------------- 3 files changed, 15 insertions(+), 18 deletions(-) diff --git a/icu.gni b/icu.gni index 8756c1be..21212b94 100644 --- a/icu.gni +++ b/icu.gni @@ -17,4 +17,6 @@ declare_args() { icu_support_libbegetutil = true distro_tzdata_dir = "\"/system/etc/tzdata_distro\"" system_tzdata_dir = "\"/system/etc/icu_tzdata\"" + icu_dat_name = "icudt72l" + icu_data_filter_dir = "full" } diff --git a/icu4c/BUILD.gn b/icu4c/BUILD.gn index a4defcbc..22caac6a 100644 --- a/icu4c/BUILD.gn +++ b/icu4c/BUILD.gn @@ -54,6 +54,15 @@ ohos_static_library("static_icustubdata") { subsystem_name = "thirdparty" } +ohos_prebuilt_etc("ohos_icudat") { + source = "$root_out_dir/thirdparty/icu/out/$icu_dat_name.dat" + + deps = [ "//third_party/icu/ohos_icu4c:pkg_icudata" ] + module_install_dir = "usr/ohos_icu/" + part_name = "icu" + subsystem_name = "thirdparty" +} + icu_common_source = [ "//third_party/icu/icu4c/source/common/ubiditransform.cpp", "//third_party/icu/icu4c/source/common/locutil.cpp", @@ -526,7 +535,10 @@ ohos_shared_library("shared_icuuc") { "SYSTEM_TZDATA_DIR=${system_tzdata_dir}", ] sources = icu_common_source - deps = [ ":static_icustubdata" ] + deps = [ + ":ohos_icudat", + ":static_icustubdata", + ] cflags_cc = [ "-O3", "-W", diff --git a/ohos_icu4c/BUILD.gn b/ohos_icu4c/BUILD.gn index 8a9780d4..0cd88b0c 100644 --- a/ohos_icu4c/BUILD.gn +++ b/ohos_icu4c/BUILD.gn @@ -15,9 +15,6 @@ import("//build/ohos.gni") import("//build/ohos/ndk/ndk.gni") import("//third_party/icu/icu.gni") -icu_dat_name = "icudt72l" -icu_data_filter_dir = "full" - ohos_shared_library("icundk") { ldflags = [ "-shared", @@ -32,7 +29,6 @@ ohos_shared_library("icundk") { sources = [ "src/icu_addon.cpp" ] deps = [ - ":ohos_icudat", "//third_party/icu/icu4c:shared_icui18n", "//third_party/icu/icu4c:shared_icuuc", ] @@ -75,16 +71,3 @@ action("pkg_icudata") { ] outputs = [ "$root_out_dir/thirdparty/icu/out/$icu_dat_name.dat" ] } - -ohos_prebuilt_etc("ohos_icudat") { - if ("${product_name}" == "ohcore") { - source = "//third_party/icu/ohos_icu4j/data/icudt68l.dat" - } else { - source = "$root_out_dir/thirdparty/icu/out/$icu_dat_name.dat" - } - - deps = [ ":pkg_icudata" ] - module_install_dir = "usr/ohos_icu/" - part_name = "icu" - subsystem_name = "thirdparty" -} From c5e4a38f93bcd30703e3393063a0dcbfdd595ceb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BD=97=E5=8D=9A=E6=98=8E?= Date: Tue, 20 Aug 2024 09:28:38 +0000 Subject: [PATCH 6/7] break dep cycle MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 罗博明 --- icu4c/BUILD.gn | 14 +------------- ohos_icu4c/BUILD.gn | 11 +++++++++++ 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/icu4c/BUILD.gn b/icu4c/BUILD.gn index 22caac6a..a4defcbc 100644 --- a/icu4c/BUILD.gn +++ b/icu4c/BUILD.gn @@ -54,15 +54,6 @@ ohos_static_library("static_icustubdata") { subsystem_name = "thirdparty" } -ohos_prebuilt_etc("ohos_icudat") { - source = "$root_out_dir/thirdparty/icu/out/$icu_dat_name.dat" - - deps = [ "//third_party/icu/ohos_icu4c:pkg_icudata" ] - module_install_dir = "usr/ohos_icu/" - part_name = "icu" - subsystem_name = "thirdparty" -} - icu_common_source = [ "//third_party/icu/icu4c/source/common/ubiditransform.cpp", "//third_party/icu/icu4c/source/common/locutil.cpp", @@ -535,10 +526,7 @@ ohos_shared_library("shared_icuuc") { "SYSTEM_TZDATA_DIR=${system_tzdata_dir}", ] sources = icu_common_source - deps = [ - ":ohos_icudat", - ":static_icustubdata", - ] + deps = [ ":static_icustubdata" ] cflags_cc = [ "-O3", "-W", diff --git a/ohos_icu4c/BUILD.gn b/ohos_icu4c/BUILD.gn index 0cd88b0c..07cccefe 100644 --- a/ohos_icu4c/BUILD.gn +++ b/ohos_icu4c/BUILD.gn @@ -29,6 +29,7 @@ ohos_shared_library("icundk") { sources = [ "src/icu_addon.cpp" ] deps = [ + ":ohos_icudat", "//third_party/icu/icu4c:shared_icui18n", "//third_party/icu/icu4c:shared_icuuc", ] @@ -71,3 +72,13 @@ action("pkg_icudata") { ] outputs = [ "$root_out_dir/thirdparty/icu/out/$icu_dat_name.dat" ] } + + +ohos_prebuilt_etc("ohos_icudat") { + source = "$root_out_dir/thirdparty/icu/out/$icu_dat_name.dat" + + deps = [ ":pkg_icudata" ] + module_install_dir = "usr/ohos_icu/" + part_name = "icu" + subsystem_name = "thirdparty" +} From 6ef71dbe3b51733037416936dd2fdbea6c51ff93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BD=97=E5=8D=9A=E6=98=8E?= Date: Tue, 20 Aug 2024 09:42:36 +0000 Subject: [PATCH 7/7] blank line MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 罗博明 --- ohos_icu4c/BUILD.gn | 1 - 1 file changed, 1 deletion(-) diff --git a/ohos_icu4c/BUILD.gn b/ohos_icu4c/BUILD.gn index 07cccefe..9ce03ad1 100644 --- a/ohos_icu4c/BUILD.gn +++ b/ohos_icu4c/BUILD.gn @@ -73,7 +73,6 @@ action("pkg_icudata") { outputs = [ "$root_out_dir/thirdparty/icu/out/$icu_dat_name.dat" ] } - ohos_prebuilt_etc("ohos_icudat") { source = "$root_out_dir/thirdparty/icu/out/$icu_dat_name.dat"