# Copyright (c) 2021 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("//base/startup/init_lite/begetd.gni") if (!defined(ohos_lite) || ohos_kernel_type != "liteos_m") { syspara_sources = [ "syscap/init_syscap.c", "syspara/param_comm.c", "syspara/parameter.c", "syspara/sysversion.c", ] } config("exported_header_files") { visibility = [ ":*" ] include_dirs = [ "//base/startup/init_lite/interfaces/innerkits/include", "//base/startup/init_lite/interfaces/innerkits/include/syspara", "//base/startup/init_lite/interfaces/innerkits/include/token", ] } if (defined(ohos_lite)) { import("//build/lite/config/component/lite_component.gni") import("//build/lite/ndk/ndk.gni") if (ohos_kernel_type == "liteos_a" || ohos_kernel_type == "linux") { shared_library("libbegetutil") { sources = [ "//base/startup/init_lite/services/log/init_log.c" ] sources += syspara_sources public_configs = [ ":exported_header_files" ] cflags = [ "-fPIC" ] defines = [ "_GNU_SOURCE", "INIT_LOG_INIT=3", "OHOS_LITE", ] include_dirs = [ "./include", "//base/hiviewdfx/hilog_lite/interfaces/native/kits", "//third_party/bounds_checking_function/include", "//base/startup/init_lite/services/include", "//base/startup/init_lite/services/include/param", "//base/startup/init_lite/interfaces/innerkits/fd_holder", "//base/startup/init_lite/services/param/include", "//base/startup/init_lite/interfaces/innerkits/include", ] deps = [ "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared", "//base/startup/init_lite/services/utils:libinit_tools", "//third_party/bounds_checking_function:libsec_shared", "//third_party/mbedtls:mbedtls", ] defines += [ "INCREMENTAL_VERSION=\"${ohos_version}\"", "BUILD_TYPE=\"${ohos_build_type}\"", "BUILD_USER=\"${ohos_build_user}\"", "BUILD_TIME=\"${ohos_build_time}\"", "BUILD_HOST=\"${ohos_build_host}\"", "BUILD_ROOTHASH=\"${ohos_build_roothash}\"", "USE_MBEDTLS", ] deps += [ "//base/startup/init_lite/services/param:param_client" ] if (ohos_kernel_type == "liteos_a") { defines += [ "__LITEOS_A__" ] } else if (ohos_kernel_type == "linux") { defines += [ "__LINUX__" ] deps += [ "//base/startup/init_lite/services/loopevent:loopevent" ] } } } if (ohos_kernel_type == "liteos_m") { static_library("libbegetutil") { sources = [ "//base/startup/init_lite/services/log/init_log.c" ] sources += [ "syscap/init_syscap.c" ] public_configs = [ ":exported_header_files" ] defines = [ "_GNU_SOURCE", "INIT_LOG_INIT=3", "OHOS_LITE", "__LITEOS_M__", ] include_dirs = [ "./include", "//base/hiviewdfx/hilog_lite/interfaces/native/kits", "//third_party/bounds_checking_function/include", "//base/startup/init_lite/services/include", "//base/startup/init_lite/services/include/param", "//base/startup/init_lite/interfaces/innerkits/fd_holder", "//base/startup/init_lite/services/param/include", "//base/startup/init_lite/interfaces/innerkits/include", ] deps = [ "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_static", "//base/startup/init_lite/services/utils:libinit_tools", "//third_party/bounds_checking_function:libsec_static", ] defines += [ "INCREMENTAL_VERSION=\"${ohos_version}\"", "BUILD_TYPE=\"${ohos_build_type}\"", "BUILD_USER=\"${ohos_build_user}\"", "BUILD_TIME=\"${ohos_build_time}\"", "BUILD_HOST=\"${ohos_build_host}\"", "BUILD_ROOTHASH=\"${ohos_build_roothash}\"", ] if (enable_ohos_startup_init_lite_use_thirdparty_mbedtls) { deps += [ "//third_party/mbedtls:mbedtls" ] defines += [ "USE_MBEDTLS" ] } deps += [ "//base/startup/init_lite/services/param:param_client" ] } } lite_component("parameter") { features = [ ":libbegetutil" ] } ndk_lib("parameter_notes") { if (ohos_kernel_type != "liteos_m") { lib_extension = ".so" } deps = [ ":libbegetutil" ] head_files = [ "//base/startup/init_lite/interfaces/innerkits/include/syspara" ] } } else { import("//build/ohos.gni") fs_manager_sources = [ "fs_manager/fstab.c", "fs_manager/fstab_mount.c", ] ohos_shared_library("libbegetutil") { sources = [ "//base/startup/init_lite/services/log/init_log.c", "fd_holder/fd_holder.c", "fd_holder/fd_holder_internal.c", "file/init_file.c", "reboot/init_reboot_innerkits.c", "service_control/service_control.c", "socket/init_socket.c", ] sources += fs_manager_sources sources += syspara_sources sources += [ "syspara/param_wrapper.cpp" ] defines = [ "INIT_AGENT", "INIT_FILE", "_GNU_SOURCE", "INIT_FILE", ] include_dirs = [ "./include", "//third_party/bounds_checking_function/include", "//base/startup/init_lite/services/include", "//base/startup/init_lite/services/include/param", "//base/startup/init_lite/services/param/include", "//base/startup/init_lite/interfaces/innerkits/fd_holder", "//base/startup/init_lite/interfaces/innerkits/include", ] deps = [ "//base/startup/init_lite/interfaces/innerkits/sandbox:libsandbox", "//base/startup/init_lite/services/loopevent:loopevent", "//base/startup/init_lite/services/param:param_client", "//base/startup/init_lite/services/utils:libinit_tools", "//base/startup/init_lite/services/utils:libinit_utils", "//third_party/bounds_checking_function:libsec_shared", "//third_party/openssl:libcrypto_shared", ] external_deps = [ "hilog_native:libhilog_base", "utils_base:utils", ] public_configs = [ ":exported_header_files" ] part_name = "init" install_images = [ "system", "updater", ] } # watcher lib must separate compilation avoid interdependence. ohos_shared_library("libbeget_proxy") { defines = [ "INIT_AGENT", "_GNU_SOURCE", ] sources = [ "//base/startup/init_lite/device_info/device_info.cpp", "//base/startup/init_lite/services/log/init_log.c", "service_watcher/service_watcher.c", ] include_dirs = [ "./include", "//base/startup/init_lite/device_info", "//base/startup/init_lite/interfaces/innerkits/include", "//base/startup/init_lite/interfaces/innerkits/syspara", "//base/startup/init_lite/services/include", "//base/startup/init_lite/services/include/param", "//base/startup/init_lite/services/param/include", "//third_party/bounds_checking_function/include", ] deps = [ "//base/startup/init_lite/services/utils:libinit_utils", "//third_party/bounds_checking_function:libsec_shared", ] if (param_feature_watcher) { sources += [ "//base/startup/init_lite/services/param/watcher/agent/watcher.cpp", "//base/startup/init_lite/services/param/watcher/agent/watcher_manager_kits.cpp", "//base/startup/init_lite/services/param/watcher/agent/watcher_manager_proxy.cpp", "//base/startup/init_lite/services/param/watcher/agent/watcher_stub.cpp", ] include_dirs += [ "//base/startup/init_lite/services/param/watcher/include", "//base/startup/init_lite/services/log", ] deps += [ "//base/startup/init_lite/services/param:param_client", "//base/startup/init_lite/services/utils:libinit_tools", "//base/startup/init_lite/services/utils:libinit_utils", "//third_party/openssl:libcrypto_shared", ] } else { defines += [ "NO_PARAM_WATCHER" ] } if (param_feature_deviceinfo) { sources += [ "//base/startup/init_lite/device_info/device_info_kits.cpp", "//base/startup/init_lite/device_info/device_info_proxy.cpp", ] defines += [ "PARAM_FEATURE_DEVICEINFO" ] } else { sources += [ "//base/startup/init_lite/interfaces/innerkits/syspara/param_comm.c", ] deps += [ "//base/startup/init_lite/services/loopevent:loopevent", "//base/startup/init_lite/services/param:param_client", "//base/startup/init_lite/services/utils:libinit_tools", "//base/startup/init_lite/services/utils:libinit_utils", "//third_party/openssl:libcrypto_shared", ] } external_deps = [ "hilog_native:libhilog_base", "ipc:ipc_core", "safwk:system_ability_fwk", "samgr_standard:samgr_proxy", "utils_base:utils", ] public_configs = [ ":exported_header_files" ] part_name = "init" install_images = [ "system" ] } # For init only ohos_static_library("libfsmanager_static") { sources = fs_manager_sources include_dirs = [ "//base/startup/init_lite/interfaces/innerkits/include", "//third_party/bounds_checking_function/include", "//base/startup/init_lite/services/log", "//base/startup/init_lite/services/include", "//base/startup/init_lite/services/param/include", ] part_name = "init" } }