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
16config("appspawn_config") {
17  visibility = [ "./*" ]
18  include_dirs = [
19    "${appspawn_innerkits_path}/include",
20    "${appspawn_path}/modules/module_engine/include",
21    "${appspawn_path}/util/include",
22    "//commonlibrary/c_utils/base/include",
23  ]
24
25  cflags = []
26  if (build_selinux) {
27    cflags += [ "-DWITH_SELINUX" ]
28  }
29
30  if (build_seccomp) {
31    cflags += [ "-DWITH_SECCOMP" ]
32    if (appspawn_seccomp_privilege) {
33      cflags += [ "-DSECCOMP_PRIVILEGE" ]
34    }
35  }
36}
37
38if (!defined(ohos_lite)) {
39  ohos_prebuilt_etc("appspawn.rc") {
40    source = "appspawn.cfg"
41    relative_install_dir = "init"
42    subsystem_name = "${subsystem_name}"
43    part_name = "${part_name}"
44  }
45
46  ohos_prebuilt_etc("nativespawn.rc") {
47    source = "nativespawn.cfg"
48    relative_install_dir = "init"
49    subsystem_name = "${subsystem_name}"
50    part_name = "${part_name}"
51  }
52
53  ohos_prebuilt_etc("cjappspawn.rc") {
54    source = "cjappspawn.cfg"
55    relative_install_dir = "init"
56    subsystem_name = "${subsystem_name}"
57    part_name = "${part_name}"
58  }
59}
60
61group("appspawn_all") {
62  deps = []
63  if (!defined(ohos_lite)) {
64    deps += [ "standard:appspawn" ]
65    deps += [ "standard:appspawn_helper" ]
66    deps += [ "standard:pid_ns_init" ]
67    deps += [ ":appspawn.rc" ]
68    deps += [ "etc:etc_files" ]
69    deps += [ "modules/ace_adapter:appspawn_ace" ]
70    deps += [ "modules/asan:appspawn_asan" ]
71    deps += [ "modules/nweb_adapter:appspawn_nweb" ]
72    deps += [ "modules/native_adapter:nativespawn" ]
73    deps += [ "modules/sandbox:appspawn_sandbox" ]
74    deps += [ "modules/common:appspawn_common" ]
75    deps += [ "modules/sysevent:event_reporter" ]
76    deps += [ "${appspawn_innerkits_path}/client:appspawn_client" ]
77    deps += [
78      "${appspawn_path}/modules/module_engine:libappspawn_module_engine",
79      "${appspawn_path}/modules/module_engine:libappspawn_stub_empty",
80    ]
81    deps += [ "service/hnp:hnp" ]
82    deps += [ "service/devicedebug:devicedebug" ]
83    if (appspawn_support_cj) {  # for support cj appspawn
84      deps += [
85        ":cjappspawn.rc",
86        "standard:cjappspawn",
87      ]
88    }
89    if (appspawn_support_native) {  # for support nativespawn
90      deps += [
91        ":nativespawn.rc",
92        "standard:nativespawn",
93      ]
94    }
95  } else {
96    deps += [ "lite:appspawn_lite" ]
97  }
98}
99