add source file and spec file

This commit is contained in:
heppen 2023-08-29 10:23:35 +08:00
parent 0213da2e22
commit dc0e0a7b6d
5 changed files with 276 additions and 0 deletions

116
bundle.json Normal file
View File

@ -0,0 +1,116 @@
{
"name": "@openharmony/distributeddatamgr_kv_store",
"version": "1.0.0",
"license": "Apache License 2.0",
"description": "",
"domain": "os",
"language": "",
"publishAs": "code-segment",
"private": false,
"tags": [
"foundation"
],
"keywords": [
"distributeddatamgr",
"kv_store"
],
"envs": [],
"author": {
"name": "",
"email": "",
"url": ""
},
"contributors": [
{
"name": "",
"email": "",
"url": ""
}
],
"segment": {
"destPath": "foundation/distributeddatamgr/kv_store"
},
"dirs": {},
"scripts": {},
"component": {
"name": "kv_store",
"subsystem": "distributeddatamgr",
"syscap": [
"SystemCapability.DistributedDataManager.KVStore.Core",
"SystemCapability.DistributedDataManager.KVStore.Lite",
"SystemCapability.DistributedDataManager.KVStore.DistributedKVStore"
],
"features": [],
"adapted_system_type": [
"standard"
],
"rom": "",
"ram": "",
"hisysevent_config": [],
"deps": {
"thrid_party": [
"uv_static",
"sqlite",
"libz",
"jsoncpp",
"libcrypto_shared"
],
"kernel_special": {},
"board_special": {},
"components": [
"libuv",
"common_event_service",
"bundle_framework",
"safwk",
"zlib",
"init",
"os_account",
"common",
"samgr",
"dataclassification",
"dsoftbus",
"jsoncpp",
"hitrace_native",
"access_token",
"huks",
"ability_base",
"ability_runtime",
"hiviewdfx_hilog_native",
"hisysevent_native",
"device_auth",
"ipc",
"napi"
]
},
"build": {
"sub_component": [
"//foundation/distributeddatamgr/kv_store/frameworks/libs/distributeddb:build_module",
"//foundation/distributeddatamgr/kv_store/interfaces/innerkits/distributeddata:build_module"
],
"inner_kits": [
{
"name": "//foundation/distributeddatamgr/kv_store/interfaces/innerkits/distributeddata:distributeddata_inner",
"header": {
"header_files": [
"blob.h",
"change_notification.h",
"distributed_kv_data_manager.h",
"kvstore.h",
"kvstore_death_recipient.h",
"kvstore_observer.h",
"kvstore_result_set.h",
"kvstore_sync_callback.h",
"single_kvstore.h",
"types.h",
"visibility.h",
"data_query.h",
"device_status_change_listener.h",
"store_errno.h"
],
"header_base": "//foundation/distributeddatamgr/kv_store/interfaces/innerkits/distributeddata/include"
}
}
]
}
}
}

View File

