• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2022 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6# http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13import("//base/startup/init/begetd.gni")
14import("//build/ohos.gni")
15
16config("exported_header_files") {
17  visibility = [ ":*" ]
18  include_dirs = [
19    "//base/startup/init/interfaces/innerkits/include",
20    "//base/startup/init/interfaces/service/include/param",
21    "//base/startup/init/interfaces/service/param/include",
22    "//third_party/bounds_checking_function/include",
23    "//third_party/selinux/libselinux/include",
24  ]
25}
26
27param_include_dirs = [
28  "//base/startup/init/services/param/include",
29  "//base/startup/init/services/param/adapter",
30  "//base/startup/init/services/param/linux",
31  "//base/startup/init/services/param/base",
32  "//base/startup/init/services/include/param",
33  "//base/startup/init/services/include",
34  "//base/startup/init/services/init/include",
35  "//base/startup/init/services/log",
36  "//base/startup/init/services/modules/init_hook",
37  "//base/startup/init/interfaces/innerkits/include/syspara",
38  "//base/startup/init/interfaces/innerkits/init_module_engine/include",
39  "//base/startup/init/services/loopevent/include",
40  "//third_party/bounds_checking_function/include",
41  "//third_party/cJSON",
42  "//commonlibrary/utils_lite/include",
43  "//base/security/selinux_adapter/interfaces/policycoreutils/include",
44]
45
46param_service_sources = [
47  "//base/startup/init/services/param/adapter/param_persistadp.c",
48  "//base/startup/init/services/param/linux/param_message.c",
49  "//base/startup/init/services/param/linux/param_msgadp.c",
50  "//base/startup/init/services/param/linux/param_service.c",
51  "//base/startup/init/services/param/manager/param_manager.c",
52  "//base/startup/init/services/param/manager/param_persist.c",
53  "//base/startup/init/services/param/manager/param_server.c",
54]
55
56param_trigger_sources = [
57  "//base/startup/init/services/param/trigger/trigger_checker.c",
58  "//base/startup/init/services/param/trigger/trigger_manager.c",
59  "//base/startup/init/services/param/trigger/trigger_processor.c",
60]
61
62param_client_sources = [
63  "//base/startup/init/services/param/linux/param_message.c",
64  "//base/startup/init/services/param/linux/param_request.c",
65  "//base/startup/init/services/param/manager/param_manager.c",
66]
67
68# only for linux
69if (defined(ohos_lite)) {
70  static_library("param_init") {
71    defines = []
72    sources = param_service_sources
73    sources += param_trigger_sources
74    include_dirs = param_include_dirs
75    public_configs = [ ":exported_header_files" ]
76
77    defines += [
78      "_GNU_SOURCE",
79      "__LINUX__",
80      "OHOS_LITE",
81      "PARAM_SUPPORT_REAL_CHECK",
82      "INCREMENTAL_VERSION=\"${ohos_version}\"",
83      "BUILD_TYPE=\"${ohos_build_type}\"",
84      "BUILD_USER=\"${ohos_build_user}\"",
85      "BUILD_TIME=\"${ohos_build_time}\"",
86      "BUILD_HOST=\"${ohos_build_host}\"",
87      "BUILD_ROOTHASH=\"${ohos_build_roothash}\"",
88    ]
89  }
90
91  static_library("param_client") {
92    include_dirs = param_include_dirs
93    sources = param_client_sources
94    public_configs = [ ":exported_header_files" ]
95    cflags = [ "-fPIC" ]
96    defines = [
97      "_GNU_SOURCE",
98      "__LINUX__",
99    ]
100  }
101} else {
102  ohos_static_library("param_init") {
103    sources = param_service_sources
104    sources += param_trigger_sources
105    include_dirs = param_include_dirs
106    public_configs = [ ":exported_header_files" ]
107    defines = [
108      "_GNU_SOURCE",
109      "PARAM_SUPPORT_REAL_CHECK",
110      "SUPPORT_PARAM_LOAD_HOOK",
111    ]
112
113    if (param_base_log) {
114      defines += [ "PARAM_BASE_LOG" ]
115    }
116    if (defined(ohos_build_type)) {
117      defines += [ "BUILD_TYPE=\"${ohos_build_type}\"" ]
118    }
119    if (defined(ohos_version)) {
120      defines += [ "INCREMENTAL_VERSION=\"${ohos_version}\"" ]
121    }
122    if (defined(ohos_build_user)) {
123      defines += [ "BUILD_USER=\"${ohos_build_user}\"" ]
124    }
125    if (defined(ohos_build_time)) {
126      defines += [ "BUILD_TIME=\"${ohos_build_time}\"" ]
127    }
128    if (defined(ohos_build_host)) {
129      defines += [ "BUILD_HOST=\"${ohos_build_host}\"" ]
130    }
131
132    if (build_selinux) {
133      include_dirs += [
134        "//third_party/selinux/libselinux/include/",
135        "//base/security/selinux_adapter/interfaces/policycoreutils/include/",
136      ]
137      defines += [
138        "PARAM_SUPPORT_SELINUX",
139        "PARAMWORKSPACE_NEED_MUTEX",
140      ]
141    }
142
143    deps = [ "//base/startup/init/services/param/base:param_base" ]
144    part_name = "init"
145    subsystem_name = "startup"
146  }
147
148  ohos_static_library("param_client") {
149    sources = param_client_sources
150    include_dirs = param_include_dirs
151    public_configs = [ ":exported_header_files" ]
152    deps = [
153      "//base/startup/init/services/log:agent_log",
154      "//base/startup/init/services/param/base:param_base",
155    ]
156
157    cflags = [ "-Wno-deprecated-pragma" ]
158    defines = [
159      "_GNU_SOURCE",
160      "INIT_AGENT",
161    ]
162    if (build_selinux) {
163      defines += [
164        "PARAM_SUPPORT_SELINUX",
165        "PARAMWORKSPACE_NEED_MUTEX",
166      ]
167    }
168    if (param_base_log) {
169      defines += [ "PARAM_BASE_LOG" ]
170    }
171    part_name = "init"
172    subsystem_name = "startup"
173  }
174}
175