• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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}/service/common",
46    "${updater_path}/service/common/ring_buffer",
47    "${updater_path}/services/include/package",
48    "${updater_path}/services/include",
49    "${updater_path}/services/package",
50    "${updater_path}/services/package/pkg_manager",
51    "${updater_path}/services/package/pkg_verify",
52    "${updater_path}/services/include/script",
53    "${updater_path}/interfaces/kits/include",
54  ]
55}
56
57libupdaterpackage_common_source = [
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
80ohos_static_library("libupdaterpackage") {
81  sources = libupdaterpackage_common_source
82
83  deps = [
84    "${updater_path}/services/common/ring_buffer:libringbuffer",
85    "${updater_path}/services/log:libupdaterlog",
86  ]
87
88  if (!is_linux && !is_mingw && !is_mac && host_cpu != "arm64") {
89    deps += [ "../rust/hash_signed_data:rust_hash_signed_data" ]
90  }
91
92  external_deps = [
93    "bounds_checking_function:libsec_static",
94    "lz4:liblz4_static",
95    "openssl:libcrypto_static",
96    "zlib:libz",
97  ]
98
99  configs = [ ":package_config" ]
100
101  public_configs = [ ":libupdaterpackage_exported_headers" ]
102  if (is_mingw) {
103    libs = [
104      "setupapi",
105      "psapi",
106      "user32",
107      "advapi32",
108      "iphlpapi",
109      "userenv",
110      "ws2_32",
111    ]
112
113    ldflags = [
114      "-Wl,--whole-archive",
115      "-lpthread",
116      "-Wl,--no-whole-archive",
117    ]
118  }
119  defines = [ "OPENSSL_SUPPRESS_DEPRECATED" ]
120
121  subsystem_name = "updater"
122  part_name = "updater"
123}
124
125ohos_shared_library("libupdaterpackage_shared") {
126  sources = libupdaterpackage_common_source
127
128  deps = [
129    "${updater_path}/services/common/ring_buffer:libringbuffer",
130    "${updater_path}/services/log:libupdaterlog_shared",
131  ]
132
133  external_deps = [
134    "bounds_checking_function:libsec_static",
135    "lz4:liblz4_static",
136    "openssl:libcrypto_shared",
137    "zlib:shared_libz",
138  ]
139
140  if (!is_linux && !is_mingw && !is_mac) {
141    deps += [ "../rust/hash_signed_data:rust_hash_signed_data" ]
142  }
143
144  configs = [ ":package_config" ]
145
146  public_configs = [ ":libupdaterpackage_exported_headers" ]
147  defines = [
148    "DIFF_PATCH_SDK",
149    "OPENSSL_SUPPRESS_DEPRECATED",
150  ]
151
152  subsystem_name = "updater"
153  part_name = "updater"
154}
155