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_algorithm", 49 "${updater_path}/services/package/pkg_manager", 50 "${updater_path}/services/package/pkg_verify", 51 "${updater_path}/services/include/script", 52 "${updater_path}/interfaces/kits/include", 53 ] 54} 55 56libupdaterpackage_common_source = [ 57 "./pkg_algorithm/pkg_algo_deflate.cpp", 58 "./pkg_algorithm/pkg_algo_digest.cpp", 59 "./pkg_algorithm/pkg_algo_lz4.cpp", 60 "./pkg_algorithm/pkg_algo_sign.cpp", 61 "./pkg_algorithm/pkg_algorithm.cpp", 62 "./pkg_manager/pkg_managerImpl.cpp", 63 "./pkg_manager/pkg_stream.cpp", 64 "./pkg_manager/pkg_utils.cpp", 65 "./pkg_package/packages_info.cpp", 66 "./pkg_package/pkg_gzipfile.cpp", 67 "./pkg_package/pkg_lz4file.cpp", 68 "./pkg_package/pkg_pkgfile.cpp", 69 "./pkg_package/pkg_upgradefile.cpp", 70 "./pkg_package/pkg_zipfile.cpp", 71 "./pkg_verify/cert_verify.cpp", 72 "./pkg_verify/openssl_util.cpp", 73 "./pkg_verify/pkcs7_signed_data.cpp", 74 "./pkg_verify/pkg_verify_util.cpp", 75 "./pkg_verify/zip_pkg_parse.cpp", 76 "pkg_verify/hash_data_verifier.cpp", 77] 78 79ohos_static_library("libupdaterpackage") { 80 sources = libupdaterpackage_common_source 81 82 deps = [ 83 "${updater_path}/services/common/ring_buffer:libringbuffer", 84 "${updater_path}/services/log:libupdaterlog", 85 ] 86 87 if (!is_linux && !is_mingw && !is_mac) { 88 deps += [ "../rust/hash_signed_data:rust_hash_signed_data" ] 89 } 90 91 external_deps = [ 92 "bounds_checking_function:libsec_static", 93 "lz4:liblz4_static", 94 "openssl:libcrypto_static", 95 "zlib:libz", 96 ] 97 98 configs = [ ":package_config" ] 99 100 public_configs = [ ":libupdaterpackage_exported_headers" ] 101 if (is_mingw) { 102 libs = [ 103 "setupapi", 104 "psapi", 105 "user32", 106 "advapi32", 107 "iphlpapi", 108 "userenv", 109 "ws2_32", 110 ] 111 112 ldflags = [ 113 "-Wl,--whole-archive", 114 "-lpthread", 115 "-Wl,--no-whole-archive", 116 ] 117 } 118 defines = [ "OPENSSL_SUPPRESS_DEPRECATED" ] 119 120 subsystem_name = "updater" 121 part_name = "updater" 122} 123 124ohos_shared_library("libupdaterpackage_shared") { 125 sources = libupdaterpackage_common_source 126 127 deps = [ 128 "${updater_path}/services/common/ring_buffer:libringbuffer", 129 "${updater_path}/services/log:libupdaterlog_shared", 130 ] 131 132 external_deps = [ 133 "bounds_checking_function:libsec_shared", 134 "lz4:liblz4_static", 135 "openssl:libcrypto_shared", 136 "zlib:shared_libz", 137 ] 138 139 if (!is_linux && !is_mingw && !is_mac) { 140 deps += [ "../rust/hash_signed_data:rust_hash_signed_data" ] 141 } 142 143 configs = [ ":package_config" ] 144 145 public_configs = [ ":libupdaterpackage_exported_headers" ] 146 defines = [ 147 "DIFF_PATCH_SDK", 148 "OPENSSL_SUPPRESS_DEPRECATED", 149 ] 150 151 subsystem_name = "updater" 152 part_name = "updater" 153} 154