BUILD.gn 5.3 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
import("//build/ohos.gni")

config("exported_header_files") {
  visibility = [ ":*" ]
  include_dirs = [
M
init  
Mupceet 已提交
19 20 21
    "//base/startup/init/interfaces/innerkits/include",
    "//base/startup/init/interfaces/service/include/param",
    "//base/startup/init/interfaces/service/param/include",
A
an_xinwei 已提交
22 23
    "//third_party/bounds_checking_function/include",
    "//third_party/selinux/libselinux/include",
M
Mupceet 已提交
24 25 26 27
  ]
}

param_include_dirs = [
M
init  
Mupceet 已提交
28 29 30 31 32 33 34 35
  "//base/startup/init/services/param/include",
  "//base/startup/init/services/param/adapter",
  "//base/startup/init/services/param/linux",
  "//base/startup/init/services/param/base",
  "//base/startup/init/services/include/param",
  "//base/startup/init/services/include",
  "//base/startup/init/services/init/include",
  "//base/startup/init/services/log",
M
Mupceet 已提交
36
  "//base/startup/init/services/modules/init_hook",
C
cheng_jinsong 已提交
37
  "//base/startup/init/interfaces/innerkits/include/syspara",
M
init  
Mupceet 已提交
38 39
  "//base/startup/init/interfaces/innerkits/init_module_engine/include",
  "//base/startup/init/services/loopevent/include",
M
Mupceet 已提交
40 41
  "//third_party/bounds_checking_function/include",
  "//third_party/cJSON",
42
  "//commonlibrary/utils_lite/include",
M
Mupceet 已提交
43 44 45 46
  "//base/security/selinux/interfaces/policycoreutils/include",
]

param_service_sources = [
M
init  
Mupceet 已提交
47 48 49 50 51 52 53
  "//base/startup/init/services/param/adapter/param_persistadp.c",
  "//base/startup/init/services/param/linux/param_message.c",
  "//base/startup/init/services/param/linux/param_msgadp.c",
  "//base/startup/init/services/param/linux/param_service.c",
  "//base/startup/init/services/param/manager/param_manager.c",
  "//base/startup/init/services/param/manager/param_persist.c",
  "//base/startup/init/services/param/manager/param_server.c",
M
Mupceet 已提交
54 55 56
]

param_trigger_sources = [
M
init  
Mupceet 已提交
57 58 59
  "//base/startup/init/services/param/trigger/trigger_checker.c",
  "//base/startup/init/services/param/trigger/trigger_manager.c",
  "//base/startup/init/services/param/trigger/trigger_processor.c",
M
Mupceet 已提交
60 61 62
]

param_client_sources = [
M
init  
Mupceet 已提交
63 64 65
  "//base/startup/init/services/param/linux/param_message.c",
  "//base/startup/init/services/param/linux/param_request.c",
  "//base/startup/init/services/param/manager/param_manager.c",
M
Mupceet 已提交
66 67 68 69 70 71 72 73 74 75 76 77 78 79
]

# only for linux
if (defined(ohos_lite)) {
  static_library("param_init") {
    defines = []
    sources = param_service_sources
    sources += param_trigger_sources
    include_dirs = param_include_dirs
    public_configs = [ ":exported_header_files" ]

    defines += [
      "_GNU_SOURCE",
      "__LINUX__",
80
      "OHOS_LITE",
M
Mupceet 已提交
81
      "PARAM_SUPPORT_REAL_CHECK",
M
Mupceet 已提交
82 83 84 85 86 87 88 89 90 91 92 93 94
      "INCREMENTAL_VERSION=\"${ohos_version}\"",
      "BUILD_TYPE=\"${ohos_build_type}\"",
      "BUILD_USER=\"${ohos_build_user}\"",
      "BUILD_TIME=\"${ohos_build_time}\"",
      "BUILD_HOST=\"${ohos_build_host}\"",
      "BUILD_ROOTHASH=\"${ohos_build_roothash}\"",
    ]
  }

  static_library("param_client") {
    include_dirs = param_include_dirs
    sources = param_client_sources
    public_configs = [ ":exported_header_files" ]
C
chengjinsong2 已提交
95
    cflags = [ "-fPIC" ]
M
Mupceet 已提交
96 97 98 99 100 101 102 103 104 105 106
    defines = [
      "_GNU_SOURCE",
      "__LINUX__",
    ]
  }
} else {
  ohos_static_library("param_init") {
    sources = param_service_sources
    sources += param_trigger_sources
    include_dirs = param_include_dirs
    public_configs = [ ":exported_header_files" ]
M
Mupceet 已提交
107 108 109
    defines = [
      "_GNU_SOURCE",
      "PARAM_SUPPORT_REAL_CHECK",
H
handyohos 已提交
110
      "SUPPORT_PARAM_LOAD_HOOK",
M
Mupceet 已提交
111
    ]
M
Mupceet 已提交
112

A
an_xinwei 已提交
113 114 115
    if (param_base_log) {
      defines += [ "PARAM_BASE_LOG" ]
    }
C
cheng_jinsong 已提交
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
    if (defined(ohos_build_type)) {
      defines += [ "BUILD_TYPE=\"${ohos_build_type}\"" ]
    }
    if (defined(ohos_version)) {
      defines += [ "INCREMENTAL_VERSION=\"${ohos_version}\"" ]
    }
    if (defined(ohos_build_user)) {
      defines += [ "BUILD_USER=\"${ohos_build_user}\"" ]
    }
    if (defined(ohos_build_time)) {
      defines += [ "BUILD_TIME=\"${ohos_build_time}\"" ]
    }
    if (defined(ohos_build_host)) {
      defines += [ "BUILD_HOST=\"${ohos_build_host}\"" ]
    }
A
an_xinwei 已提交
131

M
Mupceet 已提交
132
    if (build_selinux) {
M
Mupceet 已提交
133 134 135 136
      include_dirs += [
        "//third_party/selinux/libselinux/include/",
        "//base/security/selinux/interfaces/policycoreutils/include/",
      ]
C
cheng_jinsong 已提交
137 138 139 140
      defines += [
        "PARAM_SUPPORT_SELINUX",
        "PARAMWORKSPACE_NEED_MUTEX",
      ]
M
Mupceet 已提交
141 142 143 144 145 146 147 148 149
    }
    part_name = "init"
    subsystem_name = "startup"
  }

  ohos_static_library("param_client") {
    sources = param_client_sources
    include_dirs = param_include_dirs
    public_configs = [ ":exported_header_files" ]
M
Mupceet 已提交
150
    deps = []
G
guzhihao4 已提交
151
    cflags = [ "-Wno-deprecated-pragma" ]
M
Mupceet 已提交
152 153 154 155 156 157 158 159 160 161
    defines = [
      "_GNU_SOURCE",
      "INIT_AGENT",
    ]
    if (build_selinux) {
      defines += [
        "PARAM_SUPPORT_SELINUX",
        "PARAMWORKSPACE_NEED_MUTEX",
      ]
    }
A
an_xinwei 已提交
162 163 164
    if (param_base_log) {
      defines += [ "PARAM_BASE_LOG" ]
    }
M
Mupceet 已提交
165 166 167 168
    part_name = "init"
    subsystem_name = "startup"
  }
}