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.
13
14import("//build/ohos.gni")
15
16config("inithook_config") {
17  include_dirs = [ "//base/startup/init/services/modules/init_hook" ]
18}
19comm_include = [
20  "//base/startup/init/interfaces/innerkits/include",
21  "//base/startup/init/interfaces/innerkits/include/param",
22  "//base/startup/init/services/modules",
23  "//base/startup/init/services/modules/init_hook",
24  "//base/startup/init/services/init/include",
25  "//base/startup/init/services/loopevent/include",
26  "//base/startup/init/services/log",
27  "//base/startup/init/interfaces/innerkits/include",
28]
29if (defined(ohos_lite)) {
30  static_library("inithook") {
31    defines = [
32      "_GNU_SOURCE",
33      "OHOS_LITE",
34    ]
35    include_dirs = comm_include
36    include_dirs += [
37      "//base/hiviewdfx/hilog_lite/interfaces/native/kits",
38      "//third_party/cJSON",
39    ]
40    external_deps = [ "bounds_checking_function:libsec_static" ]
41    sources = [ "param_hook.c" ]
42    public_configs = [ ":inithook_config" ]
43  }
44} else {
45  ohos_source_set("inithook") {
46    defines = [
47      "_GNU_SOURCE",
48      "PARAM_SUPPORT_TRIGGER",
49    ]
50    include_dirs = comm_include
51    sources = [
52      "init_hook.c",
53      "param_hook.c",
54    ]
55    public_external_deps = [ "bounds_checking_function:libsec_static" ]
56    external_deps = [ "cJSON:cjson" ]
57    if (build_selinux) {
58      external_deps += [
59        "selinux:libselinux",
60        "selinux_adapter:libselinux_parameter_static",
61      ]
62      defines += [ "WITH_SELINUX" ]
63    }
64    public_configs = [ ":inithook_config" ]
65    public_configs += [ "//base/startup/init/interfaces/innerkits/init_module_engine:init_module_engine_exported_config" ]
66  }
67}
68