BUILD.gn 5.0 KB
Newer Older
M
Mupceet 已提交
1
# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
S
sun_fan 已提交
2 3 4 5 6 7 8 9 10 11 12
# 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.
C
cheng_jinsong 已提交
13
import("//base/startup/init/begetd.gni")
X
xionglei6 已提交
14

X
xionglei6 已提交
15 16
if (defined(ohos_lite)) {
  if (ohos_kernel_type == "linux") {
M
Mupceet 已提交
17
    service_ueventd_deps = [
M
init  
Mupceet 已提交
18 19
      "//base/startup/init/interfaces/innerkits/socket:libsocket",
      "//base/startup/init/services/log:init_log",
C
cheng_jinsong 已提交
20
      "//base/startup/init/services/param/base:param_base",
M
init  
Mupceet 已提交
21
      "//base/startup/init/services/utils:libinit_utils",
M
Mupceet 已提交
22 23 24
      "//third_party/bounds_checking_function:libsec_static",
    ]

X
xionglei6 已提交
25
    executable("ueventd_linux") {
X
xionglei6 已提交
26
      sources = [
M
init  
Mupceet 已提交
27 28 29 30 31 32 33 34
        "//base/startup/init/services/utils/init_utils.c",
        "//base/startup/init/ueventd/lite/ueventd_parameter.c",
        "//base/startup/init/ueventd/ueventd.c",
        "//base/startup/init/ueventd/ueventd_device_handler.c",
        "//base/startup/init/ueventd/ueventd_firmware_handler.c",
        "//base/startup/init/ueventd/ueventd_main.c",
        "//base/startup/init/ueventd/ueventd_read_cfg.c",
        "//base/startup/init/ueventd/ueventd_socket.c",
X
xionglei6 已提交
35 36 37 38
      ]
      defines = [ "__MUSL__" ]
      defines += [ "_GNU_SOURCE" ]

X
xionglei6 已提交
39
      include_dirs = [
M
init  
Mupceet 已提交
40 41 42 43 44
        "//base/startup/init/services/log",
        "//base/startup/init/services/include",
        "//base/startup/init/services/include/param",
        "//base/startup/init/services/utils",
        "//base/startup/init/ueventd/include",
X
xionglei6 已提交
45
      ]
X
xionglei6 已提交
46

M
Mupceet 已提交
47 48
      deps = service_ueventd_deps
      deps += [ "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared" ]
X
xionglei6 已提交
49 50 51 52 53 54 55
    }
    copy("ueventd.config") {
      sources = [ "etc/ueventd_l1.config" ]
      outputs = [ "$root_out_dir/etc/ueventd.config" ]
    }
  }
} else {
S
sun_fan 已提交
56
  import("//build/ohos.gni")
X
xionglei6 已提交
57
  service_ueventd_sources = [
M
init  
Mupceet 已提交
58 59 60 61 62
    "//base/startup/init/ueventd/ueventd.c",
    "//base/startup/init/ueventd/ueventd_device_handler.c",
    "//base/startup/init/ueventd/ueventd_firmware_handler.c",
    "//base/startup/init/ueventd/ueventd_read_cfg.c",
    "//base/startup/init/ueventd/ueventd_socket.c",
X
xionglei6 已提交
63 64 65 66
  ]

  service_ueventd_include = [
    "//third_party/bounds_checking_function/include",
M
init  
Mupceet 已提交
67 68 69 70
    "//base/startup/init/services/log",
    "//base/startup/init/services/include",
    "//base/startup/init/services/utils",
    "//base/startup/init/ueventd/include",
X
xionglei6 已提交
71
  ]
X
xionglei6 已提交
72

X
xionglei6 已提交
73
  service_ueventd_deps = [
M
init  
Mupceet 已提交
74 75 76
    "//base/startup/init/interfaces/innerkits/socket:libsocket",
    "//base/startup/init/services/log:init_log",
    "//base/startup/init/services/utils:libinit_utils",
X
xionglei6 已提交
77 78
    "//third_party/bounds_checking_function:libsec_static",
  ]
X
xionglei6 已提交
79

M
Mupceet 已提交
80 81 82 83 84 85 86
  #
  # exported include directories
  #
  config("libueventd_exported_config") {
    visibility = [ ":*" ]
    include_dirs = [ "./include" ]
  }
X
xionglei6 已提交
87
  ohos_static_library("libueventd_ramdisk_static") {
X
xionglei6 已提交
88 89 90
    sources = service_ueventd_sources
    include_dirs = service_ueventd_include
    deps = service_ueventd_deps
X
xionglei6 已提交
91
    defines = [ "__RAMDISK__" ]
R
renwei 已提交
92 93 94 95 96
    cflags = []
    if (build_selinux) {
      external_deps = [ "selinux:librestorecon" ]
      cflags += [ "-DWITH_SELINUX" ]
    }
M
Mupceet 已提交
97 98

    public_configs = [ ":libueventd_exported_config" ]
99
    part_name = "init"
100
    subsystem_name = "startup"
X
xionglei6 已提交
101
  }
S
sun_fan 已提交
102

X
xionglei6 已提交
103
  ohos_executable("ueventd") {
X
xionglei6 已提交
104 105
    sources = service_ueventd_sources
    sources += [
M
init  
Mupceet 已提交
106 107
      "//base/startup/init/ueventd/standard/ueventd_parameter.c",
      "//base/startup/init/ueventd/ueventd_main.c",
S
sun_fan 已提交
108
    ]
X
xionglei6 已提交
109
    include_dirs = service_ueventd_include
110
    include_dirs += [
M
init  
Mupceet 已提交
111 112
      "//base/startup/init/services/include/param",
      "//base/startup/init/interfaces/innerkits/include",
113
    ]
X
xionglei6 已提交
114
    deps = service_ueventd_deps
M
init  
Mupceet 已提交
115
    deps += [ "//base/startup/init/services/param/linux:param_client" ]
R
renwei 已提交
116
    cflags = []
C
cheng_jinsong 已提交
117
    deps += [ "//base/startup/init/services/param/base:param_base" ]
R
renwei 已提交
118 119 120 121 122
    if (build_selinux) {
      external_deps = [ "selinux:librestorecon" ]
      cflags += [ "-DWITH_SELINUX" ]
    }

S
sun_fan 已提交
123 124 125 126 127 128
    install_images = [
      "system",
      "updater",
    ]
    install_enable = true
    part_name = "init"
129
    subsystem_name = "startup"
S
sun_fan 已提交
130
  }
S
sun_fan 已提交
131

S
sun_fan 已提交
132
  ohos_prebuilt_etc("ueventd.config") {
M
init  
Mupceet 已提交
133
    source = "//base/startup/init/ueventd/etc/ueventd.config"
S
sun_fan 已提交
134
    part_name = "init"
135
    subsystem_name = "startup"
S
sun_fan 已提交
136 137 138 139 140
    install_images = [
      "system",
      "updater",
    ]
  }
S
sun_fan 已提交
141
}
M
Mupceet 已提交
142 143 144 145 146 147 148 149 150 151 152 153 154

group("startup_ueventd") {
  if (defined(ohos_lite)) {
    if (ohos_kernel_type == "linux") {
      deps = [
        ":ueventd.config",
        ":ueventd_linux",
      ]
    } else {
      deps = []
    }
  } else {
    deps = [
M
init  
Mupceet 已提交
155 156 157
      "//base/startup/init/ueventd:libueventd_ramdisk_static",
      "//base/startup/init/ueventd:ueventd",
      "//base/startup/init/ueventd:ueventd.config",
M
Mupceet 已提交
158 159 160
    ]
  }
}