169570cc8Sopenharmony_ci# Copyright (c) 2024 Huawei Device Co., Ltd.
269570cc8Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
369570cc8Sopenharmony_ci# you may not use this file except in compliance with the License.
469570cc8Sopenharmony_ci# You may obtain a copy of the License at
569570cc8Sopenharmony_ci#
669570cc8Sopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
769570cc8Sopenharmony_ci#
869570cc8Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software
969570cc8Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
1069570cc8Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1169570cc8Sopenharmony_ci# See the License for the specific language governing permissions and
1269570cc8Sopenharmony_ci# limitations under the License.
1369570cc8Sopenharmony_ciimport("//base/startup/appspawn/appspawn.gni")
1469570cc8Sopenharmony_ciimport("//build/ohos.gni")
1569570cc8Sopenharmony_ci
1669570cc8Sopenharmony_ciif (!defined(ohos_lite)) {
1769570cc8Sopenharmony_ci  ohos_executable("hnp") {
1869570cc8Sopenharmony_ci    include_dirs = [
1969570cc8Sopenharmony_ci      "base",
2069570cc8Sopenharmony_ci      "installer/include",
2169570cc8Sopenharmony_ci    ]
2269570cc8Sopenharmony_ci    sources = [
2369570cc8Sopenharmony_ci      "${appspawn_path}/service/hnp/base/hnp_file.c",
2469570cc8Sopenharmony_ci      "${appspawn_path}/service/hnp/base/hnp_json.c",
2569570cc8Sopenharmony_ci      "${appspawn_path}/service/hnp/base/hnp_log.c",
2669570cc8Sopenharmony_ci      "${appspawn_path}/service/hnp/base/hnp_sal.c",
2769570cc8Sopenharmony_ci      "${appspawn_path}/service/hnp/base/hnp_zip.c",
2869570cc8Sopenharmony_ci      "${appspawn_path}/service/hnp/hnp_main.c",
2969570cc8Sopenharmony_ci      "${appspawn_path}/service/hnp/installer/src/hnp_installer.c",
3069570cc8Sopenharmony_ci    ]
3169570cc8Sopenharmony_ci    configs = []
3269570cc8Sopenharmony_ci    cflags = []
3369570cc8Sopenharmony_ci    external_deps = [
3469570cc8Sopenharmony_ci      "bounds_checking_function:libsec_shared",
3569570cc8Sopenharmony_ci      "cJSON:cjson",
3669570cc8Sopenharmony_ci      "code_signature:libcode_sign_utils",
3769570cc8Sopenharmony_ci      "hilog:libhilog",
3869570cc8Sopenharmony_ci      "selinux_adapter:librestorecon",
3969570cc8Sopenharmony_ci      "zlib:shared_libz",
4069570cc8Sopenharmony_ci    ]
4169570cc8Sopenharmony_ci    defines = []
4269570cc8Sopenharmony_ci    if (defined(global_parts_info) &&
4369570cc8Sopenharmony_ci        defined(global_parts_info.security_code_signature)) {
4469570cc8Sopenharmony_ci      defines += [ "CODE_SIGNATURE_ENABLE" ]
4569570cc8Sopenharmony_ci    }
4669570cc8Sopenharmony_ci    install_enable = true
4769570cc8Sopenharmony_ci    subsystem_name = "${subsystem_name}"
4869570cc8Sopenharmony_ci    part_name = "${part_name}"
4969570cc8Sopenharmony_ci  }
5069570cc8Sopenharmony_ci
5169570cc8Sopenharmony_ci  ohos_executable("hnpcli") {
5269570cc8Sopenharmony_ci    include_dirs = [
5369570cc8Sopenharmony_ci      "pack/include",
5469570cc8Sopenharmony_ci      "base",
5569570cc8Sopenharmony_ci    ]
5669570cc8Sopenharmony_ci    sources = [
5769570cc8Sopenharmony_ci      "${appspawn_path}/service/hnp/base/hnp_file.c",
5869570cc8Sopenharmony_ci      "${appspawn_path}/service/hnp/base/hnp_json.c",
5969570cc8Sopenharmony_ci      "${appspawn_path}/service/hnp/base/hnp_log.c",
6069570cc8Sopenharmony_ci      "${appspawn_path}/service/hnp/base/hnp_zip.c",
6169570cc8Sopenharmony_ci      "${appspawn_path}/service/hnp/hnpcli_main.c",
6269570cc8Sopenharmony_ci      "${appspawn_path}/service/hnp/pack/src/hnp_pack.c",
6369570cc8Sopenharmony_ci    ]
6469570cc8Sopenharmony_ci    configs = []
6569570cc8Sopenharmony_ci    cflags = []
6669570cc8Sopenharmony_ci    defines = [ "HNP_CLI" ]
6769570cc8Sopenharmony_ci
6869570cc8Sopenharmony_ci    external_deps = [
6969570cc8Sopenharmony_ci      "bounds_checking_function:libsec_static",
7069570cc8Sopenharmony_ci      "cJSON:cjson_static",
7169570cc8Sopenharmony_ci      "zlib:libz",
7269570cc8Sopenharmony_ci    ]
7369570cc8Sopenharmony_ci    install_enable = true
7469570cc8Sopenharmony_ci    subsystem_name = "${subsystem_name}"
7569570cc8Sopenharmony_ci    part_name = "${part_name}"
7669570cc8Sopenharmony_ci  }
7769570cc8Sopenharmony_ci}
78