add safwk.bundle.json and safwk.BUILD.gn
change spec by zjq
This commit is contained in:
parent
dec871dc89
commit
a033a9be6a
71
0000-remove-dependency-on-hitrace-safwk.patch
Normal file
71
0000-remove-dependency-on-hitrace-safwk.patch
Normal file
@ -0,0 +1,71 @@
|
||||
From e0aace24cbc8d0943bb79589d1a236fb8ff5afdb Mon Sep 17 00:00:00 2001
|
||||
From: heppen <hepeng68@huawei.com>
|
||||
Date: Tue, 20 Jun 2023 17:23:24 +0800
|
||||
Subject: [PATCH] remove dependency on hitrace
|
||||
|
||||
---
|
||||
interfaces/innerkits/safwk/BUILD.gn | 2 +-
|
||||
services/safwk/src/local_ability_manager.cpp | 4 ++--
|
||||
services/safwk/src/system_ability.cpp | 4 ++--
|
||||
3 files changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/interfaces/innerkits/safwk/BUILD.gn b/interfaces/innerkits/safwk/BUILD.gn
|
||||
index 5509789..3dd18cb 100644
|
||||
--- a/interfaces/innerkits/safwk/BUILD.gn
|
||||
+++ b/interfaces/innerkits/safwk/BUILD.gn
|
||||
@@ -51,7 +51,7 @@ ohos_shared_library("system_ability_fwk") {
|
||||
if (is_standard_system) {
|
||||
external_deps = [
|
||||
"c_utils:utils",
|
||||
- "hitrace_native:hitrace_meter",
|
||||
+ # "hitrace_native:hitrace_meter",
|
||||
"hiviewdfx_hilog_native:libhilog",
|
||||
"ipc:ipc_core",
|
||||
"samgr:samgr_common",
|
||||
diff --git a/services/safwk/src/local_ability_manager.cpp b/services/safwk/src/local_ability_manager.cpp
|
||||
index 11f7a06..0af6af9 100644
|
||||
--- a/services/safwk/src/local_ability_manager.cpp
|
||||
+++ b/services/safwk/src/local_ability_manager.cpp
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
#include "datetime_ex.h"
|
||||
#include "errors.h"
|
||||
-#include "hitrace_meter.h"
|
||||
+// #include "hitrace_meter.h"
|
||||
#include "ipc_skeleton.h"
|
||||
#include "iservice_registry.h"
|
||||
#include "safwk_log.h"
|
||||
@@ -88,7 +88,7 @@ void LocalAbilityManager::DoStartSAProcess(const std::string& profilePath, int32
|
||||
}
|
||||
{
|
||||
std::string traceTag = GetTraceTag(realProfilePath);
|
||||
- HITRACE_METER_NAME(HITRACE_TAG_SAMGR, traceTag);
|
||||
+ // HITRACE_METER_NAME(HITRACE_TAG_SAMGR, traceTag);
|
||||
bool ret = InitSystemAbilityProfiles(realProfilePath, saId);
|
||||
if (!ret) {
|
||||
HILOGE(TAG, "InitSystemAbilityProfiles no right profile, will exit");
|
||||
diff --git a/services/safwk/src/system_ability.cpp b/services/safwk/src/system_ability.cpp
|
||||
index 84911e0..e618560 100644
|
||||
--- a/services/safwk/src/system_ability.cpp
|
||||
+++ b/services/safwk/src/system_ability.cpp
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
#include "datetime_ex.h"
|
||||
#include "errors.h"
|
||||
-#include "hitrace_meter.h"
|
||||
+// #include "hitrace_meter.h"
|
||||
#include "if_system_ability_manager.h"
|
||||
#include "iservice_registry.h"
|
||||
#include "local_ability_manager.h"
|
||||
@@ -114,7 +114,7 @@ void SystemAbility::Start()
|
||||
}
|
||||
HILOGD(TAG, "[PerformanceTest] SAFWK OnStart systemAbilityId:%{public}d", saId_);
|
||||
int64_t begin = GetTickCount();
|
||||
- HITRACE_METER_NAME(HITRACE_TAG_SAMGR, ToString(saId_) + "_OnStart");
|
||||
+ // HITRACE_METER_NAME(HITRACE_TAG_SAMGR, ToString(saId_) + "_OnStart");
|
||||
OnStart();
|
||||
isRunning_ = true;
|
||||
HILOGI(TAG, "[PerformanceTest] SAFWK OnStart systemAbilityId:%{public}d finished, spend:%{public}" PRId64 " ms",
|
||||
--
|
||||
2.33.0
|
||||
|
||||
41
innerkits.safwk.BUILD.gn
Normal file
41
innerkits.safwk.BUILD.gn
Normal file
@ -0,0 +1,41 @@
|
||||
# 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("//build/ohos.gni")
|
||||
import("//build/ohos_var.gni")
|
||||
|
||||
# 建立所需头文件链接
|
||||
exec_script("//build/openeuler/script/link.py", [ "--src_target", "/usr/include/safwk/system_ability.h", "--dest_target",
|
||||
rebase_path("//foundation/systemabilitymgr/safwk/interfaces/innerkits/safwk/system_ability.h") ], "string")
|
||||
|
||||
exec_script("//build/openeuler/script/link.py", [ "--src_target", "/usr/include/safwk", "--dest_target",
|
||||
rebase_path("//foundation/systemabilitymgr/safwk/services/safwk/include") ], "string")
|
||||
|
||||
config("system_ability_config") {
|
||||
visibility = [ ":*" ]
|
||||
include_dirs = [
|
||||
"../../../services/safwk/include",
|
||||
"//foundation/systemabilitymgr/safwk/interfaces/innerkits/safwk",
|
||||
]
|
||||
}
|
||||
|
||||
ohos_prebuilt_shared_library("system_ability_fwk") {
|
||||
source = "/usr/lib64/libsystem_ability_fwk.z.so"
|
||||
|
||||
public_configs = [ ":system_ability_config" ]
|
||||
|
||||
install_images = [ system_base_dir ]
|
||||
relative_install_dir = "platformsdk"
|
||||
part_name = "safwk"
|
||||
subsystem_name = "systemabilitymgr"
|
||||
}
|
||||
58
safwk.bundle.json
Normal file
58
safwk.bundle.json
Normal file
@ -0,0 +1,58 @@
|
||||
{
|
||||
"name": "@ohos/systemabilitymgr_safwk",
|
||||
"description": "system ability framework",
|
||||
"homePage": "https://gitee.com/openharmony",
|
||||
"version": "3.1",
|
||||
"license": "Apache License 2.0",
|
||||
"repository": "https://gitee.com/openharmony/systemabilitymgr_safwk",
|
||||
"publishAs": "code-segment",
|
||||
"segment": {
|
||||
"destPath": "foundation/systemabilitymgr/safwk"
|
||||
},
|
||||
"dirs": {},
|
||||
"scripts": {},
|
||||
"component": {
|
||||
"name": "safwk",
|
||||
"subsystem": "systemabilitymgr",
|
||||
"features": [ "safwk_feature_coverage = false" ],
|
||||
"adapted_system_type": [
|
||||
"standard"
|
||||
],
|
||||
"rom": "200KB",
|
||||
"ram": "7130KB",
|
||||
"deps": {
|
||||
"components": [
|
||||
"hitrace_native",
|
||||
"hiviewdfx_hilog_native",
|
||||
"ipc",
|
||||
"samgr",
|
||||
"c_utils"
|
||||
],
|
||||
"third_party": [ "libxml2" ]
|
||||
},
|
||||
"build": {
|
||||
"group_type": {
|
||||
"base_group": [
|
||||
"//foundation/systemabilitymgr/safwk/services/safwk:sa_main",
|
||||
"//foundation/systemabilitymgr/safwk/interfaces/innerkits/safwk:system_ability_fwk"
|
||||
],
|
||||
"fwk_group": [],
|
||||
"service_group": []
|
||||
},
|
||||
"inner_kits": [
|
||||
{
|
||||
"header": {
|
||||
"header_base": "//foundation/systemabilitymgr/safwk/interfaces/innerkits/safwk",
|
||||
"header_files": [
|
||||
"system_ability.h"
|
||||
]
|
||||
},
|
||||
"name": "//foundation/systemabilitymgr/safwk/interfaces/innerkits/safwk:system_ability_fwk"
|
||||
}
|
||||
],
|
||||
"test": [
|
||||
"//foundation/systemabilitymgr/safwk/test:unittest"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
109
safwk.spec
Normal file
109
safwk.spec
Normal file
@ -0,0 +1,109 @@
|
||||
%define debug_package %{nil}
|
||||
%global openHarmony_source_release OpenHarmony-v3.2-Release
|
||||
%global samgr_dir %{_builddir}/foundation/systemabilitymgr
|
||||
%global build_opt /opt/distributed-middleware-build
|
||||
%global safwk_path %{buildroot}%{build_opt}/openeuler/compiler_gn/foundation/systemabilitymgr/safwk
|
||||
|
||||
Name: systemabilitymgr_safwk
|
||||
Version: 1.0.0
|
||||
Release: 1
|
||||
Summary: System ability manager
|
||||
License: Apache License 2.0
|
||||
Url: https://gitee.com/openharmony/systemabilitymgr_safwk
|
||||
Source1: https://gitee.com/openharmony/systemabilitymgr_safwk/repository/archive/%{openHarmony_source_release}.tar.gz #/systemabilitymgr_safwk-%{openHarmony_source_release}.tar.gz
|
||||
Source2: safwk.bundle.json
|
||||
Source3: innerkits.safwk.BUILD.gn
|
||||
Source4: services.safwk.BUILD.gn
|
||||
|
||||
Patch1: 0000-remove-dependency-on-hitrace-safwk.patch
|
||||
|
||||
BuildRequires: gcc, make, hilog, kernel-devel, uname-build-checks,libboundscheck
|
||||
BuildRequires: libatomic,libicu-devel, libxml2-devel, openssl-devel, cjson-devel
|
||||
BuildRequires: distributed-build, distributed-beget
|
||||
BuildRequires: commonlibrary_c_utils
|
||||
BuildRequires: notification_eventhandler
|
||||
BuildRequires: cjson-devel, openssl-devel
|
||||
BuildRequires: communication_ipc
|
||||
BuildRequires: Requires: systemabilitymgr_samgr
|
||||
|
||||
Requires: commonlibrary_c_utils
|
||||
Requires: distributed-beget
|
||||
Requires: notification_eventhandler
|
||||
Requires: communication_ipc
|
||||
Requires: systemabilitymgr_samgr
|
||||
|
||||
%description
|
||||
OpenEuler supports samgr for distributed softbus capability
|
||||
%prep
|
||||
rm -rf %{_builddir}/*
|
||||
|
||||
cp -rf %{build_opt} %{_builddir}/build
|
||||
[ ! -L "%{_builddir}/build.sh" ] && ln -s %{_builddir}/build/build_scripts/build.sh %{_builddir}/build.sh
|
||||
[ ! -L "%{_builddir}/.gn" ] && ln -s %{_builddir}/build/core/gn/dotfile.gn %{_builddir}/.gn
|
||||
[ ! -L "%{_builddir}/build.py" ] && ln -s %{_builddir}/build/lite/build.py %{_builddir}/build.py
|
||||
cp -rf %{_builddir}/build/openeuler/vendor %{_builddir}/
|
||||
cp -rf %{_builddir}/build/openeuler/compiler_gn/* %{_builddir}
|
||||
|
||||
|
||||
# 统一用setup,不用autosetup,distributed-build除外
|
||||
mkdir -p %{samgr_dir}
|
||||
%setup -q -D -T -a 1 -c -n %{samgr_dir}
|
||||
# patch命令统一使用-P来指定第几个patch
|
||||
%patch -P1 -p1 -d %{samgr_dir}/safwk
|
||||
|
||||
%build
|
||||
rm -rf %{_builddir}/out
|
||||
%ifarch x86_64
|
||||
bash %{_builddir}/build.sh --product-name openeuler --target-cpu x86_64
|
||||
%endif
|
||||
|
||||
%ifarch aarch64
|
||||
bash %{_builddir}/build.sh --product-name openeuler --target-cpu arm64
|
||||
%endif
|
||||
|
||||
%install
|
||||
install -d -m 0755 %{buildroot}/%{_includedir}/safwk
|
||||
install -d -m 0755 %{buildroot}/%{_libdir}
|
||||
install -d -m 0755 %{buildroot}/%{_bindir}
|
||||
install -d -m 0755 %{buildroot}/system/bin/
|
||||
install -d -m 0755 %{safwk_path}/interfaces/innerkits/safwk
|
||||
install -d -m 0755 %{safwk_path}/services/safwk
|
||||
|
||||
%ifarch aarch64
|
||||
module_out_path="out/openeuler/linux_clang_arm64"
|
||||
%endif
|
||||
%ifarch x86_64
|
||||
module_out_path="out/openeuler/linux_clang_x86_64"
|
||||
%endif
|
||||
|
||||
# prepare so
|
||||
install -m 0755 %{_builddir}/${module_out_path}/systemabilitymgr/safwk/*.so %{buildroot}/%{_libdir}
|
||||
|
||||
# prepare bin
|
||||
install -m 0755 %{_builddir}/${module_out_path}/systemabilitymgr/safwk/sa_main %{buildroot}/%{_bindir}
|
||||
install -m 0755 %{_builddir}/${module_out_path}/systemabilitymgr/safwk/sa_main %{buildroot}/system/bin/
|
||||
|
||||
# prepare head files
|
||||
install -m 554 %{samgr_dir}/safwk/services/safwk/include/*.h %{buildroot}/%{_includedir}/safwk
|
||||
install -m 554 %{samgr_dir}/safwk/interfaces/innerkits/safwk/*.h %{buildroot}/%{_includedir}/safwk
|
||||
# cp json file
|
||||
install -m 554 %{SOURCE2} %{safwk_path}/bundle.json
|
||||
|
||||
# cp gn file
|
||||
install -m 554 %{SOURCE3} %{safwk_path}/interfaces/innerkits/safwk/BUILD.gn
|
||||
install -m 554 %{SOURCE4} %{safwk_path}/services/safwk/BUILD.gn
|
||||
|
||||
#create soft link
|
||||
ln -s /usr/include/safwk/system_ability.h %{safwk_path}/interfaces/innerkits/safwk/system_ability.h
|
||||
|
||||
%files
|
||||
%{_includedir}/safwk/*
|
||||
%{_libdir}/*.so
|
||||
%{_bindir}/sa_main
|
||||
/system/bin/sa_main
|
||||
%{build_opt}/*
|
||||
|
||||
%changelog
|
||||
* Thu Oct 12 2023 muyuying <muyuying1@huawei.com> - 1.0.0-1
|
||||
- Init and adapt safwk to openEuler
|
||||
|
||||
22
services.safwk.BUILD.gn
Normal file
22
services.safwk.BUILD.gn
Normal file
@ -0,0 +1,22 @@
|
||||
# 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("//build/ohos.gni")
|
||||
|
||||
ohos_prebuilt_executable("sa_main") {
|
||||
source = "/usr/bin/sa_main"
|
||||
install_enable = true
|
||||
|
||||
part_name = "safwk"
|
||||
subsystem_name = "systemabilitymgr"
|
||||
}
|
||||
BIN
systemabilitymgr_safwk-OpenHarmony-v3.2-Release.tar.gz
Normal file
BIN
systemabilitymgr_safwk-OpenHarmony-v3.2-Release.tar.gz
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user