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 branch_protector_ret = "pac_ret" 36 37 sanitize = { 38 boundary_sanitize = true 39 cfi = true 40 cfi_cross_dso = true 41 debug = false 42 integer_overflow = true 43 ubsan = true 44 } 45 46 public_configs = [ ":zip_config" ] 47 48 sources = [ 49 "napi/class_checksum/checksum_n_exporter.cpp", 50 "napi/class_gzip/gzip_n_exporter.cpp", 51 "napi/class_zip/zip_n_exporter.cpp", 52 "napi/common/common_func.cpp", 53 "napi/common/napi_async_work_callback.cpp", 54 "napi/common/napi_async_work_promise.cpp", 55 "napi/common/napi_business_error.cpp", 56 "napi/common/napi_class.cpp", 57 "napi/common/napi_func_arg.cpp", 58 "napi/common/napi_reference.cpp", 59 "napi/common/napi_value.cpp", 60 "napi/napi_zlib.cpp", 61 "napi/napi_zlib_common.cpp", 62 "napi/native_module.cpp", 63 "napi/properties/create_checksum.cpp", 64 "napi/properties/create_gzip.cpp", 65 "napi/properties/create_zip.cpp", 66 "napi/properties/prop_n_exporter.cpp", 67 "napi/zlib_callback_info.cpp", 68 "src/file_path.cpp", 69 "src/zip.cpp", 70 "src/zip_internal.cpp", 71 "src/zip_reader.cpp", 72 "src/zip_utils.cpp", 73 "src/zip_writer.cpp", 74 ] 75 76 cflags = [ 77 "-Os", 78 "-fstack-protector-strong", 79 ] 80 81 cflags_cc = [ 82 "-Os", 83 "-fstack-protector-strong", 84 ] 85 86 if (target_cpu == "arm") { 87 cflags += [ "-DBINDER_IPC_32BIT" ] 88 } 89 90 deps = [ 91 "${base_path}:appexecfwk_base", 92 "${common_path}:libappexecfwk_common", 93 "${core_path}:appexecfwk_core", 94 "${kits_path}/js/common:bundle_napi_common", 95 ] 96 97 external_deps = [ 98 "c_utils:utils", 99 "eventhandler:libeventhandler", 100 "ffrt:libffrt", 101 "hilog:libhilog", 102 "ipc:ipc_single", 103 "napi:ace_napi", 104 "zlib:shared_libz", 105 ] 106 public_external_deps = [ "libuv:uv" ] 107 install_enable = true 108 subsystem_name = "bundlemanager" 109 part_name = "bundle_framework" 110 relative_install_dir = "module" 111} 112 113group("tools_zip") { 114 if (support_jsapi) { 115 deps = [ ":zlib" ] 116 } 117} 118