1# Copyright (c) 2024 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.
13import("//base/startup/appspawn/appspawn.gni")
14import("//build/ohos.gni")
15
16if (!defined(ohos_lite)) {
17  ohos_executable("hnp") {
18    include_dirs = [
19      "base",
20      "installer/include",
21    ]
22    sources = [
23      "${appspawn_path}/service/hnp/base/hnp_file.c",
24      "${appspawn_path}/service/hnp/base/hnp_json.c",
25      "${appspawn_path}/service/hnp/base/hnp_log.c",
26      "${appspawn_path}/service/hnp/base/hnp_sal.c",
27      "${appspawn_path}/service/hnp/base/hnp_zip.c",
28      "${appspawn_path}/service/hnp/hnp_main.c",
29      "${appspawn_path}/service/hnp/installer/src/hnp_installer.c",
30    ]
31    configs = []
32    cflags = []
33    external_deps = [
34      "bounds_checking_function:libsec_shared",
35      "cJSON:cjson",
36      "code_signature:libcode_sign_utils",
37      "hilog:libhilog",
38      "selinux_adapter:librestorecon",
39      "zlib:shared_libz",
40    ]
41    defines = []
42    if (defined(global_parts_info) &&
43        defined(global_parts_info.security_code_signature)) {
44      defines += [ "CODE_SIGNATURE_ENABLE" ]
45    }
46    install_enable = true
47    subsystem_name = "${subsystem_name}"
48    part_name = "${part_name}"
49  }
50
51  ohos_executable("hnpcli") {
52    include_dirs = [
53      "pack/include",
54      "base",
55    ]
56    sources = [
57      "${appspawn_path}/service/hnp/base/hnp_file.c",
58      "${appspawn_path}/service/hnp/base/hnp_json.c",
59      "${appspawn_path}/service/hnp/base/hnp_log.c",
60      "${appspawn_path}/service/hnp/base/hnp_zip.c",
61      "${appspawn_path}/service/hnp/hnpcli_main.c",
62      "${appspawn_path}/service/hnp/pack/src/hnp_pack.c",
63    ]
64    configs = []
65    cflags = []
66    defines = [ "HNP_CLI" ]
67
68    external_deps = [
69      "bounds_checking_function:libsec_static",
70      "cJSON:cjson_static",
71      "zlib:libz",
72    ]
73    install_enable = true
74    subsystem_name = "${subsystem_name}"
75    part_name = "${part_name}"
76  }
77}
78
79group("hnpcli_host_toolchain") {
80  deps = [ ":hnpcli($host_toolchain)" ]
81}
82