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.
X
xionglei6 已提交
13

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

X
xionglei6 已提交
24
    executable("ueventd_linux") {
X
xionglei6 已提交
25
      sources = [
M
init  
Mupceet 已提交
26 27 28 29 30 31 32 33
        "//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 已提交
34 35 36 37
      ]
      defines = [ "__MUSL__" ]
      defines += [ "_GNU_SOURCE" ]

X
xionglei6 已提交
38
      include_dirs = [
M
init  
Mupceet 已提交
39 40 41 42 43
        "//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 已提交
44
      ]
X
xionglei6 已提交
45

M
Mupceet 已提交
46 47
      deps = service_ueventd_deps
      deps += [ "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared" ]
X
xionglei6 已提交
48 49 50 51 52 53 54
    }
    copy("ueventd.config") {
      sources = [ "etc/ueventd_l1.config" ]
      outputs = [ "$root_out_dir/etc/ueventd.config" ]
    }
  }
} else {
S
sun_fan 已提交
55
  import("//build/ohos.gni")
X
xionglei6 已提交
56
  service_ueventd_sources = [
M
init  
Mupceet 已提交
57 58 59 60 61
    "//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 已提交
62 63 64 65
  ]

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

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

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

    public_configs = [ ":libueventd_exported_config" ]
98
    part_name = "init"
X
xionglei6 已提交
99
  }
S
sun_fan 已提交
100

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

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

S
sun_fan 已提交
133
  ohos_prebuilt_etc("ueventd.config") {
M
init  
Mupceet 已提交
134
    source = "//base/startup/init/ueventd/etc/ueventd.config"
S
sun_fan 已提交
135 136 137 138 139 140
    part_name = "init"
    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
    ]
  }
}