• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2022 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.
13if (!is_linux && !is_mingw && !is_mac) {
14  import("//base/update/updater/updater_default_cfg.gni")
15}
16import("//build/ohos.gni")
17UPDATER_DIR = "//base/update/updater"
18DIFFPATCH_DIR = "//base/update/updater/services/diffpatch"
19
20config("diff_config") {
21  cflags_cc = [
22    "-frtti",
23    "-std=c++17",
24  ]
25  if (is_mingw) {
26    cflags_cc += [ "-Wno-inconsistent-dllimport" ]
27  }
28}
29
30ohos_executable("diff") {
31  use_exceptions = true
32  configs = [ ":diff_config" ]
33
34  sources = [
35    "${DIFFPATCH_DIR}/bzip2/bzip2_adapter.cpp",
36    "${DIFFPATCH_DIR}/bzip2/lz4_adapter.cpp",
37    "${DIFFPATCH_DIR}/bzip2/zip_adapter.cpp",
38    "${DIFFPATCH_DIR}/diff/blocks_diff.cpp",
39    "${DIFFPATCH_DIR}/diff/image_diff.cpp",
40    "${DIFFPATCH_DIR}/diff/update_diff.cpp",
41    "${DIFFPATCH_DIR}/diff_main.cpp",
42    "${DIFFPATCH_DIR}/diffpatch.cpp",
43    "${DIFFPATCH_DIR}/patch/blocks_patch.cpp",
44    "${DIFFPATCH_DIR}/patch/image_patch.cpp",
45    "${DIFFPATCH_DIR}/patch/update_patch.cpp",
46    "${UPDATER_DIR}/services/package/pkg_manager/pkg_utils.cpp",
47  ]
48
49  include_dirs = [
50    "${DIFFPATCH_DIR}",
51    "${UPDATER_DIR}/interfaces/kits/include",
52    "${UPDATER_DIR}/services/include/package",
53    "${UPDATER_DIR}/services/include/patch",
54    "${UPDATER_DIR}/services/include",
55    "${UPDATER_DIR}/utils/include",
56    "${UPDATER_DIR}/services/diffpatch/bzip2",
57    "${UPDATER_DIR}/services/diffpatch/diff",
58    "${UPDATER_DIR}/services/diffpatch/patch",
59    "${UPDATER_DIR}/services/diffpatch",
60    "${UPDATER_DIR}/services/package/pkg_manager",
61    "${UPDATER_DIR}/services/include/log",
62    "//third_party/bounds_checking_function/include",
63    "//third_party/openssl/include",
64    "//third_party/bzip2",
65    "//third_party/zlib",
66    "//third_party/lz4/lib",
67  ]
68
69  deps = [
70    "//base/update/updater/services/log:libupdaterlog",
71    "//base/update/updater/services/package:libupdaterpackage",
72    "//third_party/bzip2:libbz2",
73    "//third_party/lz4:liblz4_static",
74    "//third_party/openssl:libcrypto_static",
75    "//third_party/zlib:libz",
76  ]
77
78  if (is_mingw) {
79    static_link = false
80    libs = [ "setupapi" ]
81    ldflags = [
82      "-Wl,--whole-archive",
83      "-lpthread",
84      "-Wl,--no-whole-archive",
85    ]
86  }
87
88  if (is_linux) {
89    static_link = false
90
91    ldflags = [
92      "-Wl,--whole-archive",
93      "-lpthread",
94      "-latomic",
95      "-ldl",
96      "-lrt",
97      "-Wl,--no-whole-archive",
98    ]
99  }
100  install_enable = false
101  subsystem_name = "developtools"
102  part_name = "updater"
103}
104