diff --git a/thirdparty/lizard-1.0/HPKBUILD b/thirdparty/lizard-1.0/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..e58c6ee4eab6ac6a1e16ab36a47fd5f5310f2dcc --- /dev/null +++ b/thirdparty/lizard-1.0/HPKBUILD @@ -0,0 +1,71 @@ +# 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: wangjialun <2271411@stu.neu.edu.cn>, zhangqian<2371418@stu.neu.edu.cn>, wangyihao<2471389@stu.neu.edu.cn>, wangying +# Maintainer: wangyihao<2471389@stu.neu.edu.cn>, wangjialun<2271411@stu.neu.edu.cn>, zhangqian<2371418@stu.neu.edu.cn>, wangying + +pkgname=lizard-1.0 +pkgver=v1.0 +pkgrel=0 +pkgdesc="lizard is an efficient compressor with very fast decompression." +url="https://github.com/inikep/lizard/tree/v1.0" +archs=("armeabi-v7a" "arm64-v8a") +license=("BSD 2-Clause license && GPLv2 license") +depends=() +makedepends=() +source="https://github.com/inikep/lizard/archive/refs/tags/v1.0.zip" + +downloadpackage=true +autounpack=true +buildtools=make + +builddir=lizard-1.0 +packagename=lizard-1.0.zip + +source envset.sh + +prepare() { + cp -rf $builddir $builddir-$ARCH-build + if [ $ARCH == "armeabi-v7a" ];then + setarm32ENV + elif [ $ARCH == "arm64-v8a" ];then + setarm64ENV + else + echo "Not support ${ARCH} yet" + return -1 + fi +} + +build() { + make -j4 -C $builddir-$ARCH-build VERBOSE=1 >> $builddir-$ARCH-build/build.log 2>&1 + ret=$? + return $ret +} + +package() { + cd $builddir-$ARCH-build + make install PREFIX=$LYCIUM_ROOT/usr/$pkgname/$ARCH >> `pwd`/build.log 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + + +check() { + echo "The test must be on an OpenHarmony device!" +} + + +cleanbuild() { + rm -rf ${PWD}/$builddir $builddir-armeabi-v7a-build $builddir-arm64-v8a-build #${PWD}/$packagename +} \ No newline at end of file diff --git a/thirdparty/lizard-1.0/HPKCHECK b/thirdparty/lizard-1.0/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..bb2e1b2f6f2940fb5b43d6bc54dd1f802a071cb5 --- /dev/null +++ b/thirdparty/lizard-1.0/HPKCHECK @@ -0,0 +1,36 @@ +# 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: wangjialun <2271411@stu.neu.edu.cn>, zhangqian<2371418@stu.neu.edu.cn>, wangyihao<2471389@stu.neu.edu.cn> , wangying +# Maintainer: wangyihao<2471389@stu.neu.edu.cn>, wangjialun<2271411@stu.neu.edu.cn>, zhangqian<2371418@stu.neu.edu.cn>, wangying + +source HPKBUILD > /dev/null 2>&1 # 导入HPKBUILD文件 +logfile=${LYCIUM_THIRDPARTY_ROOT}/${pkgname}/${pkgname}_${ARCH}_${OHOS_SDK_VER}_test.log + +# 在OH环境执行测试的接口 +openharmonycheck() { + res=0 + cd ${builddir}/${ARCH}-build # 进入到测试目录 + #1.自行推送图片或文件到测试目录,以供测试。这里使用名为cat.jpg的图片 + #2.执行 ./lizard -z cat.jpg cat_output.liz 将cat.jpg 压缩成 cat_output.liz + #3.执行 ./lizard -d cat_output.liz cat2.jpg 将cat_output.liz 解压为 cat2.jpg + ./lizard -z cat.jpg cat_output.liz >> $logfile 2>&1 + ./lizard -d cat_output.liz cat2.jpg >> $logfile 2>&1 + res=$? + if [ $res -ne 0 ];then + mkdir ${LYCIUM_FAULT_PATH}/${pkgname} + cp Testing/Temporary/LastTest.log ${LYCIUM_FAULT_PATH}/${pkgname}/ + fi + cd $OLDPWD + return $res +} \ No newline at end of file diff --git a/thirdparty/lizard-1.0/README.OpenSource b/thirdparty/lizard-1.0/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..e4efb94e4babb2a7eb29d57852d850cd657095e1 --- /dev/null +++ b/thirdparty/lizard-1.0/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "lizard-1.0", + "License": "BSD 2-Clause license && GPLv2 license", + "License File": "https://github.com/inikep/lizard/blob/lizard/LICENSE", + "Version Number": "v1.0", + "Owner": "2942375747@qq.com", + "Upstream URL": "https://github.com/inikep/lizard", + "Description": "lizard is an efficient compressor with very fast decompression." + } +] \ No newline at end of file diff --git a/thirdparty/lizard-1.0/README_zh.md b/thirdparty/lizard-1.0/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..a8ad9c2f84dd23beb070d2938c80a6711d505d5d --- /dev/null +++ b/thirdparty/lizard-1.0/README_zh.md @@ -0,0 +1,9 @@ +# lizard-1.0三方库说明 +## 功能简介 +Lizard是一个高效的压缩器,具有非常快的解压速度。 +## 三方库版本: +- v1.0 +## 使用约束: +- [IDE和SDK版本](../../docs/constraint.md) +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) \ No newline at end of file diff --git a/thirdparty/lizard-1.0/SHA512SUM b/thirdparty/lizard-1.0/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..1209a89ae82176c29e61ef6392efce7d01d9f4b6 --- /dev/null +++ b/thirdparty/lizard-1.0/SHA512SUM @@ -0,0 +1 @@ +48682a1a7c7f8aa16c7a9b89445f3cfb54d238421d9a66a5b9a781a6b6a224391a2f10503d5075132a4cbe81615587a539680b2e57b9174060bee2458a727826 lizard-1.0.zip \ No newline at end of file diff --git a/thirdparty/lizard-1.0/docs/hap_integrate.md b/thirdparty/lizard-1.0/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..9b12a547400afcb0035973ad3a3f0a2e4900d2ab --- /dev/null +++ b/thirdparty/lizard-1.0/docs/hap_integrate.md @@ -0,0 +1,83 @@ +# lizard 集成到应用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/lizard-1.0 #三方库lizard-1.0的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── HPKCHECK #测试脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md #三方库简介 + ``` + +- 在lycium目录下编译三方库 + + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ```shell + cd lycium + ./build.sh lizard-1.0 + ``` + +- 三方库头文件及生成的库 + + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ```shell + lizard-1.0/arm64-v8a lizard-1.0/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的头文件和库文件拷贝到该目录下,将编译生成的动态库(动态库名字带版本号和不带版本号的都需要)拷贝到工程的libs目录下。如下图所示: +   + +  ![thirdparty_install_dir](pic/lizard_install_dir.png) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + + ```shell + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/lizard/${OHOS_ARCH}/lib/liblizard.so) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/lizard/${OHOS_ARCH}/include) + ``` + +## 测试三方库 +- 编译出可执行的文件,使用原库自带的测试用例来做测试。本库执行demo验证其功能 [准备三方库测试环境](../../../lycium/README.md#3ci环境准备) +- 进入到构建目录下的example目录,运行demo(注意arm64-v8a为构建64位的目录,armeabi-v7a为构建32位的目录)。 + 1.自行推送图片或文件到测试目录,以供测试。这里使用名为cat.jpg的图片 + 2.执行:./lizard -z cat.jpg cat_output.liz 将cat.jpg 压缩成 cat_output.liz + 3.执行:./lizard -d cat_output.liz cat2.jpg 将cat_output.liz 解压为 cat2.jpg + 执行结果如图所示: + +```shell + cd /data/tpc_c_cplusplus/thirdparty/lizard-1.0/lizard-1.0/arm64-v8a-build + ./lizard -z cat.jpg cat_output.liz + ./lizard -d cat_output.liz cat2.jpg +``` + ![lizard_test](pic/lizard_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) \ No newline at end of file diff --git a/thirdparty/lizard-1.0/docs/pic/lizard_install_dir.png b/thirdparty/lizard-1.0/docs/pic/lizard_install_dir.png new file mode 100644 index 0000000000000000000000000000000000000000..25f836752ce5fd802a2b9250a3383d617f12c949 Binary files /dev/null and b/thirdparty/lizard-1.0/docs/pic/lizard_install_dir.png differ diff --git a/thirdparty/lizard-1.0/docs/pic/lizard_test.png b/thirdparty/lizard-1.0/docs/pic/lizard_test.png new file mode 100644 index 0000000000000000000000000000000000000000..1c36b88ea4d65d275650d96b846442a67a8221ee Binary files /dev/null and b/thirdparty/lizard-1.0/docs/pic/lizard_test.png differ