diff --git a/thirdparty/giflib/HPKBUILD b/thirdparty/giflib/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..facf2ad6d59513979fa4e752b6c624d658cd2d9b --- /dev/null +++ b/thirdparty/giflib/HPKBUILD @@ -0,0 +1,65 @@ +# Contributor: liulihong +# Maintainer: liulihong +pkgname=giflib +pkgver=5.2.1 +pkgrel=0 +pkgdesc="giflib is a library for reading and writing gif images. " +url="https://sourceforge.net/projects/giflib/" +archs=("armeabi-v7a" "arm64-v8a") +license=("1997 Eric S. Raymond") +depends=() +makedepends=() + +source="https://sourceforge.net/projects/$pkgname/files/$pkgname-$pkgver.tar.gz" + +autounpack=true +downloadpackage=true +buildtools="make" + +builddir=$pkgname-$pkgver +packagename=$builddir.tar.gz + +cc= +ar= +# giflib 采用makefile编译构建,为了保留构建环境(方便测试)。因此同一份源码在解压后分为两份,各自编译互不干扰 +prepare() { + cp -rf $builddir $builddir-$ARCH-build + cd $builddir-$ARCH-build + if [ $ARCH == "armeabi-v7a" ] + then + cc=${OHOS_SDK}/native/llvm/bin/arm-linux-ohos-clang + ar=${OHOS_SDK}/native/llvm/bin/llvm-ar + fi + if [ $ARCH == "arm64-v8a" ] + then + cc=${OHOS_SDK}/native/llvm/bin/aarch64-linux-ohos-clang + ar=${OHOS_SDK}/native/llvm/bin/llvm-ar + fi + cd $OLDPWD # 1> /dev/null +} + +build() { + cd $builddir-$ARCH-build + make CC=${cc} AR=${ar} -j4 > `pwd`/build.log 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir-$ARCH-build + make install PREFIX=$LYCIUM_ROOT/usr/$pkgname/$ARCH >> `pwd`/build.log 2>&1 + cd $OLDPWD + unset cc ar +} + +check() { + echo "The test must be on an OpenHarmony device!" + # real test CMD + # TODO +} + +# 清理环境 +cleanbuild(){ + rm -rf ${PWD}/$builddir $builddir-armeabi-v7a-build $builddir-arm64-v8a-build #${PWD}/$packagename +} diff --git a/thirdparty/giflib/README.OpenSource b/thirdparty/giflib/README.OpenSource new file mode 100755 index 0000000000000000000000000000000000000000..85e4046f5074ba397b42b8057c46b66d5e7a18bf --- /dev/null +++ b/thirdparty/giflib/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "giflib", + "License": "giflib COPYING", + "License File": "COPYING", + "Version Number": "5.2.1", + "Owner": "huangminzhong2@huawei.com", + "Upstream URL": "https://sourceforge.net/projects/giflib", + "Description": "giflib is a library for reading and writing gif images." + } +] diff --git a/thirdparty/giflib/README_zh.md b/thirdparty/giflib/README_zh.md new file mode 100755 index 0000000000000000000000000000000000000000..7b9bcb8658b4d4a593532bb4b40e70ba4d85f68d --- /dev/null +++ b/thirdparty/giflib/README_zh.md @@ -0,0 +1,17 @@ +# giflib三方库说明 + +## 功能简介 + +giflib是一个用于阅读和编写gif图像的库 + +## 使用约束 + +- IDE版本:DevEco Studio 3.1 Beta2 +- SDK版本:ohos_sdk_public 3.2.11.9 (API Version 9 Release) +- 三方库版本:5.2.1 +- 当前适配的功能:阅读和编写gif图像 +- [giflib COPYING](https://sourceforge.net/p/giflib/code/ci/master/tree/COPYING) + +## 集成方式 + +- [应用hap包集成](docs/hap_integrate.md) diff --git a/thirdparty/giflib/SHA512SUM b/thirdparty/giflib/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..b13c20ac1a1467f4864e9cd87653029703e9ad13 --- /dev/null +++ b/thirdparty/giflib/SHA512SUM @@ -0,0 +1 @@ +4550e53c21cb1191a4581e363fc9d0610da53f7898ca8320f0d3ef6711e76bdda2609c2df15dc94c45e28bff8de441f1227ec2da7ea827cb3c0405af4faa4736 giflib-5.2.1.tar.gz diff --git a/thirdparty/giflib/docs/hap_integrate.md b/thirdparty/giflib/docs/hap_integrate.md new file mode 100755 index 0000000000000000000000000000000000000000..01fc5169e60fa81fa3974fdaa1171e3c40688661 --- /dev/null +++ b/thirdparty/giflib/docs/hap_integrate.md @@ -0,0 +1,91 @@ +# giflib集成到应用hap + +本库是在RK3568开发板上基于OpenHarmony3.2 Release版本的镜像验证的,如果是从未使用过RK3568,可以先查看[润和RK3568开发板标准系统快速上手](https://gitee.com/openharmony-sig/knowledge_demo_temp/tree/master/docs/rk3568_helloworld)。 + +## 开发环境 + +- ubuntu20.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 3.2.11.9 (API Version 9 Release)](https://gitee.com/link?target=https%3A%2F%2Frepo.huaweicloud.com%2Fopenharmony%2Fos%2F3.2-Release%2Fohos-sdk-windows_linux-public.tar.gz) +- [DevEco Studio 3.1 Beta2](https://gitee.com/link?target=https%3A%2F%2Fcontentcenter-vali-drcn.dbankcdn.cn%2Fpvt_2%2FDeveloperAlliance_package_901_9%2Ff3%2Fv3%2FuJyuq3syQ2ak4hE1QZmAug%2Fdevecostudio-windows-3.1.0.400.zip%3FHW-CC-KV%3DV1%26HW-CC-Date%3D20230408T013335Z%26HW-CC-Expire%3D315360000%26HW-CC-Sign%3D96262721EDC9B34E6F62E66884AB7AE2A94C2A7B8C28D6F7FC891F46EB211A70) +- [准备三方库构建环境](../../../tools/README.md#编译环境准备) +- [准备三方库测试环境](../../../tools/README.md#ci环境准备) + +## 编译三方库 + +- 下载本仓库 + + ```shell + git clone https://gitee.com/openharmony-sig/tpc_c_cplusplus.git --depth=1 + ``` + +- 三方库目录结构 + + ```shell + tpc_c_cplusplus/thirdparty/giflib # 三方库giflib的目录结构如下 + ├── docs # 三方库相关文档的文件夹 + ├── HPKBUILD # 构建脚本 + ├── SHA512SUM # 三方库校验文件 + ├── README.OpenSource # 说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md + ``` + +- 将giflib拷贝至tools/main目录下 + + ```shell + cd tpc_c_cplusplus + cp thirdparty/giflib tools/main -rf + ``` + +- 在tools目录下编译三方库 + + 编译环境的搭建参考[准备三方库构建环境](../../../tools/README.md#编译环境准备) + + ```shell + cd tools + ./build.sh giflib + ``` + +- 三方库头文件及生成的库 + + 在tools目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ```shell + giflib/arm64-v8a giflib/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的库拷贝到该目录下,如下图所示 + +  ![thirdparty_install_dir](../../thirdparty_template/docs/pic/xxx_install_dir.png) + + 其中`xxx`代表三方库名,即为`giflib` + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + + ```shell + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/giflib/${OHOS_ARCH}/lib/libgif.a) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/giflib/${OHOS_ARCH}/include) + ``` + + ![giflib_usage](../../thirdparty_template/docs/pic/xxx_usage.png) + +## 测试三方库 + +三方库的测试使用原库自带的测试用例来做测试,[准备三方库测试环境](../../../tools/README.md#ci环境准备) + +进入到构建目录执行ctest运行测试用例(arm64-v8a-build为构建64位的目录,armeabi-v7a-build为构建32位的目录) + + ![giflib_test](pic/giflib_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/giflib/docs/pic/giflib_test.png b/thirdparty/giflib/docs/pic/giflib_test.png new file mode 100755 index 0000000000000000000000000000000000000000..ff5fe5eac979da990a64d966cf57ed212f6f6db9 Binary files /dev/null and b/thirdparty/giflib/docs/pic/giflib_test.png differ