1# Copyright (c) 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("//build/ohos.gni")
15import("../../../../appexecfwk.gni")
16
17config("zip_config") {
18  include_dirs = [
19    "include",
20    "napi",
21    "${kits_path}/js/common",
22    "napi/common",
23    "napi/class_checksum",
24    "napi/class_zip",
25    "napi/class_gzip",
26  ]
27
28  defines = [
29    "APP_LOG_TAG = \"Zlib\"",
30    "LOG_DOMAIN = 0xD001120",
31  ]
32}
33
34ohos_shared_library("zlib") {
35  public_configs = [ ":zip_config" ]
36
37  sources = [
38    "napi/class_checksum/checksum_n_exporter.cpp",
39    "napi/class_gzip/gzip_n_exporter.cpp",
40    "napi/class_zip/zip_n_exporter.cpp",
41    "napi/common/common_func.cpp",
42    "napi/common/napi_async_work_callback.cpp",
43    "napi/common/napi_async_work_promise.cpp",
44    "napi/common/napi_business_error.cpp",
45    "napi/common/napi_class.cpp",
46    "napi/common/napi_func_arg.cpp",
47    "napi/common/napi_reference.cpp",
48    "napi/common/napi_value.cpp",
49    "napi/napi_zlib.cpp",
50    "napi/napi_zlib_common.cpp",
51    "napi/native_module.cpp",
52    "napi/properties/create_checksum.cpp",
53    "napi/properties/create_gzip.cpp",
54    "napi/properties/create_zip.cpp",
55    "napi/properties/prop_n_exporter.cpp",
56    "napi/zlib_callback_info.cpp",
57    "src/file_path.cpp",
58    "src/zip.cpp",
59    "src/zip_internal.cpp",
60    "src/zip_reader.cpp",
61    "src/zip_utils.cpp",
62    "src/zip_writer.cpp",
63  ]
64
65  cflags = [ "-Os" ]
66  cflags_cc = [ "-Os" ]
67
68  if (target_cpu == "arm") {
69    cflags += [ "-DBINDER_IPC_32BIT" ]
70  }
71
72  deps = [
73    "${base_path}:appexecfwk_base",
74    "${common_path}:libappexecfwk_common",
75    "${core_path}:appexecfwk_core",
76    "${kits_path}/js/common:bundle_napi_common",
77  ]
78
79  external_deps = [
80    "c_utils:utils",
81    "eventhandler:libeventhandler",
82    "hilog:libhilog",
83    "napi:ace_napi",
84    "zlib:shared_libz",
85  ]
86  public_external_deps = [
87    "libuv:uv",
88    "node:node_header_notice",
89  ]
90  install_enable = true
91  subsystem_name = "bundlemanager"
92  part_name = "bundle_framework"
93  relative_install_dir = "module"
94}
95
96group("tools_zip") {
97  if (support_jsapi) {
98    deps = [ ":zlib" ]
99  }
100}
101