28da8e54创建于 2025年8月17日历史提交
# Copyright (c) 2025 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
 
import("//build/ohos.gni")
 
if (is_standard_system) {
  ohos_shared_library("libethernet_service_1.0") {
    branch_protector_ret = "pac_ret"
    sanitize = {
      cfi = true  # Enable/disable control flow integrity detection
      boundary_sanitize = false  # Enable boundary san detection
      cfi_cross_dso = true  # Cross-SO CFI Checks
      integer_overflow = false  # Enable integer overflow detection
      ubsan = false  # Enable some Ubsan options
      cfi_vcall_icall_only = true
      debug = false
    }
    include_dirs = [
      "./service_common",
      "../../eth_client/include",
    ]
    sources = [
      "service_common/hdi_wpa_hal.c",
      "service_common/wpa_common_cmd.c",
      "ethernet_service.c",
    ]
 
    deps = [ "../../eth_client:ethernet_hdi_client" ]
 
    defines = [ "__OHOS__USER__" ]
 
    cflags = [
      "-Wall",
      "-Wextra",
      "-Werror",
      "-fsigned-char",
      "-fno-common",
      "-fno-strict-aliasing",
      "-fstack-protector-strong",
    ]
    cflags += [
      "-fdata-sections",
      "-ffunction-sections",
      "-Os",
      "-fno-merge-all-constants",
    ]
    ldflags = [
      "-Wl,--exclude-libs=ALL",
      "-Wl,--gc-sections",
    ]
    external_deps = [
      "c_utils:utils",
      "drivers_interface_ethernet:libethernet_stub_1.0",
      "hdf_core:libhdf_ipc_adapter",
      "hdf_core:libhdf_host",
      "hdf_core:libhdf_utils",
      "hilog:libhilog",
      "wpa_supplicant:wpa",
      "wpa_supplicant:wpa_client_vendor",
    ]
 
    install_images = [
      chipset_base_dir,
    ]
    version_script = "libethernet_hdi_service.map"
    subsystem_name = "hdf"
    part_name = "drivers_peripheral_ethernet"
  }
 
  ohos_shared_library("libethernet_hdi_c_device") {
    branch_protector_ret = "pac_ret"
    sanitize = {
      cfi = true  # Enable/disable control flow integrity detection
      boundary_sanitize = false  # Enable boundary san detection
      cfi_cross_dso = true  # Cross-SO CFI Checks
      integer_overflow = false  # Enable integer overflow detection
      ubsan = false  # Enable some Ubsan options
      cfi_vcall_icall_only = true
      debug = false
    }
    include_dirs = [ "./service_common" ]
 
    sources = [ "ethernet_driver.c" ]
 
    deps = [ ":libethernet_service_1.0" ]
 
    cflags = [
      "-Wall",
      "-Wextra",
      "-Werror",
      "-fsigned-char",
      "-fno-common",
      "-fno-strict-aliasing",
      "-fstack-protector-strong",
    ]
    cflags += [
      "-fdata-sections",
      "-ffunction-sections",
      "-Os",
      "-fno-merge-all-constants",
    ]
    ldflags = [
      "-Wl,--exclude-libs=ALL",
      "-Wl,--gc-sections",
    ]
    external_deps = [
      "c_utils:utils",
      "drivers_interface_ethernet:libethernet_stub_1.0",
      "hdf_core:libhdf_host",
      "hdf_core:libhdf_ipc_adapter",
      "hdf_core:libhdf_utils",
      "hdf_core:libhdi",
      "hilog:libhilog",
    ]
 
    shlib_type = "hdi"
    install_images = [ chipset_base_dir ]
    subsystem_name = "hdf"
    part_name = "drivers_peripheral_ethernet"
  }
} else {
  ohos_shared_library("libethernet_service_1.0") {
    branch_protector_ret = "pac_ret"
    sanitize = {
      cfi = true  # Enable/disable control flow integrity detection
      boundary_sanitize = true  # Enable boundary san detection
      cfi_cross_dso = true  # Cross-SO CFI Checks
      integer_overflow = true  # Enable integer overflow detection
      ubsan = true  # Enable some Ubsan options
      debug = false
    }
    include_dirs = []
    sources = []
 
    install_images = [ chipset_base_dir ]
    subsystem_name = "hdf"
    part_name = "drivers_peripheral_ethernet"
  }
 
  ohos_shared_library("libethernet_hdi_c_device") {
    branch_protector_ret = "pac_ret"
    sanitize = {
      cfi = true  # Enable/disable control flow integrity detection
      boundary_sanitize = true  # Enable boundary san detection
      cfi_cross_dso = true  # Cross-SO CFI Checks
      integer_overflow = true  # Enable integer overflow detection
      ubsan = true  # Enable some Ubsan options
      debug = false
    }
    include_dirs = []
    sources = []
 
    install_images = [ chipset_base_dir ]
    subsystem_name = "hdf"
    part_name = "drivers_peripheral_ethernet"
  }
}
 
group("ethernet_hdi_service") {
  deps = [
    ":libethernet_hdi_c_device",
    ":libethernet_service_1.0",
  ]
}