1# Copyright (c) 2021 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
14if (defined(ohos_lite)) {
15  group("libinit_module_engine") {
16  }
17} else {
18  import("//build/ohos.gni")
19  import("//build/ohos/native_stub/native_stub.gni")
20
21  #
22  # exported include directories
23  #
24  config("init_module_engine_exported_config") {
25    visibility = [ ":*" ]
26    visibility += [ "./../../../services/*" ]
27    include_dirs = [
28      "include/",
29      "//base/startup/init/interfaces/innerkits/include",
30      "//base/startup/init/services/log",
31    ]
32    if (ohos_indep_compiler_enable) {
33      include_dirs +=
34          [ "//binarys/third_party/cJSON/innerapis/cjson_static/includes" ]
35    } else {
36      include_dirs += [ "//third_party/cJSON" ]
37    }
38  }
39
40  #
41  # innerkits for module development
42  #
43  ohos_native_stub_library("libinit_module_engine") {
44    cflags = [ "-fstack-protector-all" ]
45    output_extension = "so"
46    public_configs = [ ":init_module_engine_exported_config" ]
47    stub_description_file = "./stub/libinit.stub.json"
48  }
49
50  #
51  # For init linking,
52  # export symbols defined in this json files only
53  #
54  ohos_native_stub_versionscript("libinit_stub_versionscript") {
55    stub_description_file = "./stub/libinit.stub.json"
56  }
57
58  #
59  # Generate empty library with symlink name to satisfy init loading required libraries
60  #
61  ohos_native_stub_library("libinit_stub_empty") {
62    cflags = [ "-fstack-protector-all" ]
63    output_extension = "so"
64    stub_description_file = "./stub/libinit.stub.empty.json"
65    part_name = "init"
66    subsystem_name = "startup"
67    install_enable = true
68    install_images = [
69      "system",
70      "updater",
71      "ramdisk",
72    ]
73    symlink_target_name = [ "libinit_module_engine.so" ]
74  }
75
76  config("init_module_engine_sources_config") {
77    include_dirs = [
78      "//base/startup/init/interfaces/innerkits/init_module_engine/include",
79      "//base/startup/init/interfaces/innerkits/include",
80      "//base/startup/init/services/loopevent/include",
81      "//base/startup/init/services/log",
82    ]
83  }
84
85  ohos_source_set("init_module_engine_sources") {
86    sources = [ "init_modulemgr.c" ]
87    public_configs = [ ":init_module_engine_sources_config" ]
88    external_deps = [ "cJSON:cjson" ]
89  }
90}
91
92#
93# init module engine all modules
94#
95group("modulegroup") {
96  if (!defined(ohos_lite)) {
97    deps = [
98      ":libinit_module_engine",
99      ":libinit_stub_empty",
100    ]
101  }
102}
103