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("patch_config") {
23  visibility = [ ":*" ]
24  include_dirs = [
25    "${updater_path}/interfaces/kits/include/package",
26    "${updater_path}/interfaces/kits/include",
27    "${updater_path}/services/common",
28    "${updater_path}/services/include/log",
29    "${updater_path}/services/include/package",
30    "${updater_path}/services/include/patch",
31    "${updater_path}/services/include",
32    "${updater_path}/utils/include",
33    "${updater_path}/services/diffpatch/bzip2",
34    "${updater_path}/services/diffpatch/patch",
35    "${updater_path}/services/diffpatch",
36    "${updater_path}/services/package/pkg_manager",
37  ]
38  defines = [ "OPENSSL_SUPPRESS_DEPRECATED" ]
39}
40
41libpatch_common_source = [
42  "${updater_path}/services/diffpatch/bzip2/bzip2_adapter.cpp",
43  "${updater_path}/services/diffpatch/bzip2/lz4_adapter.cpp",
44  "${updater_path}/services/diffpatch/bzip2/zip_adapter.cpp",
45  "${updater_path}/services/diffpatch/diffpatch.cpp",
46  "${updater_path}/services/diffpatch/patch/blocks_patch.cpp",
47  "${updater_path}/services/diffpatch/patch/image_patch.cpp",
48  "${updater_path}/services/diffpatch/patch/update_patch.cpp",
49]
50
51ohos_static_library("libpatch") {
52  sources = libpatch_common_source
53
54  deps = [
55    "${updater_path}/services/log:libupdaterlog",
56    "${updater_path}/services/package:libupdaterpackage",
57  ]
58
59  external_deps = [
60    "bounds_checking_function:libsec_static",
61    "bzip2:libbz2",
62    "lz4:liblz4_static",
63    "openssl:libcrypto_static",
64    "zlib:libz",
65  ]
66
67  configs = [ ":patch_config" ]
68  subsystem_name = "updater"
69  part_name = "updater"
70}
71
72ohos_shared_library("libpatch_shared") {
73  sources = libpatch_common_source
74
75  deps = [
76    "${updater_path}/interfaces/kits/packages:libpackage_shared",
77    "${updater_path}/services/log:libupdaterlog_shared",
78    "${updater_path}/services/package:libupdaterpackage_shared",
79  ]
80
81  external_deps = [
82    "bounds_checking_function:libsec_shared",
83    "bzip2:libbz2",
84    "lz4:liblz4_static",
85    "openssl:libcrypto_shared",
86    "zlib:libz",
87  ]
88
89  configs = [ ":patch_config" ]
90  subsystem_name = "updater"
91  part_name = "updater"
92}
93