diff --git a/0000-change-set-for-obs-build.patch b/0000-change-set-for-obs-build.patch new file mode 100644 index 0000000000000000000000000000000000000000..7fa7a2f8aa7313521a77d318d5e738a3759f0631 --- /dev/null +++ b/0000-change-set-for-obs-build.patch @@ -0,0 +1,73 @@ +diff -Naur build-OpenHarmony-v3.0.2-LTS/config/sanitizers/BUILD.gn build-OpenHarmony-v3.0.2-LTS-path2/config/sanitizers/BUILD.gn +--- build-OpenHarmony-v3.0.2-LTS/config/sanitizers/BUILD.gn 2022-02-26 17:17:05.000000000 +0800 ++++ build-OpenHarmony-v3.0.2-LTS-path2/config/sanitizers/BUILD.gn 2022-07-14 11:50:09.927655500 +0800 +@@ -678,6 +678,8 @@ + } + } + ++ print(_clang_rt_libs_dir) ++ + foreach(rt_lib, _dso_names) { + _clang_rt_dso_paths += [ "$_clang_rt_libs_dir/${rt_lib}" ] + } +diff -Naur build-OpenHarmony-v3.0.2-LTS/loader/preloader/platforms.template build-OpenHarmony-v3.0.2-LTS-path2/loader/preloader/platforms.template +--- build-OpenHarmony-v3.0.2-LTS/loader/preloader/platforms.template 2022-07-14 11:49:08.352875000 +0800 ++++ build-OpenHarmony-v3.0.2-LTS-path2/loader/preloader/platforms.template 2022-07-14 11:06:07.951920300 +0800 +@@ -12,6 +12,12 @@ + "target_cpu": "arm", + "toolchain": "//build/toolchain/linux:arm", + "parts_config": "./parts.json" ++ }, ++ { ++ "target_os": "ohos", ++ "target_cpu": "x86_64", ++ "toolchain": "//build/toolchain/linux:x86_64", ++ "parts_config": "./parts.json" + } + ] + } +diff -Naur build-OpenHarmony-v3.0.2-LTS/toolchain/linux/BUILD.gn build-OpenHarmony-v3.0.2-LTS-path2/toolchain/linux/BUILD.gn +--- build-OpenHarmony-v3.0.2-LTS/toolchain/linux/BUILD.gn 2022-07-14 11:49:08.511178900 +0800 ++++ build-OpenHarmony-v3.0.2-LTS-path2/toolchain/linux/BUILD.gn 2022-07-14 11:10:51.681272300 +0800 +@@ -25,6 +25,8 @@ + tool_path = rebase_path("//toolchain/bin", root_build_dir) + toolprefix = "${tool_path}/aarch64-openeuler-linux-gnu-" + ++ toolprefix = "" ++ + cc = "${toolprefix}gcc" + cxx = "${toolprefix}g++" + +@@ -45,6 +47,8 @@ + tool_path = rebase_path("//toolchain/bin", root_build_dir) + toolprefix = "${tool_path}/arm-openeuler-linux-gnu-" + ++ toolprefix = "" ++ + cc = "${toolprefix}gcc" + cxx = "${toolprefix}g++" + +@@ -120,4 +124,23 @@ + current_os = "linux" + is_clang = false + } ++} ++ ++gcc_toolchain("x86_64") { ++ cc = "gcc" ++ cxx = "g++" ++ ++ readelf = "readelf" ++ nm = "nm" ++ ar = "ar" ++ ld = cxx ++ ++ # Output linker map files for binary size analysis. ++ enable_linker_map = true ++ ++ toolchain_args = { ++ current_cpu = "x86_64" ++ current_os = "linux" ++ is_clang = false ++ } + } diff --git a/README.md b/README.md index 996fc270bae88a42fef30e2ff1e5a0b0699b23d4..fa749cda547e8a68599a2f5f2c701d75e48c0bcb 100644 --- a/README.md +++ b/README.md @@ -1,37 +1,37 @@ -# dsoftbus - -#### 介绍 -openEuler embedded softbus capability support - -#### 软件架构 -软件架构说明 - - -#### 安装教程 - -1. xxxx -2. xxxx -3. xxxx - -#### 使用说明 - -1. xxxx -2. xxxx -3. xxxx - -#### 参与贡献 - -1. Fork 本仓库 -2. 新建 Feat_xxx 分支 -3. 提交代码 -4. 新建 Pull Request - - -#### 特技 - -1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md -2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) -3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 -4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 -5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) -6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) +# dsoftbus + +#### 介绍 +OpenEuler supports distributed softbus capability, which is part of openEuler embedded capability + +#### 软件架构 +软件架构说明 + + +#### 安装教程 + +1. xxxx +2. xxxx +3. xxxx + +#### 使用说明 + +1. xxxx +2. xxxx +3. xxxx + +#### 参与贡献 + +1. Fork 本仓库 +2. 新建 Feat_xxx 分支 +3. 提交代码 +4. 新建 Pull Request + + +#### 码云特技 + +1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md +2. 码云官方博客 [blog.gitee.com](https://blog.gitee.com) +3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解码云上的优秀开源项目 +4. [GVP](https://gitee.com/gvp) 全称是码云最有价值开源项目,是码云综合评定出的优秀开源项目 +5. 码云官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) +6. 码云封面人物是一档用来展示码云会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) \ No newline at end of file diff --git a/dsoftbus.spec b/dsoftbus.spec new file mode 100644 index 0000000000000000000000000000000000000000..5341046452a95b0e50f9d60be7f449517fa169f2 --- /dev/null +++ b/dsoftbus.spec @@ -0,0 +1,217 @@ +%define debug_package %{nil} +%global source0_name dsoftbus_standard +%global source0_release v3.1.2-release +%global source1_name yocto-embedded-tools +%global source1_release v1.0.0-release +%global source2_name embedded-ipc +%global source2_release v1.0.0-release +%global source3_name libboundscheck +%global source3_release v1.1.11 +%global source4_name gn-linux-arm64 + +Name: dsoftbus +Version: 1.0.0 +Release: 1 +Summary: openEuler embedded softbus capability support +License: Apache License 2.0 +Url: https://openeuler.gitee.io/yocto-meta-openeuler/features/distributed_softbus.html +Source0: https://gitee.com/openeuler/%{source0_name}/repository/archive/%{source0_release}.tar.gz #/%{source0_name}-%{source0_release}.tar.gz +Source1: https://gitee.com/openeuler/%{source1_name}/repository/archive/%{source1_release}.tar.gz #/%{source1_name}-%{source1_release}.tar.gz +Source2: https://gitee.com/openeuler/%{source2_name}/repository/archive/%{source2_release}.tar.gz #/%{source2_name}-%{source2_release}.tar.gz +Source3: https://gitee.com/src-openeuler/%{source3_name}/raw/openEuler-22.03-LTS-Next/%{source3_name}-%{source3_release}.tar.gz +Source4: https://chrome-infra-packages.appspot.com/p/gn/gn/linux-arm64/+/DC9187N-24PO5pEFOlVDm4kNr7ewdhh-Lp73tDNUY5QC #/%{source4_name}.zip + +Patch0000: 0000-change-set-for-obs-build.patch + +BuildRequires: gcc, g++, cmake, python, zip, unzip, ninja-build, git + +%description +OpenEuler supports distributed softbus capability, which is part of openEuler's embedded capability + +%prep +# Create the directories needed for the build +dsoftbus_build_tools="%{_builddir}/dsoftbus_build_tools" +dsoftbus_build_dir="%{_builddir}/dsoftbus_build" +dsoftbus_prebuilts_build_tools="${dsoftbus_build_dir}/prebuilts/build-tools/linux-x86/bin" +dsoftbus_thirdparty="${dsoftbus_build_dir}/third_party" +dsoftbus_utils="${dsoftbus_build_dir}/utils" +dsoftbus_src="${dsoftbus_build_dir}/foundation/communication" +dsoftbus_hichain="${dsoftbus_build_dir}/base/security" + +mkdir -p ${dsoftbus_prebuilts_build_tools} +mkdir -p ${dsoftbus_thirdparty} +mkdir -p ${dsoftbus_utils} +mkdir -p ${dsoftbus_src} +mkdir -p ${dsoftbus_hichain} + +# Decompressing the compressed package +%setup -q -T -D -b 0 -n %{source0_name}-%{source0_release} +%setup -q -T -D -b 1 -n %{source1_name}-%{source1_release} +%setup -q -T -D -b 2 -n %{source2_name}-%{source2_release} +%setup -q -T -D -b 3 -n %{source3_name}-%{source3_release} + +cd %{_builddir} +mv %{source0_name}-%{source0_release} %{source0_name} +mv %{source1_name}-%{source1_release} %{source1_name} +mv %{source2_name}-%{source2_release} %{source2_name} +mv %{source3_name}-%{source3_release} %{source3_name} +mkdir %{_builddir}/libboundscheck-v1.1.11 + +mv %{_builddir}/yocto-embedded-tools/dsoftbus ${dsoftbus_build_tools} +unzip -d %{_builddir}/gn_aarch/ %{SOURCE4} + +# Unzip the subzip package contained in the Sourcex +build="build-OpenHarmony-v3.0.2-LTS" +gn="gn-linux-x86-1717" +ninja="ninja-linux-x86-1.10.1" +cJSON="third_party_cJSON-OpenHarmony-v3.1.2-Release" +jinja2="third_party_jinja2-OpenHarmony-v3.1.2-Release" +libcoap="third_party_libcoap-OpenHarmony-v3.1.2-Release" +markupsafe="third_party_markupsafe-OpenHarmony-v3.1.2-Release" +mbedtls="third_party_mbedtls-OpenHarmony-v3.1.2-Release" +openssl="third_party_openssl-OpenHarmony-v3.1.2-Release" +utils="commonlibrary_c_utils-OpenHarmony-v3.1.2-Release" +huks="security_huks-OpenHarmony-v3.1.2-Release" +deviceauth="security_device_auth-OpenHarmony-v3.1.2-Release" + + +# unpack build +unzip -qd ${dsoftbus_build_dir} ${dsoftbus_build_tools}/build/${build}.zip +mv ${dsoftbus_build_dir}/${build} ${dsoftbus_build_dir}/build + +# unpack build_tools +%ifarch x86_64 +for i in $gn $ninja +do + tar -C ${dsoftbus_prebuilts_build_tools} -zxf ${dsoftbus_build_tools}/build_tools/${i}.tar.gz +done +%endif + +%ifarch aarch64 + ninja_dir=$(which ninja) + cp -rf %{_builddir}/gn_aarch/* ${dsoftbus_prebuilts_build_tools} + cp ${ninja_dir[0]} ${dsoftbus_prebuilts_build_tools} +%endif + +# unpack third_party +for i in cJSON jinja2 libcoap markupsafe mbedtls openssl +do +pkg=`eval echo '$'"$i"` + unzip -qd ${dsoftbus_thirdparty} ${dsoftbus_build_tools}/third_party/${i}/${pkg}.zip + mv ${dsoftbus_thirdparty}/${pkg} ${dsoftbus_thirdparty}/${i} +done + +# unpack hichain +for i in huks deviceauth +do +pkg=`eval echo '$'"$i"` + unzip -qd ${dsoftbus_hichain} ${dsoftbus_build_tools}/hichain/${i}/${pkg}.zip + mv ${dsoftbus_hichain}/${pkg} ${dsoftbus_hichain}/${i} +done + +# unpack boundcheck +mv %{_builddir}/libboundscheck ${dsoftbus_thirdparty}/bounds_checking_function + +# unpack utils +unzip -qd ${dsoftbus_utils} ${dsoftbus_build_tools}/utils/${utils}.zip +mv ${dsoftbus_utils}/${utils} ${dsoftbus_utils}/native + +# init_dsoftbus_selfcode +toolchain_path="/usr1/openeuler/gcc/openeuler_gcc_arm64le" +build_patch="0001-add-dsoftbus-build-support-for-embedded-env.patch" +hichain_patch="0002-support-hichian-for-openeuler.patch" +ipc_patch="0003-add-deviceauth-ipc-sdk-compile.patch" +utils_patch="0001-Adaptation-for-dsoftbus.patch" +boundscheck_patch="0001-Adaptation-for-dsoftbus.patch" + +mbedtls_patch="0001-Adaptation-for-dsoftbus-v3.1.2.patch" +mbedtls_cve_001_patch="0002-fix-CVE-2021-43666.patch" +mbedtls_cve_002_patch="0003-fix-CVE-2021-45451.patch" +openssl_patch="0001-support-openssl-for-dsoftbus.patch" +huks_patch="0001-support-huks-for-openeuler.patch" +deviceauth_patch_001="0001-support-deviceauth-for-openeuler.patch" +deviceauth_patch_002="0002-adapter-deviceauth-ipc-service.patch" + +# init gn root +ln -s ${dsoftbus_build_dir}/build/build_scripts/build.sh ${dsoftbus_build_dir}/build.sh +ln -s ${dsoftbus_build_dir}/build/core/gn/dotfile.gn ${dsoftbus_build_dir}/.gn + +# link selfcode +ln -s ${dsoftbus_build_tools}/productdefine ${dsoftbus_build_dir}/productdefine +ln -s ${dsoftbus_build_tools}/depend ${dsoftbus_build_dir}/depend +ln -s %{_builddir}/embedded-ipc ${dsoftbus_build_dir}/depend/ipc +ln -s %{_builddir}/dsoftbus_standard ${dsoftbus_src}/dsoftbus + +# link toolchain +ln -s ${toolchain_path} ${dsoftbus_build_dir}/toolchain + +# do patch +patch -p1 -d ${dsoftbus_build_dir}/build < ${dsoftbus_build_tools}/build/${build_patch} +patch -p1 -d ${dsoftbus_build_dir}/build < ${dsoftbus_build_tools}/build/${hichain_patch} +patch -p1 -d ${dsoftbus_build_dir}/build < ${dsoftbus_build_tools}/build/${ipc_patch} +patch -p1 -d ${dsoftbus_utils}/native < ${dsoftbus_build_tools}/utils/${utils_patch} +patch -p1 -d ${dsoftbus_thirdparty}/bounds_checking_function < ${dsoftbus_build_tools}/bounds_checking_function/${boundscheck_patch} +patch -p1 -d ${dsoftbus_thirdparty}/mbedtls < ${dsoftbus_build_tools}/third_party/mbedtls/${mbedtls_patch} +patch -p1 -d ${dsoftbus_thirdparty}/mbedtls < ${dsoftbus_build_tools}/third_party/mbedtls/${mbedtls_cve_001_patch} +patch -p1 -d ${dsoftbus_thirdparty}/mbedtls < ${dsoftbus_build_tools}/third_party/mbedtls/${mbedtls_cve_002_patch} +patch -p1 -d ${dsoftbus_thirdparty}/openssl < ${dsoftbus_build_tools}/third_party/openssl/${openssl_patch} +patch -p1 -d ${dsoftbus_hichain}/huks < ${dsoftbus_build_tools}/hichain/huks/${huks_patch} +patch -p1 -d ${dsoftbus_hichain}/deviceauth < ${dsoftbus_build_tools}/hichain/deviceauth/${deviceauth_patch_001} +patch -p1 -d ${dsoftbus_hichain}/deviceauth < ${dsoftbus_build_tools}/hichain/deviceauth/${deviceauth_patch_002} + +%patch -p1 -d ${dsoftbus_build_dir}/build + +%ifarch x86_64 + sed -i 's/"target_cpu": "arm64"/"target_cpu": "x86_64"/' ${dsoftbus_build_tools}/productdefine/common/device/openEuler.json +%endif + +%build +rm -rf %{_builddir}/dsoftbus_build/out +cd %{_builddir}/dsoftbus_build +./build.sh --product-name openEuler + +%install +dsoftbus_build_dir="%{_builddir}/dsoftbus_build" +%ifarch x86_64 + dsoftbus_release_dir_name="ohos-x86_64-release" +%endif +%ifarch aarch64 + dsoftbus_release_dir_name="ohos-arm64-release" +%endif + +install -d %{buildroot}/%{_includedir}/dsoftbus +install -d %{buildroot}/%{_libdir} +install -d %{buildroot}/%{_bindir} + +install -d %{buildroot}/data/data/deviceauth/ + +# prepare so +install -m 0755 ${dsoftbus_build_dir}/out/${dsoftbus_release_dir_name}/common/common/*.so %{buildroot}/%{_libdir} +install -m 0755 ${dsoftbus_build_dir}/out/${dsoftbus_release_dir_name}/communication/dsoftbus_standard/*.so %{buildroot}/%{_libdir} +install -m 0755 ${dsoftbus_build_dir}/out/${dsoftbus_release_dir_name}/security/huks/*.so %{buildroot}/%{_libdir} +install -m 0755 ${dsoftbus_build_dir}/out/${dsoftbus_release_dir_name}/security/deviceauth_standard/*.so %{buildroot}/%{_libdir} + +# prepare bin +install -m 0755 ${dsoftbus_build_dir}/out/${dsoftbus_release_dir_name}/communication/dsoftbus_standard/softbus_server_main %{buildroot}/%{_bindir} + +# prepare head files +install -m 554 \ +${dsoftbus_build_dir}/foundation/communication/dsoftbus/interfaces/kits/discovery/*.h \ +${dsoftbus_build_dir}/foundation/communication/dsoftbus/interfaces/kits/common/*.h \ +${dsoftbus_build_dir}/foundation/communication/dsoftbus/interfaces/kits/bus_center/*.h \ +${dsoftbus_build_dir}/foundation/communication/dsoftbus/interfaces/kits/transport/*.h \ +${dsoftbus_build_dir}/foundation/communication/dsoftbus/core/common/include/softbus_errcode.h \ +${dsoftbus_build_dir}/base/security/deviceauth/interfaces/innerkits/*.h \ +${dsoftbus_build_dir}/third_party/cJSON/*.h \ +${dsoftbus_build_dir}/third_party/bounds_checking_function/include/*.h \ + %{buildroot}/%{_includedir}/dsoftbus + +%files +%{_includedir}/dsoftbus/* +%{_bindir}/softbus_server_main +%{_libdir}/*.so +/data/data + +%changelog +* Tue Nov 22 2022 liheavy - 1.0.0-1 +- init dsoftbus \ No newline at end of file diff --git a/dsoftbus_standard-v3.1.2-release.tar.gz b/dsoftbus_standard-v3.1.2-release.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..7ab7050da5e35472a821544f156876faf5ad02de Binary files /dev/null and b/dsoftbus_standard-v3.1.2-release.tar.gz differ diff --git a/embedded-ipc-v1.0.0-release.tar.gz b/embedded-ipc-v1.0.0-release.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..292f76b5e50ff61aa764cf3066986c704686f8d0 Binary files /dev/null and b/embedded-ipc-v1.0.0-release.tar.gz differ diff --git a/gn-linux-arm64.zip b/gn-linux-arm64.zip new file mode 100644 index 0000000000000000000000000000000000000000..4daca8d4b2787a553bb67f6935c687d5b5af8a05 Binary files /dev/null and b/gn-linux-arm64.zip differ diff --git a/libboundscheck-v1.1.11.tar.gz b/libboundscheck-v1.1.11.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..2a4d2717669d4abdb81af062e80cdc00f27e82ec Binary files /dev/null and b/libboundscheck-v1.1.11.tar.gz differ diff --git a/yocto-embedded-tools-v1.0.0-release.tar.gz b/yocto-embedded-tools-v1.0.0-release.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..6613ae1eb60170ed45cba69e8a1525668f864019 Binary files /dev/null and b/yocto-embedded-tools-v1.0.0-release.tar.gz differ