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 "//third_party/zlib", 32 "//third_party/lz4/lib", 33 "${updater_path}/services/include/package", 34 "${updater_path}/services/include/script", 35 "${updater_path}/services/include/log", 36 "pkg_algorithm", 37 "pkg_manager", 38 "pkg_package", 39 "pkg_verify", 40 "//third_party/bounds_checking_function/include", 41 ] 42} 43 44config("libupdaterpackage_exported_headers") { 45 visibility = [ ":*" ] 46 include_dirs = [ 47 "${updater_path}/services/include/package", 48 "${updater_path}/services/include", 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 56ohos_static_library("libupdaterpackage") { 57 sources = [ 58 "./pkg_algorithm/pkg_algo_deflate.cpp", 59 "./pkg_algorithm/pkg_algo_digest.cpp", 60 "./pkg_algorithm/pkg_algo_lz4.cpp", 61 "./pkg_algorithm/pkg_algo_sign.cpp", 62 "./pkg_algorithm/pkg_algorithm.cpp", 63 "./pkg_manager/pkg_managerImpl.cpp", 64 "./pkg_manager/pkg_stream.cpp", 65 "./pkg_manager/pkg_utils.cpp", 66 "./pkg_package/packages_info.cpp", 67 "./pkg_package/pkg_gzipfile.cpp", 68 "./pkg_package/pkg_lz4file.cpp", 69 "./pkg_package/pkg_pkgfile.cpp", 70 "./pkg_package/pkg_upgradefile.cpp", 71 "./pkg_package/pkg_zipfile.cpp", 72 "./pkg_verify/cert_verify.cpp", 73 "./pkg_verify/openssl_util.cpp", 74 "./pkg_verify/pkcs7_signed_data.cpp", 75 "./pkg_verify/pkg_verify_util.cpp", 76 "./pkg_verify/zip_pkg_parse.cpp", 77 "pkg_verify/hash_data_verifier.cpp", 78 ] 79 80 deps = [ 81 "${updater_path}/services/common/ring_buffer:libringbuffer", 82 "${updater_path}/services/log:libupdaterlog", 83 "//third_party/bounds_checking_function:libsec_static", 84 "//third_party/openssl:libcrypto_shared", 85 ] 86 87 if (!is_linux && !is_mingw && !is_mac) { 88 deps += [ "../rust/hash_signed_data:rust_hash_signed_data" ] 89 } 90 91 configs = [ ":package_config" ] 92 93 public_configs = [ ":libupdaterpackage_exported_headers" ] 94 if (is_mingw) { 95 libs = [ 96 "setupapi", 97 "psapi", 98 "user32", 99 "advapi32", 100 "iphlpapi", 101 "userenv", 102 "ws2_32", 103 ] 104 105 ldflags = [ 106 "-Wl,--whole-archive", 107 "-lpthread", 108 "-Wl,--no-whole-archive", 109 ] 110 } 111 defines = [ "OPENSSL_SUPPRESS_DEPRECATED" ] 112 113 subsystem_name = "updater" 114 part_name = "updater" 115} 116