1# Copyright (c) 2021 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 14if (!is_linux && !is_mingw && !is_mac) { 15 import("//base/update/updater/updater_default_cfg.gni") 16 updater_path = rebase_path("${updater_absolutely_path}", ".") 17} else { 18 updater_path = "../.." 19} 20import("//build/ohos.gni") 21 22config("package_config") { 23 visibility = [ ":*" ] 24 cflags_cc = [ "-std=c++17" ] 25 include_dirs = [ 26 "${updater_path}/interfaces/kits/include", 27 "${updater_path}/utils/include", 28 "${updater_path}/services/common", 29 "${updater_path}/services/include", 30 "${updater_path}/services/include", 31 "${updater_path}/services/include/package", 32 "${updater_path}/services/include/script", 33 "${updater_path}/services/include/log", 34 "pkg_algorithm", 35 "pkg_manager", 36 "pkg_package", 37 "pkg_verify", 38 ] 39} 40 41config("libupdaterpackage_exported_headers") { 42 visibility = [ ":*" ] 43 include_dirs = [ 44 "${updater_path}/services", 45 "${updater_path}/services/include/package", 46 "${updater_path}/services/include", 47 "${updater_path}/services/package", 48 "${updater_path}/services/package/pkg_manager", 49 "${updater_path}/services/package/pkg_verify", 50 "${updater_path}/services/include/script", 51 "${updater_path}/interfaces/kits/include", 52 ] 53} 54 55libupdaterpackage_common_source = [ 56 "./pkg_algorithm/pkg_algo_deflate.cpp", 57 "./pkg_algorithm/pkg_algo_digest.cpp", 58 "./pkg_algorithm/pkg_algo_lz4.cpp", 59 "./pkg_algorithm/pkg_algo_sign.cpp", 60 "./pkg_algorithm/pkg_algorithm.cpp", 61 "./pkg_manager/pkg_managerImpl.cpp", 62 "./pkg_manager/pkg_stream.cpp", 63 "./pkg_manager/pkg_utils.cpp", 64 "./pkg_package/packages_info.cpp", 65 "./pkg_package/pkg_gzipfile.cpp", 66 "./pkg_package/pkg_lz4file.cpp", 67 "./pkg_package/pkg_pkgfile.cpp", 68 "./pkg_package/pkg_upgradefile.cpp", 69 "./pkg_package/pkg_zipfile.cpp", 70 "./pkg_verify/cert_verify.cpp", 71 "./pkg_verify/openssl_util.cpp", 72 "./pkg_verify/pkcs7_signed_data.cpp", 73 "./pkg_verify/pkg_verify_util.cpp", 74 "./pkg_verify/zip_pkg_parse.cpp", 75 "pkg_verify/hash_data_verifier.cpp", 76] 77 78ohos_static_library("libupdaterpackage") { 79 sources = libupdaterpackage_common_source 80 81 deps = [ 82 "${updater_path}/services/common/ring_buffer:libringbuffer", 83 "${updater_path}/services/log:libupdaterlog", 84 ] 85 86 if (!is_linux && !is_mingw && !is_mac && host_cpu != "arm64") { 87 deps += [ "../rust/hash_signed_data:rust_hash_signed_data" ] 88 } 89 90 external_deps = [ 91 "bounds_checking_function:libsec_static", 92 "lz4:liblz4_static", 93 "openssl:libcrypto_static", 94 "zlib:libz", 95 ] 96 97 configs = [ ":package_config" ] 98 99 public_configs = [ ":libupdaterpackage_exported_headers" ] 100 if (is_mingw) { 101 libs = [ 102 "setupapi", 103 "psapi", 104 "user32", 105 "advapi32", 106 "iphlpapi", 107 "userenv", 108 "ws2_32", 109 ] 110 111 ldflags = [ 112 "-Wl,--whole-archive", 113 "-lpthread", 114 "-Wl,--no-whole-archive", 115 ] 116 } 117 defines = [ "OPENSSL_SUPPRESS_DEPRECATED" ] 118 119 subsystem_name = "updater" 120 part_name = "updater" 121} 122 123ohos_shared_library("libupdaterpackage_shared") { 124 sources = libupdaterpackage_common_source 125 126 deps = [ 127 "${updater_path}/services/common/ring_buffer:libringbuffer", 128 "${updater_path}/services/log:libupdaterlog_shared", 129 ] 130 131 external_deps = [ 132 "bounds_checking_function:libsec_static", 133 "lz4:liblz4_static", 134 "openssl:libcrypto_shared", 135 "zlib:shared_libz", 136 ] 137 138 if (!is_linux && !is_mingw && !is_mac) { 139 deps += [ "../rust/hash_signed_data:rust_hash_signed_data" ] 140 } 141 142 configs = [ ":package_config" ] 143 144 public_configs = [ ":libupdaterpackage_exported_headers" ] 145 defines = [ 146 "DIFF_PATCH_SDK", 147 "OPENSSL_SUPPRESS_DEPRECATED", 148 ] 149 150 subsystem_name = "updater" 151 part_name = "updater" 152} 153