diff --git a/thirdparty/ytnef/HPKBUILD b/thirdparty/ytnef/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..2e0a95d73542b635523c9c983879e0b3463c2137 --- /dev/null +++ b/thirdparty/ytnef/HPKBUILD @@ -0,0 +1,102 @@ +# 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: Ran Dai +# Maintainer: huangminzhong + +pkgname=ytnef +pkgver=2.1.2 +pkgrel=0 +pkgdesc="Yeraze's TNEF Stream Reader - for winmail.dat files" +url="https://github.com/Yeraze/ytnef" +archs=("arm64-v8a") +license=("GPL-2.0 license") +depends=() +makedepends=() + +source="https://mirror.ghproxy.com/https://github.com/Yeraze/ytnef/archive/refs/tags/v2.1.2.tar.gz" + +autounpack=true +downloadpackage=true + +builddir=${pkgname}-${pkgver} +packagename=$builddir.tar.gz +buildtools="configure" + +source envset.sh +host= + +prepare() { + cp -arf $builddir $builddir-$ARCH-build + if [ $ARCH == "armeabi-v7a" ] + then + setarm32ENV + host=arm-linux + elif [ $ARCH == "arm64-v8a" ] + then + setarm64ENV + host=aarch64-linux + elif [ $ARCH == "x86_64" ] + then + setx86_64ENV + host=x86_64-linux + else + echo "${ARCH} not support" + return -1 + fi +} + +build() { + cd $builddir-$ARCH-build + ./autogen.sh + PKG_CONFIG_LIBDIR="${pkgconfigpath}" ./configure "$@" --host=$host > $buildlog 2>&1 + $MAKE >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir-$ARCH-build + $MAKE install >> $buildlog 2>&1 + cd $OLDPWD +} + +check() { + echo "The test must be on an OpenHarmony device!" +} + +recoverpkgbuildenv() { + unset host + if [ $ARCH == "armeabi-v7a" ] + then + unsetarm32ENV + elif [ $ARCH == "arm64-v8a" ] + then + unsetarm64ENV + elif [ $ARCH == "x86_64" ] + then + unsetx86_64ENV + else + echo "${ARCH} not support" + return -1 + fi +} + +# 清理环境 +cleanbuild() { + rm -rf ${PWD}/$builddir + rm -rf ${PWD}/$builddir-arm64-v8a-build + rm -rf ${PWD}/$builddir-armeabi-v7a-build #${PWD}/$packagename +} + diff --git a/thirdparty/ytnef/HPKCHECK b/thirdparty/ytnef/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..ce8d58c387b887894d8501e9f9ccd6e0ea41cb3d --- /dev/null +++ b/thirdparty/ytnef/HPKCHECK @@ -0,0 +1,33 @@ +# 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: Ran Dai +# Maintainer: huangminzhong + +source HPKBUILD > /dev/null 2>&1 +logfile=${LYCIUM_THIRDPARTY_ROOT}/${pkgname}/${pkgname}_${ARCH}_${OHOS_SDK_VER}_test.log + +openharmonycheck() { + res=0 + cd $builddir-$ARCH-build/test-data + ./test.sh > ${logfile} 2>&1 + res=$? + if [ $res -ne 0 ] + then + mkdir -p ${LYCIUM_FAULT_PATH}/${pkgname} + cp ${logfile} ${LYCIUM_FAULT_PATH}/${pkgname}/ + fi + rm -rf data + cd $OLDPWD + return $res +} diff --git a/thirdparty/ytnef/OAT.xml b/thirdparty/ytnef/OAT.xml new file mode 100644 index 0000000000000000000000000000000000000000..eeb1f946d683c0b81976cd06522096062a6901b9 --- /dev/null +++ b/thirdparty/ytnef/OAT.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/ytnef/README.OpenSource b/thirdparty/ytnef/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..701cfdac6319f6a509802dd0bca85821ba819971 --- /dev/null +++ b/thirdparty/ytnef/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "ytnef", + "License": "GPL-2.0 license", + "License File": "LICENSE", + "Version Number": "ytnef-2.1.2", + "Owner": "huangminzhong2@huawei.com", + "Upstream URL": "https://github.com/Yeraze/ytnef/releases/tag/v2.1.2", + "Description": "Yeraze's TNEF Stream Reader - for winmail.dat files." + } +] diff --git a/thirdparty/ytnef/README_zh.md b/thirdparty/ytnef/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..69e411265b2dd506ab8165e4e2823bb5dfc471c7 --- /dev/null +++ b/thirdparty/ytnef/README_zh.md @@ -0,0 +1,13 @@ +# ytnef三方库说明 +## 功能简介 + +ytnef是一个开源库,实现对tnef流的多种格式附件的解析支持。 + + ## 使用约束 +- IDE版本:DevEco Studio 5.0.3.400SP7 +- SDK版本:ohos_sdk_public 5.0.0.25 (API Version 12 Canary4) +- 三方库版本:ytnef-2.1.2 +- 当前适配的功能:解析tnef格式邮件并提取文本、音频和图片等多种格式的文件数据 + + ## 集成方式 +[应用包hap集成](docs/hap_integrate.md) diff --git a/thirdparty/ytnef/SHA512SUM b/thirdparty/ytnef/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..61913138413106996ab47cb967818fad836d77f7 --- /dev/null +++ b/thirdparty/ytnef/SHA512SUM @@ -0,0 +1 @@ +2b605d8e23309c613c208fa24d113d5720997393a8083565a546857bcc540ed87ad7f7b4b7e1b40aab272ab9646170ea9f3becca6ab81bba9653ffecfe37281c ytnef-2.1.2.tar.gz diff --git a/thirdparty/ytnef/docs/hap_integrate.md b/thirdparty/ytnef/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..2ce0a7439ece041cdce3b2b72f87da87069f1f40 --- /dev/null +++ b/thirdparty/ytnef/docs/hap_integrate.md @@ -0,0 +1,78 @@ +# ytnef集成到应用hap + +本库是在RK3568开发板上基于OpenHarmony3.2 Release版本的镜像验证的,如果是从未使用过RK3568,可以先查看[润和RK3568开发板标准系统快速上手](https://gitee.com/openharmony-sig/knowledge_demo_temp/tree/master/docs/rk3568_helloworld)。 + +## 开发环境 + +- [开发环境准备](../../../docs/hap_integrate_environment.md) + +## 编译三方库 + +- 下载本仓库 + + ```shell + git clone https://gitee.com/openharmony-sig/tpc_c_cplusplus.git --depth=1 + ``` + +- 三方库目录结构 + + ```shell + tpc_c_cplusplus/thirdparty/ytnef #三方库ytnef的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── HPKCHECK #测试脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本、license等信息 + ├── README_zh.md + ``` + +- 在lycium目录下编译三方库 + + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ```shell + cd lycium + ./build.sh ytnef + ``` + +- 三方库头文件及生成的库 + + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ```shell + ytnef/arm64-v8a ytnef/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的库拷贝到该目录下,如下图所示 + + ![thirdparty_install_dir](pic/ytnef_usage_for_ide.png) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + + ```cmake + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/ytnef/${OHOS_ARCH}/include) + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/ytnef/${OHOS_ARCH}/lib/libytnef.a) + ``` + + +## 测试三方库 + +三方库的测试使用原库自带的测试用例来做测试,[准备三方库测试环境](../../../lycium/README.md#3ci环境准备) + +进入到对应版本目录的test-data子目录,执行如下命令./test.sh + + ![ytnef_test](pic/test.png) + + ![ytnef_test](pic/test_result.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/ytnef/docs/pic/test.png b/thirdparty/ytnef/docs/pic/test.png new file mode 100644 index 0000000000000000000000000000000000000000..2f6204030bd2d08344aa7b69e77a1d7fc3ae3fc0 Binary files /dev/null and b/thirdparty/ytnef/docs/pic/test.png differ diff --git a/thirdparty/ytnef/docs/pic/test_result.png b/thirdparty/ytnef/docs/pic/test_result.png new file mode 100644 index 0000000000000000000000000000000000000000..b592c9c5febfe149d614de66166a301599a981a9 Binary files /dev/null and b/thirdparty/ytnef/docs/pic/test_result.png differ diff --git a/thirdparty/ytnef/docs/pic/ytnef_usage_for_ide.png b/thirdparty/ytnef/docs/pic/ytnef_usage_for_ide.png new file mode 100644 index 0000000000000000000000000000000000000000..d05e9c8f3be23c587cc5b405559279a6980b15cf Binary files /dev/null and b/thirdparty/ytnef/docs/pic/ytnef_usage_for_ide.png differ