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 14import("//base/update/updater/updater_default_cfg.gni") 15import("//build/ohos.gni") 16 17SUBSYSTEM_DIR = "//base/update/updater" 18 19updater_common_include = [ 20 "include", 21 "${SUBSYSTEM_DIR}/utils/include", 22 "${SUBSYSTEM_DIR}/interfaces/kits/include/", 23 "//base/update/updater/services/include/package", 24 "//base/update/updater/services/package/pkg_manager", 25 "//base/update/updater/services/package/pkg_verify", 26 "//base/update/updater/services/include/log", 27 "//base/update/updater/utils/json", 28 "//foundation/graphic/ui/frameworks", 29 "//foundation/graphic/ui/interfaces/kits", 30 "//foundation/graphic/ui/interfaces/innerkits", 31 "//foundation/graphic/utils/interfaces/kits", 32 "//foundation/graphic/utils/interfaces/innerkits", 33 "//third_party/bounds_checking_function/include", 34 "//base/update/updater/services", 35 "//base/update/updater/services/ui", 36 "//base/update/updater/services/include", 37 "//base/startup/syspara_lite/interfaces/innerkits/native/syspara/include", 38] 39 40updater_common_deps = [ 41 "//base/update/updater/interfaces/kits/packages:libpackageExt", 42 "//base/update/updater/services/applypatch:libapplypatch", 43 "//base/update/updater/services/diffpatch/patch:libpatch", 44 "//base/update/updater/services/flashd:libflashd", 45 "//base/update/updater/services/fs_manager:libfsmanager", 46 "//base/update/updater/services/log:libupdaterlog", 47 "//base/update/updater/services/package:libupdaterpackage", 48 "//third_party/bounds_checking_function:libsec_shared", 49 "//third_party/bounds_checking_function:libsec_static", 50 "//third_party/bzip2:libbz2", 51 "//third_party/cJSON:cjson", 52 "//third_party/openssl:libcrypto_static", 53 "//third_party/openssl:ssl_source", 54 "//third_party/zlib:libz", 55] 56 57ohos_executable("updater") { 58 defines = [ "BUILD_OHOS" ] 59 sources = [ 60 "main.cpp", 61 "updater.cpp", 62 "updater_main.cpp", 63 "updater_preprocess.cpp", 64 "updater_utils.cpp", 65 ] 66 67 include_dirs = updater_common_include 68 include_dirs += [ 69 "//third_party/openssl/include", 70 "//base/update/updater/services/ui/view", 71 ] 72 73 deps = updater_common_deps 74 deps += [ 75 "//base/update/updater/interfaces/kits/misc_info:libmiscinfo", 76 "//base/update/updater/services/ui:libui", 77 "//third_party/libdrm:libdrm", 78 ] 79 80 if (defined(use_ptable)) { 81 include_dirs += [ "//base/update/updater/services/ptable_parse" ] 82 deps += [ "//base/update/updater/services/ptable_parse:libptableparse" ] 83 defines += [ "UPDATER_USE_PTABLE" ] 84 } 85 86 # add updater custom library 87 if (defined(updater_custom_lib)) { 88 deps += updater_custom_lib 89 deps += [ "//drivers/peripheral/input/udriver:hdi_input_udriver" ] 90 } 91 92 # force link invisible function 93 if (defined(updater_force_link_libs)) { 94 ldflags = [ "-Wl,--whole-archive" ] 95 foreach(lib, updater_force_link_libs) { 96 ldflags += [ "${lib}" ] 97 } 98 ldflags += [ "-Wl,--no-whole-archive" ] 99 } 100 101 external_deps += [ "init:libbegetutil" ] 102 103 install_images = [ "updater" ] 104 install_enable = true 105 part_name = "updater" 106 subsystem_name = "updater" 107} 108 109ohos_static_library("libupdater") { 110 defines = [ "BUILD_OHOS" ] 111 sources = [ 112 "updater.cpp", 113 "updater_preprocess.cpp", 114 "updater_utils.cpp", 115 ] 116 117 include_dirs = updater_common_include 118 119 deps = updater_common_deps 120 121 if (defined(use_ptable)) { 122 include_dirs += [ "//base/update/updater/services/ptable_parse" ] 123 deps += [ "//base/update/updater/services/ptable_parse:libptableparse" ] 124 defines += [ "UPDATER_USE_PTABLE" ] 125 } 126 127 # add updater custom library 128 if (defined(updater_custom_lib)) { 129 deps += updater_custom_lib 130 deps += [ "//drivers/peripheral/input/udriver:hdi_input_udriver" ] 131 } 132 133 # force link invisible function 134 if (defined(updater_force_link_libs)) { 135 ldflags = [ "-Wl,--whole-archive" ] 136 foreach(lib, updater_force_link_libs) { 137 ldflags += [ "${lib}" ] 138 } 139 ldflags += [ "-Wl,--no-whole-archive" ] 140 } 141 142 external_deps += [ "init:libbegetutil" ] 143 if (build_selinux) { 144 external_deps += [ "selinux:librestorecon" ] 145 cflags = [ "-DWITH_SELINUX" ] 146 } 147 148 subsystem_name = "updater" 149 part_name = "updater" 150} 151