diff --git a/thirdparty/jbigkit/HPKBUILD b/thirdparty/jbigkit/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..065a98e0e5e64931a060f013ad2d305515b06736 --- /dev/null +++ b/thirdparty/jbigkit/HPKBUILD @@ -0,0 +1,77 @@ +# Contributor: liulihong +# Maintainer: liulihong +pkgname=jbigkit +pkgver=2.1 +pkgrel=0 +pkgdesc="" +url="" +archs=("armeabi-v7a" "arm64-v8a") +license=("GNU General Public License") +depends=() +makedepends=() +install= +source="https://www.cl.cam.ac.uk/~mgk25/$pkgname/download/$pkgname-$pkgver.tar.gz" + +autounpack=true +downloadpackage=true +buildtools="make" + +builddir=$pkgname-${pkgver} +packagename=$builddir.tar.gz + +cc= +# jbigkit 采用makefile编译构建,为了保留构建环境(方便测试)。因此同一份源码在解压后分为两份,分别patch。各自编译互不干扰 +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 + fi + if [ $ARCH == "arm64-v8a" ] + then + cc=${OHOS_SDK}/native/llvm/bin/aarch64-linux-ohos-clang + fi + cd $OLDPWD +} +build() { + cd $builddir-$ARCH-build + make CC=${cc} -j4 > `pwd`/build.log 2>&1 + ret=$? + cd $OLDPWD + return $ret + +} + +package() { + cd $builddir-$ARCH-build + mkdir -p $LYCIUM_ROOT/usr/$pkgname/$ARCH/lib/ + cp libjbig/lib*.a $LYCIUM_ROOT/usr/$pkgname/$ARCH/lib/ + + mkdir -p $LYCIUM_ROOT/usr/$pkgname/$ARCH/include/ + cp libjbig/j*.h $LYCIUM_ROOT/usr/$pkgname/$ARCH/include/ + + mkdir -p $LYCIUM_ROOT/usr/$pkgname/$ARCH/bin/ + cp pbmtools/jbgtopbm $LYCIUM_ROOT/usr/$pkgname/$ARCH/bin/ + cp pbmtools/jbgtopbm85 $LYCIUM_ROOT/usr/$pkgname/$ARCH/bin/ + cp pbmtools/pbmtojbg $LYCIUM_ROOT/usr/$pkgname/$ARCH/bin/ + cp pbmtools/pbmtojbg85 $LYCIUM_ROOT/usr/$pkgname/$ARCH/bin/ + + mkdir -p $LYCIUM_ROOT/usr/$pkgname/$ARCH/man/man1/ + cp pbmtools/jbgtopbm.1 $LYCIUM_ROOT/usr/$pkgname/$ARCH/man/man1/ + cp pbmtools/pbmtojbg.1 $LYCIUM_ROOT/usr/$pkgname/$ARCH/man/man1/ + + mkdir -p $LYCIUM_ROOT/usr/$pkgname/$ARCH/man/man5/ + cp pbmtools/pbm.5 $LYCIUM_ROOT/usr/$pkgname/$ARCH/man/man5/ + cp pbmtools/pgm.5 $LYCIUM_ROOT/usr/$pkgname/$ARCH/man/man5/ + cd $OLDPWD + unset cc +} + +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 +} diff --git a/thirdparty/jbigkit/README.OpenSource b/thirdparty/jbigkit/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..20b8a893125623a9bc84b4d8257645ba0ac1a28d --- /dev/null +++ b/thirdparty/jbigkit/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "jbigkit", + "License": "GNU General Public License", + "License File": "notes.txt", + "Version Number": "2.1", + "Owner": "llh_01129@163.com", + "Upstream URL": "https://www.cl.cam.ac.uk/~mgk25/$pkgname/download/jbigkit-2.1.tar.gz", + "Description": "JBIG-KIT is a software implementation of the JBIG1 data compression standard (ITU-T T.82), which was designed for bi-level image data, such as scanned documents." + } +] diff --git a/thirdparty/jbigkit/README_zh.md b/thirdparty/jbigkit/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..d3c4893352a78384d7edcbd643aedc53c36857ae --- /dev/null +++ b/thirdparty/jbigkit/README_zh.md @@ -0,0 +1,12 @@ +# jbigkit三方库说明 +## 功能简介 +JBIG-KIT是JBIG1数据压缩标准(ITU-T T.82)的软件实现,该标准是为扫描文档等双层图像数据设计的。 +## 使用约束 +- IDE版本:DevEco Studio 3.1 Beta2 +- SDK版本:ohos_sdk_public 3.2.11.9 (API Version 9 Release) +- 三方库版本:v2.5.0 +- 当前适配的功能:支持数据压缩标准的软件实现 +- [GNU General Public License](https://www.cl.cam.ac.uk/~mgk25/jbigkit/) + +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) diff --git a/thirdparty/jbigkit/SHA512SUM b/thirdparty/jbigkit/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..423676dead650460742eb9f2372a74920282b19a --- /dev/null +++ b/thirdparty/jbigkit/SHA512SUM @@ -0,0 +1 @@ +c4127480470ef90db1ef3bd2caa444df10b50ed8df0bc9997db7612cb48b49278baf44965028f1807a21028eb965d677e015466306b44683c4ec75a23e1922cf jbigkit-2.1.tar.gz diff --git a/thirdparty/jbigkit/docs/hap_integrate.md b/thirdparty/jbigkit/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..fd4da39edc978ac8c45c02af469893227870dd76 --- /dev/null +++ b/thirdparty/jbigkit/docs/hap_integrate.md @@ -0,0 +1,72 @@ +# jbigkit集成到应用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/jbigkit #三方库jbigkit的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md + ``` + +- 将jbigkit拷贝至tools/main目录下 + ``` + cd tpc_c_cplusplus + cp thirdparty/jbigkit tools/main -rf + ``` +- 在tools目录下编译三方库 + 编译环境的搭建参考[准备三方库构建环境](../../../tools/README.md#编译环境准备) + ``` + cd tools + ./build.sh jbigkit + ``` +- 三方库头文件及生成的库 + 在tools目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ``` + jbigkit/arm64-v8a jbigkit/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的库拷贝到该目录下,如下图所示 + ![thirdparty_install_dir](pic/jbigkit_install_dir.png) +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + ``` + + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/jbigkit/${OHOS_ARCH}/lib/libjbig85.a) + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/jbigkit/${OHOS_ARCH}/lib/libjbig.a) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/jbigkit/${OHOS_ARCH}/include) + ``` + ![jbigkit_usage](pic/jbigkit_usage.png) +## 测试三方库 +三方库的测试使用原库自带的测试用例来做测试,[准备三方库测试环境](../../../tools/README.md#ci环境准备) + +进入到构建目录执行ctest运行测试用例(arm64-v8a-build为构建64位的目录,armeabi-v7a-build为构建32位的目录) + + ![jbigkit_test](pic/jbigkit_test1.png) + ![jbigkit_test](pic/jbigkit_test2.png) + ![jbigkit_test](pic/jbigkit_test3.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/jbigkit/docs/pic/jbigkit_install_dir.png b/thirdparty/jbigkit/docs/pic/jbigkit_install_dir.png new file mode 100644 index 0000000000000000000000000000000000000000..60737365f3f7876d0855ac8e0063ff8bd855a22e Binary files /dev/null and b/thirdparty/jbigkit/docs/pic/jbigkit_install_dir.png differ diff --git a/thirdparty/jbigkit/docs/pic/jbigkit_test1.png b/thirdparty/jbigkit/docs/pic/jbigkit_test1.png new file mode 100644 index 0000000000000000000000000000000000000000..4c03d072287c08d53c931ed9ca49ba25fab8776d Binary files /dev/null and b/thirdparty/jbigkit/docs/pic/jbigkit_test1.png differ diff --git a/thirdparty/jbigkit/docs/pic/jbigkit_test2.png b/thirdparty/jbigkit/docs/pic/jbigkit_test2.png new file mode 100644 index 0000000000000000000000000000000000000000..f9c508935122aeeeee19e12bc174becb5807c660 Binary files /dev/null and b/thirdparty/jbigkit/docs/pic/jbigkit_test2.png differ diff --git a/thirdparty/jbigkit/docs/pic/jbigkit_test3.png b/thirdparty/jbigkit/docs/pic/jbigkit_test3.png new file mode 100644 index 0000000000000000000000000000000000000000..e8658d791226e599cfb8639494fac0adf013d4b8 Binary files /dev/null and b/thirdparty/jbigkit/docs/pic/jbigkit_test3.png differ diff --git a/thirdparty/jbigkit/docs/pic/jbigkit_usage.png b/thirdparty/jbigkit/docs/pic/jbigkit_usage.png new file mode 100644 index 0000000000000000000000000000000000000000..b929b73eaa774f6ee96cb096c68255b53de25b6e Binary files /dev/null and b/thirdparty/jbigkit/docs/pic/jbigkit_usage.png differ