diff --git a/thirdparty/libwbxml/HPKBUILD b/thirdparty/libwbxml/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..134b6245f10224254dcaad93a97073d1ef3b3d3f --- /dev/null +++ b/thirdparty/libwbxml/HPKBUILD @@ -0,0 +1,62 @@ +# Copyright (c) 2023 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. + +# Contributor: wangyang497@h-partners.com +# Maintainer: wangyang497@h-partners.com + +pkgname=libwbxml +pkgver=0.11.10 +pkgrel=0 +pkgdesc="AES algorithm implementation using C." +url=https://gitee.com/dddddddr/libwbxml +archs=("arm64-v8a" "armeabi-v7a") +license=(MIT) +depends=(libexpat) +makedepends=() +source=https://kkgithub.com/$pkgname/$pkgname/archive/refs/tags/$pkgname-$pkgver.tar.gz +autounpack=true +downloadpackage=true +buildtools= + +builddir=$pkgname-$pkgname-$pkgver +packagename=$pkgname-$pkgver.tar.gz + + +prepare() { + mkdir -p $builddir/$ARCH-build +} + +build() { + cd ${builddir} + PKG_CONFIG_LIBDIR="${pkgconfigpath}" ${OHOS_SDK}/native/build-tools/cmake/bin/cmake -D BUILD_STATIC_LIBS=true "$@" -B${ARCH}-build -S./ > `pwd`/$ARCH-build/build.log 2>&1 || return -1 + ${MAKE} -j4 VERBOSE=1 -C ${ARCH}-build >> `pwd`/$ARCH-build/build.log 2>&1 || return -2 + cd ${OLDPWD} + return 0 +} + +package() { + cd ${builddir} + ${MAKE} -C ${ARCH}-build install >> ${buildlog} 2>&1 || return -1 + cd ${OLDPWD} + return 0 +} + +check() { + echo "The test must be on an OpenHarmony device!" + return 0 +} + +cleanbuild() { + rm -rf ${PWD}/${builddir} + return 0 +} \ No newline at end of file diff --git a/thirdparty/libwbxml/HPKCHECK b/thirdparty/libwbxml/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..955478f9aff25f0710f5cf427803d8dddfcd33eb --- /dev/null +++ b/thirdparty/libwbxml/HPKCHECK @@ -0,0 +1,30 @@ +# Copyright (c) 2023 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. + +# Contributor: wangyang497@h-partners.com +# Maintainer: wangyang497@h-partners.com + +source HPKBUILD > /dev/null 2>&1 +logfile=${LYCIUM_THIRDPARTY_ROOT}/${pkgname}/${pkgname}_${ARCH}_${OHOS_SDK_VER}_test.log + +checkprepare() { + return 0 +} + +openharmonycheck() { + cd ${builddir}/${ARCH}-build/test/tools + ctest > ${logfile} 2>&1 || return -1 + cp ${logfile} ${LYCIUM_FAULT_PATH}/${pkgname}/ + cd ${OLDPWD} + return 0 +} diff --git a/thirdparty/libwbxml/OAT.xml.txt b/thirdparty/libwbxml/OAT.xml.txt new file mode 100644 index 0000000000000000000000000000000000000000..4875919bb0e98131d89494b76d5299c2d0a532b4 --- /dev/null +++ b/thirdparty/libwbxml/OAT.xml.txt @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/libwbxml/README.OpenSource.txt b/thirdparty/libwbxml/README.OpenSource.txt new file mode 100644 index 0000000000000000000000000000000000000000..0922bc404529173027bba425b92b069c51cc6d0d --- /dev/null +++ b/thirdparty/libwbxml/README.OpenSource.txt @@ -0,0 +1,11 @@ +[ + { + "Name": "libwbxml", + "License": "Apache-2.0", + "License File": "https://github.com/RoaringBitmap/CRoaring/blob/master/LICENSE", + "Version Number": "0.11.10", + "Owner": "wangyang497@h-partners.com", + "Upstream URL": "https://github.com/libwbxml/libwbxml/archive/refs/tags/libwbxml-0.11.10.tar.gz", + "Description": "libwbxml library is an open source library written in C specifically for processing WBXML (Wireless Binary XML) documents" + } +] diff --git a/thirdparty/libwbxml/README_zh.md.txt b/thirdparty/libwbxml/README_zh.md.txt new file mode 100644 index 0000000000000000000000000000000000000000..78618aa09183e4cdc7fad13dd252d10eb9ccb53a --- /dev/null +++ b/thirdparty/libwbxml/README_zh.md.txt @@ -0,0 +1,10 @@ +# libwbxml三方库说明 +## 功能简介 +libwbxml库是一个专门用于处理WBXML(Wireless Binary XML)文档的C语言编写的开源库,可以实现wbxml和xml格式之间的相互转换。 +## 使用约束 +- IDE版本:deveco-studio-5.0.3.404 +- SDK版本:ohos_sdk_public 4.0.10.18 (API Version 10 Release) +- 三方库版本:0.11.10 + +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) \ No newline at end of file diff --git a/thirdparty/libwbxml/SHA512SUM.txt b/thirdparty/libwbxml/SHA512SUM.txt new file mode 100644 index 0000000000000000000000000000000000000000..0435db4b3a6c08a6df61cf9c0f388b2bfcaf5de8 --- /dev/null +++ b/thirdparty/libwbxml/SHA512SUM.txt @@ -0,0 +1 @@ +be8097a96ac82618e9e95c1368d502f46eab959e3ac6a5d5866b33d20f710c470df96928aa9bad5e785d2a2773186eadf1df7bcd7b4ffeaf9b05b92c8e1bc8f9 libwbxml-libwbxml-0.11.10.tar.gz \ No newline at end of file diff --git a/thirdparty/libwbxml/docs/hap_integrate.md b/thirdparty/libwbxml/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..c6bc717c91337e76c87c953c6cda4a8f347b34da --- /dev/null +++ b/thirdparty/libwbxml/docs/hap_integrate.md @@ -0,0 +1,74 @@ +# libwbxml集成到应用hap +本库是在RK3568开发板上基于OpenHarmony的镜像验证的,如果是从未使用过RK3568,可以先查看[润和RK3568开发板标准系统快速上手](https://gitee.com/openharmony-sig/knowledge_demo_temp/tree/master/docs/rk3568_helloworld)。 +## 开发环境 +- ubuntu22.04 +- [OpenHarmony3.2Release镜像](https://gitee.com/link?target=https%3A%2F%2Frepo.huaweicloud.com%2Fopenharmony%2Fos%2F3.2-Release%2Fdayu200_standard_arm32.tar.gz) +- [ohos_sdk_public 5.0.0.13 (API Version 12 Release)](https://cidownload.openharmony.cn/version/Master_Version/OpenHarmony_5.0.0.13_dev/20240303_020132/version-Master_Version-OpenHarmony_5.0.0.13_dev-20240303_020132-ohos-sdk-full.tar.gz) +- [DevEco Studio 3.1 Release](https://contentcenter-vali-drcn.dbankcdn.cn/pvt_2/DeveloperAlliance_package_901_9/81/v3/tgRUB84wR72nTfE8Ir_xMw/devecostudio-windows-3.1.0.501.zip?HW-CC-KV=V1&HW-CC-Date=20230621T074329Z&HW-CC-Expire=315360000&HW-CC-Sign=22F6787DF6093ECB4D4E08F9379B114280E1F65DA710599E48EA38CB24F3DBF2) +- [准备三方库构建环境](../../../lycium/README.md#1编译环境准备) +- [准备三方库测试环境](../../../lycium/README.md#3ci环境准备) +## 编译三方库 +- 下载本仓库 + ```shell + git clone https://gitee.com/openharmony-sig/tpc_c_cplusplus.git --depth=1 + ``` + +- 三方库目录结构 + ``` + tpc_c_cplusplus/thirdparty/libxml #三方库的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── HPKCHECK #测试脚本 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md #三方库简介 + ├── OAT.xml #扫描结果文件 + ├── SHA512SUM.txt #校验文件 + ``` + +- 在lycium目录下编译三方库,编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ```shell + cd lycium + ./build.sh libwbxml + ``` + +- 三方库头文件及生成的库,在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ``` + libwbxml/armeabi-v7a libwbxml/arm64-v8a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的头文件拷贝到该目录下,将生成的.so文件拷贝至libs目录下,如下图所示 + + ![libwbxml_install_dir.png](.\pic\libwbxml_install_dir.png) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + ```makefile + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libwbxml/${OHOS_ARCH}/lib/libwbxml2.so) + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libwbxml/${OHOS_ARCH}/lib/libexpat.so) + + + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libwbxml/${OHOS_ARCH}/include) + ``` +## 测试三方库 +三方库的测试使用原库自带的测试用例来做测试,[准备三方库测试环境](../../../lycium/README.md#3ci环境准备) + +进入到构建目录准备测试,32位目录为 armeabi-v7a-build,64位为 arm64-v8a-build,执行可执行文件进行测试 + +```shell +cd tpc_c_cplusplus/thirdparty/libwbxml/libwbxml-79461f8bd49861287c0f1689adb75e7753630e5a/arm64-v8a-build/test/tools +ctest +``` + +![libwbxml_test.png](.\pic\libwbxml_test.png) + +## 参考资料 +- [润和RK3568开发板标准系统快速上手](https://gitee.com/openharmony-sig/knowledge_demo_temp/tree/master/docs/rk3568_helloworld) +- [OpenHarmony三方库地址](https://gitee.com/openharmony-tpc) +- [OpenHarmony知识体系](https://gitee.com/openharmony-sig/knowledge) +- [通过DevEco Studio开发一个NAPI工程](https://gitee.com/openharmony-sig/knowledge_demo_temp/blob/master/docs/napi_study/docs/hello_napi.md) diff --git a/thirdparty/libwbxml/docs/pic/libwbxml_install_dir.png b/thirdparty/libwbxml/docs/pic/libwbxml_install_dir.png new file mode 100644 index 0000000000000000000000000000000000000000..68801207d376ba80a459e36d5ed985167d0fb4b5 Binary files /dev/null and b/thirdparty/libwbxml/docs/pic/libwbxml_install_dir.png differ diff --git a/thirdparty/libwbxml/docs/pic/libwbxml_test.png b/thirdparty/libwbxml/docs/pic/libwbxml_test.png new file mode 100644 index 0000000000000000000000000000000000000000..fab65631289801e1f53648ede18406f773c2d1a7 Binary files /dev/null and b/thirdparty/libwbxml/docs/pic/libwbxml_test.png differ