1094332d3Sopenharmony_ci# Copyright (c) 2023 Huawei Device Co., Ltd.
2094332d3Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
3094332d3Sopenharmony_ci# you may not use this file except in compliance with the License.
4094332d3Sopenharmony_ci# You may obtain a copy of the License at
5094332d3Sopenharmony_ci#
6094332d3Sopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
7094332d3Sopenharmony_ci#
8094332d3Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software
9094332d3Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
10094332d3Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11094332d3Sopenharmony_ci# See the License for the specific language governing permissions and
12094332d3Sopenharmony_ci# limitations under the License.
13094332d3Sopenharmony_ci
14094332d3Sopenharmony_ciimport("//build/ohos.gni")
15094332d3Sopenharmony_ciimport("//third_party/wpa_supplicant/wpa_supplicant-2.9_standard/wpa.gni")
16094332d3Sopenharmony_ciWPA_ROOT_DIR = "//third_party/wpa_supplicant"
17094332d3Sopenharmony_ci
18094332d3Sopenharmony_ciif (is_standard_system) {
19094332d3Sopenharmony_ci  ohos_shared_library("libhostapd_interface_service_1.0") {
20094332d3Sopenharmony_ci    branch_protector_ret = "pac_ret"
21094332d3Sopenharmony_ci    sanitize = {
22094332d3Sopenharmony_ci      cfi = true  # Enable/disable control flow integrity detection
23094332d3Sopenharmony_ci      boundary_sanitize = true  # Enable boundary san detection
24094332d3Sopenharmony_ci      cfi_cross_dso = true  # Cross-SO CFI Checks
25094332d3Sopenharmony_ci      integer_overflow = true  # Enable integer overflow detection
26094332d3Sopenharmony_ci      ubsan = true  # Enable some Ubsan options
27094332d3Sopenharmony_ci      debug = false
28094332d3Sopenharmony_ci    }
29094332d3Sopenharmony_ci    include_dirs = [
30094332d3Sopenharmony_ci      "./service_common",
31094332d3Sopenharmony_ci      "../../client/include",
32094332d3Sopenharmony_ci      "$WPA_ROOT_DIR/wpa_supplicant-2.9_standard/src",
33094332d3Sopenharmony_ci      "$WPA_ROOT_DIR/wpa_supplicant-2.9_standard/hostapd",
34094332d3Sopenharmony_ci    ]
35094332d3Sopenharmony_ci    sources = [
36094332d3Sopenharmony_ci      "hostapd_interface_service.c",
37094332d3Sopenharmony_ci      "service_common/hdi_hostapd_hal.c",
38094332d3Sopenharmony_ci      "service_common/hostapd_common_cmd.c",
39094332d3Sopenharmony_ci    ]
40094332d3Sopenharmony_ci
41094332d3Sopenharmony_ci    deps = [ "../../client:hostapd_hdi_client" ]
42094332d3Sopenharmony_ci
43094332d3Sopenharmony_ci    defines = [ "__OHOS__USER__" ]
44094332d3Sopenharmony_ci
45094332d3Sopenharmony_ci    cflags = [
46094332d3Sopenharmony_ci      "-Wall",
47094332d3Sopenharmony_ci      "-Wextra",
48094332d3Sopenharmony_ci      "-Werror",
49094332d3Sopenharmony_ci      "-fsigned-char",
50094332d3Sopenharmony_ci      "-fno-common",
51094332d3Sopenharmony_ci      "-fno-strict-aliasing",
52094332d3Sopenharmony_ci      "-DCONFIG_CTRL_IFACE",
53094332d3Sopenharmony_ci      "-DCONFIG_WPS",
54094332d3Sopenharmony_ci    ]
55094332d3Sopenharmony_ci
56094332d3Sopenharmony_ci    external_deps = [
57094332d3Sopenharmony_ci      "c_utils:utils",
58094332d3Sopenharmony_ci      "drivers_interface_wlan:libhostapd_stub_1.0",
59094332d3Sopenharmony_ci      "hdf_core:libhdf_host",
60094332d3Sopenharmony_ci      "hdf_core:libhdf_utils",
61094332d3Sopenharmony_ci      "hilog:libhilog",
62094332d3Sopenharmony_ci      "wpa_supplicant:wpa",
63094332d3Sopenharmony_ci      "wpa_supplicant:wpa_client_vendor",
64094332d3Sopenharmony_ci    ]
65094332d3Sopenharmony_ci
66094332d3Sopenharmony_ci    install_images = [ chipset_base_dir ]
67094332d3Sopenharmony_ci    subsystem_name = "hdf"
68094332d3Sopenharmony_ci    part_name = "drivers_peripheral_wlan"
69094332d3Sopenharmony_ci  }
70094332d3Sopenharmony_ci
71094332d3Sopenharmony_ci  ohos_shared_library("libhostapd_hdi_c_device") {
72094332d3Sopenharmony_ci    branch_protector_ret = "pac_ret"
73094332d3Sopenharmony_ci    sanitize = {
74094332d3Sopenharmony_ci      cfi = true  # Enable/disable control flow integrity detection
75094332d3Sopenharmony_ci      boundary_sanitize = true  # Enable boundary san detection
76094332d3Sopenharmony_ci      cfi_cross_dso = true  # Cross-SO CFI Checks
77094332d3Sopenharmony_ci      integer_overflow = true  # Enable integer overflow detection
78094332d3Sopenharmony_ci      ubsan = true  # Enable some Ubsan options
79094332d3Sopenharmony_ci      debug = false
80094332d3Sopenharmony_ci    }
81094332d3Sopenharmony_ci    include_dirs = [ "./service_common" ]
82094332d3Sopenharmony_ci
83094332d3Sopenharmony_ci    sources = [ "hostapd_interface_drivers.c" ]
84094332d3Sopenharmony_ci
85094332d3Sopenharmony_ci    deps = [ ":libhostapd_interface_service_1.0" ]
86094332d3Sopenharmony_ci
87094332d3Sopenharmony_ci    cflags = [
88094332d3Sopenharmony_ci      "-Wall",
89094332d3Sopenharmony_ci      "-Wextra",
90094332d3Sopenharmony_ci      "-Werror",
91094332d3Sopenharmony_ci      "-fsigned-char",
92094332d3Sopenharmony_ci      "-fno-common",
93094332d3Sopenharmony_ci      "-fno-strict-aliasing",
94094332d3Sopenharmony_ci    ]
95094332d3Sopenharmony_ci
96094332d3Sopenharmony_ci    external_deps = [
97094332d3Sopenharmony_ci      "c_utils:utils",
98094332d3Sopenharmony_ci      "drivers_interface_wlan:libhostapd_stub_1.0",
99094332d3Sopenharmony_ci      "hdf_core:libhdf_host",
100094332d3Sopenharmony_ci      "hdf_core:libhdf_ipc_adapter",
101094332d3Sopenharmony_ci      "hdf_core:libhdf_utils",
102094332d3Sopenharmony_ci      "hdf_core:libhdi",
103094332d3Sopenharmony_ci      "hilog:libhilog",
104094332d3Sopenharmony_ci    ]
105094332d3Sopenharmony_ci
106094332d3Sopenharmony_ci    shlib_type = "hdi"
107094332d3Sopenharmony_ci    install_images = [ chipset_base_dir ]
108094332d3Sopenharmony_ci    subsystem_name = "hdf"
109094332d3Sopenharmony_ci    part_name = "drivers_peripheral_wlan"
110094332d3Sopenharmony_ci  }
111094332d3Sopenharmony_ci} else {
112094332d3Sopenharmony_ci  ohos_shared_library("libhostapd_interface_service_1.0") {
113094332d3Sopenharmony_ci    branch_protector_ret = "pac_ret"
114094332d3Sopenharmony_ci    sanitize = {
115094332d3Sopenharmony_ci      cfi = true  # Enable/disable control flow integrity detection
116094332d3Sopenharmony_ci      boundary_sanitize = true  # Enable boundary san detection
117094332d3Sopenharmony_ci      cfi_cross_dso = true  # Cross-SO CFI Checks
118094332d3Sopenharmony_ci      integer_overflow = true  # Enable integer overflow detection
119094332d3Sopenharmony_ci      ubsan = true  # Enable some Ubsan options
120094332d3Sopenharmony_ci      debug = false
121094332d3Sopenharmony_ci    }
122094332d3Sopenharmony_ci    include_dirs = []
123094332d3Sopenharmony_ci    sources = []
124094332d3Sopenharmony_ci
125094332d3Sopenharmony_ci    install_images = [ chipset_base_dir ]
126094332d3Sopenharmony_ci    subsystem_name = "hdf"
127094332d3Sopenharmony_ci    part_name = "drivers_peripheral_wlan"
128094332d3Sopenharmony_ci  }
129094332d3Sopenharmony_ci
130094332d3Sopenharmony_ci  ohos_shared_library("libhostapd_hdi_c_device") {
131094332d3Sopenharmony_ci    branch_protector_ret = "pac_ret"
132094332d3Sopenharmony_ci    sanitize = {
133094332d3Sopenharmony_ci      cfi = true  # Enable/disable control flow integrity detection
134094332d3Sopenharmony_ci      boundary_sanitize = true  # Enable boundary san detection
135094332d3Sopenharmony_ci      cfi_cross_dso = true  # Cross-SO CFI Checks
136094332d3Sopenharmony_ci      integer_overflow = true  # Enable integer overflow detection
137094332d3Sopenharmony_ci      ubsan = true  # Enable some Ubsan options
138094332d3Sopenharmony_ci      debug = false
139094332d3Sopenharmony_ci    }
140094332d3Sopenharmony_ci    include_dirs = []
141094332d3Sopenharmony_ci    sources = []
142094332d3Sopenharmony_ci
143094332d3Sopenharmony_ci    install_images = [ chipset_base_dir ]
144094332d3Sopenharmony_ci    subsystem_name = "hdf"
145094332d3Sopenharmony_ci    part_name = "drivers_peripheral_wlan"
146094332d3Sopenharmony_ci  }
147094332d3Sopenharmony_ci}
148094332d3Sopenharmony_ci
149094332d3Sopenharmony_cigroup("hdi_hostapd_service") {
150094332d3Sopenharmony_ci  deps = [
151094332d3Sopenharmony_ci    ":libhostapd_hdi_c_device",
152094332d3Sopenharmony_ci    ":libhostapd_interface_service_1.0",
153094332d3Sopenharmony_ci  ]
154094332d3Sopenharmony_ci}
155