1600cc4afSopenharmony_ci# Copyright (c) 2022 Huawei Device Co., Ltd.
2600cc4afSopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
3600cc4afSopenharmony_ci# you may not use this file except in compliance with the License.
4600cc4afSopenharmony_ci# You may obtain a copy of the License at
5600cc4afSopenharmony_ci#
6600cc4afSopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
7600cc4afSopenharmony_ci#
8600cc4afSopenharmony_ci# Unless required by applicable law or agreed to in writing, software
9600cc4afSopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
10600cc4afSopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11600cc4afSopenharmony_ci# See the License for the specific language governing permissions and
12600cc4afSopenharmony_ci# limitations under the License.
13600cc4afSopenharmony_ci
14600cc4afSopenharmony_ciimport("//build/ohos.gni")
15600cc4afSopenharmony_ciimport("../../../../appexecfwk.gni")
16600cc4afSopenharmony_ci
17600cc4afSopenharmony_ciconfig("zip_config") {
18600cc4afSopenharmony_ci  include_dirs = [
19600cc4afSopenharmony_ci    "include",
20600cc4afSopenharmony_ci    "napi",
21600cc4afSopenharmony_ci    "${kits_path}/js/common",
22600cc4afSopenharmony_ci    "napi/common",
23600cc4afSopenharmony_ci    "napi/class_checksum",
24600cc4afSopenharmony_ci    "napi/class_zip",
25600cc4afSopenharmony_ci    "napi/class_gzip",
26600cc4afSopenharmony_ci  ]
27600cc4afSopenharmony_ci
28600cc4afSopenharmony_ci  defines = [
29600cc4afSopenharmony_ci    "APP_LOG_TAG = \"Zlib\"",
30600cc4afSopenharmony_ci    "LOG_DOMAIN = 0xD001120",
31600cc4afSopenharmony_ci  ]
32600cc4afSopenharmony_ci}
33600cc4afSopenharmony_ci
34600cc4afSopenharmony_ciohos_shared_library("zlib") {
35600cc4afSopenharmony_ci  public_configs = [ ":zip_config" ]
36600cc4afSopenharmony_ci
37600cc4afSopenharmony_ci  sources = [
38600cc4afSopenharmony_ci    "napi/class_checksum/checksum_n_exporter.cpp",
39600cc4afSopenharmony_ci    "napi/class_gzip/gzip_n_exporter.cpp",
40600cc4afSopenharmony_ci    "napi/class_zip/zip_n_exporter.cpp",
41600cc4afSopenharmony_ci    "napi/common/common_func.cpp",
42600cc4afSopenharmony_ci    "napi/common/napi_async_work_callback.cpp",
43600cc4afSopenharmony_ci    "napi/common/napi_async_work_promise.cpp",
44600cc4afSopenharmony_ci    "napi/common/napi_business_error.cpp",
45600cc4afSopenharmony_ci    "napi/common/napi_class.cpp",
46600cc4afSopenharmony_ci    "napi/common/napi_func_arg.cpp",
47600cc4afSopenharmony_ci    "napi/common/napi_reference.cpp",
48600cc4afSopenharmony_ci    "napi/common/napi_value.cpp",
49600cc4afSopenharmony_ci    "napi/napi_zlib.cpp",
50600cc4afSopenharmony_ci    "napi/napi_zlib_common.cpp",
51600cc4afSopenharmony_ci    "napi/native_module.cpp",
52600cc4afSopenharmony_ci    "napi/properties/create_checksum.cpp",
53600cc4afSopenharmony_ci    "napi/properties/create_gzip.cpp",
54600cc4afSopenharmony_ci    "napi/properties/create_zip.cpp",
55600cc4afSopenharmony_ci    "napi/properties/prop_n_exporter.cpp",
56600cc4afSopenharmony_ci    "napi/zlib_callback_info.cpp",
57600cc4afSopenharmony_ci    "src/file_path.cpp",
58600cc4afSopenharmony_ci    "src/zip.cpp",
59600cc4afSopenharmony_ci    "src/zip_internal.cpp",
60600cc4afSopenharmony_ci    "src/zip_reader.cpp",
61600cc4afSopenharmony_ci    "src/zip_utils.cpp",
62600cc4afSopenharmony_ci    "src/zip_writer.cpp",
63600cc4afSopenharmony_ci  ]
64600cc4afSopenharmony_ci
65600cc4afSopenharmony_ci  cflags = [ "-Os" ]
66600cc4afSopenharmony_ci  cflags_cc = [ "-Os" ]
67600cc4afSopenharmony_ci
68600cc4afSopenharmony_ci  if (target_cpu == "arm") {
69600cc4afSopenharmony_ci    cflags += [ "-DBINDER_IPC_32BIT" ]
70600cc4afSopenharmony_ci  }
71600cc4afSopenharmony_ci
72600cc4afSopenharmony_ci  deps = [
73600cc4afSopenharmony_ci    "${base_path}:appexecfwk_base",
74600cc4afSopenharmony_ci    "${common_path}:libappexecfwk_common",
75600cc4afSopenharmony_ci    "${core_path}:appexecfwk_core",
76600cc4afSopenharmony_ci    "${kits_path}/js/common:bundle_napi_common",
77600cc4afSopenharmony_ci  ]
78600cc4afSopenharmony_ci
79600cc4afSopenharmony_ci  external_deps = [
80600cc4afSopenharmony_ci    "c_utils:utils",
81600cc4afSopenharmony_ci    "eventhandler:libeventhandler",
82600cc4afSopenharmony_ci    "hilog:libhilog",
83600cc4afSopenharmony_ci    "napi:ace_napi",
84600cc4afSopenharmony_ci    "zlib:shared_libz",
85600cc4afSopenharmony_ci  ]
86600cc4afSopenharmony_ci  public_external_deps = [ "libuv:uv" ]
87600cc4afSopenharmony_ci  install_enable = true
88600cc4afSopenharmony_ci  subsystem_name = "bundlemanager"
89600cc4afSopenharmony_ci  part_name = "bundle_framework"
90600cc4afSopenharmony_ci  relative_install_dir = "module"
91600cc4afSopenharmony_ci}
92600cc4afSopenharmony_ci
93600cc4afSopenharmony_cigroup("tools_zip") {
94600cc4afSopenharmony_ci  if (support_jsapi) {
95600cc4afSopenharmony_ci    deps = [ ":zlib" ]
96600cc4afSopenharmony_ci  }
97600cc4afSopenharmony_ci}
98