1# Copyright (c) 2023 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")
15import("//third_party/wpa_supplicant/wpa_supplicant-2.9_standard/wpa.gni")
16WPA_ROOT_DIR = "//third_party/wpa_supplicant"
17
18if (is_standard_system) {
19  ohos_shared_library("libwpa_interface_service_1.1") {
20    branch_protector_ret = "pac_ret"
21    sanitize = {
22      cfi = true  # Enable/disable control flow integrity detection
23      boundary_sanitize = true  # Enable boundary san detection
24      cfi_cross_dso = true  # Cross-SO CFI Checks
25      integer_overflow = true  # Enable integer overflow detection
26      ubsan = true  # Enable some Ubsan options
27      debug = false
28    }
29    include_dirs = [
30      "./service_common",
31      "../../client/include",
32      "$WPA_ROOT_DIR/wpa_supplicant-2.9_standard",
33      "$WPA_ROOT_DIR/wpa_supplicant-2.9_standard/src",
34      "$WPA_ROOT_DIR/wpa_supplicant-2.9_standard/src/utils",
35      "$WPA_ROOT_DIR/wpa_supplicant-2.9_standard/wpa_supplicant",
36      "$WPA_ROOT_DIR/wpa_supplicant-2.9_standard/wpa_supplicant_lib",
37    ]
38    sources = [
39      "service_common/hdi_wpa_common.c",
40      "service_common/hdi_wpa_hal.c",
41      "service_common/wpa_common_cmd.c",
42      "service_common/wpa_common_cmd_ext.c",
43      "service_common/wpa_hdi_util.c",
44      "service_common/wpa_p2p_cmd.c",
45      "service_common/wpa_p2p_hal.c",
46      "service_common/wpa_supplicant_hal.c",
47      "wpa_interface_service.c",
48    ]
49
50    deps = [ "../../client:wpa_hdi_client" ]
51
52    defines = [ "__OHOS__USER__" ]
53
54    cflags = [
55      "-Wall",
56      "-Wextra",
57      "-Werror",
58      "-fsigned-char",
59      "-fno-common",
60      "-fno-strict-aliasing",
61      "-DCONFIG_CTRL_IFACE",
62      "-DCONFIG_P2P",
63      "-DCONFIG_WEP",
64      "-DCONFIG_WPS",
65    ]
66
67    external_deps = [
68      "c_utils:utils",
69      "drivers_interface_wlan:libwpa_stub_1.1",
70      "hdf_core:libhdf_host",
71      "hdf_core:libhdf_utils",
72      "hilog:libhilog",
73      "wpa_supplicant:wpa",
74      "wpa_supplicant:wpa_client_vendor",
75    ]
76
77    install_images = [ chipset_base_dir ]
78    subsystem_name = "hdf"
79    part_name = "drivers_peripheral_wlan"
80  }
81
82  ohos_shared_library("libwpa_hdi_c_device") {
83    branch_protector_ret = "pac_ret"
84    sanitize = {
85      cfi = true  # Enable/disable control flow integrity detection
86      boundary_sanitize = true  # Enable boundary san detection
87      cfi_cross_dso = true  # Cross-SO CFI Checks
88      integer_overflow = true  # Enable integer overflow detection
89      ubsan = true  # Enable some Ubsan options
90      debug = false
91    }
92    include_dirs = [ "./service_common" ]
93
94    sources = [ "wpa_interface_drivers.c" ]
95
96    deps = [ ":libwpa_interface_service_1.1" ]
97
98    cflags = [
99      "-Wall",
100      "-Wextra",
101      "-Werror",
102      "-fsigned-char",
103      "-fno-common",
104      "-fno-strict-aliasing",
105    ]
106
107    external_deps = [
108      "c_utils:utils",
109      "drivers_interface_wlan:libwpa_stub_1.1",
110      "hdf_core:libhdf_host",
111      "hdf_core:libhdf_ipc_adapter",
112      "hdf_core:libhdf_utils",
113      "hdf_core:libhdi",
114      "hilog:libhilog",
115    ]
116
117    shlib_type = "hdi"
118    install_images = [ chipset_base_dir ]
119    subsystem_name = "hdf"
120    part_name = "drivers_peripheral_wlan"
121  }
122
123  ohos_shared_library("hdi_wpa_base_mini") {
124    branch_protector_ret = "pac_ret"
125    sanitize = {
126      cfi = true  # Enable/disable control flow integrity detection
127      boundary_sanitize = true  # Enable boundary san detection
128      cfi_cross_dso = true  # Cross-SO CFI Checks
129      integer_overflow = true  # Enable integer overflow detection
130      ubsan = true  # Enable some Ubsan options
131      debug = false
132    }
133    include_dirs = [
134      "./service_common",
135      "../../client/include",
136    ]
137    sources = [
138      "service_common/hdi_wpa_common.c",
139      "service_common/hdi_wpa_hal.c",
140      "service_common/wpa_hdi_util.c",
141      "service_common/wpa_supplicant_hal.c",
142    ]
143
144    defines = [
145      "__OHOS__USER__",
146      "OHOS_EUPDATER",
147    ]
148
149    cflags = [
150      "-Wall",
151      "-Wextra",
152      "-Werror",
153      "-fsigned-char",
154      "-fno-common",
155      "-fno-strict-aliasing",
156      "-DCONFIG_CTRL_IFACE",
157      "-DCONFIG_P2P",
158      "-DCONFIG_WEP",
159      "-DCONFIG_WPS",
160    ]
161
162    external_deps = [
163      "c_utils:utils",
164      "drivers_interface_wlan:libwpa_stub_1.1",
165      "hdf_core:libhdf_host",
166      "hdf_core:libhdf_utils",
167      "hilog:libhilog",
168      "wpa_supplicant:wpa_client_updater",
169    ]
170
171    install_images = [ updater_vendor_base_dir ]
172    subsystem_name = "hdf"
173    part_name = "drivers_peripheral_wlan"
174  }
175} else {
176  ohos_shared_library("libwpa_interface_service_1.1") {
177    branch_protector_ret = "pac_ret"
178    sanitize = {
179      cfi = true  # Enable/disable control flow integrity detection
180      boundary_sanitize = true  # Enable boundary san detection
181      cfi_cross_dso = true  # Cross-SO CFI Checks
182      integer_overflow = true  # Enable integer overflow detection
183      ubsan = true  # Enable some Ubsan options
184      debug = false
185    }
186    include_dirs = []
187    sources = []
188
189    install_images = [ chipset_base_dir ]
190    subsystem_name = "hdf"
191    part_name = "drivers_peripheral_wlan"
192  }
193
194  ohos_shared_library("libwpa_hdi_c_device") {
195    branch_protector_ret = "pac_ret"
196    sanitize = {
197      cfi = true  # Enable/disable control flow integrity detection
198      boundary_sanitize = true  # Enable boundary san detection
199      cfi_cross_dso = true  # Cross-SO CFI Checks
200      integer_overflow = true  # Enable integer overflow detection
201      ubsan = true  # Enable some Ubsan options
202      debug = false
203    }
204    include_dirs = []
205    sources = []
206
207    install_images = [ chipset_base_dir ]
208    subsystem_name = "hdf"
209    part_name = "drivers_peripheral_wlan"
210  }
211}
212
213group("hdi_wpa_service") {
214  deps = [
215    ":libwpa_hdi_c_device",
216    ":libwpa_interface_service_1.1",
217  ]
218  if (is_standard_system) {
219    deps += [ ":hdi_wpa_base_mini" ]
220  }
221}
222