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 17updater_path = rebase_path("${updater_absolutely_path}", ".") 18config("updater_config") { 19 visibility = [ ":*" ] 20 include_dirs = [ 21 "${updater_path}/interfaces/kits/include", 22 "${updater_path}/services", 23 "${updater_path}/services/common", 24 "${updater_path}/services/flow_update", 25 "${updater_path}/services/include/package", 26 "${updater_path}/services/include/script", 27 "${updater_path}/services/include/log", 28 "${updater_path}/services/include", 29 "${updater_path}/utils/include", 30 "${updater_path}/utils/json", 31 "${updater_path}/services/include/applypatch", 32 "//base/startup/init/interfaces/innerkits/include", 33 "//third_party/bounds_checking_function/include", 34 "//drivers/hdf/frameworks/include/utils", 35 ] 36} 37 38ohos_executable("updater_binary") { 39 sources = [ 40 "${updater_path}/services/updater_binary/main.cpp", 41 "${updater_path}/services/updater_binary/update_image_block.cpp", 42 "${updater_path}/services/updater_binary/update_image_patch.cpp", 43 "${updater_path}/services/updater_binary/update_partitions.cpp", 44 "${updater_path}/services/updater_binary/update_processor.cpp", 45 ] 46 configs = [ ":updater_config" ] 47 48 ldflags = [ "-Wl -std=c++11" ] 49 if (defined(binary_force_link_libs)) { 50 ldflags += [ "-Wl,--whole-archive" ] 51 foreach(lib, binary_force_link_libs) { 52 ldflags += [ "${lib}" ] 53 } 54 ldflags += [ "-Wl,--no-whole-archive" ] 55 } 56 deps = [ 57 "${updater_path}/interfaces/kits/misc_info:libmiscinfo", 58 "${updater_path}/interfaces/kits/slot_info:libslotinfo", 59 "${updater_path}/services/applypatch:libapplypatch", 60 "${updater_path}/services/diffpatch/patch:libpatch", 61 "${updater_path}/services/flow_update/update_bin:libBinFlowUpdate", 62 "${updater_path}/services/fs_manager:libfsmanager", 63 "${updater_path}/services/log:libupdaterlog", 64 "${updater_path}/services/package:libupdaterpackage", 65 "${updater_path}/services/script:libupdaterscript", 66 "//third_party/bzip2:libbz2", 67 "//third_party/cJSON:cjson_static", 68 "//third_party/lz4:liblz4_static", 69 "//third_party/openssl:libcrypto_static", 70 "//third_party/openssl:libssl_static", 71 "//third_party/zlib:libz", 72 ] 73 74 if (defined(binary_custom_lib)) { 75 deps += binary_custom_lib 76 } 77 78 defines = [ "OPENSSL_SUPPRESS_DEPRECATED" ] 79 80 if (defined(use_ptable)) { 81 include_dirs = [ "${updater_path}/services/ptable_parse" ] 82 deps += [ "${updater_path}/services/ptable_parse:libptableparse" ] 83 defines += [ "UPDATER_USE_PTABLE" ] 84 } 85 86 external_deps = [ "init:libfsmanager_static" ] 87 88 install_enable = true 89 install_images = [ 90 "system", 91 "updater", 92 ] 93 part_name = "updater" 94 subsystem_name = "updater" 95} 96