BUILD.gn 4.5 KB
Newer Older
M
mamingshuai 已提交
1 2 3 4 5 6 7 8 9 10 11 12
# Copyright (c) 2020 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.
Z
zhong_ning 已提交
13 14
if (defined(ohos_lite)) {
  # feature: init
15 16
  executable("init_lite") {
    output_name = "init"
Z
zhong_ning 已提交
17 18
    defines = [
      "_GNU_SOURCE",  #syscall function need this macro definition
Z
zhong_ning 已提交
19
      "OHOS_LITE",
Z
zhong_ning 已提交
20 21 22 23 24 25 26 27
    ]
    sources = [
      "src/init_adapter.c",
      "src/init_cmds.c",
      "src/init_jobs.c",
      "src/init_read_cfg.c",
      "src/init_service.c",
      "src/init_service_manager.c",
Z
zhong_ning 已提交
28
      "src/init_import.c",
Z
zhong_ning 已提交
29
      "src/init_signal_handler.c",
Z
zhong_ning 已提交
30 31
      "src/init_utils.c",
      "src/init_service_socket.c",
Z
zhong_ning 已提交
32
      "src/main.c",
Z
zhong_ning 已提交
33
      "src/init_capability.c",
Z
zhong_ning 已提交
34
    ]
M
mamingshuai 已提交
35

Z
zhong_ning 已提交
36
    include_dirs = [
Z
zhong_ning 已提交
37 38
      "//base/startup/init_lite/services/include",
      "//base/startup/init_lite/services/property/include",
Z
zhong_ning 已提交
39 40 41 42
      "//third_party/cJSON",
      "//third_party/bounds_checking_function/include",
      "//base/startup/syspara_lite/interfaces/kits",
    ]
M
mamingshuai 已提交
43

Z
zhong_ning 已提交
44
    cflags = [ "-Wall" ]
M
mamingshuai 已提交
45

Z
zhong_ning 已提交
46 47
    deps = [
      "//base/startup/syspara_lite/frameworks/parameter:parameter",
48
      "//base/startup/init_lite/initsync:initsync",
Z
zhong_ning 已提交
49 50 51 52 53
      "//build/lite/config/component/cJSON:cjson_shared",
      "//third_party/bounds_checking_function:libsec_shared",
    ]
    ldflags = []
    if (ohos_kernel_type == "liteos_a") {
54 55 56 57 58 59
      include_dirs += [
        "//kernel/liteos_a/syscall",
        "//base/startup/init_lite/interfaces/kits",
        "//base/startup/init_lite/initsync/include",
      ]
      deps += [ "//base/startup/init_lite/initsync:initsync" ]
Z
zhong_ning 已提交
60 61 62 63 64 65 66
    }
    if (ohos_kernel_type == "linux") {
      defines += [ "NEED_EXEC_RCS_LINUX" ]
      ldflags += [
        "-lm",
        "-lpthread",
      ]
Y
yangming_ha 已提交
67
      deps += [
68 69 70
        "//third_party/mksh",
        "//third_party/toybox",
      ]
Z
zhong_ning 已提交
71 72
    }
  }
M
mamingshuai 已提交
73

Z
zhong_ning 已提交
74 75
  if (ohos_build_type == "debug") {
    group("unittest") {
76 77
      deps =
          [ "//base/startup/init_lite/services/test/unittest/common:unittest" ]
Z
zhong_ning 已提交
78 79 80 81 82
    }
  }
} else {
  import("//build/ohos.gni")
  ohos_executable("updaterueventd") {
83 84 85 86 87 88 89 90 91 92
    sources = [
      "src/list.c",
      "src/uevent.c",
    ]
    include_dirs = [
      "include",
      "//third_party/bounds_checking_function/include",
    ]
    deps = [ "//third_party/bounds_checking_function:libsec_static" ]
    install_enable = true
Z
zhong_ning 已提交
93
    part_name = "init"
M
mamingshuai 已提交
94 95
  }

Z
zhong_ning 已提交
96
  ohos_executable("init") {
97 98 99 100 101
    sources = [
      "src/device.c",
      "src/init_adapter.c",
      "src/init_cmds.c",
      "src/init_jobs.c",
Z
zhong_ning 已提交
102
      "src/init_log.c",
103 104 105
      "src/init_read_cfg.c",
      "src/init_service.c",
      "src/init_service_manager.c",
Z
zhong_ning 已提交
106
      "src/init_import.c",
107
      "src/init_signal_handler.c",
Z
zhong_ning 已提交
108 109
      "src/init_utils.c",
      "src/init_service_socket.c",
110
      "src/main.c",
Z
zhong_ning 已提交
111
      "src/init_capability.c",
112 113
    ]
    include_dirs = [
Z
zhong_ning 已提交
114 115 116 117
      "//base/startup/init_lite/services/include/property",
      "//base/startup/init_lite/services/include/trigger",
      "//base/startup/init_lite/services/include",
      "//base/startup/init_lite/services/property/include",
118 119 120 121
      "//third_party/cJSON",
      "//third_party/bounds_checking_function/include",
    ]
    deps = [
Z
zhong_ning 已提交
122 123 124
      "//base/startup/init_lite/services/property:propertyserver",
      "//base/startup/init_lite/services/property:propertyclient",
      "//base/startup/init_lite/services/trigger:triggerservice",
125 126 127
      "//third_party/bounds_checking_function:libsec_static",
      "//third_party/cJSON:cjson_static",
    ]
Z
zhong_ning 已提交
128 129 130 131 132 133
    if (use_musl) {
      deps += [
        "//third_party/mksh:sh",
        "//third_party/toybox:toybox"
      ]
    }
134
    install_enable = true
Z
zhong_ning 已提交
135
    part_name = "init"
M
mamingshuai 已提交
136 137
  }

Z
zhong_ning 已提交
138
  ohos_prebuilt_etc("init.cfg") {
139
    source = "//device/hisilicon/hi3516dv300/updater/init.cfg"
Z
zhong_ning 已提交
140 141 142 143 144 145 146 147 148 149 150 151 152 153
    part_name = "init"
  }

  group("startup_init") {
    deps = [
      ":init.cfg",
      ":init",
      ":updaterueventd",
      "//base/startup/init_lite/services/trigger:triggerservice",
      "//base/startup/init_lite/services/property:propertyserver",
      "//base/startup/init_lite/services/property:propertyclient",
      "//base/startup/init_lite/services/property:setparam",
      "//base/startup/init_lite/services/property:getparam"
    ]
M
mamingshuai 已提交
154 155
  }
}