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("libhostapd_interface_service_1.0") {
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/src",
33      "$WPA_ROOT_DIR/wpa_supplicant-2.9_standard/hostapd",
34    ]
35    sources = [
36      "hostapd_interface_service.c",
37      "service_common/hdi_hostapd_hal.c",
38      "service_common/hostapd_common_cmd.c",
39    ]
40
41    deps = [ "../../client:hostapd_hdi_client" ]
42
43    defines = [ "__OHOS__USER__" ]
44
45    cflags = [
46      "-Wall",
47      "-Wextra",
48      "-Werror",
49      "-fsigned-char",
50      "-fno-common",
51      "-fno-strict-aliasing",
52      "-DCONFIG_CTRL_IFACE",
53      "-DCONFIG_WPS",
54    ]
55
56    external_deps = [
57      "c_utils:utils",
58      "drivers_interface_wlan:libhostapd_stub_1.0",
59      "hdf_core:libhdf_host",
60      "hdf_core:libhdf_utils",
61      "hilog:libhilog",
62      "wpa_supplicant:wpa",
63      "wpa_supplicant:wpa_client_vendor",
64    ]
65
66    install_images = [ chipset_base_dir ]
67    subsystem_name = "hdf"
68    part_name = "drivers_peripheral_wlan"
69  }
70
71  ohos_shared_library("libhostapd_hdi_c_device") {
72    branch_protector_ret = "pac_ret"
73    sanitize = {
74      cfi = true  # Enable/disable control flow integrity detection
75      boundary_sanitize = true  # Enable boundary san detection
76      cfi_cross_dso = true  # Cross-SO CFI Checks
77      integer_overflow = true  # Enable integer overflow detection
78      ubsan = true  # Enable some Ubsan options
79      debug = false
80    }
81    include_dirs = [ "./service_common" ]
82
83    sources = [ "hostapd_interface_drivers.c" ]
84
85    deps = [ ":libhostapd_interface_service_1.0" ]
86
87    cflags = [
88      "-Wall",
89      "-Wextra",
90      "-Werror",
91      "-fsigned-char",
92      "-fno-common",
93      "-fno-strict-aliasing",
94    ]
95
96    external_deps = [
97      "c_utils:utils",
98      "drivers_interface_wlan:libhostapd_stub_1.0",
99      "hdf_core:libhdf_host",
100      "hdf_core:libhdf_ipc_adapter",
101      "hdf_core:libhdf_utils",
102      "hdf_core:libhdi",
103      "hilog:libhilog",
104    ]
105
106    shlib_type = "hdi"
107    install_images = [ chipset_base_dir ]
108    subsystem_name = "hdf"
109    part_name = "drivers_peripheral_wlan"
110  }
111} else {
112  ohos_shared_library("libhostapd_interface_service_1.0") {
113    branch_protector_ret = "pac_ret"
114    sanitize = {
115      cfi = true  # Enable/disable control flow integrity detection
116      boundary_sanitize = true  # Enable boundary san detection
117      cfi_cross_dso = true  # Cross-SO CFI Checks
118      integer_overflow = true  # Enable integer overflow detection
119      ubsan = true  # Enable some Ubsan options
120      debug = false
121    }
122    include_dirs = []
123    sources = []
124
125    install_images = [ chipset_base_dir ]
126    subsystem_name = "hdf"
127    part_name = "drivers_peripheral_wlan"
128  }
129
130  ohos_shared_library("libhostapd_hdi_c_device") {
131    branch_protector_ret = "pac_ret"
132    sanitize = {
133      cfi = true  # Enable/disable control flow integrity detection
134      boundary_sanitize = true  # Enable boundary san detection
135      cfi_cross_dso = true  # Cross-SO CFI Checks
136      integer_overflow = true  # Enable integer overflow detection
137      ubsan = true  # Enable some Ubsan options
138      debug = false
139    }
140    include_dirs = []
141    sources = []
142
143    install_images = [ chipset_base_dir ]
144    subsystem_name = "hdf"
145    part_name = "drivers_peripheral_wlan"
146  }
147}
148
149group("hdi_hostapd_service") {
150  deps = [
151    ":libhostapd_hdi_c_device",
152    ":libhostapd_interface_service_1.0",
153  ]
154}
155