BUILD.gn 2.9 KB
Newer Older
M
Mupceet 已提交
1 2 3 4 5 6 7 8 9 10 11 12
# Copyright (c) 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.
M
init  
Mupceet 已提交
13
import("//base/startup/init/begetd.gni")
M
Mupceet 已提交
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49

init_common_sources = [
  "../init_capability.c",
  "../init_common_cmds.c",
  "../init_common_service.c",
  "../init_config.c",
  "../init_group_manager.c",
  "../init_service_file.c",
  "../init_service_manager.c",
  "../init_service_socket.c",
  "../main.c",
]

# feature: init
executable("init") {
  output_name = "init"
  defines = [
    "_GNU_SOURCE",
    "OHOS_LITE",
    "__MUSL__",
  ]
  if (enable_ohos_startup_init_feature_begetctl_liteos) {
    defines += [ "LITEOS_SUPPORT" ]
  }
  sources = [
    "../adapter/init_adapter.c",
    "../lite/init.c",
    "../lite/init_cmds.c",
    "../lite/init_jobs.c",
    "../lite/init_reboot.c",
    "../lite/init_service.c",
    "../lite/init_signal_handler.c",
  ]
  sources += init_common_sources

  include_dirs = [
M
init  
Mupceet 已提交
50 51
    "//base/startup/init/interfaces/innerkits/include",
    "//base/startup/init/interfaces/innerkits/fd_holder",
C
cheng_jinsong 已提交
52
    "//base/startup/init/services/include/param",
M
init  
Mupceet 已提交
53
    "//base/startup/init/services/init/include",
M
Mupceet 已提交
54 55 56 57 58 59 60 61
    "//third_party/cJSON",
    "//third_party/bounds_checking_function/include",
    "//base/hiviewdfx/hilog_lite/interfaces/native/kits",
  ]

  ldflags = []
  deps = [
    "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
M
init  
Mupceet 已提交
62 63
    "//base/startup/init/services/log:init_log",
    "//base/startup/init/services/loopevent:loopevent",
M
Mupceet 已提交
64
    "//base/startup/init/services/modules/init_hook:inithook",
C
cheng_jinsong 已提交
65
    "//base/startup/init/services/param/base:param_base",
M
init  
Mupceet 已提交
66
    "//base/startup/init/services/utils:libinit_utils",
M
Mupceet 已提交
67 68 69 70 71 72 73 74 75
    "//build/lite/config/component/cJSON:cjson_static",
    "//third_party/bounds_checking_function:libsec_static",
  ]

  if (ohos_kernel_type == "liteos_a") {
    defines += [ "__LITEOS_A__" ]
    include_dirs += [
      "//kernel/liteos_a/syscall",
      "//kernel/liteos_a/kernel/include",
M
init  
Mupceet 已提交
76 77
      "//base/startup/init/interfaces/kits/syscap",
      "//base/startup/init/initsync/include",
M
Mupceet 已提交
78 79
    ]
    deps += [
M
init  
Mupceet 已提交
80 81
      "//base/startup/init/initsync:initsync",
      "//base/startup/init/services/param/liteos:param_init_lite",
M
Mupceet 已提交
82 83 84 85 86 87 88 89 90 91 92 93
    ]
  }
  if (ohos_kernel_type == "linux") {
    defines += [
      "NEED_EXEC_RCS_LINUX",
      "__LINUX__",
    ]
    ldflags += [
      "-lm",
      "-lpthread",
    ]
    deps += [
M
init  
Mupceet 已提交
94
      "//base/startup/init/services/param/linux:param_init",
M
Mupceet 已提交
95 96 97 98 99
      "//third_party/mksh",
      "//third_party/toybox",
    ]
  }
}