@ -0,0 +1,120 @@
%define debug_package %{nil}
%global oh_version OpenHarmony-v3.2-Release
%global kv_store_dir %{_builddir}/foundation/distributeddatamgr/
%global build_opt /opt/distributed-middleware-build
%global bundle_dir %{build_opt}/openeuler/compiler_gn/foundation/distributeddatamgr/kv_store
%global frameworks_dir %{bundle_dir}/frameworks/libs/distributeddb
%global interface_dir %{bundle_dir}/interfaces/innerkits/distributeddata
Name: distributeddatamgr_kv_store
Version: 1.0.0
Release: 3
Summary: Supports distributed key-value and document-based data management, and supports the use of schemas to describe data formats.
License: Apache-2.0
Url: https://gitee.com/openharmony/distributeddatamgr_kv_store
Source0: https://gitee.com/openharmony/distributeddatamgr_kv_store/repository/archive/OpenHarmony-v3.2-Release.tar.gz#/distributeddatamgr_kv_store-OpenHarmony-v3.2-Release.tar.gz
Source1: frameworks.BUILD.gn
Source2: interface.BUILD.gn
Source3: bundle.json
Patch0: 0001-remove-useless-dependency-datashare.patch
Patch1: 0002-remove-useless-dependency-hitrace-hisysevent.patch
Patch2: 0003-remove-useless-dependency-compile.patch
Patch3: 0004-add-huks-component.patch
Patch4: 0005-add-third-part-component.patch
Patch5: 0006-establish-kvstore-dependence-on-boundscheck.patch
BuildRequires: libatomic libicu-devel libxml2-devel openssl-devel
BuildRequires: distributed-build distributed-build_lite hilog distributed-utils
BuildRequires: jsoncpp jsoncpp-devel
Requires: jsoncpp jsoncpp-devel hilog distributed-utils
%description
KV database (KV store) is developed based on the KV storage capability provided by the current public basic library,and provides key-value pair data management capabilities for device applications. On a platform with processes, the parameter management provided by KV storage is accessed by a single process and cannot be used by other processes. On such platforms, KV storage is loaded in the application process as a basic library to ensure that it is not accessed by other processes.
%prep
rm -rf %{_builddir}/*
# 在rpmbuild/BUILD目录下构建变成目录结构
cd %{_builddir}
cp -rp %{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
mv build/openeuler/vendor %{_builddir}/
cp -rf build/openeuler/compiler_gn/* %{_builddir}/
%setup -q -T -a 0 -c -n %{kv_store_dir}
mv %{kv_store_dir}%{name}-%{oh_version} %{kv_store_dir}kv_store
%patch0 -p1 -d %{kv_store_dir}kv_store
%patch1 -p1 -d %{kv_store_dir}kv_store
%patch2 -p1 -d %{kv_store_dir}kv_store
%patch3 -p1 -d %{_builddir}/base/security
%patch4 -p1 -d %{_builddir}/third_party
%patch5 -p1 -d %{_builddir}/foundation
%build
cd %{_builddir}
rm -rf %{_builddir}/out
%ifarch x86_64
./build.sh --product-name openeuler --target-cpu x86_64
%endif
%ifarch aarch64
./build.sh --product-name openeuler --target-cpu arm64
%endif
%install
install -d -m 0755 %{buildroot}%{_includedir}/kv_store
install -d -m 0755 %{buildroot}%{_libdir}
install -d %{buildroot}%{frameworks_dir}
install -d %{buildroot}%{interface_dir}
install -d -m 0755 %{buildroot}/system/lib64
cp %{SOURCE1} %{buildroot}%{frameworks_dir}/BUILD.gn
cp %{SOURCE2} %{buildroot}%{interface_dir}/BUILD.gn
cp %{SOURCE3} %{buildroot}%{bundle_dir}
%ifarch aarch64
module_out_path="out/openeuler/linux_clang_arm64/distributeddatamgr/kv_store"
header_out_path="out/openeuler/innerkits/linux-arm64/kv_store"
%endif
%ifarch x86_64
module_out_path="out/openeuler/linux_clang_x86_64/distributeddatamgr/kv_store"
header_out_path="out/openeuler/innerkits/linux-x86_64/kv_store"
%endif
install -m 0755 %{_builddir}/${module_out_path}/*.so %{buildroot}%{_libdir}
install -m 0755 %{_builddir}/${module_out_path}/*.so %{buildroot}/system/lib64/
# 对外头文件使用kv_store功能的头文件
find %{_builddir}/${header_out_path} -name *.h -print0 | xargs -0 -i cp -rf {} %{buildroot}%{_includedir}/kv_store/
cp -vf %{_builddir}/foundation/distributeddatamgr/kv_store/frameworks/innerkitsimpl/rdb/include/*.h %{buildroot}%{_includedir}/kv_store/
# 导出所有的头文件,给其他组件编译使用
pushd %{_builddir}/foundation/distributeddatamgr/kv_store
for include_file in `find . \( -name kvstoremock -o -name test -o -name jskitsimpl \) -prune -o -name "*.h" -type f`
do
if [[ ${include_file} != *.h ]]; then
continue
fi
cp --parents ${include_file} %{buildroot}%{bundle_dir}
done
popd
%files
%{_libdir}/*.so
%{_includedir}/kv_store/*
%{bundle_dir}/*
/system/*
%changelog
* Fri Aug 04 2023 Yuying Mu <muyuying1@huawei.com> - 1.0.0-3
- Disassemble the original patch according to its function.
* Thu Aug 03 2023 Peng He <hepeng68@huawei.com> - 1.0.0-2
- Add requires and rectify the contents of the RPM package.
* Tue Jul 18 2023 Ge Wang <wang__ge@126.com> - 1.0.0-1
- init package

20
frameworks.BUILD.gn Normal file
View File

@ -0,0 +1,20 @@
import("//build/ohos.gni")
config("distrdb_config") {
include_dirs = [
"interfaces/include",
"interfaces/include/relational",
"include"
# "/usr/include/kv_store",
# "/usr/include/openssl",
]
libs = [ "distributeddb.z" ]
}
group("distributeddb") {
public_configs = [ ":distrdb_config" ]
}
group("build_module") {
deps = [ ":distributeddb" ]
}

20
interface.BUILD.gn Normal file
View File

@ -0,0 +1,20 @@
import("//build/ohos.gni")
group("build_module") {
deps = [ ":distributeddata_inner" ]
}
config("distributeddatall_config") {
include_dirs = [
"include",
"../../../frameworks/innerkitsimpl/rdb/include",
"../../../frameworks/innerkitsimpl/object/include",
"../../../frameworks/innerkitsimpl/distributeddatafwk/include",
"//commonlibrary/c_utils/base/include",
]
libs = [ "distributeddata_inner.z" ]
}
group("distributeddata_inner") {
public_configs = [ ":distributeddatall_config" ]
}