2024-04-13 10:58:15 +00:00
|
|
|
# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
import("//base/startup/appspawn/appspawn.gni")
|
|
|
|
import("//build/ohos.gni")
|
|
|
|
import("//build/ohos/native_stub/native_stub.gni")
|
|
|
|
|
|
|
|
config("appspawn_server_config") {
|
|
|
|
visibility = [ ":*" ]
|
|
|
|
include_dirs = [
|
|
|
|
"${appspawn_path}/common",
|
|
|
|
"${appspawn_path}/standard",
|
2024-06-17 09:54:59 +00:00
|
|
|
"${appspawn_path}/modules/common",
|
2024-04-13 10:58:15 +00:00
|
|
|
"${appspawn_path}/modules/modulemgr",
|
2024-06-11 07:29:09 +00:00
|
|
|
"${appspawn_path}/modules/sysevent",
|
2024-04-13 10:58:15 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
cflags = []
|
|
|
|
if (build_selinux) {
|
|
|
|
cflags += [ "-DWITH_SELINUX" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
if (build_seccomp) {
|
|
|
|
cflags += [ "-DWITH_SECCOMP" ]
|
|
|
|
}
|
|
|
|
configs = [ "${appspawn_path}:appspawn_config" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
ohos_executable("appspawn") {
|
|
|
|
sources = [
|
|
|
|
"${appspawn_path}/common/appspawn_server.c",
|
2024-06-17 09:54:59 +00:00
|
|
|
"${appspawn_path}/modules/common/appspawn_dfx_dump.cpp",
|
2024-04-13 10:58:15 +00:00
|
|
|
"${appspawn_path}/modules/modulemgr/appspawn_modulemgr.c",
|
|
|
|
"${appspawn_path}/standard/appspawn_appmgr.c",
|
|
|
|
"${appspawn_path}/standard/appspawn_main.c",
|
|
|
|
"${appspawn_path}/standard/appspawn_msgmgr.c",
|
|
|
|
"${appspawn_path}/standard/appspawn_service.c",
|
|
|
|
"${appspawn_path}/standard/nwebspawn_launcher.c",
|
|
|
|
]
|
|
|
|
|
|
|
|
defines = []
|
|
|
|
configs = [
|
|
|
|
":appspawn_server_config",
|
|
|
|
"${appspawn_path}:appspawn_config",
|
|
|
|
]
|
|
|
|
deps = [
|
|
|
|
"${appspawn_path}/modules/module_engine:libappspawn_stub_versionscript",
|
|
|
|
"${appspawn_path}/util:libappspawn_util",
|
|
|
|
]
|
|
|
|
if (asan_detector || is_asan) {
|
|
|
|
defines += [ "ASAN_DETECTOR" ]
|
|
|
|
}
|
2024-04-30 10:53:46 +00:00
|
|
|
if (is_debug || build_variant == "root") {
|
|
|
|
defines += [ "DEBUG_BEGETCTL_BOOT" ]
|
|
|
|
}
|
2024-04-13 10:58:15 +00:00
|
|
|
|
|
|
|
external_deps = [
|
|
|
|
"c_utils:utils",
|
|
|
|
"config_policy:configpolicy_util",
|
2024-06-17 09:54:59 +00:00
|
|
|
"faultloggerd:libdfx_dumpcatcher",
|
2024-04-13 10:58:15 +00:00
|
|
|
"hilog:libhilog",
|
|
|
|
"init:libbegetutil",
|
|
|
|
]
|
|
|
|
|
2024-06-03 11:46:30 +00:00
|
|
|
if (appspawn_use_encaps) {
|
|
|
|
defines += [ "USE_ENCAPS" ]
|
|
|
|
}
|
2024-06-11 07:29:09 +00:00
|
|
|
if (appspawn_report_event) {
|
|
|
|
defines += [ "APPSPAWN_HISYSEVENT" ]
|
|
|
|
external_deps += [ "hisysevent:libhisysevent" ]
|
|
|
|
sources += [ "${appspawn_path}/modules/sysevent/appspawn_hisysevent.cpp" ]
|
|
|
|
}
|
2024-04-13 10:58:15 +00:00
|
|
|
if (build_selinux) {
|
|
|
|
defines += [ "WITH_SELINUX" ]
|
|
|
|
external_deps += [
|
|
|
|
"selinux:libselinux",
|
|
|
|
"selinux_adapter:libhap_restorecon",
|
|
|
|
]
|
|
|
|
}
|
|
|
|
cflags = []
|
|
|
|
|
|
|
|
#ldflags = [ "-Wl,--dynamic-linker,/system/bin/linker64z" ]
|
|
|
|
if (!defined(global_parts_info) ||
|
|
|
|
defined(global_parts_info.security_code_signature)) {
|
|
|
|
defines += [ "CODE_SIGNATURE_ENABLE" ]
|
|
|
|
external_deps += [ "code_signature:libcode_sign_attr_utils" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
version_script = get_label_info(
|
|
|
|
"${appspawn_path}/modules/module_engine:libappspawn_stub_versionscript",
|
|
|
|
"target_gen_dir") + "/" + get_label_info(
|
|
|
|
"${appspawn_path}/modules/module_engine:libappspawn_stub_versionscript",
|
|
|
|
"name") + stub_version_script_suffix
|
|
|
|
|
|
|
|
install_enable = true
|
|
|
|
subsystem_name = "${subsystem_name}"
|
|
|
|
part_name = "${part_name}"
|
|
|
|
}
|
|
|
|
|
|
|
|
ohos_shared_library("appspawn_helper") {
|
|
|
|
sources = [ "${appspawn_path}/common/appspawn_server.c" ]
|
|
|
|
defines = [ "APPSPAWN_HELPER" ]
|
|
|
|
configs = [
|
|
|
|
":appspawn_server_config",
|
|
|
|
"${appspawn_path}:appspawn_config",
|
|
|
|
]
|
|
|
|
cflags = [
|
|
|
|
"-fvisibility=hidden",
|
|
|
|
"-fstack-protector-all",
|
|
|
|
]
|
|
|
|
external_deps = [
|
|
|
|
"hilog:libhilog",
|
|
|
|
"init:libbegetutil",
|
|
|
|
]
|
|
|
|
|
|
|
|
install_enable = true
|
|
|
|
subsystem_name = "${subsystem_name}"
|
|
|
|
part_name = "${part_name}"
|
|
|
|
}
|
|
|
|
|
|
|
|
ohos_prebuilt_etc("appspawn.rc") {
|
|
|
|
source = "appspawn.cfg"
|
|
|
|
relative_install_dir = "init"
|
|
|
|
subsystem_name = "${subsystem_name}"
|
|
|
|
part_name = "${part_name}"
|
|
|
|
}
|
|
|
|
|
|
|
|
ohos_executable("pid_ns_init") {
|
|
|
|
sources = [ "${appspawn_path}/standard/pid_ns_init.c" ]
|
|
|
|
install_enable = true
|
|
|
|
subsystem_name = "${subsystem_name}"
|
|
|
|
part_name = "${part_name}"
|
|
|
|
}
|
2024-05-14 08:21:23 +00:00
|
|
|
|
|
|
|
# to support cjappspawn
|
|
|
|
ohos_executable("cjappspawn") {
|
|
|
|
sources = [
|
|
|
|
"${appspawn_path}/common/appspawn_server.c",
|
|
|
|
"${appspawn_path}/modules/modulemgr/appspawn_modulemgr.c",
|
|
|
|
"${appspawn_path}/standard/appspawn_appmgr.c",
|
|
|
|
"${appspawn_path}/standard/appspawn_main.c",
|
|
|
|
"${appspawn_path}/standard/appspawn_msgmgr.c",
|
|
|
|
"${appspawn_path}/standard/appspawn_service.c",
|
|
|
|
"${appspawn_path}/standard/nwebspawn_launcher.c",
|
|
|
|
]
|
|
|
|
|
|
|
|
defines = [ "CJAPP_SPAWN" ]
|
|
|
|
configs = [
|
|
|
|
":appspawn_server_config",
|
|
|
|
"${appspawn_path}:appspawn_config",
|
|
|
|
]
|
|
|
|
deps = [
|
|
|
|
"${appspawn_path}/modules/module_engine:libappspawn_stub_versionscript",
|
|
|
|
"${appspawn_path}/util:libappspawn_util",
|
|
|
|
]
|
|
|
|
if (asan_detector || is_asan) {
|
|
|
|
defines += [ "ASAN_DETECTOR" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
external_deps = [
|
|
|
|
"c_utils:utils",
|
|
|
|
"config_policy:configpolicy_util",
|
|
|
|
"hilog:libhilog",
|
|
|
|
"init:libbegetutil",
|
|
|
|
]
|
2024-06-11 07:29:09 +00:00
|
|
|
if (appspawn_report_event) {
|
|
|
|
defines += [ "APPSPAWN_HISYSEVENT" ]
|
|
|
|
external_deps += [ "hisysevent:libhisysevent" ]
|
|
|
|
sources += [ "${appspawn_path}/modules/sysevent/appspawn_hisysevent.cpp" ]
|
|
|
|
}
|
2024-05-14 08:21:23 +00:00
|
|
|
if (build_selinux) {
|
|
|
|
defines += [ "WITH_SELINUX" ]
|
|
|
|
external_deps += [
|
2024-05-15 12:22:29 +00:00
|
|
|
"selinux:libselinux",
|
2024-05-14 08:21:23 +00:00
|
|
|
"selinux_adapter:libhap_restorecon",
|
|
|
|
]
|
|
|
|
}
|
|
|
|
cflags = []
|
|
|
|
|
|
|
|
#ldflags = [ "-Wl,--dynamic-linker,/system/bin/linker64z" ]
|
|
|
|
if (!defined(global_parts_info) ||
|
|
|
|
defined(global_parts_info.security_code_signature)) {
|
|
|
|
defines += [ "CODE_SIGNATURE_ENABLE" ]
|
|
|
|
external_deps += [ "code_signature:libcode_sign_attr_utils" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
version_script = get_label_info(
|
|
|
|
"${appspawn_path}/modules/module_engine:libappspawn_stub_versionscript",
|
|
|
|
"target_gen_dir") + "/" + get_label_info(
|
|
|
|
"${appspawn_path}/modules/module_engine:libappspawn_stub_versionscript",
|
|
|
|
"name") + stub_version_script_suffix
|
|
|
|
|
|
|
|
install_enable = true
|
|
|
|
subsystem_name = "${subsystem_name}"
|
|
|
|
part_name = "${part_name}"
|
|
|
|
}
|
|
|
|
|
|
|
|
ohos_prebuilt_etc("cjappspawn.rc") {
|
|
|
|
source = "cjappspawn.cfg"
|
|
|
|
relative_install_dir = "init"
|
|
|
|
subsystem_name = "${subsystem_name}"
|
|
|
|
part_name = "${part_name}"
|
|
|
|
}
|