diff --git a/thirdparty/libpng/HPKBUILD b/thirdparty/libpng/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..423619943a6b68a7dec54aab10f7a532d850e0f3 --- /dev/null +++ b/thirdparty/libpng/HPKBUILD @@ -0,0 +1,96 @@ +# Contributor: Jeff Han +# Maintainer: Jeff Han +pkgname=libpng +pkgver=1.6.39 +pkgrel=0 +pkgdesc="" +url="" +archs=("armeabi-v7a" "arm64-v8a") +license=("PNG Reference Library License version 2") +depends=() +makedepends=() +install= +source="https://sourceforge.net/projects/$pkgname/files/libpng16/$pkgver/$pkgname-$pkgver.tar.xz" + +autounpack=true +downloadpackage=true +buildtools="configure" + +builddir=$pkgname-${pkgver} +packagename=$builddir.tar.xz + +source envset.sh +host= + +prepare() { + mkdir -p $builddir/$ARCH-build + if [ $ARCH == "armeabi-v7a" ] + then + setarm32ENV + host=arm-linux + fi + if [ $ARCH == "arm64-v8a" ] + then + setarm64ENV + host=aarch64-linux + fi +} + +build() { + cd $builddir/$ARCH-build + ../configure "$@" --host=$host --enable-shared --enable-static > `pwd`/build.log 2>&1 + ret=-1 + if [ $LYCIUM_BUILD_OS == "CYGWI" ] + then + make libpng16.la -j4 >> `pwd`/build.log 2>&1 + ret=$? + else + make -j4 >> `pwd`/build.log 2>&1 + ret=$? + fi + cd $OLDPWD + return $ret +} + +package() { + cd $builddir/$ARCH-build + ret=-1 + if [ $LYCIUM_BUILD_OS == "CYGWI" ] + then + make install-libLTLIBRARIES >> `pwd`/build.log 2>&1 + make install-library-links >> `pwd`/build.log 2>&1 + make install-pkgincludeHEADERS >> `pwd`/build.log 2>&1 + make install-header-links >> `pwd`/build.log 2>&1 + make install-pkgconfigDATA >> `pwd`/build.log 2>&1 + ret=$? + else + make install >> `pwd`/build.log 2>&1 + ret=$? + fi + cd $OLDPWD + return $ret +} + +check() { + cd $builddir/$ARCH-build + make pngtest pngunknown pngstest pngvalid pngimage pngcp timepng >> `pwd`/build.log 2>&1 + sed -i '/.*check-TESTS: $(check_PROGRAMS)/c\check-TESTS: #$(check_PROGRAMS)' Makefile + cd $OLDPWD + if [ $ARCH == "armeabi-v7a" ] + then + unsetarm32ENV + fi + if [ $ARCH == "arm64-v8a" ] + then + unsetarm64ENV + fi + unset host + echo "The test must be on an OpenHarmony device!" + # test CMD + # make check-TESTS +} + +# 清理环境 +cleanbuild(){ + rm -rf ${PWD}/$builddir #${PWD}/$packagename +} diff --git a/thirdparty/libpng/README.OpenSource b/thirdparty/libpng/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..1e24263b9c3edfdbee2f0fd2ab645f93f878eeed --- /dev/null +++ b/thirdparty/libpng/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "libpng", + "License": "zlib/libpng License", + "License File": "LICENSE", + "Version Number": "1.6.39", + "Owner": "wupingyuan@huawei.com", + "Upstream URL": "https://sourceforge.net/projects/libpng/files/libpng16/1.6.39/libpng-1.6.39.tar.xz", + "Description": "LIBPNG: Portable Network Graphics support, official libpng repository" + } +] diff --git a/thirdparty/libpng/README_zh.md b/thirdparty/libpng/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..6ec1977412bce53db539f640d7dbb292e748f727 --- /dev/null +++ b/thirdparty/libpng/README_zh.md @@ -0,0 +1,12 @@ +# libpng三方库说明 +## 功能简介 +libpng是一款C语言编写的用来读写PNG文件的库。 +## 使用约束 +- IDE版本:DevEco Studio 3.1 Beta2 +- SDK版本:ohos_sdk_public 3.2.11.9 (API Version 9 Release) +- 三方库版本:1.6.39 +- 当前适配的功能:处理PNG文件的读写 +- [zlib/libpng License](https://sourceforge.net/projects/libpng/) + +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) diff --git a/thirdparty/libpng/SHA512SUM b/thirdparty/libpng/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..3335a8fa3102d53252d47800d238b54e2d8201b4 --- /dev/null +++ b/thirdparty/libpng/SHA512SUM @@ -0,0 +1 @@ +ce233bb58d70b391b7dc858a132a8f9f66a9e30f5b387426317fdd5e76e8395e00ec36324e5e2caec8fda49a3f2b13fe27594a3466fdf2020ec7520e79a608c9 libpng-1.6.39.tar.xz diff --git a/thirdparty/libpng/docs/hap_integrate.md b/thirdparty/libpng/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..4192e45ae238ffb59c3333d04355fc5457c9a0f2 --- /dev/null +++ b/thirdparty/libpng/docs/hap_integrate.md @@ -0,0 +1,67 @@ +# libpng集成到应用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环境准备) +## 编译三方库 +- 下载本仓库 + ``` + git clone https://gitee.com/openharmony-sig/tpc_c_cplusplus.git --depth=1 + ``` +- 三方库目录结构 + ``` + tpc_c_cplusplus/thirdparty/libpng #三方库WavPack的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md + ``` + +- 将libpng拷贝至tools/main目录下 + ``` + cd tpc_c_cplusplus + cp thirdparty/libpng tools/main -rf + ``` +- 在tools目录下编译三方库 + 编译环境的搭建参考[准备三方库构建环境](../../../tools/README.md#编译环境准备) + ``` + cd tools + ./build.sh libpng + ``` +- 三方库头文件及生成的库 + 在tools目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + ``` + libpng/arm64-v8a libpng/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的库拷贝到该目录下,如下图所示 + ![thirdparty_install_dir](pic/libpng_install_dir.jpg) +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + ``` + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libpng/${OHOS_ARCH}/lib/libpng.a) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libpng/${OHOS_ARCH}/include) + ``` + ![libpng_usage](pic/libpng_usage.jpg) +## 测试三方库 +三方库的测试使用原库自带的测试用例来做测试,[准备三方库测试环境](../../../tools/README.md#ci环境准备) + +进入到构建目录执行make check运行测试用例(arm64-v8a-build为构建64位的目录,armeabi-v7a-build为构建32位的目录) + + ![libpng_test](pic/libpng_test.jpg) + +## 参考资料 +- [润和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/libpng/docs/pic/libpng_install_dir.jpg b/thirdparty/libpng/docs/pic/libpng_install_dir.jpg new file mode 100644 index 0000000000000000000000000000000000000000..c1991e26be93ce5ddebfa43b2efdebd143a6a47d Binary files /dev/null and b/thirdparty/libpng/docs/pic/libpng_install_dir.jpg differ diff --git a/thirdparty/libpng/docs/pic/libpng_test.jpg b/thirdparty/libpng/docs/pic/libpng_test.jpg new file mode 100644 index 0000000000000000000000000000000000000000..ce412d688405af5dc9bc69556a8452959019ca6d Binary files /dev/null and b/thirdparty/libpng/docs/pic/libpng_test.jpg differ diff --git a/thirdparty/libpng/docs/pic/libpng_usage.jpg b/thirdparty/libpng/docs/pic/libpng_usage.jpg new file mode 100644 index 0000000000000000000000000000000000000000..bc0081bd59ea8cc1607ee11fcf4435c2d0bec273 Binary files /dev/null and b/thirdparty/libpng/docs/pic/libpng_usage.jpg differ