diff --git a/community/CUnit/HPKBUILD b/community/CUnit/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..5ac03ceb37aa1715dc5802f244ec53a839bf59b2 --- /dev/null +++ b/community/CUnit/HPKBUILD @@ -0,0 +1,78 @@ +# Contributor: Jeff Han +# Maintainer: Jeff Han +pkgname=CUnit +pkgver=2.1-3 +pkgrel=0 +pkgdesc="" +url="" +archs=("armeabi-v7a" "arm64-v8a") +license=() +depends=() +makedepends=() +install= +source="https://sourceforge.net/projects/cunit/files/$pkgname/$pkgver/$pkgname-$pkgver.tar.bz2" + +autounpack=false +downloadpackage=true +buildtools="configure" + +builddir=$pkgname-${pkgver} +packagename=$builddir.tar.bz2 + +source envset.sh +host= +prepare() { + mkdir $pkgname-$ARCH-build + tar -jxf $packagename -C $pkgname-$ARCH-build + if [ $ARCH == "armeabi-v7a" ] + then + setarm32ENV + host=arm-linux + fi + if [ $ARCH == "arm64-v8a" ] + then + setarm64ENV + host=aarch64-linux + fi + cd $pkgname-$ARCH-build/$builddir + ./bootstrap > $buildlog 2>&1 + cd $OLDPWD +} + +build() { + cd $pkgname-$ARCH-build/$builddir + PKG_CONFIG_LIBDIR="${pkgconfigpath}" ./configure "$@" --host=$host --enable-debug \ + --enable-automated --enable-basic --enable-console + --enable-examples --enable-test >> $buildlog 2>&1 + $MAKE VERBOSE=1 >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $pkgname-$ARCH-build/$builddir + $MAKE VERBOSE=1 install >> $buildlog 2>&1 + cd $OLDPWD + if [ $ARCH == "armeabi-v7a" ] + then + unsetarm32ENV + fi + if [ $ARCH == "arm64-v8a" ] + then + unsetarm64ENV + fi + + unset host +} + +check() { + echo "The test must be on an OpenHarmony device!" + # 在OpenHarmony开发板中执行用例 + # ./test_cunit +} + +# 清理环境 +cleanbuild(){ + rm -rf ${PWD}/$pkgname-armeabi-v7a-build ${PWD}/$pkgname-arm64-v8a-build #${PWD}/$packagename +} diff --git a/community/CUnit/README.OpenSource b/community/CUnit/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..545967c46bf70a3bde9760b89b0d060565e278a5 --- /dev/null +++ b/community/CUnit/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "CUnit", + "License": "GNU Library General Public License", + "License File": "https://sourceforge.net/p/cunit/code/HEAD/tree/branches/mingw64/COPYING", + "Version Number": "2.1-3", + "Owner": "tianyong13@huawei.com", + "Upstream URL": "https://sourceforge.net/projects/cunit/files/latest/download", + "Description": "CUnit is a Unit testing framework for C." + } +] diff --git a/community/CUnit/README_zh.md b/community/CUnit/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..b61ccb3cc64ee4bbe74226be3aa3a265ed4eeec9 --- /dev/null +++ b/community/CUnit/README_zh.md @@ -0,0 +1,12 @@ +# CUnit三方库说明 +## 功能简介 +CUnit是C语言的单元测试框架 + +## 三方库版本 +- 2.1-3 + +## 使用约束 +- [IDE和SDK版本](../../docs/constraint.md) + +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) diff --git a/community/CUnit/SHA512SUM b/community/CUnit/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..13960a9588116ee1fcab15e048c194b6594b75a0 --- /dev/null +++ b/community/CUnit/SHA512SUM @@ -0,0 +1 @@ +547b417109332446dfab8fda17bf4ccd2da841dc93f824dc90a20635bcf1fb80fb2176500d8a0906940f3f3d3e2f77b2d70a71090c9ab84ad9af43f3582bc487 CUnit-2.1-3.tar.bz2 diff --git a/community/CUnit/docs/hap_integrate.md b/community/CUnit/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..f87c06248f6be7979add20bfd932b20b53bbfb62 --- /dev/null +++ b/community/CUnit/docs/hap_integrate.md @@ -0,0 +1,57 @@ +# CUnit集成到应用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) +## 编译三方库 +- 下载本仓库 + ``` + git clone https://gitee.com/openharmony-sig/tpc_c_cplusplus.git --depth=1 + ``` +- 三方库目录结构 + ``` + tpc_c_cplusplus/thirdparty/CUnit #三方库CUnit的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md + ``` + +- 在lycium目录下编译三方库 + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ``` + cd lycium + ./build.sh CUnit + ``` +- 三方库头文件及生成的库 + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + ``` + CUnit/arm64-v8a CUnit/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的库拷贝到该目录下,如下图所示 + ![thirdparty_install_dir](pic/cunit_install_dir.png) +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + ``` + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/CUnit/${OHOS_ARCH}/lib/libcunit.a) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/CUnit/${OHOS_ARCH}/include) + ``` + ![cunit_usage](pic/cunit_usage.png) +## 测试三方库 +三方库的测试使用原库自带的测试用例来做测试 + +进入到构建目录获取可执行文件test_cunit,运行测试用例(CUnit-arm64-v8a-build为构建64位的目录,CUnit-armeabi-v7a-build为构建32位的目录) + ![cunit_test_result](pic/cunit_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/community/CUnit/docs/pic/cunit_install_dir.png b/community/CUnit/docs/pic/cunit_install_dir.png new file mode 100644 index 0000000000000000000000000000000000000000..5401ba860fee2adb3feefcfc4c9c641f8c968b57 Binary files /dev/null and b/community/CUnit/docs/pic/cunit_install_dir.png differ diff --git a/community/CUnit/docs/pic/cunit_test_result.png b/community/CUnit/docs/pic/cunit_test_result.png new file mode 100644 index 0000000000000000000000000000000000000000..c04a12e3e302419cb89df29b7fba78527c922232 Binary files /dev/null and b/community/CUnit/docs/pic/cunit_test_result.png differ diff --git a/community/CUnit/docs/pic/cunit_usage.png b/community/CUnit/docs/pic/cunit_usage.png new file mode 100644 index 0000000000000000000000000000000000000000..7715aca5f26f657cdc699d693fd166296a871b97 Binary files /dev/null and b/community/CUnit/docs/pic/cunit_usage.png differ diff --git a/community/Catch2/HPKBUILD b/community/Catch2/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..d6b30b3f40ed4ddb252ba9eaae2d35a0190c6ac3 --- /dev/null +++ b/community/Catch2/HPKBUILD @@ -0,0 +1,74 @@ +# 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: huangminzhong2 ,zhuangkun +# Maintainer: huangminzhong2 + +pkgname=Catch2 +pkgver=v2.13.8 +pkgrel=0 +pkgdesc="Catch2 is mainly a unit testing framework for C++, but it also provides basic micro-benchmarking features, and simple BDD macros." +url="https://github.com/catchorg/Catch2" +archs=("armeabi-v7a" "arm64-v8a") +license=("BSL-1.0") +depends=() +makedepends=() + +source="https://github.com/catchorg/$pkgname/archive/refs/tags/$pkgver.tar.gz" + +downloadpackage=true +autounpack=true +patchflag=true +buildtools="cmake" +builddir=${pkgname}-${pkgver:1} +packagename=$builddir.tar.gz + +prepare() { + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + PKG_CONFIG_LIBDIR="${pkgconfigpath}" ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" \ + -DOHOS_ARCH=$ARCH -DCATCH_DEVELOPMENT_BUILD=ON -DCATCH_BUILD_TESTING=ON \ + -DCMAKE_CXX_FLAGS="-Wno-unused-command-line-argument" -B$ARCH-build -S./ -L > $buildlog 2>&1 + $MAKE VERBOSE=1 -C $ARCH-build >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +# 打包安装 +package() { + cd $builddir + $MAKE VERBOSE=1 -C $ARCH-build install >> $buildlog 2>&1 + cd $OLDPWD +} + +# 进行测试的准备和说明 +check() { + echo "The test must be on an OpenHarmony device!" + cd $builddir/$ARCH-build + ohos_sdk_cmake_path=${OHOS_SDK//\//\\\/}"\/native\/build-tools\/cmake\/bin\/cmake" + sed -i 's/'$ohos_sdk_cmake_path'/cmake/' ./projects/CTestTestfile.cmake + sed -i '33s/^/#/' ./projects/CTestTestfile.cmake + sed -i '34s/^/#/' ./projects/CTestTestfile.cmake + sed -i '53s/^/#/' ./projects/CTestTestfile.cmake + sed -i '54s/^/#/' ./projects/CTestTestfile.cmake + cd $OLDPWD +} + +# 清理环境 +cleanbuild() { + rm -rf ${PWD}/$builddir #${PWD}/$packagename +} diff --git a/community/Catch2/HPKCHECK b/community/Catch2/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..9261aaa15d696b2dbf9890a3787038404437b88f --- /dev/null +++ b/community/Catch2/HPKCHECK @@ -0,0 +1,31 @@ +# 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: huangminzhong2 ,zhuangkun +# Maintainer: huangminzhong2 + +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 + ctest >> $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 +} diff --git a/community/Catch2/OAT.xml b/community/Catch2/OAT.xml new file mode 100644 index 0000000000000000000000000000000000000000..6c910b32a0f5cab1461a8807c1f474d998359e04 --- /dev/null +++ b/community/Catch2/OAT.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/community/Catch2/README.OpenSource b/community/Catch2/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..d95b9d08088ff68849a8928f6d2ad405efce7330 --- /dev/null +++ b/community/Catch2/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "Catch2", + "License": "BSL-1.0", + "License File": "https://github.com/catchorg/Catch2/blob/devel/LICENSE.txt", + "Version Number": "v2.13.8", + "Owner": "huangminzhong2@huawei.com", + "Upstream URL": "https://github.com/catchorg/Catch2", + "Description": "Catch2 is mainly a unit testing framework for C++, but it also provides basic micro-benchmarking features, and simple BDD macros." + } +] diff --git a/community/Catch2/README_zh.md b/community/Catch2/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..288ffa4012dcb2de1761e658eca3dac1f7d0aaa5 --- /dev/null +++ b/community/Catch2/README_zh.md @@ -0,0 +1,12 @@ +# Catch2三方库说明 +## 功能简介 +Catch2主要是c++的单元测试框架,但它也提供了基本的微基准测试特性和简单的BDD宏。 + +## 三方库版本 +- v2.13.8 + +## 使用约束 +- [IDE和SDK版本](../../docs/constraint.md) + +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) diff --git a/community/Catch2/SHA512SUM b/community/Catch2/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..2f781c64d9f92f23cd4378493cf1ae1f95476751 --- /dev/null +++ b/community/Catch2/SHA512SUM @@ -0,0 +1 @@ +68a45efa47beb3c85d2d7b8a8eba89b8ec1664b4a72bb223227fef1632778aeaf5cf5cc09f40e47aef50426c8661c7d6a69c2dab0b88fbbf7d9a6b2974d6e32e Catch2-2.13.8.tar.gz diff --git a/community/Catch2/doc/hap_integrate.md b/community/Catch2/doc/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..7f8cd6043bdc76d69c5a42ede11cc232b63093a1 --- /dev/null +++ b/community/Catch2/doc/hap_integrate.md @@ -0,0 +1,59 @@ +# Catch2集成到应用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/Catch2 #三方库Catch2的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── HPKCHECK #测试脚本 + ├── OAT.xml #扫描结果文件 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md #三方库简介 + ``` +- 在lycium目录下编译三方库 + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + ```shell + cd lycium + ./build.sh Catch2 + ``` +- 三方库头文件 + 在lycium目录下会生成usr目录,该目录下存在Catch2的头文件 + ```shell + Catch2/arm64-v8a Catch2/armeabi-v7a + ``` +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +Catch2是一个Header only库,只需要引入头文件即可使用,无需编译生成额外的库文件。 + +## 测试三方库 + +- 编译出可执行的文件进行测试,[准备三方库测试环境](../../../lycium/README.md#3ci环境准备) + +- 进入到构建目录运行测试用例(注意arm64-v8a为构建64位的目录,armeabi-v7a为构建32位的目录),执行结果如图所示 +``` + cd /data/tpc_c_cplusplus/thirdparty/Catch2/Catch2-2.13.8/armeabi-v7a-build/ + ctest +``` + + ![Catch2_test](pic/test-cmd-ret.png) + +## 参考资料 + +* [OpenHarmony三方库地址](https://gitee.com/openharmony-tpc) +* [OpenHarmony知识体系](https://gitee.com/openharmony-sig/knowledge) +* [Catch2三方库地址](https://github.com/catchorg/Catch2) \ No newline at end of file diff --git a/community/Catch2/doc/pic/test-cmd-ret.png b/community/Catch2/doc/pic/test-cmd-ret.png new file mode 100644 index 0000000000000000000000000000000000000000..79d2436f54da4544e51e26aba18b5de1126b0da5 Binary files /dev/null and b/community/Catch2/doc/pic/test-cmd-ret.png differ diff --git a/community/DLib/DLib_oh_pkg.patch b/community/DLib/DLib_oh_pkg.patch new file mode 100644 index 0000000000000000000000000000000000000000..28c2ed6a5e8e7d730793268164ef64f84d497ac1 --- /dev/null +++ b/community/DLib/DLib_oh_pkg.patch @@ -0,0 +1,11 @@ +diff -rupN DLib-1.1-free/CMakeLists.txt DLib-1.1-free_patch/CMakeLists.txt +--- DLib-1.1-free/CMakeLists.txt 2023-08-24 10:42:32.303144743 +0800 ++++ DLib-1.1-free_patch/CMakeLists.txt 2023-08-24 10:45:15.833834065 +0800 +@@ -63,6 +63,7 @@ if(BUILD_DVision) + ${SRCS}) + + find_package(Boost QUIET) # For dynamic_bitset ++ include_directories(${Boost_INCLUDE_DIR}) + if (Boost_FOUND) + set(HDRS include/DVision/BRIEF.h ${HDRS}) + set(SRCS src/DVision/BRIEF.cpp ${SRCS}) diff --git a/community/DLib/HPKBUILD b/community/DLib/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..12feddc9da7086717ac25cb6b0287953ddde0c73 --- /dev/null +++ b/community/DLib/HPKBUILD @@ -0,0 +1,72 @@ +# 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: TangShaoteng , zhaoxu <357489213@qq.com> +# Maintainer: TangShaoteng + +pkgname=DLib +pkgver=v1.1-free +pkgrel=0 +pkgdesc="C++ library with several utilities" +url="https://github.com/dorian3d/DLib" +archs=("armeabi-v7a" "arm64-v8a") +license=("Copyright (c) 2015 Dorian Galvez-Lopez. http://doriangalvez.com All rights reserved.") +depends=("boost" "opencv_3.4.1") +makedepends=() +source="https://github.com/dorian3d/$pkgname/archive/refs/tags/$pkgver.tar.gz" + +autounpack=true +downloadpackage=true +buildtools="cmake" +patchflag=true + +builddir=$pkgname-${pkgver:1} +packagename=$builddir.tar.gz + +prepare() { + mkdir -p $builddir/$ARCH-build + cd $builddir + + if $patchflag + then + # 添加boost依赖库头文件查询路径 + patch -p1 < ../DLib_oh_pkg.patch + # patch只需要打一次,关闭打patch + patchflag=false + fi + + cd $OLDPWD +} + +build() { + cd $builddir + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" -DOHOS_ARCH=$ARCH -B$ARCH-build -S./ -L > `pwd`/$ARCH-build/build.log 2>&1 + make VERBOSE=1 -j4 -C $ARCH-build >> `pwd`/$ARCH-build/build.log 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + make -C $ARCH-build install >> `pwd`/$ARCH-build/build.log 2>&1 + cd $OLDPWD +} + +check() { + echo "The test must be on an OpenHarmony device!" + # TODO +} + +cleanbuild() { + rm -rf ${PWD}/$builddir #${PWD}/$packageName +} diff --git a/community/DLib/SHA512SUM b/community/DLib/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..0b9c0ae8632fed1f24f5a08fc1005d6aa4eb70fb --- /dev/null +++ b/community/DLib/SHA512SUM @@ -0,0 +1,2 @@ +eafe6366650b2c390640cd8498bc1c24d1255307409476e1b953c6532d91bbadebcbcc896c0040d9e124696acf06e7bdbd8fdda67a783e56d7a9f4e8a329fe92 DLib-1.1-free.tar.gz +c5869b76549eeef1814c6384f36a06268be8615980db71fad183530574d08a14d62ba1ef6ebc6cfb10f50d68c38e3c95e3c7767b352d8e4ca2d4e7f218dcb13c DLib_oh_pkg.patch diff --git a/community/FFmpeg-ff4.0/HPKBUILD b/community/FFmpeg-ff4.0/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..b3963b50bd48f0dd457262a2dcd6976b264945b6 --- /dev/null +++ b/community/FFmpeg-ff4.0/HPKBUILD @@ -0,0 +1,97 @@ +# Contributor: zhangxin +# Maintainer: zhangxin +pkgname=FFmpeg-ff4.0 +pkgver=ijk0.8.8-20210426-001 +pkgrel=0 +pkgdesc="FFmpeg is a collection of libraries and tools to process multimedia content such as audio, video, subtitles and related metadata." +url="https://github.com/bilibili/FFmpeg/" +archs=("armeabi-v7a" "arm64-v8a") +license=("GPL2 or later" "LGPL2.1 or later" "MIT" "X11" "BSD-styl") +depends=("openssl") +makedepends=() +source="https://github.com/bilibili/FFmpeg/archive/refs/tags/ff4.0--ijk0.8.8--20210426--001.tar.gz" + +autounpack=false +downloadpackage=true +buildtools="configure" + +builddir=$pkgname-${pkgver} +packagename=$builddir.tar.gz +patchflag=true +source envset.sh +arch= +ldflags= + +prepare() { + mkdir $pkgname-$ARCH-build + tar -zxf $packagename -C $pkgname-$ARCH-build + + if $patchflag + then + cd $pkgname-$ARCH-build/$builddir + # fix bug + patch -p1 < `pwd`/../../oh_ffmpeg-bug-fixed.patch + patchflag=false + cd $OLDPWD + fi + + if [ $ARCH == "armeabi-v7a" ] + then + setarm32ENV + arch=arm + ldflags="-L${OHOS_SDK}/native/sysroot/usr/lib/arm-linux-ohos" + elif [ $ARCH == "arm64-v8a" ] + then + setarm64ENV + arch=aarch64 + ldflags="-L${OHOS_SDK}/native/sysroot/usr/lib/aarch64-linux-ohos" + else + echo "${ARCH} not support" + return -1 + fi + export CFLAGS="-Wno-int-conversion -fPIC $CFLAGS" + export CXXFLAGS="-Wno-int-conversion -fPIC $CXXFLAGS" + return $ret +} + +build() { + cd $pkgname-$ARCH-build/$builddir + PKG_CONFIG_LIBDIR="${pkgconfigpath}" ./configure "$@" --enable-neon --enable-asm --enable-network \ + --enable-cross-compile --disable-x86asm --enable-openssl --enable-protocols \ + --disable-programs --enable-static --disable-shared --disable-doc --disable-htmlpages --target-os=linux --arch=$arch \ + --cc=${CC} --ld=${CC} --strip=${STRIP} --sysroot=${OHOS_SDK}/native/sysroot > $buildlog 2>&1 + $MAKE >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $pkgname-$ARCH-build/$builddir + $MAKE install >> $buildlog 2>&1 + cd $OLDPWD +} + +check() { + return 0 +} + +recoverpkgbuildenv() { + unset arch + unset ldflags + if [ $ARCH == "armeabi-v7a" ] + then + unsetarm32ENV + elif [ $ARCH == "arm64-v8a" ] + then + unsetarm64ENV + else + echo "${ARCH} not support" + return -1 + fi +} + +# 清理环境 +cleanbuild() { + rm -rf ${PWD}/${builddir} ${PWD}/$pkgname-arm64-v8a-build ${PWD}/$pkgname-armeabi-v7a-build #${PWD}/$packagename +} diff --git a/community/FFmpeg-ff4.0/README_zh.md b/community/FFmpeg-ff4.0/README_zh.md new file mode 100755 index 0000000000000000000000000000000000000000..c7a3a4a0b894e8bad14d61cd8f7f17b0472e38ed --- /dev/null +++ b/community/FFmpeg-ff4.0/README_zh.md @@ -0,0 +1,88 @@ +# FFmpeg-ff4.0三方库说明 + +## 前言 + +​ FFmpeg-ff4.0是为适配[ohos_ijkplayer](https://gitee.com/openharmony-sig/ohos_ijkplayer)的指定版本,tags:ff4.0--ijk0.8.8--20210426--001。 + +## 构建准备 + +[准备三方库构建环境](../../lycium/README.md#1编译环境准备) + + +## 构建方式 + +``` +#编译库 +cd tpc_c_cplusplus/lycium +./build.sh FFmpeg-ff4.0 + +#库所在目录 +tpc_c_cplusplus/lycium/usr/FFmpeg-ff4.0 +``` + + + +## 如何在[ohos_ijkplayer](https://gitee.com/openharmony-sig/ohos_ijkplayer) 中使用 + +1.在库目录中取出openssl以及FFmpeg的文件夹,存放到工程的ijkplayer/src/main/cpp/thirdparty下,如图所示 + +![img](./pic/dir.png) + +2.修改ijkplayer/src/main/cpp/下的CMakeLists.txt文件以及ijkplayer、ijksdl中的CMakeLists.txt文件,总共三个CMakeLists.txt文件,请注意 + +``` +#CMakeLists.txt都屏蔽以下内容 +#target_link_libraries(ijkplayer ijkffmpeg) + +#add_library(ijkffmpeg SHARED IMPORTED) +#set_target_properties(ijkffmpeg PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/../../../../libs/${OHOS_ARCH}/libijkffmpeg.z.so) +``` + +``` +#ijkplayer/src/main/cpp/ijkplayer中的CMakeLists.txt添加如下内容 +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../third_party/ffmpeg/${OHOS_ARCH}/include) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../third_party/openssl/${OHOS_ARCH}/include) + +target_link_libraries(ijkplayer PUBLIC z) +target_link_libraries(ijkplayer PUBLIC avcodec) +target_link_libraries(ijkplayer PUBLIC avfilter) +target_link_libraries(ijkplayer PUBLIC avformat) +target_link_libraries(ijkplayer PUBLIC avutil) +target_link_libraries(ijkplayer PUBLIC swresample) +target_link_libraries(ijkplayer PUBLIC swscale) +target_link_libraries(ijkplayer PUBLIC avdevice) +target_link_libraries(ijkplayer PUBLIC crypto) +target_link_libraries(ijkplayer PUBLIC ssl) +target_link_directories(ijkplayer PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../third_party/ffmpeg/${OHOS_ARCH}/lib ${CMAKE_CURRENT_SOURCE_DIR}/../third_party/openssl/${OHOS_ARCH}/lib) +``` + +``` +#ijkplayer/src/main/cpp/ijksdl中的CMakeLists.txt添加如下内容 +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../third_party/ffmpeg/${OHOS_ARCH}/include) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../third_party/openssl/${OHOS_ARCH}/include) + +target_link_libraries(ijksdl PUBLIC z) +target_link_libraries(ijksdl PUBLIC avcodec) +target_link_libraries(ijksdl PUBLIC avfilter) +target_link_libraries(ijksdl PUBLIC avformat) +target_link_libraries(ijksdl PUBLIC avutil) +target_link_libraries(ijksdl PUBLIC swresample) +target_link_libraries(ijksdl PUBLIC swscale) +target_link_libraries(ijksdl PUBLIC avdevice) +target_link_libraries(ijksdl PUBLIC crypto) +target_link_libraries(ijksdl PUBLIC ssl) +target_link_directories(ijksdl PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../third_party/ffmpeg/${OHOS_ARCH}/lib ${CMAKE_CURRENT_SOURCE_DIR}/../third_party/openssl/${OHOS_ARCH}/lib) +``` + +``` +#ijkplayer/src/main/cpp/中的CMakeLists.txt添加如下内容 +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/third_party/ffmpeg/${OHOS_ARCH}/include) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/third_party/openssl/${OHOS_ARCH}/include) + +修改 +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-int-conversion") +替换成 +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-int-conversion -Wl,-Bsymbolic") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-int-conversion -Wl,-Bsymbolic") +``` + diff --git a/community/FFmpeg-ff4.0/oh_ffmpeg-bug-fixed.patch b/community/FFmpeg-ff4.0/oh_ffmpeg-bug-fixed.patch new file mode 100644 index 0000000000000000000000000000000000000000..78e3ca1aec023b28acd102ae4ffaf3e30437a2cd --- /dev/null +++ b/community/FFmpeg-ff4.0/oh_ffmpeg-bug-fixed.patch @@ -0,0 +1,438 @@ +From d076b8f13f32a3cb79cb8bacaf4b57ff93ab3637 Mon Sep 17 00:00:00 2001 +From: duanjf <605126199@qq.com> +Date: Sat, 25 May 2024 09:43:56 +0800 +Subject: [PATCH] ffmpeg bug fixed + +Signed-off-by: duanjf <605126199@qq.com> +--- + libavcodec/idctdsp.c | 2 +- + libavcodec/idctdsp.h | 1 + + libavcodec/libx264.c | 1 + + libavcodec/mpeg4videodec.c | 15 ++++++++++++++- + libavcodec/mpeg4videoenc.c | 2 +- + libavcodec/mpegvideo.c | 3 +++ + libavcodec/utils.c | 24 +++++++++++++----------- + libavcodec/vqavideo.c | 2 +- + libavformat/asfdec_o.c | 2 +- + libavformat/flvenc.c | 5 +++++ + libavformat/movenc.c | 7 ++++++- + libavformat/mpegts.c | 15 ++++++++------- + libavformat/mxfdec.c | 2 +- + libavformat/nutdec.c | 18 +++++++++++++----- + libavformat/pva.c | 4 ++++ + libavformat/rmdec.c | 2 +- + libavformat/tty.c | 20 +++++++++++++++++++- + 17 files changed, 93 insertions(+), 32 deletions(-) + +diff --git a/libavcodec/idctdsp.c b/libavcodec/idctdsp.c +index 662033bd78..954066a5e3 100644 +--- a/libavcodec/idctdsp.c ++++ b/libavcodec/idctdsp.c +@@ -258,7 +258,7 @@ av_cold void ff_idctdsp_init(IDCTDSPContext *c, AVCodecContext *avctx) + if (avctx->bits_per_raw_sample == 10 || avctx->bits_per_raw_sample == 9) { + /* 10-bit MPEG-4 Simple Studio Profile requires a higher precision IDCT + However, it only uses idct_put */ +- if (avctx->codec_id == AV_CODEC_ID_MPEG4 && avctx->profile == FF_PROFILE_MPEG4_SIMPLE_STUDIO) ++ if (c->mpeg4_studio_profile) + c->idct_put = ff_simple_idct_put_int32_10bit; + else { + c->idct_put = ff_simple_idct_put_int16_10bit; +diff --git a/libavcodec/idctdsp.h b/libavcodec/idctdsp.h +index 26221f6a9d..71c0d1c260 100644 +--- a/libavcodec/idctdsp.h ++++ b/libavcodec/idctdsp.h +@@ -95,6 +95,7 @@ typedef struct IDCTDSPContext { + */ + uint8_t idct_permutation[64]; + enum idct_permutation_type perm_type; ++ int mpeg4_studio_profile; + } IDCTDSPContext; + + void ff_put_pixels_clamped_c(const int16_t *block, uint8_t *av_restrict pixels, +diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c +index 12379ff763..053dcd7877 100644 +--- a/libavcodec/libx264.c ++++ b/libavcodec/libx264.c +@@ -1080,6 +1080,7 @@ AVCodec ff_libx264rgb_encoder = { + .priv_class = &rgbclass, + .defaults = x264_defaults, + .pix_fmts = pix_fmts_8bit_rgb, ++ .caps_internal = FF_CODEC_CAP_INIT_CLEANUP, + .wrapper_name = "libx264", + }; + #endif +diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c +index 32eb3d1ca8..25a38edd7b 100644 +--- a/libavcodec/mpeg4videodec.c ++++ b/libavcodec/mpeg4videodec.c +@@ -2848,11 +2848,13 @@ static int decode_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb) + return 0; + } + +-static void read_quant_matrix_ext(MpegEncContext *s, GetBitContext *gb) ++static int read_quant_matrix_ext(MpegEncContext *s, GetBitContext *gb) + { + int i, j, v; + + if (get_bits1(gb)) { ++ if (get_bits_left(gb) < 64*8) ++ return AVERROR_INVALIDDATA; + /* intra_quantiser_matrix */ + for (i = 0; i < 64; i++) { + v = get_bits(gb, 8); +@@ -2863,6 +2865,8 @@ static void read_quant_matrix_ext(MpegEncContext *s, GetBitContext *gb) + } + + if (get_bits1(gb)) { ++ if (get_bits_left(gb) < 64*8) ++ return AVERROR_INVALIDDATA; + /* non_intra_quantiser_matrix */ + for (i = 0; i < 64; i++) { + get_bits(gb, 8); +@@ -2870,6 +2874,8 @@ static void read_quant_matrix_ext(MpegEncContext *s, GetBitContext *gb) + } + + if (get_bits1(gb)) { ++ if (get_bits_left(gb) < 64*8) ++ return AVERROR_INVALIDDATA; + /* chroma_intra_quantiser_matrix */ + for (i = 0; i < 64; i++) { + v = get_bits(gb, 8); +@@ -2879,6 +2885,8 @@ static void read_quant_matrix_ext(MpegEncContext *s, GetBitContext *gb) + } + + if (get_bits1(gb)) { ++ if (get_bits_left(gb) < 64*8) ++ return AVERROR_INVALIDDATA; + /* chroma_non_intra_quantiser_matrix */ + for (i = 0; i < 64; i++) { + get_bits(gb, 8); +@@ -2886,6 +2894,7 @@ static void read_quant_matrix_ext(MpegEncContext *s, GetBitContext *gb) + } + + next_start_code_studio(gb); ++ return 0; + } + + static void extension_and_user_data(MpegEncContext *s, GetBitContext *gb, int id) +@@ -3090,6 +3099,10 @@ int ff_mpeg4_decode_picture_header(Mpeg4DecContext *ctx, GetBitContext *gb) + /* search next start code */ + align_get_bits(gb); + ++ if (!s->studio_profile && s->avctx->bits_per_raw_sample != 8) { ++ s->avctx->bits_per_raw_sample = 0; ++ } ++ + if (s->codec_tag == AV_RL32("WV1F") && show_bits(gb, 24) == 0x575630) { + skip_bits(gb, 24); + if (get_bits(gb, 8) == 0xF0) +diff --git a/libavcodec/mpeg4videoenc.c b/libavcodec/mpeg4videoenc.c +index 494452c938..f6a5992df7 100644 +--- a/libavcodec/mpeg4videoenc.c ++++ b/libavcodec/mpeg4videoenc.c +@@ -882,7 +882,7 @@ void ff_set_mpeg4_time(MpegEncContext *s) + + static void mpeg4_encode_gop_header(MpegEncContext *s) + { +- int hours, minutes, seconds; ++ int64_t hours, minutes, seconds; + int64_t time; + + put_bits(&s->pb, 16, 0); +diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c +index 45ea0f09e9..ee1d7bb5f4 100644 +--- a/libavcodec/mpegvideo.c ++++ b/libavcodec/mpegvideo.c +@@ -329,6 +329,9 @@ static av_cold int dct_init(MpegEncContext *s) + + av_cold void ff_mpv_idct_init(MpegEncContext *s) + { ++ if (s->codec_id == AV_CODEC_ID_MPEG4) { ++ s->idsp.mpeg4_studio_profile = s->studio_profile; ++ } + ff_idctdsp_init(&s->idsp, s->avctx); + + /* load & permutate scantables +diff --git a/libavcodec/utils.c b/libavcodec/utils.c +index 59d41ccbb6..42ed9e1504 100644 +--- a/libavcodec/utils.c ++++ b/libavcodec/utils.c +@@ -1007,7 +1007,7 @@ end: + + return ret; + free_and_end: +- if (avctx->codec && ++ if (avctx->codec && avctx->codec->close && + (avctx->codec->caps_internal & FF_CODEC_CAP_INIT_CLEANUP)) + avctx->codec->close(avctx); + +@@ -1699,20 +1699,22 @@ static int get_audio_frame_duration(enum AVCodecID id, int sr, int ch, int ba, + + int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes) + { +- return get_audio_frame_duration(avctx->codec_id, avctx->sample_rate, +- avctx->channels, avctx->block_align, +- avctx->codec_tag, avctx->bits_per_coded_sample, +- avctx->bit_rate, avctx->extradata, avctx->frame_size, +- frame_bytes); ++ int duration = get_audio_frame_duration(avctx->codec_id, avctx->sample_rate, ++ avctx->channels, avctx->block_align, ++ avctx->codec_tag, avctx->bits_per_coded_sample, ++ avctx->bit_rate, avctx->extradata, avctx->frame_size, ++ frame_bytes); ++ return FFMAX(0, duration); + } + + int av_get_audio_frame_duration2(AVCodecParameters *par, int frame_bytes) + { +- return get_audio_frame_duration(par->codec_id, par->sample_rate, +- par->channels, par->block_align, +- par->codec_tag, par->bits_per_coded_sample, +- par->bit_rate, par->extradata, par->frame_size, +- frame_bytes); ++ int duration = get_audio_frame_duration(par->codec_id, par->sample_rate, ++ par->channels, par->block_align, ++ par->codec_tag, par->bits_per_coded_sample, ++ par->bit_rate, par->extradata, par->frame_size, ++ frame_bytes); ++ return FFMAX(0, duration); + } + + #if !HAVE_THREADS +diff --git a/libavcodec/vqavideo.c b/libavcodec/vqavideo.c +index 0e70be1000..b9743abda9 100644 +--- a/libavcodec/vqavideo.c ++++ b/libavcodec/vqavideo.c +@@ -147,7 +147,7 @@ static av_cold int vqa_decode_init(AVCodecContext *avctx) + } + s->width = AV_RL16(&s->avctx->extradata[6]); + s->height = AV_RL16(&s->avctx->extradata[8]); +- if ((ret = av_image_check_size(s->width, s->height, 0, avctx)) < 0) { ++ if ((ret = ff_set_dimensions(avctx, s->width, s->height)) < 0) { + s->width= s->height= 0; + return ret; + } +diff --git a/libavformat/asfdec_o.c b/libavformat/asfdec_o.c +index 5122e33c78..33dbbacebc 100644 +--- a/libavformat/asfdec_o.c ++++ b/libavformat/asfdec_o.c +@@ -706,7 +706,7 @@ static int parse_video_info(AVIOContext *pb, AVStream *st) + st->codecpar->codec_id = ff_codec_get_id(ff_codec_bmp_tags, tag); + size_bmp = FFMAX(size_asf, size_bmp); + +- if (size_bmp > BMP_HEADER_SIZE) { ++ if (size_bmp > BMP_HEADER_SIZE && size_bmp < INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE) { + int ret; + st->codecpar->extradata_size = size_bmp - BMP_HEADER_SIZE; + if (!(st->codecpar->extradata = av_malloc(st->codecpar->extradata_size + +diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c +index e8af48cb64..1f503679e2 100644 +--- a/libavformat/flvenc.c ++++ b/libavformat/flvenc.c +@@ -879,6 +879,11 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) + int flags = -1, flags_size, ret; + int64_t cur_offset = avio_tell(pb); + ++ if (par->codec_type == AVMEDIA_TYPE_AUDIO && !pkt->size) { ++ av_log(s, AV_LOG_WARNING, "Empty audio Packet\n"); ++ return AVERROR(EINVAL); ++ } ++ + if (par->codec_id == AV_CODEC_ID_VP6F || par->codec_id == AV_CODEC_ID_VP6A || + par->codec_id == AV_CODEC_ID_VP6 || par->codec_id == AV_CODEC_ID_AAC) + flags_size = 2; +diff --git a/libavformat/movenc.c b/libavformat/movenc.c +index 0b44fd66ea..27284df4c0 100644 +--- a/libavformat/movenc.c ++++ b/libavformat/movenc.c +@@ -1005,7 +1005,7 @@ static int mov_write_audio_tag(AVFormatContext *s, AVIOContext *pb, MOVMuxContex + uint32_t tag = track->tag; + + if (track->mode == MODE_MOV) { +- if (track->timescale > UINT16_MAX) { ++ if (track->timescale > UINT16_MAX || !track->par->channels) { + if (mov_get_lpcm_flags(track->par->codec_id)) + tag = AV_RL32("lpcm"); + version = 2; +@@ -5213,6 +5213,11 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt) + else + samples_in_chunk = 1; + ++ if (samples_in_chunk < 1) { ++ av_log(s, AV_LOG_ERROR, "fatal error, input packet contains no samples\n"); ++ return AVERROR_PATCHWELCOME; ++ } ++ + /* copy extradata if it exists */ + if (trk->vos_len == 0 && par->extradata_size > 0 && + !TAG_IS_AVCI(trk->tag) && +diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c +index 37a6aa8bff..261c74861f 100644 +--- a/libavformat/mpegts.c ++++ b/libavformat/mpegts.c +@@ -472,20 +472,21 @@ static MpegTSFilter *mpegts_open_section_filter(MpegTSContext *ts, + { + MpegTSFilter *filter; + MpegTSSectionFilter *sec; ++ uint8_t *section_buf = av_mallocz(MAX_SECTION_SIZE); + +- if (!(filter = mpegts_open_filter(ts, pid, MPEGTS_SECTION))) ++ if (!section_buf) + return NULL; ++ if (!(filter = mpegts_open_filter(ts, pid, MPEGTS_SECTION))) { ++ av_free(section_buf); ++ return NULL; ++ } + sec = &filter->u.section_filter; + sec->section_cb = section_cb; + sec->opaque = opaque; +- sec->section_buf = av_malloc(MAX_SECTION_SIZE); ++ sec->section_buf = section_buf; + sec->check_crc = check_crc; + sec->last_ver = -1; +- +- if (!sec->section_buf) { +- av_free(filter); +- return NULL; +- } ++ + return filter; + } + +diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c +index 7a42555562..c78e272a7e 100644 +--- a/libavformat/mxfdec.c ++++ b/libavformat/mxfdec.c +@@ -2085,7 +2085,7 @@ static int mxf_parse_structural_metadata(MXFContext *mxf) + MXFEssenceContainerData *essence_data; + + if (!(essence_data = mxf_resolve_strong_ref(mxf, &mxf->essence_container_data_refs[k], EssenceContainerData))) { +- av_log(mxf, AV_LOG_TRACE, "could not resolve essence container data strong ref\n"); ++ av_log(mxf->fc, AV_LOG_TRACE, "could not resolve essence container data strong ref\n"); + continue; + } + if (!memcmp(component->source_package_ul, essence_data->package_ul, sizeof(UID)) && !memcmp(component->source_package_uid, essence_data->package_uid, sizeof(UID))) { +diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c +index 27440c88d4..b9c81cccc9 100644 +--- a/libavformat/nutdec.c ++++ b/libavformat/nutdec.c +@@ -346,9 +346,13 @@ static int decode_main_header(NUTContext *nut) + ret = AVERROR(ENOMEM); + goto fail; + } +- for (i = 0; i < stream_count; i++) +- avformat_new_stream(s, NULL); +- ++ for (i = 0; i < stream_count; i++) { ++ if (!avformat_new_stream(s, NULL)) { ++ ret = AVERROR(ENOMEM); ++ goto fail; ++ } ++ } ++ + return 0; + fail: + av_freep(&nut->time_base); +@@ -793,19 +797,23 @@ static int nut_read_header(AVFormatContext *s) + NUTContext *nut = s->priv_data; + AVIOContext *bc = s->pb; + int64_t pos; +- int initialized_stream_count; ++ int initialized_stream_count, ret; + + nut->avf = s; + + /* main header */ + pos = 0; ++ ret = 0; + do { ++ if (ret == AVERROR(ENOMEM)) ++ return ret; ++ + pos = find_startcode(bc, MAIN_STARTCODE, pos) + 1; + if (pos < 0 + 1) { + av_log(s, AV_LOG_ERROR, "No main startcode found.\n"); + goto fail; + } +- } while (decode_main_header(nut) < 0); ++ } while ((ret = decode_main_header(nut)) < 0); + + /* stream headers */ + pos = 0; +diff --git a/libavformat/pva.c b/libavformat/pva.c +index 16381db905..04ae8e2800 100644 +--- a/libavformat/pva.c ++++ b/libavformat/pva.c +@@ -134,6 +134,10 @@ recover: + pes_flags = avio_rb16(pb); + pes_header_data_length = avio_r8(pb); + ++ if (avio_feof(pb)) { ++ return AVERROR_EOF; ++ } ++ + if (pes_signal != 1 || pes_header_data_length == 0) { + pva_log(s, AV_LOG_WARNING, "expected non empty signaled PES packet, " + "trying to recover\n"); +diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c +index ac61723c66..0216003e88 100644 +--- a/libavformat/rmdec.c ++++ b/libavformat/rmdec.c +@@ -522,7 +522,7 @@ static int rm_read_multi(AVFormatContext *s, AVIOContext *pb, + + size2 = avio_rb32(pb); + ret = ff_rm_read_mdpr_codecdata(s, s->pb, st2, st2->priv_data, +- size2, mime); ++ size2, NULL); + if (ret < 0) + return ret; + } +diff --git a/libavformat/tty.c b/libavformat/tty.c +index 8d48f2c45c..e85e819149 100644 +--- a/libavformat/tty.c ++++ b/libavformat/tty.c +@@ -34,6 +34,13 @@ + #include "internal.h" + #include "sauce.h" + ++static int isansicode(int x) ++{ ++ return x == 0x1B || x== 0x0A || x == 0x0D || (x >= 0x20 && x < 0x7f); ++} ++ ++static const char tty_extensions[31] = "ans,art,asc,diz,ice,nfo,txt,vt"; ++ + typedef struct TtyDemuxContext { + AVClass *class; + int chars_per_frame; +@@ -42,6 +49,16 @@ typedef struct TtyDemuxContext { + AVRational framerate; /**< Set by a private option. */ + } TtyDemuxContext; + ++static int read_probe(const AVProbeData *p) ++{ ++ int cnt = 0; ++ for (int i = 0; i < p->buf_size; i++) ++ cnt += !!isansicode(p->buf[i]); ++ ++ return (cnt * 100LL / p->buf_size) * (cnt > 400) * ++ !!av_match_ext(p->filename, tty_extensions); ++} ++ + /** + * Parse EFI header + */ +@@ -153,8 +170,9 @@ AVInputFormat ff_tty_demuxer = { + .name = "tty", + .long_name = NULL_IF_CONFIG_SMALL("Tele-typewriter"), + .priv_data_size = sizeof(TtyDemuxContext), ++ .read_probe = read_probe, + .read_header = read_header, + .read_packet = read_packet, +- .extensions = "ans,art,asc,diz,ice,nfo,txt,vt", ++ .extensions = tty_extensions, + .priv_class = &tty_demuxer_class, + }; +-- +2.43.0.windows.1 + diff --git a/community/FFmpeg-ff4.0/pic/dir.png b/community/FFmpeg-ff4.0/pic/dir.png new file mode 100755 index 0000000000000000000000000000000000000000..8ba8295e07259b86ad6a57ce5a88905ce9806bdc Binary files /dev/null and b/community/FFmpeg-ff4.0/pic/dir.png differ diff --git a/community/GKlib/HPKBUILD b/community/GKlib/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..fbaac608a64ad926913a22eaafff593e49b92737 --- /dev/null +++ b/community/GKlib/HPKBUILD @@ -0,0 +1,49 @@ +# Contributor: shann +# Maintainer: shann +pkgname=GKlib +pkgver=METIS-v5.1.1-DistDGL-0.5 +pkgrel=0 +pkgdesc="GKlib is a library for graphics programming that provides a series of functions and tools, which can be used to implement basic graphics operations and graphics processing functions." +url="https://github.com/KarypisLab/GKlib" +archs=("armeabi-v7a" "arm64-v8a") +license=("Apache-2.0") +depends=() +makedepends=() + +source="https://github.com/KarypisLab/$pkgname/archive/refs/tags/$pkgver.tar.gz" + +autounpack=true +downloadpackage=true +buildtools="cmake" + +builddir=$pkgname-${pkgver} +packagename=$builddir.tar.gz + +prepare() { + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + PKG_CONFIG_LIBDIR="${pkgconfigpath}" ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" \ + -DOHOS_ARCH=$ARCH -B$ARCH-build -S./ -L > $buildlog 2>&1 + $MAKE VERBOSE=1 -C $ARCH-build >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + $MAKE VERBOSE=1 -C $ARCH-build install >> $buildlog 2>&1 + cd $OLDPWD +} + +check() { + echo "The test must be on an OpenHarmony device!" +} + +# 清理环境 +cleanbuild() { + rm -rf ${PWD}/$builddir +} diff --git a/community/GKlib/README.OpenSource b/community/GKlib/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..952c1a2845ffe55c2782115860c96df94f8e2a7d --- /dev/null +++ b/community/GKlib/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "GKlib", + "License": "Apache-2.0", + "License File": "https://github.com/KarypisLab/GKlib/blob/master/LICENSE.txt", + "Version Number": "METIS-v5.1.1-DistDGL-0.5", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://github.com/KarypisLab/GKlib/archive/refs/tags/METIS-v5.1.1-DistDGL-0.5.tar.gz", + "Description": "GKlib is a library for graphics programming that provides a series of functions and tools, which can be used to implement basic graphics operations and graphics processing functions." + } +] \ No newline at end of file diff --git a/community/GKlib/SHA512SUM b/community/GKlib/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..d540e1e37834433f138c8a3b17618d631a01e945 --- /dev/null +++ b/community/GKlib/SHA512SUM @@ -0,0 +1 @@ +248db76a51c66ae9b94ac759e19f6e5504dd75d6e1b3a1c0f8a1f2db899099ec7b62328213bfdefef8c70b6be40f122a27d427c016cbf4419fd1e032a52567ca GKlib-METIS-v5.1.1-DistDGL-0.5.tar.gz diff --git a/community/ImageMagick_7_1_1_35/HPKBUILD b/community/ImageMagick_7_1_1_35/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..c00db10fb851fe0cdb645be662d7ffdb67887f41 --- /dev/null +++ b/community/ImageMagick_7_1_1_35/HPKBUILD @@ -0,0 +1,100 @@ +# 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: Jeff Han , wen fan +# Maintainer: Jeff Han + +pkgname=ImageMagick_7_1_1_35 +pkgver=7.1.1-35 +pkgrel= +pkgdesc="ImageMagick is a free and open-source software suite for displaying, converting, and editing raster image and vector image files." +url=https://imagemagick.org/ +archs=(armeabi-v7a arm64-v8a) +license=(ImageMagick) +depends=(libzip zlib_1_3_1 zstd djvulibre fontconfig freetype2 libheif lcms2 openjpeg libpng libtiff libwebp libxml2 icu xz jbigkit bzip2_1_0_8 jpeg) +makedepends=() + +source=https://github.com/ImageMagick/ImageMagick/archive/refs/tags/${pkgver}.tar.gz + +autounpack=true +downloadpackage=true + +builddir=ImageMagick-${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 + else + echo "${ARCH} not support" + return -1 + fi +} + +build() { + cd $builddir-$ARCH-build + export CPPFLAGS="-I${LYCIUM_ROOT}/usr/jpeg/${ARCH}/include -I${LYCIUM_ROOT}/usr/jbigkit/${ARCH}/include -I${LYCIUM_ROOT}/usr/bzip2_1_0_8/${ARCH}/include ${CPPFLAGS}" + export LDFLAGS="-L${LYCIUM_ROOT}/usr/jbigkit/${ARCH}/lib -L${LYCIUM_ROOT}/usr/jpeg/${ARCH}/lib -L${LYCIUM_ROOT}/usr/bzip2_1_0_8/${ARCH}/lib ${LDFLAGS}" + 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() { + cd $builddir-$ARCH-build + sed -i.bak 's/$(MAKE) $(AM_MAKEFLAGS) check-TESTS check-local/#$(MAKE) $(AM_MAKEFLAGS) check-TESTS check-local/g' Makefile # 注释make check 里执行文件的代码,只编译生成测试文件 + sed -i.bak 's/check-TESTS: $(check_PROGRAMS)/check-TESTS: /g' Makefile # 删除check-TESTS的依赖,不检查编译生成测试文件过程 + ${MAKE} check >> ${buildlog} 2>&1 + ret=$? + cd ${OLDPWD} + echo "The test must be on an OpenHarmony device!" + return ${ret} +} + +recoverpkgbuildenv() { + unset host + if [ ${ARCH} == armeabi-v7a ] + then + unsetarm32ENV + elif [ ${ARCH} == arm64-v8a ] + then + unsetarm64ENV + else + echo "${ARCH} not support" + return -1 + fi +} + +# 清理环境 +cleanbuild() { + rm -rf ${PWD}/${builddir} ${PWD}/${builddir}-${ARCH}-build +} diff --git a/community/ImageMagick_7_1_1_35/HPKCHECK b/community/ImageMagick_7_1_1_35/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..c3301f1a6a23e4d79247b8aa941cfc7539ac4432 --- /dev/null +++ b/community/ImageMagick_7_1_1_35/HPKCHECK @@ -0,0 +1,39 @@ +# 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: Jeff Han , wen fan +# Maintainer: Jeff Han + +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 + make check-TESTS > ${logfile} 2>&1 + res=$? + if [ ${res} -ne 0 ] + then + find . -type f -exec sed -i.bak 's|/bin/bash|/data/CIusr/bin/bash|g' {} \; + find . -type f -exec sed -i.bak 's|/usr/bin/sed|/data/CIusr/bin/sed|g' {} \; + make check-TESTS > ${logfile} 2>&1 + res=$? + if [ ${res} -ne 0 ] + then + mkdir -p ${LYCIUM_FAULT_PATH}/${pkgname} + cp test-suite.log ${LYCIUM_FAULT_PATH}/${pkgname}/ + fi + fi + cd ${OLDPWD} + return ${res} +} diff --git a/community/ImageMagick_7_1_1_35/OAT.xml b/community/ImageMagick_7_1_1_35/OAT.xml new file mode 100644 index 0000000000000000000000000000000000000000..89dbc352914f19922588a09677a510c6ee404daf --- /dev/null +++ b/community/ImageMagick_7_1_1_35/OAT.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/community/ImageMagick_7_1_1_35/README.OpenSource b/community/ImageMagick_7_1_1_35/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..3fa7996353bcd5d00a06c8cff914f1c88487fe81 --- /dev/null +++ b/community/ImageMagick_7_1_1_35/README.OpenSource @@ -0,0 +1,165 @@ +[ + { + "Name": "ImageMagick", + "License": "ImageMagick", + "License File": "https://github.com/ImageMagick/ImageMagick/blob/main/LICENSE", + "Version Number": "7.1.1-35", + "Owner": "huangminzhong2@huawei.com", + "Upstream URL": "https://github.com/ImageMagick/ImageMagick", + "Description": "ImageMagick is a free and open-source software suite for displaying, converting, and editing raster image and vector image files." + }, + { + "Name": "libzip", + "License": "BSD license", + "License File": "https://github.com/nih-at/libzip/blob/main/LICENSE", + "Version Number": "v1.9.2", + "Owner": "qinjianqi@huawei.com", + "Upstream URL": "https://github.com/nih-at/libzip.git", + "Description": "This is libzip, a C library for reading, creating, and modifying zip and zip64 archives." + }, + { + "Name": "zlib_1_3_1", + "License": "Zlib", + "License File": "https://github.com/madler/zlib/blob/master/LICENSE", + "Version Number": "v1.3.1", + "Owner": "huangminzhong2@huawei.com", + "Upstream URL": "https://github.com/madler/zlib", + "Description": "zlib 1.3.1 is a general purpose data compression library.All the code is thread safe." + }, + { + "Name": "zstd", + "License": "BSD-3-Clause or GPL-2.0", + "License File": ["https://github.com/facebook/zstd/blob/dev/LICENSE","https://github.com/facebook/zstd/blob/dev/COPYING"], + "Version Number": "v1.5.4", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://github.com/facebook/zstd/releases/download/v1.5.4/zstd-1.5.4.tar.gz", + "Description": "Zstandard, or zstd as short version, is a fast lossless compression algorithm, targeting real-time compression scenarios at zlib-level and better compression ratios." + }, + { + "Name": "djvulibre", + "License": "GPL-2.0-only", + "License File": "https://github.com/barak/djvulibre/blob/master/COPYING", + "Version Number": "3.5.27.1-7", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://github.com/barak/djvulibre/archive/refs/tags/debian/3.5.27.1-7+deb9u1.tar.gz", + "Description": "DjVu (pronounced \"déjà vu\") a set of compression technologies, a file format,and a software platform for the delivery over the Web of digital documents,scanned documents, and high resolution images." + }, + { + "Name": "fontconfig", + "License": "HPND and Public Domain and MIT-Modern-Variant and MIT", + "License File": "https://gitlab.freedesktop.org/fontconfig/fontconfig/-/blob/main/COPYING", + "Version Number": "2.14.2", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://gitlab.freedesktop.org/fontconfig/fontconfig/-/archive/2.14.2/fontconfig-2.14.2.tar.gz", + "Description": "Font configuration and customization library" + }, + { + "Name": "freetype", + "License": "GPL-2-only or FTL", + "License File": "https://github.com/freetype/freetype/blob/master/docs/FTL.TXT", + "Version Number": "2.13.0", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://sourceforge.net/projects/freetype/files/freetype2/2.13.0/freetype-2.13.0.tar.xz", + "Description": "FreeType is written in C. It is designed to be small, efficient, and highly customizable while capable of producing high-quality output (glyph images) of most vector and bitmap font formats for digital typography. FreeType is a freely available and portable software library to render fonts." + }, + { + "Name": "libheif", + "License": "LGPL-3.0-only and MIT", + "License File": "https://github.com/strukturag/libheif/blob/master/COPYING", + "Version Number": "v1.15.2", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://github.com/strukturag/libheif/releases/download/v1.15.2/libheif-1.15.2.tar.gz", + "Description": "libheif is an HEIF and AVIF file format decoder and encoder." + }, + { + "Name": "lcms2", + "License": " MIT license", + "License File": "COPYING", + "Version Number": "2.15", + "Owner": "hanjinfei@foxmail.com", + "Upstream URL": "https://sourceforge.net/projects/lcms/files/lcms/2.15/lcms2-2.15.tar.gz", + "Description": "Little cms is a color management library. Implements fast transforms between ICC profiles. It is focused on speed, and is portable across several platforms." + }, + { + "Name": "openJPEG", + "License": "BSD-2-Clause", + "License File": "https://github.com/uclouvain/openjpeg/blob/master/LICENSE", + "Version Number": "v2.5.0", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://github.com/uclouvain/openjpeg.git", + "Description": "OpenJPEG is an open-source JPEG 2000 codec written in C language. It has been developed in order to promote the use of JPEG 2000, a still-image compression standard from the Joint Photographic Experts Group (JPEG). Since April 2015, it is officially recognized by ISO/IEC and ITU-T as a JPEG 2000 Reference Software." + }, + { + "Name": "libpng", + "License": "libpng-2.0", + "License File": "https://sourceforge.net/p/libpng/code/ci/master/tree/LICENSE", + "Version Number": "1.6.39", + "Owner": "xiafeng@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" + }, + { + "Name": "libtiff", + "License": "libtiff", + "License File": "https://gitlab.com/libtiff/libtiff/-/blob/master/LICENSE.md", + "Version Number": "51558511bdbbcffdce534db21dbaf5d54b31638a", + "Owner": "huangminzhong2@huawei.com", + "Upstream URL": "https://gitlab.com/libtiff/libtiff", + "Description": "a small collection of tools for doingsimple manipulations of TIFF images, and documentation on the library and tools." + }, + { + "Name": "libwebp", + "License": "BSD-3-Clause", + "License File": "https://github.com/webmproject/libwebp/blob/main/COPYING", + "Version Number": "v1.3.1", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://github.com/webmproject/libwebp/archive/refs/tags/v1.3.1.tar.gz", + "Description": "WebP codec is a library to encode and decode images in WebP format. This package contains the library that can be used in other programs to add WebP support, as well as the command line tools 'cwebp' and 'dwebp' to compress and decompress images respectively." + }, + { + "Name": "libxml2", + "License": " MIT license", + "License File": "https://github.com/GNOME/libxml2/blob/master/Copyright", + "Version Number": "v2.11.3", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://github.com/GNOME/libxml2/archive/refs/tags/v2.11.3.tar.gz", + "Description": "libxml2 is an XML toolkit implemented in C, originally developed for the GNOME Project." + }, + { + "Name": "xz", + "License": "Public Domain and LGPL-2.1 and GPL-2.0 and GPL-3.0", + "License File": ["https://github.com/tukaani-project/xz/blob/v5.4/COPYING","https://github.com/tukaani-project/xz/blob/v5.4/COPYING.GPLv2", + "https://github.com/tukaani-project/xz/blob/v5.4/COPYING.GPLv3","https://github.com/tukaani-project/xz/blob/v5.4/COPYING.LGPLv2.1"], + "Version Number": "5.4.1", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://github.com/tukaani-project/xz/releases/download/v5.4.1/xz-5.4.1.tar.gz", + "Description": "XZ Utils is free general-purpose data compression software with a high compression ratio. " + }, + { + "Name": "jbigkit", + "License": "GPL-2.0-only", + "License File": "COPYING", + "Version Number": "2.1", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://www.cl.cam.ac.uk/~mgk25/jbigkit/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." + }, + { + "Name": "bzip2_1_0_8", + "License": "bzip2-1.0.6", + "License File": "https://sourceforge.net/p/bzip2/bzip2/ci/bzip2-1_0_6/tree/LICENSE", + "Version Number": "1.0.8", + "Owner": "huangminzhong2@huawei.com", + "Upstream URL": "https://sourceware.org/git/bzip2", + "Description": "bzip2 is a freely available, patent free (see below), high-quality data compressor. It typically compresses files to within 10% to 15% of the best available techniques (the PPM family of statistical compressors), whilst being around twice as fast at compression and six times faster at decompression." + }, + { + "Name": "jpeg", + "License": "IJG", + "License File": "https://www.ijg.org/files/README", + "Version Number": "v9e", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "http://www.ijg.org/files/jpegsrc.v9e.tar.gz", + "Description": "IJG is an informal group that writes and distributes a widely used free library for JPEG image compression" + } +] diff --git a/community/ImageMagick_7_1_1_35/README_zh.md b/community/ImageMagick_7_1_1_35/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..dd1a36ecb60a83fb59b13220ff029f456c9284d7 --- /dev/null +++ b/community/ImageMagick_7_1_1_35/README_zh.md @@ -0,0 +1,15 @@ +# ImageMagick三方库说明 +## 功能简介 + ImageMagick是一个免费的开源软件套件,用于显示、转换和编辑光栅图像和矢量图像文件。 + +## 三方库版本 +- 7.1.1-35 + +## 已适配功能 +- 支持图像格式转换、图像编辑(图像尺寸调整、旋转、锐化和减色)和图像添加水印 + +## 使用约束 +- [IDE和SDK版本](../../docs/constraint.md) + + ## 集成方式 +[应用包hap集成](docs/hap_integrate.md) diff --git a/community/ImageMagick_7_1_1_35/SHA512SUM b/community/ImageMagick_7_1_1_35/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..5e9b70d00fc28ff8a69d179fa1582669f2b734c9 --- /dev/null +++ b/community/ImageMagick_7_1_1_35/SHA512SUM @@ -0,0 +1 @@ +e3e2188b365b1557ecd89acfbffe869e17668634c3c3f21bc52372a34eb79652df14d0a2ea3c1cdc22f186cdaa27bb1833ff25935de6eae5899846db6047b2ee ImageMagick-7.1.1-35.tar.gz diff --git a/community/ImageMagick_7_1_1_35/docs/hap_integrate.md b/community/ImageMagick_7_1_1_35/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..0ae0f45f8ef1c93fafebb0bc25d9c2fd9d9ca117 --- /dev/null +++ b/community/ImageMagick_7_1_1_35/docs/hap_integrate.md @@ -0,0 +1,84 @@ +# ImageMagick_7_1_1_35集成到应用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 + ``` + +- 三方库目录结构 + + ``` + tpc_c_cplusplus/thirdparty/ImageMagick_7_1_1_35 #三方库ImageMagick_7_1_1_35的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── HPKCHECK #测试脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本、license等信息 + ├── README_zh.md #三方库简介 + ├── OAT.xml #扫描结果文件 + ``` + +- 在lycium目录下编译三方库 + + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ```shell + cd lycium + ./build.sh ImageMagick_7_1_1_35 + ``` + +- 三方库头文件及生成的库 + + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ```shell + ImageMagick_7_1_1_35/arm64-v8a ImageMagick_7_1_1_35/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 需要将libMagickCore-7.Q16HDRI.so,libMagickWand-7.Q16HDRI.so,libMagick++-7.Q16HDRI.so相关目录拷贝到entry/libs目录下 +- ![thirdparty_install_dir](pic/ImageMagick_so_usage_for_ide.png) + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的库拷贝到该目录下,如下图所示 + + ![thirdparty_install_dir](pic/ImageMagick_usage_for_ide.png) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + + ```cmake + #将三方库的头文件加入工程中 + target_link_libraries(entry PUBLIC ${CMAKE_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/libMagickCore-7.Q16HDRI.so) + target_link_libraries(entry PUBLIC ${CMAKE_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/libMagickWand-7.Q16HDRI.so) + target_link_libraries(entry PUBLIC ${CMAKE_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/libMagick++-7.Q16HDRI.so) + target_include_directories(entry PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/cups/${OHOS_ARCH}/include/ImageMagick-7) + ``` + + +## 测试三方库 + +三方库的测试使用原库自带的测试用例来做测试,[准备三方库测试环境](../../../lycium/README.md#3ci环境准备) + +进入到对应版本目录,执行如下命令make check + + ![ImageMagick-7_test](pic/test.png) + + ![ImageMagick-7_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/community/ImageMagick_7_1_1_35/docs/pic/ImageMagick_so_usage_for_ide.png b/community/ImageMagick_7_1_1_35/docs/pic/ImageMagick_so_usage_for_ide.png new file mode 100644 index 0000000000000000000000000000000000000000..aa2f36e4d2a2557e937f3ae50328dd4c17243d98 Binary files /dev/null and b/community/ImageMagick_7_1_1_35/docs/pic/ImageMagick_so_usage_for_ide.png differ diff --git a/community/ImageMagick_7_1_1_35/docs/pic/ImageMagick_usage_for_ide.png b/community/ImageMagick_7_1_1_35/docs/pic/ImageMagick_usage_for_ide.png new file mode 100644 index 0000000000000000000000000000000000000000..365dd23c8500457cafa5879c64c7137c366b857d Binary files /dev/null and b/community/ImageMagick_7_1_1_35/docs/pic/ImageMagick_usage_for_ide.png differ diff --git a/community/ImageMagick_7_1_1_35/docs/pic/test.png b/community/ImageMagick_7_1_1_35/docs/pic/test.png new file mode 100644 index 0000000000000000000000000000000000000000..97503bc21ec5f33307cbca5de6b732b702eed987 Binary files /dev/null and b/community/ImageMagick_7_1_1_35/docs/pic/test.png differ diff --git a/community/ImageMagick_7_1_1_35/docs/pic/test_result.png b/community/ImageMagick_7_1_1_35/docs/pic/test_result.png new file mode 100644 index 0000000000000000000000000000000000000000..669aaa5ac425266ce1283a6acfbc9ea23231af87 Binary files /dev/null and b/community/ImageMagick_7_1_1_35/docs/pic/test_result.png differ diff --git a/community/InferLLM/HPKBUILD b/community/InferLLM/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..9d408418d37dbdf022c1201d61ba0d42d1a62935 --- /dev/null +++ b/community/InferLLM/HPKBUILD @@ -0,0 +1,61 @@ +# Copyright (c) 2023, HiHope Community. +# 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: jiajiahao +# Maintainer: jiajiajiao + +pkgname=InferLLM +pkgver=405d866e4c11b884a8072b4b30659c63555be41d # InferLLM main之前的branches分支不能正常通过编译,故使用指定commterID的版本。 +pkgrel=0 +pkgdesc="InferLLM is a lightweight LLM model inference framework that mainly references and borrows from the llama.cpp project." +url="https://github.com/MegEngine/InferLLM" +archs=("armeabi-v7a" "arm64-v8a") +license=("Apache License") +depends=() +makedepends=() + +source="https://codeload.github.com/MegEngine/$pkgname/zip/$pkgver" + +downloadpackage=true +autounpack=true +builddir=$pkgname-${pkgver} +packagename=$builddir.zip +prepare() { + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + PKG_CONFIG_LIBDIR="${pkgconfigpath}" ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" \ + -B$ARCH-build -S./ > $buildlog 2>&1 + $MAKE VERBOSE=1 -C $ARCH-build >> $buildlog 2>&1 # 此处使用$MAKE,在lycium/build.sh中定义,变量值为make -j32。日志路径使用变量build.log + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + $MAKE VERBOSE=1 -C $ARCH-build >> $buildlog 2>&1# 此处使用$MAKE,在lycium/build.sh中定义,变量值为make -j32。日志路径使用变量build.log + cd $OLDPWD +} + +check() { + echo "The test must be on an OpenHarmony device!" + # TODO +} + +# 清理环境 +cleanbuild() { + rm -rf ${PWD}/$builddir #${PWD}/$packagename +} \ No newline at end of file diff --git a/community/InferLLM/OAT.xml b/community/InferLLM/OAT.xml new file mode 100644 index 0000000000000000000000000000000000000000..48451617d589699332b69c13b4e80ffe2b8d0375 --- /dev/null +++ b/community/InferLLM/OAT.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/community/InferLLM/README.OpenSource b/community/InferLLM/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..7e62d5a2ec7f2ff4d1e7b1e3d335a2181af1d4b0 --- /dev/null +++ b/community/InferLLM/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "InferLLM", + "License": "Apache-2.0 license", + "License File": "LICENSE", + "Version Number": "405d866e4c11b884a8072b4b30659c63555be41d", + "Owner": "jia_jiahao@runkaihong.com.cn", + "Upstream URL": "https://github.com/MegEngine/InferLLM", + "Description": "InferLLM 是一个简单高效的 LLM CPU 推理框架,可以实现在本地部署 LLM 中的量化模型" + } +] \ No newline at end of file diff --git a/community/InferLLM/README_zh.md b/community/InferLLM/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..eb43bbbcc5d929d927b2cc65e482303d83f3e36f --- /dev/null +++ b/community/InferLLM/README_zh.md @@ -0,0 +1,14 @@ +# InferLLM三方库说明 + +## 功能简介 +InferLLM 是一个简单高效的 LLM CPU 推理框架,可以实现在本地部署 LLM 中的量化模型 + +## 三方库版本 +- 405d866e4c11b884a8072b4b30659c63555be41d + +## 使用约束 +- [IDE和SDK版本](../../docs/constraint.md) + +## 集成方式 + ++ [应用hap包集成](docs/hap_integrate.md) diff --git a/community/InferLLM/SHA512SUM b/community/InferLLM/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..1965fea11221755df8baf906e06e9ede9a88fd32 --- /dev/null +++ b/community/InferLLM/SHA512SUM @@ -0,0 +1 @@ +a062ecadd4a9abb87f0d0a5e91506994ec8d239edfe0019eccc3376f10be6f27a878d8019e4859a3a8a0cbbdcf39e7d37d267ac5b20ae00445de14d444f09e81 InferLLM-405d866e4c11b884a8072b4b30659c63555be41d.zip diff --git a/community/InferLLM/docs/hap_integrate.md b/community/InferLLM/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..a23f721f24287baf533aa18ad45de1940c42e0d5 --- /dev/null +++ b/community/InferLLM/docs/hap_integrate.md @@ -0,0 +1,110 @@ +# InferLLM在OpenHarHarmony上运行 + +本库是在RK3568开发板上基于OpenHarmony3.2 Release版本的镜像验证的,如果是从未使用过RK3568,可以先查看[润和RK3568开发板标准系统快速上手](https://gitee.com/openharmony-sig/knowledge_demo_temp/tree/master/docs/rk3568_helloworld)。 + +## 开发环境 + +- [开发环境准备](../../../docs/hap_integrate_environment.md) + +## 编译三方库 + +- 下载本仓库 + + ``` + git clone https://gitee.com/openharmony-sig/tpc_c_cplusplus.git --depth=1 + ``` + +- 三方库目录结构 + + ```shell + tpc_c_cplusplus/thirdparty/InferLLM #三方库InferLLM的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── README_zh.md #InferLLM说明文档 + ├── SHA512SUM #三方库校验文件 + ├── OAT.xml #OAT开源审查文本 + ``` + +- 在lycium目录下编译三方库 + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ``` + cd lycium + ./build.sh InferLLM + ``` + + +- 三方库头文件及生成的库 + 在tpc_c_cplusplus/thirdparty/InferLLM/目录下会生成InferLLM-405d866e4c11b884a8072b4b30659c63555be41d目录,该目录下存在已编译完成的32位和64位三方库。(相关编译结果不会被打包进入lycium目录下的usr目录) + + ``` + InferLLM-405d866e4c11b884a8072b4b30659c63555be41d/arm64-v8a-build + InferLLM-405d866e4c11b884a8072b4b30659c63555be41d/armeabi-v7a-build + ``` + +- [测试三方库](#测试三方库) + +## 测试三方库 + +`特别说明:InferLLM相关编译产物不能被集成进hap(没有头文件库和api引出)` + +对InferLLM三方库的测试通过执行它的编译产物llama可执行文件来进行,在OpenHarmony设备 rk3568开发板(2GB版本)上部署大语言模型。 + +- 测试准备 + - 1.下载模型文件:[chinese-alpaca-7b-q4.bin](https://huggingface.co/kewin4933/InferLLM-Model/tree/main) + - 2.将编译InferLLM生成的`llama可执行文件`、OpenHarmony sdk中的`libc++_shared.so`、下载好的模型文件`chinese-alpaca-7b-q4.bin` 打包成文件夹 llama_file + +``` +# 将llama_file文件夹发送到开发板data目录 +hdc file send llama_file /data +``` + +``` +# hdc shell 进入开发板执行 +cd data/llama_file + +# 在2GB的dayu200上加swap交换空间 +# 新建一个空的ram_ohos文件 +touch ram_ohos +# 创建一个用于交换空间的文件(8GB大小的交换文件) +fallocate -l 8G /data/ram_ohos +# 设置文件权限,以确保所有用户可以读写该文件: +chmod 777 /data/ram_ohos +# 将文件设置为交换空间: +mkswap /data/ram_ohos +# 启用交换空间: +swapon /data/ram_ohos + +# 设置库搜索路径 +export LD_LIBRARY_PATH=/data/llama_file:$LD_LIBRARY_PATH + +# 提升rk3568cpu频率 +# 查看 CPU 频率 +cat /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_cur_freq + +# 查看 CPU 可用频率(不同平台显示的可用频率会有所不同) +cat /sys/devices/system/cpu/cpufreq/policy0/scaling_available_frequencies + +# 将 CPU 调频模式切换为用户空间模式,这意味着用户程序可以手动控制 CPU 的工作频率,而不是由系统自动管理。这样可以提供更大的灵活性和定制性,但需要注意合理调整频率以保持系统稳定性和性能。 +echo userspace > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor + +# 设置rk3568 CPU 频率为1.9GHz +echo 1992000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_setspeed + +# 执行大语言模型 +chmod 777 llama +./llama -m chinese-alpaca-7b-q4.bin -t 4 +``` + +移植InferLLM三方库在OpenHarmmony设备rk3568上部署大语言模型实现人机对话。最后运行效果有些慢,跳出人机对话框也有些慢,请耐心等待。 + +![Alt text](./pic/hap_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/community/InferLLM/docs/pic/hap_result.png b/community/InferLLM/docs/pic/hap_result.png new file mode 100644 index 0000000000000000000000000000000000000000..2ed5ed598dafb521ad555a74c505ac06dc023b55 Binary files /dev/null and b/community/InferLLM/docs/pic/hap_result.png differ diff --git a/community/LuaJIT/HPKBUILD b/community/LuaJIT/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..b2b968d952e4756263319b1f89717e6308c15304 --- /dev/null +++ b/community/LuaJIT/HPKBUILD @@ -0,0 +1,77 @@ +# Contributor: Jeff Han +# Maintainer: Jeff Han +pkgname=LuaJIT +pkgver=v2.1.0-beta3 +pkgrel=0 +pkgdesc="A Just-In-Time Compiler for Lua." +url="https://luajit.org/" +archs=("armeabi-v7a" "arm64-v8a") +license=("MIT") +depends=() +makedepends=("gcc") + +source="https://github.com/LuaJIT/$pkgname/archive/refs/tags/$pkgver.tar.gz" + +autounpack=true +downloadpackage=true +buildtools="make" + +builddir=$pkgname-${pkgver:1} +packagename=$builddir.tar.gz + +dynamic_cc= +target_ld= +static_cc= +target_ar= +target_strip= +# luajit 采用makefile编译构建,为了保留构建环境(方便测试)。因此同一份源码在解压后分为两份,各自编译互不干扰 +# 如果编译环境为x86-64, 请安装32位开发环境,否则无法编译armeabi-v7a +# sudo apt-get install build-essential module-assistant +# sudo apt-get install gcc-multilib g++-multilib +prepare() { + cp -rf $builddir $builddir-$ARCH-build + cd $builddir-$ARCH-build + if [ $ARCH == "armeabi-v7a" ] + then + dynamic_cc=${OHOS_SDK}/native/llvm/bin/arm-linux-ohos-clang + target_ld=${OHOS_SDK}/native/llvm/bin/arm-linux-ohos-clang + host_gcc="gcc -m32" + fi + if [ $ARCH == "arm64-v8a" ] + then + dynamic_cc=${OHOS_SDK}/native/llvm/bin/aarch64-linux-ohos-clang + target_ld=${OHOS_SDK}/native/llvm/bin/aarch64-linux-ohos-clang + host_gcc="gcc" + fi + static_cc=${dynamic_cc} + export target_ar="${OHOS_SDK}/native/llvm/bin/llvm-ar rcus 2>/dev/null" + target_strip=${OHOS_SDK}/native/llvm/bin/llvm-strip + cd $OLDPWD +} +build() { + cd $builddir-$ARCH-build + $MAKE HOST_CC="$host_gcc" CFLAGS="-fPIC" DYNAMIC_CC=${dynamic_cc} \ + TARGET_LD=${target_ld} STATIC_CC=${static_cc} TARGET_AR="${target_ar}" \ + TARGET_STRIP=${target_strip} VERBOSE=1 > $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir-$ARCH-build + $MAKE install PREFIX=$LYCIUM_ROOT/usr/$pkgname/$ARCH >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + unset dynamic_cc target_ld static_cc target_ar target_strip + 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 +} diff --git a/community/LuaJIT/README.OpenSource b/community/LuaJIT/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..bca7f6de67b5127baecee2baae4080a20b14419a --- /dev/null +++ b/community/LuaJIT/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "LuaJIT", + "License": "MIT license", + "License File": "https://github.com/LuaJIT/LuaJIT/blob/v2.1/COPYRIGHT", + "Version Number": "2.1.0-beta3", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://luajit.org/download/LuaJIT-2.1.0-beta3.tar.gz", + "Description": "A Just-In-Time Compiler for Lua." + } +] \ No newline at end of file diff --git a/community/LuaJIT/SHA512SUM b/community/LuaJIT/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..ac1cd438e0b88c7df334b3717038b2dbea9ad960 --- /dev/null +++ b/community/LuaJIT/SHA512SUM @@ -0,0 +1 @@ +fe4fed5703ca856a8220d9a42119ad7c955e1f78ed23cc2f9d8edad1bb45c2c9ff01503302c3c67fd4459abcdc2090d78f10d763ac11045b2b4d46388af88f2e LuaJIT-2.1.0-beta3.tar.gz diff --git a/community/METIS/HPKBUILD b/community/METIS/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..7b56fe11c35f89cb2f399fd4bc058c0c5c23beec --- /dev/null +++ b/community/METIS/HPKBUILD @@ -0,0 +1,75 @@ +# Contributor: shann +# Maintainer: shann +pkgname=METIS +pkgver=v5.2.1 +pkgrel=0 +pkgdesc="METIS is a set of serial programs for partitioning graphs, partitioning finite element meshes, and producing fill reducing orderings for sparse matrices. The algorithms implemented in METIS are based on the multilevel recursive-bisection, multilevel k-way, and multi-constraint partitioning schemes developed in our lab." +url="https://github.com/KarypisLab/METIS" +archs=("armeabi-v7a" "arm64-v8a") +license=("Apache-2.0") +depends=("GKlib") +makedepends=() + +source="https://github.com/KarypisLab/$pkgname/archive/refs/tags/$pkgver.tar.gz" + +autounpack=true +downloadpackage=true +buildtools="make" + +builddir=$pkgname-${pkgver:1} +packagename=$builddir.tar.gz + +source envset.sh +firstflag=true + +prepare() { + if [ $ARCH == "armeabi-v7a" ]; then + setarm32ENV + elif [ $ARCH == "arm64-v8a" ]; then + setarm64ENV + else + echo "${ARCH} not support" + return -1 + fi + + if $firstflag + then + cd $builddir + # https://github.com/KarypisLab/METIS/issues/54 官方相同bug + patch -p1 < ../METIS_oh_pkg.patch + cd $OLDPWD + firstflag=false + fi + cp -r $builddir $builddir-$ARCH-build +} + +build() { + cd $builddir-$ARCH-build + make config cc=$CC prefix=$LYCIUM_ROOT/usr/$pkgname/$ARCH gklib_path=$LYCIUM_ROOT/usr/GKlib/$ARCH/ > `pwd`/build.log 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir-$ARCH-build + make install >> `pwd`/build.log 2>&1 + cd $OLDPWD +} + +check() { + if [ $ARCH == "armeabi-v7a" ]; then + unsetarm32ENV + elif [ $ARCH == "arm64-v8a" ]; then + unsetarm64ENV + else + echo "${ARCH} not support" + return -1 + fi + echo "The test must be on an OpenHarmony device!" +} + +# 清理环境 +cleanbuild() { + rm -rf ${PWD}/$builddir ${PWD}/METIS-5.2.1-arm64-v8a-build ${PWD}/METIS-5.2.1-armeabi-v7a-build +} diff --git a/community/METIS/METIS_oh_pkg.patch b/community/METIS/METIS_oh_pkg.patch new file mode 100644 index 0000000000000000000000000000000000000000..3bea12b1dcb7ba2d789988b8f4cf32fa72038289 --- /dev/null +++ b/community/METIS/METIS_oh_pkg.patch @@ -0,0 +1,36 @@ +diff -Naur METIS-5.2.1_old/programs/gpmetis.c METIS-5.2.1/programs/gpmetis.c +--- METIS-5.2.1_old/programs/gpmetis.c 2023-08-02 20:05:49.538058190 +0800 ++++ METIS-5.2.1/programs/gpmetis.c 2023-08-02 20:06:11.002477166 +0800 +@@ -245,7 +245,7 @@ + getrusage(RUSAGE_SELF, &usage); + printf(" rusage.ru_maxrss:\t\t %7.3"PRREAL" MB\n", (real_t)(usage.ru_maxrss/(1024.0))); + } +- printf(" proc/self/stat/VmPeak:\t %7.3"PRREAL" MB\n", (real_t)gk_GetProcVmPeak()/(1024.0*1024.0)); ++ //printf(" proc/self/stat/VmPeak:\t %7.3"PRREAL" MB\n", (real_t)gk_GetProcVmPeak()/(1024.0*1024.0)); + #endif + + printf("******************************************************************************\n"); +diff -Naur METIS-5.2.1_old/programs/mpmetis.c METIS-5.2.1/programs/mpmetis.c +--- METIS-5.2.1_old/programs/mpmetis.c 2023-08-02 20:05:49.538058190 +0800 ++++ METIS-5.2.1/programs/mpmetis.c 2023-08-02 20:06:29.618836694 +0800 +@@ -194,7 +194,7 @@ + getrusage(RUSAGE_SELF, &usage); + printf(" rusage.ru_maxrss:\t\t %7.3"PRREAL" MB\n", (real_t)(usage.ru_maxrss/(1024.0))); + } +- printf(" proc/self/stat/VmPeak:\t %7.3"PRREAL" MB\n", (real_t)gk_GetProcVmPeak()/(1024.0*1024.0)); ++ //printf(" proc/self/stat/VmPeak:\t %7.3"PRREAL" MB\n", (real_t)gk_GetProcVmPeak()/(1024.0*1024.0)); + #endif + + printf("******************************************************************************\n"); +diff -Naur METIS-5.2.1_old/programs/ndmetis.c METIS-5.2.1/programs/ndmetis.c +--- METIS-5.2.1_old/programs/ndmetis.c 2023-08-02 20:05:49.538058190 +0800 ++++ METIS-5.2.1/programs/ndmetis.c 2023-08-02 20:06:22.970708705 +0800 +@@ -178,7 +178,7 @@ + getrusage(RUSAGE_SELF, &usage); + printf(" rusage.ru_maxrss:\t\t %7.3"PRREAL" MB\n", (real_t)(usage.ru_maxrss/(1024.0))); + } +- printf(" proc/self/stat/VmPeak:\t %7.3"PRREAL" MB\n", (real_t)gk_GetProcVmPeak()/(1024.0*1024.0)); ++ //printf(" proc/self/stat/VmPeak:\t %7.3"PRREAL" MB\n", (real_t)gk_GetProcVmPeak()/(1024.0*1024.0)); + #endif + + printf("******************************************************************************\n"); diff --git a/community/METIS/README.OpenSource b/community/METIS/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..23779fac4c03a2bf988d1fcb0b05172c18c2f4e6 --- /dev/null +++ b/community/METIS/README.OpenSource @@ -0,0 +1,20 @@ +[ + { + "Name": "METIS", + "License": "Apache-2.0", + "License File": "https://github.com/KarypisLab/METIS/blob/master/LICENSE", + "Version Number": "v5.2.1", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://github.com/KarypisLab/METIS/archive/refs/tags/v5.2.1.tar.gz", + "Description": "METIS is a set of serial programs for partitioning graphs, partitioning finite element meshes, and producing fill reducing orderings for sparse matrices. The algorithms implemented in METIS are based on the multilevel recursive-bisection, multilevel k-way, and multi-constraint partitioning schemes developed in our lab." + }, + { + "Name": "GKlib", + "License": "Apache-2.0", + "License File": "https://github.com/KarypisLab/GKlib/blob/master/LICENSE.txt", + "Version Number": "METIS-v5.1.1-DistDGL-0.5", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://github.com/KarypisLab/GKlib/archive/refs/tags/METIS-v5.1.1-DistDGL-0.5.tar.gz", + "Description": "GKlib is a library for graphics programming that provides a series of functions and tools, which can be used to implement basic graphics operations and graphics processing functions." + } +] \ No newline at end of file diff --git a/community/METIS/SHA512SUM b/community/METIS/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..b80cecab3f5883f7c67f73a205964cb42cfc93a4 --- /dev/null +++ b/community/METIS/SHA512SUM @@ -0,0 +1 @@ +69127b7a777f9ba14cf399a7122000af9d6094a5f44be600a28384cfc0495c024fb0c6eab37c4473a5763ec1077cd9f30d9bcbb3c952462f6c9ead31c6b9e790 METIS-5.2.1.tar.gz diff --git a/community/OpenBLAS/HPKBUILD b/community/OpenBLAS/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..c636bccb35fc27989ac7f9b539904ead3222b413 --- /dev/null +++ b/community/OpenBLAS/HPKBUILD @@ -0,0 +1,89 @@ +# 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: Chen Xu +# Maintainer: Chen Xu +pkgname=OpenBLAS +pkgver="v0.3.5" +pkgrel=0 +pkgdesc="OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version." +url="https://www.openblas.net" +archs=("armeabi-v7a" "arm64-v8a") +license=("BSD-3-Clause license") +depends=() +makedepends=("gcc") + +# source="https://github.com/xianyi/$pkgname/archive/refs/tags/$pkgver.tar.gz" +source="https://gitee.com/mirrors/$pkgname/repository/archive/$pkgver.zip" + +downloadpackage=true +autounpack=true +buildtools="make" + +builddir=$pkgname-$pkgver +packagename=$builddir.zip + +source envset.sh +openblastarget= + +prepare() { + cp -rf $builddir $builddir-$ARCH-build + if [ $ARCH == "armeabi-v7a" ] + then + setarm32ENV + openblastarget="ARMV7" + elif [ $ARCH == "arm64-v8a" ] + then + setarm64ENV + openblastarget="ARMV8" + else + echo "${ARCH} not support" + return -1 + fi +} + +build() { + cd $builddir-$ARCH-build + $MAKE TARGET=${openblastarget} AR=${AR} RANLIB=echo ARM_SOFTFP_ABI=1 ONLY_CBLAS=1 HOSTCC=gcc NUM_THREADS=32 USE_THREAD=0 libs netlib shared VERBOSE=1 \ + > $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir-$ARCH-build + $MAKE PREFIX=$LYCIUM_ROOT/usr/$pkgname/$ARCH install VERBOSE=1 >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + unset openblastarget + if [ $ARCH == "armeabi-v7a" ] + then + unsetarm32ENV + elif [ $ARCH == "arm64-v8a" ] + then + unsetarm64ENV + else + echo "${ARCH} not support" + return -1 + fi + return $ret +} + +check() { + echo "The test must be on an OpenHarmony device!" +} + +# 清理环境 +cleanbuild() { + rm -rf ${PWD}/$builddir ${PWD}/$builddir-armeabi-v7a-build ${PWD}/$builddir-arm64-v8a-build # ${PWD}/$packagename +} diff --git a/community/OpenBLAS/SHA512SUM b/community/OpenBLAS/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..a6ed760dfcf7fb2ae4912b439897dfd7286c786b --- /dev/null +++ b/community/OpenBLAS/SHA512SUM @@ -0,0 +1 @@ +e3e4936a52df758bb043dc0c3c602b12b2e85e18761b647d0a48a8f3ae9ce583193488c53ceccd97669eaa77971cf151d6e38c988f4ac9c0f4ca02414211a027 OpenBLAS-v0.3.5.zip diff --git a/community/OpenBLAS_0.3.23/HPKBUILD b/community/OpenBLAS_0.3.23/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..199d5c1b3e582e97d0a8eb4ae66277b3a8bdb643 --- /dev/null +++ b/community/OpenBLAS_0.3.23/HPKBUILD @@ -0,0 +1,75 @@ +# 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: zhaoxu <357489213@qq.com> +# Maintainer: zhaoxu <357489213@qq.com> + +pkgname=OpenBLAS_0.3.23 +pkgver=0.3.23 +pkgrel=0 +pkgdesc="OpenBLAS is an optimized BLAS (Basic Linear Algebra Subprograms) library based on GotoBLAS2 1.13 BSD version." +url="https://www.openblas.net" +archs=("armeabi-v7a" "arm64-v8a") +license=("BSD-3-Clause license") +depends=() +makedepends=() + +# 源source="https://github.com/xianyi/${pkgname:0:8}/releases/download/v$pkgver/${pkgname:0:8}-$pkgver.tar.gz" +source="https://gitee.com/mirrors/${pkgname:0:8}/repository/archive/v${pkgver}.zip" + +autounpack=true +downloadpackage=true +buildtools="cmake" + +builddir=${pkgname:0:8}-v${pkgver} +packagename=v$pkgver.zip +patchflag=true + +prepare() { + if $patchflag + then + cd $builddir + # patch 增加使用软件浮点运算指令集 + patch -p1 < `pwd`/../OpenBLAS_oh_pkg.patch + patchflag=false + cd $OLDPWD + fi + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + PKG_CONFIG_LIBDIR="${pkgconfigpath}" \ + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" \ + -DCMAKE_Fortran_COMPILER=OFF -DOHOS_ARCH=$ARCH -B$ARCH-build -S./ -L > $buildlog 2>&1 + $MAKE -C $ARCH-build VERBOSE=1 >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + $MAKE -C $ARCH-build install VERBOSE=1 >> $buildlog 2>&1 + cd $OLDPWD +} + +check() { + echo "The test must be on an OpenHarmony device!" +} + +# 清理环境 +cleanbuild() { + echo "Clean build diretory!" + rm -rf ${PWD}/$builddir #${PWD}/$packagename +} \ No newline at end of file diff --git a/community/OpenBLAS_0.3.23/OpenBLAS_oh_pkg.patch b/community/OpenBLAS_0.3.23/OpenBLAS_oh_pkg.patch new file mode 100644 index 0000000000000000000000000000000000000000..5d50e31d22b00d1ca96f40f44f61884844fa2395 --- /dev/null +++ b/community/OpenBLAS_0.3.23/OpenBLAS_oh_pkg.patch @@ -0,0 +1,11 @@ +diff -rupN OpenBLAS-0.3.23/CMakeLists.txt OpenBLAS-0.3.23_patch/CMakeLists.txt +--- OpenBLAS-0.3.23/CMakeLists.txt 2023-08-24 15:43:10.734511633 +0800 ++++ OpenBLAS-0.3.23_patch/CMakeLists.txt 2023-08-24 15:44:08.619766867 +0800 +@@ -16,6 +16,7 @@ set(OpenBLAS_VERSION "${OpenBLAS_MAJOR_V + include(GNUInstallDirs) + + include(CMakePackageConfigHelpers) ++add_compile_options(-mfloat-abi=softfp) + + ####### + option(BUILD_WITHOUT_LAPACK "Do not build LAPACK and LAPACKE (Only BLAS or CBLAS)" OFF) diff --git a/community/OpenBLAS_0.3.23/SHA512SUM b/community/OpenBLAS_0.3.23/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..7bd6c58952a179525ba13204806de9c4e92e65a7 --- /dev/null +++ b/community/OpenBLAS_0.3.23/SHA512SUM @@ -0,0 +1,2 @@ +c2233d52788b9e88abe406bb3fc7c1ffa78a6952aa5316941199fd17ca5df4419e7f47da0e1f38c515bd7781928e9dfebf7690f8845b050882dd0602e6c48ae2 v0.3.23.zip +da16c3cffc285f7fdd15fb6bd1672a3840d2e728f059b592ba488413f618a34cf8c43f47f32daadea9e1c8fb2a9d1ec1aa5374983e78f979e046608e2047d993 OpenBLAS_oh_pkg.patch diff --git a/community/Paddle-Lite-2.7/HPKBUILD b/community/Paddle-Lite-2.7/HPKBUILD new file mode 100755 index 0000000000000000000000000000000000000000..afbacfe506cac899829da86d0c00b99f7ac14742 --- /dev/null +++ b/community/Paddle-Lite-2.7/HPKBUILD @@ -0,0 +1,159 @@ +# 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: liukai +# Maintainer: liukai + +pkgname=Paddle-Lite-2.7 +pkgver=v2.7 +pkgrel=0 +pkgdesc="PaddlePaddle High Performance Deep Learning Inference Engine for Mobile and Edge." +url="www.paddlepaddle.org.cn/lite" +archs=("armeabi-v7a" "arm64-v8a") +license=("Apache-2.0 license") +depends=() +makedepends=("python3") + +source="https://gitee.com/lycium_pkg_mirror/Paddle-Lite/repository/archive/$pkgver.zip" + +buildtools="cmake" +autounpack=true +patchflag=true +downloadpackage=true + +builddir=Paddle-Lite-v2.7 +packagename=$pkgname.zip +extracflags= +arch= +# 准备三方代码 +repos=( + "https://gitee.com/mirrors/gflags.git" # 源链接: https://github.com/gflags/gflags.git + "https://gitee.com/mirrors/googletest.git" # 源链接: https://github.com/google/googletest.git +) +# 对应文件夹 +folders=( + "third-party/gflags" + "third-party/googletest" +) +# branches + +commitIDs=( + "77592648e3f3be87d6c7123eb81cbad75f9aef5a" # gflags + "ec44c6c1675c25b9827aacd08c02433cccde7780" # googletest +) + +clonesrc() { + for (( i=0; i<${#repos[@]}; i++ ));do + repo=${repos[$i]} + folder=${folders[$i]} + commitID=${commitIDs[$i]} + + git clone $repo $folder + if [ $? -ne 0 ];then + return -1 + fi + cd $folder + git checkout --detach $commitID + cd $OLDPWD + done +} + +prepare() { + # 1、大多数仿照Android移植修改。但Android的测试用例是单独写的,只使用了部分测试用例, + # Android单元测试脚本: tools/ci_tools/ci_android_unit_test.sh + # 2、有部分修改是测试用例存在明显错误,没有指定模型文件,或模型文件指向不对, + # 参考issue: https://github.com/PaddlePaddle/Paddle-Lite/issues/10351 + # 3、还有部分修改是因为OH系统性能不够,延长了超时时间 + # 4、测试用例在执行汇编指令时出现段错误。 + # 参考issue: https://github.com/PaddlePaddle/Paddle-Lite/issues/10355 + # 参考PR: https://github.com/PaddlePaddle/Paddle-Lite/pull/10365 + + mkdir -p $builddir/$ARCH-build + + # 2. 准备分析工具 + cd $builddir + mkdir -pv $ARCH-build/lite/tools/debug + cp -v lite/tools/debug/analysis_tool.py $ARCH-build/lite/tools/debug + + #3. 准备生成源码文件 + mkdir -pv $ARCH-build/lite/gen_code + touch $ARCH-build/lite/gen_code/__generated_code__.cc + cd $OLDPWD + + if [ $ARCH == "armeabi-v7a" ];then + extracflags="-march=armv7-a" + arch="armv7" + elif [ $ARCH == "arm64-v8a" ];then + arch="armv8" + extracflags="-march=armv8" + else + echo "$ARCH not support!" + return -2 + fi +} + +build() { + cd $builddir + PKG_CONFIG_LIBDIR="${pkgconfigpath}" ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" \ + -DARM_TARGET_OS="armlinux" -DARM_TARGET_LANG="clang" \ + -DCMAKE_CXX_FLAGS="-Wno-error=register -Wno-unused-but-set-variable $extracflags" \ + -DCMAKE_C_FLAGS="$extracflags -Wno-unused-but-set-variable" \ + -DARM_TARGET_ARCH_ABI=$arch \ + -DLITE_WITH_OPENMP=OFF \ + -DLITE_ON_TINY_PUBLISH=ON \ + -DWITH_ARM_DOTPROD=ON \ + -DWITH_MKL=OFF \ + -DWITH_LITE=ON \ + -DLITE_WITH_ARM=ON \ + -DLITE_WITH_X86=OFF \ + -DLITE_BUILD_EXTRA=ON \ + -DWITH_COVERAGE=ON \ + -DLITE_WITH_LIGHT_WEIGHT_FRAMEWORK=ON \ + -DOHOS_ARCH=$ARCH -B$ARCH-build -S./ -L > $buildlog 2>&1 + $MAKE -C $ARCH-build VERBOSE=1 >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + # 不支持make install, 参考$builddir/lite/tools/build_android.sh 的做法 + $MAKE -C $ARCH-build publish_inference VERBOSE=1 >> $buildlog 2>&1 + mkdir -p $LYCIUM_ROOT/usr/$pkgname/$ARCH + cp -rf $ARCH-build/inference_lite_lib.armlinux.${arch}/cxx/* $LYCIUM_ROOT/usr/$pkgname/$ARCH/ + #cp -rf $ARCH-build/lite/api/*.so $ARCH-build/lite/api/*.a $LYCIUM_ROOT/usr/$pkgname/$ARCH/lib + cd $OLDPWD + + # 恢复环境 + unset extracflags +} + +check() { + if [ $ARCH == "armeabi-v7a" ];then + cp $OHOS_SDK/native/llvm/lib/arm-linux-ohos/libc++_shared.so $builddir/$ARCH-build/ + elif [ $ARCH == "arm64-v8a" ];then + cp $OHOS_SDK/native/llvm/lib/aarch64-linux-ohos/libc++_shared.so $builddir/$ARCH-build/ + else + echo "$ARCH not support!" + return -1 + fi + echo "The test must be on an OpenHarmony device!" + # real test + # ctest +} + +# 清理环境 +cleanbuild(){ + rm -rf $builddir +} diff --git a/community/Paddle-Lite-2.7/OAT.xml b/community/Paddle-Lite-2.7/OAT.xml new file mode 100644 index 0000000000000000000000000000000000000000..eeb1f946d683c0b81976cd06522096062a6901b9 --- /dev/null +++ b/community/Paddle-Lite-2.7/OAT.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/community/Paddle-Lite-2.7/README.OpenSource b/community/Paddle-Lite-2.7/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..4716dc5b277d4919faf94f25e6d096b62fdb4365 --- /dev/null +++ b/community/Paddle-Lite-2.7/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "Paddle-Lite-2.7", + "License": "Apache-2.0 license", + "License File": "LICENSE", + "Version Number": "v2.7", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "www.paddlepaddle.org.cn/lite", + "Description": "PaddlePaddle High Performance Deep Learning Inference Engine for Mobile and Edge." + } +] \ No newline at end of file diff --git a/community/Paddle-Lite-2.7/README_zh.md b/community/Paddle-Lite-2.7/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..f6998c6284031151fcc68a1375b800237a5da1c1 --- /dev/null +++ b/community/Paddle-Lite-2.7/README_zh.md @@ -0,0 +1,12 @@ +# Paddle-Lite 三方库说明 +## 功能简介 +paddlelite是深度神经网络学习框架。 + +## 三方库版本 +- v2.7 + +## 使用约束 +- [IDE和SDK版本](../../docs/constraint.md) + +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) diff --git a/community/Paddle-Lite-2.7/SHA512SUM b/community/Paddle-Lite-2.7/SHA512SUM new file mode 100755 index 0000000000000000000000000000000000000000..11a68c8336160f4cab99bfd46b1597d1be10c330 --- /dev/null +++ b/community/Paddle-Lite-2.7/SHA512SUM @@ -0,0 +1 @@ +a2b3d11bea0713c4fc216713bbc1178c012a3c7a21dd84755bb15b886c5cdb81f5d2efc0beb2fe0975484d3e5626fcf8cfd75b131390cadf51536be007657913 Paddle-Lite-2.7.zip diff --git a/community/Paddle-Lite-2.7/docs/hap_integrate.md b/community/Paddle-Lite-2.7/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..e284077c1663392753262da38c06c95e131587dd --- /dev/null +++ b/community/Paddle-Lite-2.7/docs/hap_integrate.md @@ -0,0 +1,74 @@ +# Paddle-Lite-2.7 集成到应用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/Paddle-Lite-2.7 #三方库Paddle-Lite-2.7的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── SHA512SUM #三方库校验文件 + ├── OAT.xml #OAT开源审查文本文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md #三方库简介 + ``` + +- 在lycium目录下编译三方库 + + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ```shell + cd lycium + ./build.sh Paddle-Lite-2.7 + ``` + +- 三方库头文件及生成的库 + + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ```shell + Paddle-Lite-2.7/arm64-v8a Paddle-Lite-2.7/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 在IDE的cpp目录新建一个thirdparty目录,将生成的二进制文件以及头文件拷贝到该目录下,每种架构目录下包含了该库的头文件(include)、二进制文件(lib),如下图所示: +   + +  ![thirdparty_install_dir](pic/Paddle-Lite-2.7_install_dir.png) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + + ```shell + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/libpaddle_light_api_shared.so) + + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include) + ``` + +## 测试三方库 + + ![Paddle-Lite-2.7_test](pic/Paddle-Lite-2.7_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) \ No newline at end of file diff --git a/community/Paddle-Lite-2.7/docs/pic/Paddle-Lite-2.7_install_dir.png b/community/Paddle-Lite-2.7/docs/pic/Paddle-Lite-2.7_install_dir.png new file mode 100644 index 0000000000000000000000000000000000000000..b60ea0ec6adba4b83cbe1f50e16c29034d64802f Binary files /dev/null and b/community/Paddle-Lite-2.7/docs/pic/Paddle-Lite-2.7_install_dir.png differ diff --git a/community/Paddle-Lite-2.7/docs/pic/Paddle-Lite-2.7_test.jpg b/community/Paddle-Lite-2.7/docs/pic/Paddle-Lite-2.7_test.jpg new file mode 100644 index 0000000000000000000000000000000000000000..8b3ef3e8e82b6964446fa65b67e8c307170eb4b4 Binary files /dev/null and b/community/Paddle-Lite-2.7/docs/pic/Paddle-Lite-2.7_test.jpg differ diff --git a/community/SQLiteCpp-3.2.1/HPKBUILD b/community/SQLiteCpp-3.2.1/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..4b0c998ca770cc9d41b58f9b46be42644df26469 --- /dev/null +++ b/community/SQLiteCpp-3.2.1/HPKBUILD @@ -0,0 +1,73 @@ +# 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=SQLiteCpp-3.2.1 +pkgver=3.2.1 +pkgrel=0 +pkgdesc="SQLiteCpp offers an encapsulation around the native C APIs of SQLite, with a few intuitive and well documented C++ classes." +url="https://github.com/SRombauts/SQLiteCpp/tree/3.2.1" +archs=("armeabi-v7a" "arm64-v8a") +license=("MIT license") +depends=() +makedepends=() +#下载镜像 +source="https://gitee.com/NEU-lab/SQLiteCpp/repository/archive/3.2.1.zip" + +downloadpackage=true +autounpack=true +buildtools=cmake +patchflag=true + +builddir=SQLiteCpp-3.2.1 +packagename=SQLiteCpp-3.2.1.zip + +# 为编译设置环境,如设置环境变量,创建编译目录等 +prepare() { + if $patchflag + then + cd $builddir + #patch用来打开测试用例构建开关;修改了头文件路径 + patch -p1 < `pwd`/../SQLiteCpp-3.2.1_oh_pkg.patch + #patch只需要打一次,关闭打patch + patchflag=false + cd $OLDPWD + fi + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" -DCMAKE_C_FLAGS="-Wno-unused-command-line-argument" \ + -DCMAKE_CXX_FLAGS="-Wno-unused-command-line-argument" -B$ARCH-build -S./ > $buildlog 2>&1 + $MAKE VERBOSE=1 -C $ARCH-build >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + $MAKE -C $ARCH-build install >> $buildlog 2>&1 + cd $OLDPWD +} + +check() { + echo "The test must be on an OpenHarmony device!" +} + +cleanbuild() { + rm -rf ${PWD}/$builddir +} \ No newline at end of file diff --git a/community/SQLiteCpp-3.2.1/HPKCHECK b/community/SQLiteCpp-3.2.1/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..45087f23bbfe1b9cac2c3352e606b765ef4a975f --- /dev/null +++ b/community/SQLiteCpp-3.2.1/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: 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}_${OHOS_SDK_VER}_test.log + + +# 在OH环境执行测试的接口 +openharmonycheck() { + res=0 + cd ${builddir}/${ARCH}-build # 进入到测试目录 + ctest > $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/community/SQLiteCpp-3.2.1/README.OpenSource b/community/SQLiteCpp-3.2.1/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..8a65f5e3da5015d0e5a320e9e0f5da161fa2ab8e --- /dev/null +++ b/community/SQLiteCpp-3.2.1/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "SQLiteCpp-3.2.1", + "License": "MIT license", + "License File": "https://github.com/SRombauts/SQLiteCpp/blob/master/LICENSE.txt", + "Version Number": "3.2.1", + "Owner": "2942375747@qq.com", + "Upstream URL": "https://github.com/SRombauts/SQLiteCpp", + "Description": "SQLiteCpp offers an encapsulation around the native C APIs of SQLite, with a few intuitive and well documented C++ classes." + } +] \ No newline at end of file diff --git a/community/SQLiteCpp-3.2.1/README_zh.md b/community/SQLiteCpp-3.2.1/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..d7a08d87770d85dd91ca17abbf47318c4f41d1a6 --- /dev/null +++ b/community/SQLiteCpp-3.2.1/README_zh.md @@ -0,0 +1,9 @@ +# SQLiteCpp-3.2.1三方库说明 +## 功能简介 +SQLiteCpp是一个简洁易用的c++ SQLite3包装器。 +## 三方库版本: +- 3.2.1 +## 使用约束: +- [IDE和SDK版本](../../docs/constraint.md) +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) \ No newline at end of file diff --git a/community/SQLiteCpp-3.2.1/SHA512SUM b/community/SQLiteCpp-3.2.1/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..626aa7f8b6894633b9df9984f86618a27b6ba949 --- /dev/null +++ b/community/SQLiteCpp-3.2.1/SHA512SUM @@ -0,0 +1 @@ +073dc887d7be063adf01ffcbc04591a4fb8a2daf75f5745c2dbdc24a23962724beecfe6189ff52097d9b0e71267e781a4cb4cde6313eca8990ce17d7e28564c1 SQLiteCpp-3.2.1.zip \ No newline at end of file diff --git a/community/SQLiteCpp-3.2.1/SQLiteCpp-3.2.1_oh_pkg.patch b/community/SQLiteCpp-3.2.1/SQLiteCpp-3.2.1_oh_pkg.patch new file mode 100644 index 0000000000000000000000000000000000000000..8b858418e715e6fc569833914a89d7c0bde78b21 --- /dev/null +++ b/community/SQLiteCpp-3.2.1/SQLiteCpp-3.2.1_oh_pkg.patch @@ -0,0 +1,33 @@ +diff -urN SQLiteCpp-3.2.1_old/CMakeLists.txt SQLiteCpp-3.2.1/CMakeLists.txt +--- SQLiteCpp-3.2.1_old/CMakeLists.txt 2022-12-13 01:14:25.000000000 +0800 ++++ SQLiteCpp-3.2.1/CMakeLists.txt 2024-10-10 15:45:40.029211912 +0800 +@@ -20,7 +20,7 @@ + message (STATUS "CMake version: ${CMAKE_VERSION}") + message (STATUS "Project version: ${PROJECT_VERSION}") + +-option(SQLITECPP_BUILD_TESTS "Build and run tests." OFF) ++option(SQLITECPP_BUILD_TESTS "Build and run tests." ON) + + # Define useful variables to handle OS differences: + if (WIN32) +@@ -393,7 +393,7 @@ + message(STATUS "SQLITECPP_RUN_DOXYGEN OFF") + endif (SQLITECPP_RUN_DOXYGEN) + +-option(SQLITECPP_BUILD_EXAMPLES "Build examples." OFF) ++option(SQLITECPP_BUILD_EXAMPLES "Build examples." ON) + if (SQLITECPP_BUILD_EXAMPLES) + # add the basic example executable + add_executable(SQLiteCpp_example1 ${SQLITECPP_EXAMPLES}) +diff -urN SQLiteCpp-3.2.1_old/sqlite3/sqlite3.c SQLiteCpp-3.2.1/sqlite3/sqlite3.c +--- SQLiteCpp-3.2.1_old/sqlite3/sqlite3.c 2022-12-13 01:14:25.000000000 +0800 ++++ SQLiteCpp-3.2.1/sqlite3/sqlite3.c 2024-10-10 15:47:11.761901957 +0800 +@@ -25406,7 +25406,7 @@ + ** Use the zone allocator available on apple products unless the + ** SQLITE_WITHOUT_ZONEMALLOC symbol is defined. + */ +-#include ++#include + #include + #ifdef SQLITE_MIGHT_BE_SINGLE_CORE + #include diff --git a/community/SQLiteCpp-3.2.1/docs/hap_integrate.md b/community/SQLiteCpp-3.2.1/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..be30c8d0bcb4be39146040fb026a7df94d21bba4 --- /dev/null +++ b/community/SQLiteCpp-3.2.1/docs/hap_integrate.md @@ -0,0 +1,80 @@ +# SQLiteCpp集成到应用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/SQLiteCpp-3.2.1 #三方库SQLiteCpp-3.2.1的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── HPKCHECK #测试脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md #三方库简介 + ├── SQLiteCpp-3.2.1_oh_pkg.patch #用于SQLiteCpp-3.2.1库编译的补丁 + ``` + +- 在lycium目录下编译三方库 + + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ```shell + cd lycium + ./build.sh SQLiteCpp-3.2.1 + ``` + +- 三方库头文件及生成的库 + + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ```shell + SQLiteCpp-3.2.1/arm64-v8a SQLiteCpp-3.2.1/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的头文件和静态库文件拷贝到该目录下,如下图所示: +   + +  ![thirdparty_install_dir](pic/SQLiteCpp_install_dir.png) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + + ```shell + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/SQLiteCpp/${OHOS_ARCH}/lib/libSQLiteCpp.a) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/SQLiteCpp/${OHOS_ARCH}/include) + ``` + +## 测试三方库 +- 编译出可执行的文件,使用原库自带的测试用例来做测试 [准备三方库测试环境](../../../lycium/README.md#3ci环境准备) +进入到构建目录运行测试用例(注意arm64-v8a为构建64位的目录,armeabi-v7a为构建32位的目录)。执行结果如图所示 + +```shell + cd /data/tpc_c_cplusplus/thirdparty/SQLiteCpp-3.2.1/SQLiteCpp-3.2.1/arm64-v8a-build/ + ctest +``` + ![SQLiteCpp_test](pic/SQLiteCpp_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/community/SQLiteCpp-3.2.1/docs/pic/SQLiteCpp_install_dir.png b/community/SQLiteCpp-3.2.1/docs/pic/SQLiteCpp_install_dir.png new file mode 100644 index 0000000000000000000000000000000000000000..71e879860756d5c4560b5529ec8ef5e4cab52aca Binary files /dev/null and b/community/SQLiteCpp-3.2.1/docs/pic/SQLiteCpp_install_dir.png differ diff --git a/community/SQLiteCpp-3.2.1/docs/pic/SQLiteCpp_test.png b/community/SQLiteCpp-3.2.1/docs/pic/SQLiteCpp_test.png new file mode 100644 index 0000000000000000000000000000000000000000..9129ce568f3d3e4937e1e2dabeb1a584c9d77db8 Binary files /dev/null and b/community/SQLiteCpp-3.2.1/docs/pic/SQLiteCpp_test.png differ diff --git a/community/World-1.0.0/HPKBUILD b/community/World-1.0.0/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..61d3c220be510027b94190d09ea85dfccd131aa4 --- /dev/null +++ b/community/World-1.0.0/HPKBUILD @@ -0,0 +1,73 @@ +# 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=World-1.0.0 +pkgver=v1.0.0 +pkgrel=0 +pkgdesc="World is a high-quality speech analysis, manipulation and synthesis system." +url="https://github.com/mmorise/World/tree/v1.0.0" +archs=("armeabi-v7a" "arm64-v8a") +license=("BSD license") +depends=() +makedepends=() +source="https://github.com/mmorise/World/archive/refs/tags/v1.0.0.zip" + +downloadpackage=true +autounpack=true +buildtools=cmake +patchflag=true + +builddir=World-1.0.0 +packagename=World-v1.0.0.zip + +# 为编译设置环境,如设置环境变量,创建编译目录等 +prepare() { + if $patchflag + then + cd $builddir + patch -p1 < `pwd`/../World-1.0.0_oh_pkg.patch + # 基于源库test文件夹里的测试文件,激活测试,从而在交叉编译时构建编译出测试用例的可执行文件 + patchflag=false + cd $OLDPWD + fi + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" -DCMAKE_C_FLAGS="-Wno-unused-command-line-argument" \ + -DCMAKE_CXX_FLAGS="-Wno-unused-command-line-argument" -B$ARCH-build -S./ > $buildlog 2>&1 + $MAKE VERBOSE=1 -C $ARCH-build >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + $MAKE -C $ARCH-build install >> $buildlog 2>&1 + cd $OLDPWD +} + + +check() { + echo "The test must be on an OpenHarmony device!" +} + + +cleanbuild() { + rm -rf ${PWD}/$builddir +} \ No newline at end of file diff --git a/community/World-1.0.0/HPKCHECK b/community/World-1.0.0/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..acddb21d38a5b8f497e911924020a0271d1e06f6 --- /dev/null +++ b/community/World-1.0.0/HPKCHECK @@ -0,0 +1,32 @@ +# 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}_${OHOS_SDK_VER}_test.log + +# 在OH环境执行测试的接口 +openharmonycheck() { + res=0 + cd ${builddir}/${ARCH}-build # 进入到测试目录 + ctest > $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/community/World-1.0.0/README.OpenSource b/community/World-1.0.0/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..db87f3c1d988b8a81547c0acadc02abda1392a25 --- /dev/null +++ b/community/World-1.0.0/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "World-1.0.0", + "License": "BSD license", + "License File": "https://github.com/mmorise/World/blob/master/LICENSE.txt", + "Version Number": "v1.0.0", + "Owner": "2942375747@qq.com", + "Upstream URL": "https://github.com/mmorise/World", + "Description": "World is a high-quality speech analysis, manipulation and synthesis system." + } +] \ No newline at end of file diff --git a/community/World-1.0.0/README_zh.md b/community/World-1.0.0/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..68265c9b341229261712898a1cc24eafb059fbe5 --- /dev/null +++ b/community/World-1.0.0/README_zh.md @@ -0,0 +1,9 @@ +# World-1.0.0三方库说明 +## 功能简介 +World是一个高质量的语音分析,操作和合成系统。 +## 三方库版本: +- v1.0.0 +## 使用约束: +- [IDE和SDK版本](../../docs/constraint.md) +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) diff --git a/community/World-1.0.0/SHA512SUM b/community/World-1.0.0/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..ff0d28616eb31a933db6e42a8bff7bc609c5ef72 --- /dev/null +++ b/community/World-1.0.0/SHA512SUM @@ -0,0 +1 @@ +cec558d2dfbf0420c6ff6e83ba9139d80029b98700a6d12b4e902585cab89dadc1eb9686628f80e613186feeeec1b1900e99bc7f8cbdecca0ca05c0148fb6b6b World-v1.0.0.zip \ No newline at end of file diff --git a/community/World-1.0.0/World-1.0.0_oh_pkg.patch b/community/World-1.0.0/World-1.0.0_oh_pkg.patch new file mode 100644 index 0000000000000000000000000000000000000000..eea52420aad2821853126e2e97c52fb70a9abb90 --- /dev/null +++ b/community/World-1.0.0/World-1.0.0_oh_pkg.patch @@ -0,0 +1,23 @@ +diff -urN World-1.0.0_old/CMakeLists.txt World-1.0.0/CMakeLists.txt +--- World-1.0.0_old/CMakeLists.txt 2021-02-15 17:38:48.000000000 +0800 ++++ World-1.0.0/CMakeLists.txt 2024-09-23 14:30:28.075055828 +0800 +@@ -3,7 +3,7 @@ + set(PROJECT_NAME "WORLD") + + project(${PROJECT_NAME}) +- ++enable_testing() + FILE(GLOB SRCS "src/*.cpp" "src/*.c") + + FILE(GLOB HEADERS "src/world/*.h" "src/world/*.hpp") +@@ -13,3 +13,10 @@ + target_include_directories(${PROJECT_NAME} PUBLIC "src") + + install(TARGETS ${PROJECT_NAME}) ++# 添加测试程序 ++add_executable(test_program test/test.cpp tools/audioio.cpp) ++# 链接测试程序与WORLD库,并添加头文件搜索路径 ++target_include_directories(test_program PUBLIC "${CMAKE_SOURCE_DIR}/src" "${CMAKE_SOURCE_DIR}/tools") ++target_link_libraries(test_program ${PROJECT_NAME}) ++# 添加测试命令 ++add_test(NAME run_test_program COMMAND test_program ${CMAKE_SOURCE_DIR}/test/vaiueo2d.wav) diff --git a/community/World-1.0.0/docs/hap_integrate.md b/community/World-1.0.0/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..bc1707d3e0f8d86fe9656a84251584e4a987b0bc --- /dev/null +++ b/community/World-1.0.0/docs/hap_integrate.md @@ -0,0 +1,77 @@ +# World-1.0.0集成到应用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/World-1.0.0 #三方库World-1.0.0的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── HPKCHECK #测试脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md #三方库简介 + ├── World-1.0.0_oh_pkg.patch #用于World-1.0.0库编译的补丁 + ``` + +- 在lycium目录下编译三方库 + + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ```shell + cd lycium + ./build.sh World-1.0.0 + ``` + +- 三方库头文件及生成的库 + + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ```shell + World-1.0.0/arm64-v8a World-1.0.0/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的头文件拷贝到该目录下,将编译生成的三方库以及依赖库全部(动态库名字带版本号和不带版本号的都需要)拷贝到工程的libs目录下,如下图所示: +   + +  ![thirdparty_install_dir](pic/World_install_dir.png) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + + ```shell + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/World/${OHOS_ARCH}/lib/libWORLD.so) + ``` + +## 测试三方库 +- 编译出可执行的文件,使用原库自带的测试用例来做测试[准备三方库测试环境](../../../lycium/README.md#3ci环境准备) +进入到构建目录运行测试用例(注意arm64-v8a为构建64位的目录,armeabi-v7a为构建32位的目录),执行结果如图所示 + +```shell + cd /data/tpc_c_cplusplus/thirdparty/World-1.0.0/World-1.0.0/arm64-v8a-build/ + ./ctest +``` + ![World_test](pic/World_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/community/World-1.0.0/docs/pic/World_install_dir.png b/community/World-1.0.0/docs/pic/World_install_dir.png new file mode 100644 index 0000000000000000000000000000000000000000..30651472dd639d138259aa24a52183bcf1628467 Binary files /dev/null and b/community/World-1.0.0/docs/pic/World_install_dir.png differ diff --git a/community/World-1.0.0/docs/pic/World_test.png b/community/World-1.0.0/docs/pic/World_test.png new file mode 100644 index 0000000000000000000000000000000000000000..54fe365e60e4232a8eca0471cf497f1f10248ab6 Binary files /dev/null and b/community/World-1.0.0/docs/pic/World_test.png differ diff --git a/community/agg/HPKBUILD b/community/agg/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..c4d2b717cf18f3d82a302357c794eb7b83baa66b --- /dev/null +++ b/community/agg/HPKBUILD @@ -0,0 +1,88 @@ +# Contributor: lpzhong <278527840@qq.com> +# Maintainer: lpzhong <278527840@qq.com> + +pkgname=agg +pkgver=2.6 +pkgrel=0 +pkgdesc="Anti-Grain Geometry library, written by Maxim Shemanarev in C++. It is an Open Source, 2D vector graphics library." +url="https://github.com/ghaerr/agg-2.6" +archs=("armeabi-v7a" "arm64-v8a") +license=("BSD License") +depends=() +makedepends=() + +#source="https://github.com/ghaerr/${pkgname}-${pkgver}/archive/refs/heads/master.zip" +source="https://gitee.com/lycium_pkg_mirror/agg-2.6.git" +builddir=${pkgname}-${pkgver}-master +#packagename=${builddir}.zip +autounpack=false +downloadpackage=false +buildtools="make" +cc= +ar= +commitid=b289c3cc11162cb4712eddc855ee8a321dfe93f0 +cloneflag=true +source envset.sh + +# agg 采用makefile编译构建,为了保留构建环境(方便测试)。因此同一份源码在解压后分为两份,各自编译互不干扰 +prepare() { + if [ $cloneflag == true ] + then + mkdir $builddir + git clone $source $builddir > $publicbuildlog 2>&1 + if [ $? != 0 ] + then + return -1 + fi + cd $builddir + git reset --hard $commitid > $publicbuildlog 2>&1 + if [ $? != 0 ] + then + return -1 + fi + cd $OLDPWD + cloneflag=false + fi + + cp -rf ${builddir} $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 + + return 0 +} + +build() { + cd $builddir-${ARCH}-build/agg-src + ${MAKE} VERBOSE=1 C="$cc" LIB="$ar cr" CXX="$cc" > $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + install_dir=${LYCIUM_ROOT}/usr/${pkgname}/${ARCH} + mkdir -p ${install_dir}/lib + cd ${builddir}-${ARCH}-build/agg-src + cp -af src/libagg.a ${install_dir}/lib/ + cp -arf include ${install_dir}/ + cd ${OLDPWD} + + unset ar + unset cc + + return 0 +} + +check() { + echo "The test must be on an OpenHarmony device!" +} + +cleanbuild() { + rm -rf ${PWD}/${builddir} ${PWD}/${builddir}-armeabi-v7a-build ${PWD}/${builddir}-arm64-v8a-build #${PWD}/$packagename +} diff --git a/community/agg/OAT.xml b/community/agg/OAT.xml new file mode 100644 index 0000000000000000000000000000000000000000..2591b1fc8221d8cfbcb2d20d51b134197a6e3616 --- /dev/null +++ b/community/agg/OAT.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/community/agg/README.OpenSource b/community/agg/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..efe0a84bd00c7c578511d81b11f3ab9a1bcd759f --- /dev/null +++ b/community/agg/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "Anti-Grain Geometry", + "License": "BSD License", + "License File": "Readme", + "Version Number": "2.6", + "Owner": "zhongluping1@huawei.com", + "Upstream URL": "https://github.com/ghaerr/agg-2.6", + "Description": "Anti-Grain Geometry library, written by Maxim Shemanarev in C++. It is an Open Source, 2D vector graphics library." + } +] diff --git a/community/agg/README_zh.md b/community/agg/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..a8b350a1dd196e45a5fb7a5357221f2d85e85803 --- /dev/null +++ b/community/agg/README_zh.md @@ -0,0 +1,16 @@ +# Anti-Grain Geometry 三方库说明 + +## 功能简介 +Anti-Grain Geometry 是一个用C++编写的开源二维矢量图形库。 + +## 三方库版本 +- 2.6 + +## 已适配功能 +- 二维矢量图形处理。 + +## 使用约束 +- [IDE和SDK版本](../../docs/constraint.md) + +## 集成方式 +- [应用hap包集成](docs/hap_integrate.md) diff --git a/community/agg/SHA512SUM b/community/agg/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..2a907c6c62a2718eb8b34ebce215eebdcd11f937 --- /dev/null +++ b/community/agg/SHA512SUM @@ -0,0 +1 @@ +875133be878ee45d1e81aeeb4cf22a2292e276d9bb1205832f6ea3024aa10d33ab7317766783976540b4ed545c0d62ea3e64843da22f7ddbdc32ae038742e79d agg-2.6-master.zip diff --git a/community/agg/docs/hap_integrate.md b/community/agg/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..07457f69d026e70dddfc861920630d38e9b9d492 --- /dev/null +++ b/community/agg/docs/hap_integrate.md @@ -0,0 +1,72 @@ +# Anti-Grain Geometry 集成到应用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 + ├── docs # TPC_C_PLUSPLUS仓库文档目录 + ├── thirdparty/agg # 三方库agg的目录结构如下 + | ├── docs # 三方库相关文档的文件夹 + | ├── HPKBUILD # 构建脚本 + | ├── SHA512SUM # 三方库校验文件 + | ├── README.OpenSource # 说明三方库源码的下载地址,版本,license等信息 + | ├── README_zh.md + ├── lycium # 三方库编译目录 + + ``` + +- 进入到编译目录`lycium`并编译`agg`三方库 + + ```shell + cd tpc_c_cplusplus/lycium + ./build.sh agg + ``` + +- 三方库头文件及生成的库 + + 在编译目录`lycium`目录下会生成`usr`目录,该目录下存在已编译完成的32位和64位三方库 + + ```shell + agg/arm64-v8a agg/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的库拷贝到该目录下,如下图所示 +  ![thirdparty_install_dir](../../thirdparty_template/docs/pic/xxx_install_dir.png)
+ 其中`xxx`代表的是三方库名字`agg` +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + + ```shell + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/agg/${OHOS_ARCH}/lib/libagg.a) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/agg/${OHOS_ARCH}/include) + ``` + + ![thirdparty_usage](../../thirdparty_template/docs/pic/xxx_usage.png) + +## 测试三方库 + +该三方库的测试依赖X11的协议,暂时无法在OH环境上进行测试。 + +## 参考资料 + +- [润和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) diff --git a/community/avro/HPKBUILD b/community/avro/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..9b9b1a3992482d4f0744779fcb7ea56a206aea84 --- /dev/null +++ b/community/avro/HPKBUILD @@ -0,0 +1,71 @@ +# Contributor: 小肉头君 +# Maintainer: 小肉头君 + +pkgname=avro +pkgver=release-1.11.1 +pkgrel=0 +pkgdesc="Apache Avro is a data serialization system." +url="https://github.com/apache/avro" +archs=("armeabi-v7a" "arm64-v8a") +license=("Apache-2.0 license") +depends=("jansson") +makedepends=() +source="https://github.com/apache/$pkgname/archive/refs/tags/$pkgver.tar.gz" + +autounpack=true +downloadpackage=true +patchflag=true + +builddir=$pkgname-$pkgver +packagename=$builddir.tar.gz + +prepare() { + if $patchflag + then + cd $builddir + # 运行ctest时,会再去触发cmake去复制一份文件,这样会导致在设备上测试不通过 + # 并且测试套件已经在所在目录,所以打patch去掉cmake操作 + patch -p1 < `pwd`/../avro_oh_pkg.patch + # patch只需要打一次,关闭打patch + patchflag=false + cd $OLDPWD + fi + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + # 编译avro c的版本 + PKG_CONFIG_PATH="${pkgconfigpath}" ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" -DOHOS_ARCH=$ARCH -B$ARCH-build -Slang/c -L > `pwd`/$ARCH-build/build.log 2>&1 + make -j4 -C $ARCH-build >> `pwd`/$ARCH-build/build.log 2>&1 + ret=$? + + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + make -C $ARCH-build install >> `pwd`/$ARCH-build/build.log 2>&1 + cd $OLDPWD +} + +check() { + cd $builddir + cp -rf lang/c/tests/schema_tests $ARCH-build/tests + cp lang/c/tests/avro-1237-bad-union-discriminant.avro $ARCH-build/tests + cp lang/c/tests/avro-1237-good.avro $ARCH-build/tests + cp lang/c/tests/avro-1238-good.avro $ARCH-build/tests + cp lang/c/tests/avro-1238-truncated.avro $ARCH-build/tests + cp lang/c/tests/avro-1279-codec.avro $ARCH-build/tests + cp lang/c/tests/avro-1279-no-codec.avro $ARCH-build/tests + cd $OLDPWD + echo "The test must be on an OpenHarmony device!" + # real test + # ctest +} + +# 清理环境 +cleanbuild(){ + rm -rf ${PWD}/$builddir #${PWD}/$packagename +} \ No newline at end of file diff --git a/community/avro/OAT.xml b/community/avro/OAT.xml new file mode 100644 index 0000000000000000000000000000000000000000..96937ea08644b79312d0ced7c0b3eb1e845108ee --- /dev/null +++ b/community/avro/OAT.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/community/avro/README.OpenSource b/community/avro/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..51dc8297114bad55e53506dad9fc1aaa83cff02b --- /dev/null +++ b/community/avro/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "avro", + "License": "Apache-2.0 license", + "License File": "LICENSES", + "Version Number": "1.11.1", + "Owner": "chenbaodi@huawei.com", + "Upstream URL": "https://github.com/apache/avro/archive/refs/tags/release-1.11.1.tar.gz", + "Description": "Apache Avro is a data serialization system." + } +] \ No newline at end of file diff --git a/community/avro/README_zh.md b/community/avro/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..488dc022484a393fc3f17460b60eb3b8ddd5e9e3 --- /dev/null +++ b/community/avro/README_zh.md @@ -0,0 +1,15 @@ +# avro三方库说明 +## 功能简介 +avro是指数据序列化的系统,有丰富的数据结构类型、快速可压缩的二进制数据形式。 + +## 三方库版本 +- release-1.11.1 + +## 已适配功能 +- 提供数据的序列化框架 + +## 使用约束 +- [IDE和SDK版本](../../docs/constraint.md) + +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) \ No newline at end of file diff --git a/community/avro/SHA512SUM b/community/avro/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..858cef61b231ced1d33d498c161821d92943fd90 --- /dev/null +++ b/community/avro/SHA512SUM @@ -0,0 +1 @@ +1a9a9fc2c1d88db06d099ace2cc67c2b634acdf38b5b42a3a1daed929abeaf19005a82dffc1de7cbce96a1b2133b78e4c04ab808eb6e960ce719b37d31488b95 avro-release-1.11.1.tar.gz diff --git a/community/avro/avro_oh_pkg.patch b/community/avro/avro_oh_pkg.patch new file mode 100644 index 0000000000000000000000000000000000000000..a59a36f9f9c901c91dc555bd926ca581812e4784 --- /dev/null +++ b/community/avro/avro_oh_pkg.patch @@ -0,0 +1,21 @@ +diff -Naur avro-release-1.11.1_old/lang/c/examples/CMakeLists.txt avro-release-1.11.1/lang/c/examples/CMakeLists.txt +--- avro-release-1.11.1_old/lang/c/examples/CMakeLists.txt 2023-06-08 10:46:03.120338183 +0800 ++++ avro-release-1.11.1/lang/c/examples/CMakeLists.txt 2023-06-08 10:52:34.003978909 +0800 +@@ -27,6 +27,5 @@ + endif (WIN32) + + add_test(quickstop +- ${CMAKE_COMMAND} -E chdir ${AvroC_SOURCE_DIR}/examples + ${exec_name} + ) +diff -Naur avro-release-1.11.1_old/lang/c/tests/CMakeLists.txt avro-release-1.11.1/lang/c/tests/CMakeLists.txt +--- avro-release-1.11.1_old/lang/c/tests/CMakeLists.txt 2023-06-08 10:46:03.124338242 +0800 ++++ avro-release-1.11.1/lang/c/tests/CMakeLists.txt 2023-06-08 10:52:23.643924713 +0800 +@@ -35,7 +35,6 @@ + endif (WIN32) + + add_test(${name} +- ${CMAKE_COMMAND} -E chdir ${AvroC_SOURCE_DIR}/tests + ${exec_name} + ) + endmacro(add_avro_test) \ No newline at end of file diff --git a/community/avro/docs/hap_integrate.md b/community/avro/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..570c8ae358f6e9560978a88f11ad29457d6b225f --- /dev/null +++ b/community/avro/docs/hap_integrate.md @@ -0,0 +1,85 @@ +# avro集成到应用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/avro #三方库avro的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md + ``` + +- 在lycium目录下编译三方库 + + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ```shell + cd lycium + ./build.sh avro + ``` + +- 三方库头文件及生成的库 + + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ```shell + avro/arm64-v8a avro/armeabi-v7a + ``` +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的库拷贝到该目录下,如下图所示: + +  ![thirdparty_install_dir](pic/avrocpp_install_dir.png) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + + ```shell + #将三方库加入工程中 + #使用c语言库 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/avro/${OHOS_ARCH}/lib/libavro.so) + + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/avro/${OHOS_ARCH}/include) + + #将动态库打包到libs + file(GLOB allLibs "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/avro/${OHOS_ARCH}/lib/*.so*") + add_custom_command(TARGET entry POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy + ${allLibs} + ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/) + ``` + 修改IDE的entry/build-profile.json5 文件,增加编译架构过滤:"abiFilters": ["armeabi-v7a", "arm64-v8a"], 如下图所示: + + ![avro_build](pic/avro_build.png) + +## 测试三方库 + +三方库的测试使用原库自带的测试用例来做测试,[准备三方库测试环境](../../../lycium/README.md#3ci环境准备) + +进入到构建目录,执行如下命令ctest(arm64-v8a-build为构建64位的目录,armeabi-v7a-build为构建32位的目录) + +![avro_test](pic/avro_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/community/avro/docs/pic/avro_build.png b/community/avro/docs/pic/avro_build.png new file mode 100755 index 0000000000000000000000000000000000000000..3a44fbf78c725c6d94bc99434b2eca64cf72b8a9 Binary files /dev/null and b/community/avro/docs/pic/avro_build.png differ diff --git a/community/avro/docs/pic/avro_test.png b/community/avro/docs/pic/avro_test.png new file mode 100755 index 0000000000000000000000000000000000000000..36c3c0017e7e238732748eb0d84f69598bc5d601 Binary files /dev/null and b/community/avro/docs/pic/avro_test.png differ diff --git a/community/avro/docs/pic/avrocpp_install_dir.png b/community/avro/docs/pic/avrocpp_install_dir.png new file mode 100755 index 0000000000000000000000000000000000000000..59112257e1c7a4ed211eb64a6e5b68dc741731bf Binary files /dev/null and b/community/avro/docs/pic/avrocpp_install_dir.png differ diff --git a/community/avrocpp/HPKBUILD b/community/avrocpp/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..ea0d77053b80859f0954be70e7a9b6944052f270 --- /dev/null +++ b/community/avrocpp/HPKBUILD @@ -0,0 +1,73 @@ +# Contributor: wlxuz +# Maintainer: wlxuz + +pkgname=avrocpp +pkgver=release-1.11.1 +pkgrel=0 +pkgdesc="Apache Avro is a data serialization system." +url="https://github.com/apache/avro" +archs=("armeabi-v7a" "arm64-v8a") +license=("Apache-2.0 license") +depends=("zlib" "boost" "snappy") +makedepends=() +source="https://github.com/apache/avro/archive/refs/tags/$pkgver.tar.gz" + +autounpack=true +downloadpackage=true +patchflag=true +buildhost=true + +builddir=avro-$pkgver +packagename=avro-$pkgver.tar.gz + +prepare() { + # 源码本身存在不正确的数据类型转换,以及交叉编译需要指定路径,因此需要打patch + if [ $patchflag == true ];then + cd $builddir + patch -p1 < `pwd`/../avro_oh_pkg.patch + patchflag=false + cd $OLDPWD + fi + mkdir -p $builddir/$ARCH-build + + # 需要优先编译linux版本的avrogencpp, 否则无法生成中间文件 + if [ $buildhost == true ];then + mkdir -p $builddir/host-build + cd $builddir + cmake -Bhost-build -Slang/c++ -L > `pwd`/host-build/build.log 2>&1 + make -j4 -C host-build avrogencpp VERBOSE=1 >> `pwd`/host-build/build.log 2>&1 + cd $OLDPWD + buildhost=false + fi +} + +build() { + # 编译avro c++的版本 + cd $builddir + PKG_CONFIG_PATH="${pkgconfigpath}" ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" \ + -DCMAKE_CXX_FLAGS="${LYCIUM_ROOT}/usr/zlib/${ARCH}/lib/libz.a" \ + -DAVROGENCPPCMD=$(pwd)/host-build/avrogencpp -DOHOS_ARCH=$ARCH -B$ARCH-build \ + -Slang/c++ -L > `pwd`/$ARCH-build/build.log 2>&1 + make -j4 -C $ARCH-build VERBOSE=1 >> `pwd`/$ARCH-build/build.log 2>&1 + + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + make -C $ARCH-build install VERBOSE=1 >> `pwd`/$ARCH-build/build.log 2>&1 + cd $OLDPWD +} + +check() { + echo "The test must be on an OpenHarmony device!" + # real test + # ctest +} + +# 清理环境 +cleanbuild(){ + rm -rf ${PWD}/$builddir #${PWD}/$packagename +} diff --git a/community/avrocpp/HPKCHECK b/community/avrocpp/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..dcaf766dc7e139a9a7c39f540e772a898b05314e --- /dev/null +++ b/community/avrocpp/HPKCHECK @@ -0,0 +1,23 @@ +# Contributor: 城meto +# Maintainer: 城meto + +source HPKBUILD > /dev/null 2>&1 # 导入HPKBUILD文件 +logfile=${LYCIUM_THIRDPARTY_ROOT}/${pkgname}/${pkgname}_${ARCH}_${OHOS_SDK_VER}_test.log + +checkprepare(){ + return 0 +} + +# 在OH环境执行测试的接口 +openharmonycheck() { + res=0 + cd ${builddir}/${ARCH}-build + ctest > ${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 +} diff --git a/community/avrocpp/OAT.xml b/community/avrocpp/OAT.xml new file mode 100644 index 0000000000000000000000000000000000000000..96937ea08644b79312d0ced7c0b3eb1e845108ee --- /dev/null +++ b/community/avrocpp/OAT.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/community/avrocpp/README.OpenSource b/community/avrocpp/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..bc0e9f42f8664f256082be00388eade29aaf4e41 --- /dev/null +++ b/community/avrocpp/README.OpenSource @@ -0,0 +1,38 @@ +[ + { + "Name": "avrocpp", + "License": "Apache-2.0 license", + "License File": "https://github.com/apache/avro/blob/main/LICENSE.txt", + "Version Number": "1.11.1", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://github.com/apache/avro/archive/refs/tags/release-1.11.1.tar.gz", + "Description": "Apache Avro is a data serialization system." + }, + { + "Name": "zlib", + "License": "zlib License", + "License File": "https://github.com/madler/zlib/blob/master/LICENSE", + "Version Number": "v1.2.13", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://github.com/madler/zlib/releases/download/v1.2.13/zlib-1.2.13.tar.gz", + "Description": "A massively spiffy yet delicately unobtrusive compression library." + }, + { + "Name": "boost", + "License": "Boost Software License", + "License File": "https://www.boost.org/LICENSE_1_0.txt", + "Version Number": "1.81.0", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://boostorg.jfrog.io/artifactory/main/release/1.81.0/source/boost_1_81_0.tar.gz", + "Description": "Boost provides free peer-reviewed portable C++ source libraries." + }, + { + "Name": "snappy", + "License": "MIT License", + "License File": "https://github.com/google/snappy/blob/main/COPYING", + "Version Number": "1.1.10", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://github.com/google/snappy/archive/refs/tags/1.1.10.tar.gz", + "Description": "Snappy is a compression/decompression library. It does not aim for maximum compression, or compatibility with any other compression library; instead, it aims for very high speeds and reasonable compression. For instance, compared to the fastest mode of zlib, Snappy is an order of magnitude faster for most inputs, but the resulting compressed files are anywhere from 20% to 100% bigger" + } +] \ No newline at end of file diff --git a/community/avrocpp/README_zh.md b/community/avrocpp/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..81d74df1cf2887c49e41fb66d02d27beef36bb33 --- /dev/null +++ b/community/avrocpp/README_zh.md @@ -0,0 +1,15 @@ +# avrocpp三方库说明 +## 功能简介 +avrocpp是指数据序列化的系统,有丰富的数据结构类型、快速可压缩的二进制数据形式。 + +## 三方库版本 +- release-1.11.1 + +## 已适配功能 +- 提供数据的序列化框架 + +## 使用约束 +- [IDE和SDK版本](../../docs/constraint.md) + +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) \ No newline at end of file diff --git a/community/avrocpp/SHA512SUM b/community/avrocpp/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..858cef61b231ced1d33d498c161821d92943fd90 --- /dev/null +++ b/community/avrocpp/SHA512SUM @@ -0,0 +1 @@ +1a9a9fc2c1d88db06d099ace2cc67c2b634acdf38b5b42a3a1daed929abeaf19005a82dffc1de7cbce96a1b2133b78e4c04ab808eb6e960ce719b37d31488b95 avro-release-1.11.1.tar.gz diff --git a/community/avrocpp/avro_oh_pkg.patch b/community/avrocpp/avro_oh_pkg.patch new file mode 100644 index 0000000000000000000000000000000000000000..9afa4ff08831a9f17958ae7852fc31c2e320c4f7 --- /dev/null +++ b/community/avrocpp/avro_oh_pkg.patch @@ -0,0 +1,62 @@ +--- avro-release-1.11.1_old/lang/c++/impl/FileStream.cc 2023-06-21 14:59:41.940883254 +0800 ++++ avro-release-1.11.1/lang/c++/impl/FileStream.cc 2023-06-21 14:58:14.135760524 +0800 +@@ -42,7 +42,7 @@ + namespace { + struct BufferCopyIn { + virtual ~BufferCopyIn() = default; +- virtual void seek(size_t len) = 0; ++ virtual void seek(int64_t len) = 0; + virtual bool read(uint8_t *b, size_t toRead, size_t &actual) = 0; + }; + +@@ -59,7 +59,7 @@ + ::CloseHandle(h_); + } + +- void seek(size_t len) { ++ void seek(int64_t len) { + if (::SetFilePointer(h_, len, NULL, FILE_CURRENT) == INVALID_SET_FILE_POINTER && ::GetLastError() != NO_ERROR) { + throw Exception(boost::format("Cannot skip file: %1%") % ::GetLastError()); + } +@@ -86,7 +86,7 @@ + ::close(fd_); + } + +- void seek(size_t len) final { ++ void seek(int64_t len) final { + off_t r = ::lseek(fd_, len, SEEK_CUR); + if (r == static_cast(-1)) { + throw Exception(boost::format("Cannot skip file: %1%") % strerror(errno)); +@@ -110,7 +110,7 @@ + explicit IStreamBufferCopyIn(istream &is) : is_(is) { + } + +- void seek(size_t len) override { ++ void seek(int64_t len) override { + if (!is_.seekg(len, std::ios_base::cur)) { + throw Exception("Cannot skip stream"); + } +@@ -129,11 +129,11 @@ + struct NonSeekableIStreamBufferCopyIn : public IStreamBufferCopyIn { + explicit NonSeekableIStreamBufferCopyIn(istream &is) : IStreamBufferCopyIn(is) {} + +- void seek(size_t len) final { ++ void seek(int64_t len) final { + const size_t bufSize = 4096; + uint8_t buf[bufSize]; + while (len > 0) { +- size_t n = std::min(len, bufSize); ++ size_t n = std::min(len, bufSize); + is_.read(reinterpret_cast(buf), n); + if (is_.bad()) { + throw Exception("Cannot skip stream"); +--- avro-release-1.11.1_old/lang/c++/CMakeLists.txt 2022-07-27 03:26:24.000000000 +0800 ++++ avro-release-1.11.1/lang/c++/CMakeLists.txt 2023-06-21 15:39:01.351747359 +0800 +@@ -141,6 +141,6 @@ + macro (gen file ns) + add_custom_command (OUTPUT ${file}.hh +- COMMAND avrogencpp ++ COMMAND ${AVROGENCPPCMD} + -p - + -i ${CMAKE_CURRENT_SOURCE_DIR}/jsonschemas/${file} + -o ${file}.hh -n ${ns} -U \ No newline at end of file diff --git a/community/avrocpp/docs/hap_integrate.md b/community/avrocpp/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..059bfc9713b3c8ec9f2a7613f24b575ad664682a --- /dev/null +++ b/community/avrocpp/docs/hap_integrate.md @@ -0,0 +1,91 @@ +# avrocpp集成到应用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/avrocpp #三方库avrocpp的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md + ``` + +- 在lycium目录下编译三方库 + 编译需要先安装libboost-all-dev + + ```shell + sudo apt-get install libboost-all-dev + ``` + + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ```shell + cd lycium + ./build.sh avrocpp boost snappy + ``` + +- 三方库头文件及生成的库 + + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ```shell + avrocpp/arm64-v8a avrocpp/armeabi-v7a + ``` +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的库拷贝到该目录下,如下图所示: + + ![thirdparty_install_dir](pic/avrocpp_install_dir.png) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + + ```shell + #将三方库加入工程中 + #使用c++库 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/avrocpp/${OHOS_ARCH}/lib/libavrocpp.so) + + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/avrocpp/${OHOS_ARCH}/include) + + #将动态库打包到libs + file(GLOB allLibs "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/avrocpp/${OHOS_ARCH}/lib/*.so*") + add_custom_command(TARGET entry POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy + ${allLibs} + ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/) + ``` + + 修改IDE的entry/build-profile.json5 文件,增加编译架构过滤:"abiFilters": ["armeabi-v7a", "arm64-v8a"], 如下图所示: + + ![avro_build](pic/avro_build.png) + +## 测试三方库 + +三方库的测试使用原库自带的测试用例来做测试,[准备三方库测试环境](../../../lycium/README.md#3ci环境准备) + +进入到构建目录,执行如下命令ctest(arm64-v8a-build为构建64位的目录,armeabi-v7a-build为构建32位的目录) + +![avrocpp_test](pic/avrocpp_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/community/avrocpp/docs/pic/avro_build.png b/community/avrocpp/docs/pic/avro_build.png new file mode 100644 index 0000000000000000000000000000000000000000..3a44fbf78c725c6d94bc99434b2eca64cf72b8a9 Binary files /dev/null and b/community/avrocpp/docs/pic/avro_build.png differ diff --git a/community/avrocpp/docs/pic/avro_test.png b/community/avrocpp/docs/pic/avro_test.png new file mode 100644 index 0000000000000000000000000000000000000000..36c3c0017e7e238732748eb0d84f69598bc5d601 Binary files /dev/null and b/community/avrocpp/docs/pic/avro_test.png differ diff --git a/community/avrocpp/docs/pic/avrocpp_install_dir.png b/community/avrocpp/docs/pic/avrocpp_install_dir.png new file mode 100644 index 0000000000000000000000000000000000000000..59112257e1c7a4ed211eb64a6e5b68dc741731bf Binary files /dev/null and b/community/avrocpp/docs/pic/avrocpp_install_dir.png differ diff --git a/community/avrocpp/docs/pic/avrocpp_test.png b/community/avrocpp/docs/pic/avrocpp_test.png new file mode 100644 index 0000000000000000000000000000000000000000..73441ae1007063e82c053ec8855a2508f2afe3ce Binary files /dev/null and b/community/avrocpp/docs/pic/avrocpp_test.png differ diff --git a/community/bdwgc-8.0.0/HPKBUILD b/community/bdwgc-8.0.0/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..ddfd09383734843fdb9e362896a4584d76b10378 --- /dev/null +++ b/community/bdwgc-8.0.0/HPKBUILD @@ -0,0 +1,73 @@ +# 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=bdwgc-8.0.0 +pkgver=v8.0.0 +pkgrel=0 +pkgdesc="bdwgc is a conservative garbage collector for C and C++." +url="https://github.com/ivmai/bdwgc/tree/v8.0.0" +archs=("armeabi-v7a" "arm64-v8a") +license=("MIT license") +depends=() +makedepends=() +source="https://github.com/ivmai/bdwgc/archive/refs/tags/v8.0.0.zip" + +downloadpackage=true +autounpack=true +buildtools=cmake +patchflag=true + +builddir=bdwgc-8.0.0 +packagename=bdwgc-v8.0.0.zip + +# 为编译设置环境,如设置环境变量,创建编译目录等 +prepare() { + if $patchflag + then + cd $builddir + patch -p1 < `pwd`/../bdwgc-8.0.0_oh_pkg.patch + # patch只需要打一次,关闭打patch + patchflag=false + cd $OLDPWD + fi + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" -DCMAKE_C_FLAGS="-Wno-unused-command-line-argument" \ + -DCMAKE_CXX_FLAGS="-Wno-unused-command-line-argument" -B$ARCH-build -S./ > $buildlog 2>&1 + $MAKE VERBOSE=1 -C $ARCH-build >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + $MAKE -C $ARCH-build install >> $buildlog 2>&1 + cd $OLDPWD +} + + +check() { + echo "The test must be on an OpenHarmony device!" +} + + +cleanbuild() { + rm -rf ${PWD}/$builddir +} \ No newline at end of file diff --git a/community/bdwgc-8.0.0/HPKCHECK b/community/bdwgc-8.0.0/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..30cecfd08661d3dea9f0badda98230d47abe5169 --- /dev/null +++ b/community/bdwgc-8.0.0/HPKCHECK @@ -0,0 +1,29 @@ +# 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}_${OHOS_SDK_VER}_test.log + +# 在OH环境执行测试的接口 +openharmonycheck() { + res=0 + cd ${builddir}/${ARCH}-build # 进入到测试目录 + ctest > ${logfile} 2>&1 # 执行测试命令并将测试结果导出到${logfile} + res=$? + cd $OLDPWD + + return $res +} \ No newline at end of file diff --git a/community/bdwgc-8.0.0/OAT.xml b/community/bdwgc-8.0.0/OAT.xml new file mode 100644 index 0000000000000000000000000000000000000000..eeb1f946d683c0b81976cd06522096062a6901b9 --- /dev/null +++ b/community/bdwgc-8.0.0/OAT.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/community/bdwgc-8.0.0/README.OpenSource b/community/bdwgc-8.0.0/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..fbf869ae3c30c930c0d1fc1884b592b1c8784e76 --- /dev/null +++ b/community/bdwgc-8.0.0/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "bdwgc-8.0.0", + "License": "MIT license", + "License File": "https://github.com/ivmai/bdwgc/blob/master/LICENSE", + "Version Number": "v8.0.0", + "Owner": "2942375747@qq.com", + "Upstream URL": "https://github.com/ivmai/bdwgc", + "Description": "bdwgc is a conservative garbage collector for C and C++." + } +] \ No newline at end of file diff --git a/community/bdwgc-8.0.0/README_zh.md b/community/bdwgc-8.0.0/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..5a4f7a792f2d906ca8d29f8aaf21f256cdc06160 --- /dev/null +++ b/community/bdwgc-8.0.0/README_zh.md @@ -0,0 +1,9 @@ +# bdwgc-8.0.0三方库说明 +## 功能简介 +bdwgc-8.0.0是一个面向C和c++的保守垃圾收集器 +## 三方库版本: +- v8.0.0 +## 使用约束: +- [IDE和SDK版本](../../docs/constraint.md) +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) diff --git a/community/bdwgc-8.0.0/SHA512SUM b/community/bdwgc-8.0.0/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..802cd20c0326b151941b8946ca7a3c45998c21f7 --- /dev/null +++ b/community/bdwgc-8.0.0/SHA512SUM @@ -0,0 +1 @@ +36f81a9ee99ef32905e2e1ed8601da6d1bd03d064291b30706aa7609e69eb4db8723b6c03ff7caf3c0fb9389fe151a4dfd58dec7e302fb403649a9f9c2c6be22 bdwgc-v8.0.0.zip \ No newline at end of file diff --git a/community/bdwgc-8.0.0/bdwgc-8.0.0_oh_pkg.patch b/community/bdwgc-8.0.0/bdwgc-8.0.0_oh_pkg.patch new file mode 100644 index 0000000000000000000000000000000000000000..c65e9a9b4669a9d94f4b7bf3f0505d9f04e75098 --- /dev/null +++ b/community/bdwgc-8.0.0/bdwgc-8.0.0_oh_pkg.patch @@ -0,0 +1,151 @@ +--- bdwgc-8.0.0_old/os_dep.c 2018-09-05 06:10:55.000000000 +0800 ++++ bdwgc-8.0.0/os_dep.c 2024-09-02 11:21:27.546371962 +0800 +@@ -18,7 +18,7 @@ + + #if !defined(OS2) && !defined(PCR) && !defined(AMIGA) && !defined(MACOS) \ + && !defined(MSWINCE) && !defined(SN_TARGET_ORBIS) \ +- && !defined(SN_TARGET_PSP2) && !defined(__CC_ARM) ++ && !defined(SN_TARGET_PSP2) && !defined(__CC_ARM) && !defined(__OHOS__) + # include + # if !defined(MSWIN32) && !defined(MSWIN_XBOX1) + # include +@@ -504,14 +504,14 @@ + ptr_t GC_data_start = NULL; + + EXTERN_C_BEGIN +- extern char **environ; ++ // extern char **environ; + EXTERN_C_END + + GC_INNER void GC_init_netbsd_elf(void) + { + /* This may need to be environ, without the underscore, for */ + /* some versions. */ +- GC_data_start = GC_find_limit((ptr_t)&environ, FALSE); ++ // GC_data_start = GC_find_limit((ptr_t)&environ, FALSE); + } + #endif /* NETBSD */ + +@@ -1531,7 +1531,7 @@ + /* with SunOS dynamic loading), or GC_mark_roots needs to check for */ + /* them (as we do with PCR). Called with allocator lock held. */ + # ifdef OS2 +- ++#ifndef __OHOS__ + void GC_register_data_segments(void) + { + PTIB ptib; +@@ -1717,6 +1717,7 @@ + # else + # define GetWriteWatch_alloc_flag 0 + # endif /* !GWW_VDB */ ++#endif + + # if defined(MSWIN32) || defined(MSWINCE) || defined(CYGWIN32) + +@@ -1916,7 +1917,7 @@ + if (base != limit) GC_add_roots_inner(base, limit, FALSE); + } + #endif /* MSWIN32 */ +- ++#if !defined(__OHOS__) + void GC_register_data_segments(void) + { + # ifdef MSWIN32 +@@ -1924,7 +1925,7 @@ + /* any other GC global variable would fit too. */ + # endif + } +- ++#endif + # else /* !OS2 && !Windows */ + + # if (defined(SVR4) || defined(AIX) || defined(DGUX) \ +@@ -2007,7 +2008,7 @@ + # undef GC_AMIGA_DS + + #elif defined(OPENBSD) +- ++#if !defined(__OHOS__) + /* Depending on arch alignment, there can be multiple holes */ + /* between DATASTART and DATAEND. Scan in DATASTART .. DATAEND */ + /* and register each region. */ +@@ -2027,7 +2028,7 @@ + region_start = GC_skip_hole_openbsd(region_end, DATAEND); + } + } +- ++#endif + # else /* !OS2 && !Windows && !AMIGA && !OPENBSD */ + + # if !defined(PCR) && !defined(MACOS) && defined(REDIRECT_MALLOC) \ +@@ -2036,7 +2037,7 @@ + extern caddr_t sbrk(int); + EXTERN_C_END + # endif +- ++#if !defined(__OHOS__) + void GC_register_data_segments(void) + { + # if !defined(PCR) && !defined(MACOS) +@@ -2105,7 +2106,7 @@ + /* Dynamic libraries are added at every collection, since they may */ + /* change. */ + } +- ++#endif + # endif /* !AMIGA */ + # endif /* !MSWIN32 && !MSWINCE */ + # endif /* !OS2 */ +--- bdwgc-8.0.0_old/misc.c 2018-09-05 06:10:55.000000000 +0800 ++++ bdwgc-8.0.0/misc.c 2024-09-02 11:40:15.563734838 +0800 +@@ -1277,7 +1277,10 @@ + + /* Add initial guess of root sets. Do this first, since sbrk(0) */ + /* might be used. */ +- if (GC_REGISTER_MAIN_STATIC_DATA()) GC_register_data_segments(); ++ if (GC_REGISTER_MAIN_STATIC_DATA()) ++ #ifndef __OHOS__ ++ GC_register_data_segments(); ++ #endif + GC_init_headers(); + GC_bl_init(); + GC_mark_init(); + +--- bdwgc-8.0.0_old/CMakeLists.txt 2018-09-05 06:10:55.000000000 +0800 ++++ bdwgc-8.0.0/CMakeLists.txt 2024-09-02 18:26:14.137861542 +0800 +@@ -248,14 +248,25 @@ + + ADD_LIBRARY( gcmt-dll SHARED ${SRC}) + +-IF(WIN32) +- ADD_EXECUTABLE(cord cord/cordbscs.c cord/cordxtra.c +- cord/tests/de.c cord/tests/de_win.c) +- SET_TARGET_PROPERTIES(cord PROPERTIES WIN32_EXECUTABLE TRUE) +- SET_TARGET_PROPERTIES(cord PROPERTIES +- COMPILE_DEFINITIONS GC_NOT_DLL) +- TARGET_LINK_LIBRARIES(cord gc-lib) +- TARGET_LINK_LIBRARIES(cord gdi32) +-ENDIF(WIN32) ++#IF(WIN32) ++# ADD_EXECUTABLE(cord cord/cordbscs.c cord/cordxtra.c ++# cord/tests/de.c cord/tests/de_win.c) ++# SET_TARGET_PROPERTIES(cord PROPERTIES WIN32_EXECUTABLE TRUE) ++# SET_TARGET_PROPERTIES(cord PROPERTIES ++# COMPILE_DEFINITIONS GC_NOT_DLL) ++# TARGET_LINK_LIBRARIES(cord gc-lib) ++# TARGET_LINK_LIBRARIES(cord gdi32) ++#ENDIF(WIN32) ++set(TARGET_NAME bdwgc-8.0.0) ++set(TARGET_INSTALL_INCLUDEDIR "include") ++set(TARGET_INSTALL_LIBDIR "lib") ++# װ̬ ++install(TARGETS gcmt-lib ++ ARCHIVE DESTINATION ${TARGET_INSTALL_LIBDIR}) ++ ++# װ ++install(TARGETS gcmt-lib ++ LIBRARY DESTINATION ${TARGET_INSTALL_LIBDIR}) ++ + + ADD_SUBDIRECTORY(tests) diff --git a/community/bdwgc-8.0.0/docs/hap_integrate.md b/community/bdwgc-8.0.0/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..0120b7fd1523388e37259efefac88b47314d3ec6 --- /dev/null +++ b/community/bdwgc-8.0.0/docs/hap_integrate.md @@ -0,0 +1,76 @@ +# bdwgc-8.0.0集成到应用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/bdwgc-8.0.0 #三方库bdwgc-8.0.0的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── HPKCHECK #测试脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md #三方库简介 + ``` + +- 在lycium目录下编译三方库 + + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ```shell + cd lycium + ./build.sh bdwgc-8.0.0 + ``` + +- 三方库头文件及生成的库 + + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ```shell + bdwgc-8.0.0/arm64-v8a bdwgc-8.0.0/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +- 编译出可执行的文件进行测试,[准备三方库测试环境](../../../lycium/README.md#3ci环境准备) +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的头文件拷贝到该目录下,将编译生成的三方库以及依赖库全部(动态库名字带版本号和不带版本号的都需要)拷贝到工程的libs目录下,如下图所示: +   + +  ![thirdparty_install_dir](pic/bdwgc_install_dir.png) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + + ```shell + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/bdwgc/${OHOS_ARCH}/lib/libgcmt-lib.a) + ``` + +## 测试三方库 +进入到构建目录运行测试用例(注意arm64-v8a为构建64位的目录,armeabi-v7a为构建32位的目录),执行结果如图所示 + +```shell + cd /data/tpc_c_cplusplus/thirdparty/bdwgc-8.0.0/bdwgc-8.0.0/arm64-v8a-build/ + ./ctest +``` + ![bdwgc_test](pic/bdwgc_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/community/bdwgc-8.0.0/docs/pic/bdwgc_install_dir.png b/community/bdwgc-8.0.0/docs/pic/bdwgc_install_dir.png new file mode 100644 index 0000000000000000000000000000000000000000..a0dbbf20b92693df38b1efb5ee22c85282b2c3e2 Binary files /dev/null and b/community/bdwgc-8.0.0/docs/pic/bdwgc_install_dir.png differ diff --git a/community/bdwgc-8.0.0/docs/pic/bdwgc_test.png b/community/bdwgc-8.0.0/docs/pic/bdwgc_test.png new file mode 100644 index 0000000000000000000000000000000000000000..326cf80e10ed22b3cd2726f96efda67f96447392 Binary files /dev/null and b/community/bdwgc-8.0.0/docs/pic/bdwgc_test.png differ diff --git a/community/behaviortree/BUILD.gn b/community/behaviortree/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..a4c0376389f64dd63d878360b9c7e1447011ee10 --- /dev/null +++ b/community/behaviortree/BUILD.gn @@ -0,0 +1,750 @@ +# Copyright (c) 2023, HiHope Community. +# 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. + +import("//build/ohos.gni") + +declare_args() { + enable_behaviortree_test = false +} + +config("public_config") { + ldflags = [ + "-Wl", + "-lm", + "-lc", + "-lpthread", + ] +} + +config("lexy_file_config") { + cflags_cc = [ + "-O3", + "-DNDEBUG", + "-Wpedantic", + "-pedantic-errors", + "-Werror", + "-Wall", + "-Wextra", + "-Wconversion", + "-Wsign-conversion", + "-Wno-parentheses", + "-Wno-unused-local-typedefs", + "-Wno-array-bounds", + "-Wno-maybe-uninitialized", + "-Wno-restrict", + "-std=gnu++20", + ] +} + +ohos_static_library("lexy_file") { + output_name = "lexy_file" + + sources = [ "BehaviorTree.CPP/3rdparty/lexy/src/input/file.cpp" ] + + defines = [] + + configs = [ + ":lexy_file_config", + ":public_config", + ] + + include_dirs = [ "BehaviorTree.CPP/3rdparty/lexy/include" ] + + part_name = "behaviortree" +} + +config("bt_sample_nodes_config") { + cflags_cc = [ + "-O3", + "-DNDEBUG", + "-Wpedantic", + "-std=gnu++17", + "-fexceptions", + "-frtti", + "-Wno-unused-function", + ] +} + +ohos_static_library("bt_sample_nodes") { + sources = [ + "BehaviorTree.CPP/sample_nodes/crossdoor_nodes.cpp", + "BehaviorTree.CPP/sample_nodes/dummy_nodes.cpp", + "BehaviorTree.CPP/sample_nodes/movebase_node.cpp", + ] + + defines = [] + + configs = [ + ":bt_sample_nodes_config", + ":public_config", + ] + + include_dirs = [ + "BehaviorTree.CPP/include", + "BehaviorTree.CPP/sample_nodes", + ] + + part_name = "behaviortree" +} + +config("behaviortreecpp_config") { + cflags_cc = [ + "-O3", + "-DNDEBUG", + "-fPIC", + "-Wpedantic", + "-Wall", + "-Wextra", + "-std=gnu++20", + "-fexceptions", + "-frtti", + "-Wno-deprecated-volatile", + "-Wno-unused-lambda-capture", + ] + + include_dirs = [ + "BehaviorTree.CPP/.", + "BehaviorTree.CPP/include", + "BehaviorTree.CPP/3rdparty", + "BehaviorTree.CPP/3rdparty/lexy/include", + ] +} + +ohos_shared_library("behaviortree_cpp") { + output_name = "behaviortree_cpp" + + sources = [ + "BehaviorTree.CPP/3rdparty/minitrace/minitrace.cpp", + "BehaviorTree.CPP/3rdparty/tinyxml2/tinyxml2.cpp", + "BehaviorTree.CPP/src/action_node.cpp", + "BehaviorTree.CPP/src/actions/test_node.cpp", + "BehaviorTree.CPP/src/basic_types.cpp", + "BehaviorTree.CPP/src/behavior_tree.cpp", + "BehaviorTree.CPP/src/blackboard.cpp", + "BehaviorTree.CPP/src/bt_factory.cpp", + "BehaviorTree.CPP/src/condition_node.cpp", + "BehaviorTree.CPP/src/control_node.cpp", + "BehaviorTree.CPP/src/controls/fallback_node.cpp", + "BehaviorTree.CPP/src/controls/if_then_else_node.cpp", + "BehaviorTree.CPP/src/controls/parallel_node.cpp", + "BehaviorTree.CPP/src/controls/reactive_fallback.cpp", + "BehaviorTree.CPP/src/controls/reactive_sequence.cpp", + "BehaviorTree.CPP/src/controls/sequence_node.cpp", + "BehaviorTree.CPP/src/controls/sequence_star_node.cpp", + "BehaviorTree.CPP/src/controls/switch_node.cpp", + "BehaviorTree.CPP/src/controls/while_do_else_node.cpp", + "BehaviorTree.CPP/src/decorator_node.cpp", + "BehaviorTree.CPP/src/decorators/delay_node.cpp", + "BehaviorTree.CPP/src/decorators/inverter_node.cpp", + "BehaviorTree.CPP/src/decorators/repeat_node.cpp", + "BehaviorTree.CPP/src/decorators/retry_node.cpp", + "BehaviorTree.CPP/src/decorators/subtree_node.cpp", + "BehaviorTree.CPP/src/json_export.cpp", + "BehaviorTree.CPP/src/loggers/bt_cout_logger.cpp", + "BehaviorTree.CPP/src/loggers/bt_file_logger.cpp", + "BehaviorTree.CPP/src/loggers/bt_minitrace_logger.cpp", + "BehaviorTree.CPP/src/loggers/bt_observer.cpp", + "BehaviorTree.CPP/src/script_parser.cpp", + "BehaviorTree.CPP/src/shared_library.cpp", + "BehaviorTree.CPP/src/shared_library_UNIX.cpp", + "BehaviorTree.CPP/src/tree_node.cpp", + "BehaviorTree.CPP/src/xml_parsing.cpp", + ] + + defines = [ + "LEXY_HAS_UNICODE_DATABASE=1", + "behaviortree_cpp_EXPORTS", + ] + + configs = [ + ":behaviortreecpp_config", + ":public_config", + ] + + deps = [ "//third_party/behaviortree:lexy_file" ] + + install_enable = true + + install_images = [ + "system", + "ramdisk", + "updater", + ] + + part_name = "behaviortree" +} + +config("dummy_nodes_dyn_config") { + cflags_cc = [ + "-O3", + "-DNDEBUG", + "-fPIC", + "-Wpedantic", + "-std=gnu++17", + "-fexceptions", + "-frtti", + "-Wno-deprecated-volatile", + "-Wno-unused-lambda-capture", + ] + + include_dirs = [ + "BehaviorTree.CPP/include", + "BehaviorTree.CPP/sample_nodes", + ] +} + +ohos_shared_library("dummy_nodes_dyn") { + output_name = "dummy_nodes_dyn" + + sources = [ "BehaviorTree.CPP/sample_nodes/dummy_nodes.cpp" ] + + defines = [ + "BT_PLUGIN_EXPORT", + "dummy_nodes_dyn_EXPORTS", + ] + + configs = [ + ":dummy_nodes_dyn_config", + ":public_config", + ] + + deps = [ "//third_party/behaviortree:behaviortree_cpp" ] + + install_enable = true + + install_images = [ + "system", + "ramdisk", + "updater", + ] + + part_name = "behaviortree" +} + +config("crossdoor_nodes_dyn_config") { + cflags_cc = [ + "-O3", + "-DNDEBUG", + "-fPIC", + "-Wpedantic", + "-std=gnu++17", + "-fexceptions", + "-frtti", + "-Wno-deprecated-volatile", + "-Wno-unused-lambda-capture", + ] + + include_dirs = [ + "BehaviorTree.CPP/include", + "BehaviorTree.CPP/sample_nodes", + ] +} + +ohos_shared_library("crossdoor_nodes_dyn") { + output_name = "crossdoor_nodes_dyn" + + sources = [ "BehaviorTree.CPP/sample_nodes/crossdoor_nodes.cpp" ] + + defines = [ + "BT_PLUGIN_EXPORT", + "crossdoor_nodes_dyn_EXPORTS", + ] + + configs = [ + ":crossdoor_nodes_dyn_config", + ":public_config", + ] + + deps = [ "//third_party/behaviortree:behaviortree_cpp" ] + + install_enable = true + + install_images = [ + "system", + "ramdisk", + "updater", + ] + + part_name = "behaviortree" +} + +config("movebase_node_dyn_config") { + cflags_cc = [ + "-O3", + "-DNDEBUG", + "-fPIC", + "-Wpedantic", + "-std=gnu++17", + "-fexceptions", + "-frtti", + "-Wno-deprecated-volatile", + "-Wno-unused-lambda-capture", + ] + + include_dirs = [ + "BehaviorTree.CPP/include", + "BehaviorTree.CPP/sample_nodes", + ] +} + +ohos_shared_library("movebase_node_dyn") { + output_name = "movebase_node_dyn" + + sources = [ "BehaviorTree.CPP/sample_nodes/movebase_node.cpp" ] + + defines = [ + "BT_PLUGIN_EXPORT", + "movebase_node_dyn_EXPORTS", + ] + + configs = [ + ":movebase_node_dyn_config", + ":public_config", + ] + + deps = [ "//third_party/behaviortree:behaviortree_cpp" ] + + install_enable = true + + install_images = [ + "system", + "ramdisk", + "updater", + ] + + part_name = "behaviortree" +} + +group("tests") { + if (enable_behaviortree_test) { + deps = [ + ":ex01_wrap_legacy", + ":ex02_runtime_ports", + ":ex04_waypoints", + ":t01_build_your_first_tree", + ":t02_basic_ports", + ":t03_generic_ports", + ":t04_reactive_sequence", + ":t05_crossdoor", + ":t06_subtree_port_remapping", + ":t07_load_multiple_xml", + ":t08_additional_node_args", + ":t09_scripting", + ":t10_observer", + ":t11_replace_rules", + ] + } else { + deps = [] + } +} + +config("executable_public_config") { + cflags_cc = [ + "-O3", + "-DNDEBUG", + "-Wpedantic", + "-std=gnu++17", + "-fexceptions", + "-frtti", + "-Wno-deprecated-volatile", + "-Wno-unused-lambda-capture", + ] + + include_dirs = [ + "BehaviorTree.CPP/include", + "BehaviorTree.CPP/sample_nodes", + ] +} + +ohos_executable("t01_build_your_first_tree") { + output_name = "t01_build_your_first_tree" + + sources = [ "BehaviorTree.CPP/examples/t01_build_your_first_tree.cpp" ] + + configs = [ + ":executable_public_config", + ":public_config", + ] + + deps = [ + "//third_party/behaviortree:behaviortree_cpp", + "//third_party/behaviortree:bt_sample_nodes", + ] + + install_enable = true + + install_images = [ + "system", + "ramdisk", + "updater", + ] + + part_name = "behaviortree" +} + +ohos_executable("t02_basic_ports") { + output_name = "t02_basic_ports" + + sources = [ "BehaviorTree.CPP/examples/t02_basic_ports.cpp" ] + + configs = [ + ":executable_public_config", + ":public_config", + ] + + deps = [ + "//third_party/behaviortree:behaviortree_cpp", + "//third_party/behaviortree:bt_sample_nodes", + ] + + install_enable = true + + install_images = [ + "system", + "ramdisk", + "updater", + ] + + part_name = "behaviortree" +} + +ohos_executable("t03_generic_ports") { + output_name = "t03_generic_ports" + + sources = [ "BehaviorTree.CPP/examples/t03_generic_ports.cpp" ] + + configs = [ + ":executable_public_config", + ":public_config", + ] + + deps = [ + "//third_party/behaviortree:behaviortree_cpp", + "//third_party/behaviortree:bt_sample_nodes", + ] + + install_enable = true + + install_images = [ + "system", + "ramdisk", + "updater", + ] + + part_name = "behaviortree" +} + +ohos_executable("t04_reactive_sequence") { + output_name = "t04_reactive_sequence" + + sources = [ "BehaviorTree.CPP/examples/t04_reactive_sequence.cpp" ] + + configs = [ + ":executable_public_config", + ":public_config", + ] + + deps = [ + "//third_party/behaviortree:behaviortree_cpp", + "//third_party/behaviortree:bt_sample_nodes", + ] + + install_enable = true + + install_images = [ + "system", + "ramdisk", + "updater", + ] + + part_name = "behaviortree" +} + +ohos_executable("t05_crossdoor") { + output_name = "t05_crossdoor" + + sources = [ "BehaviorTree.CPP/examples/t05_crossdoor.cpp" ] + + configs = [ + ":executable_public_config", + ":public_config", + ] + + deps = [ + "//third_party/behaviortree:behaviortree_cpp", + "//third_party/behaviortree:bt_sample_nodes", + ] + + install_enable = true + + install_images = [ + "system", + "ramdisk", + "updater", + ] + + part_name = "behaviortree" +} + +ohos_executable("t06_subtree_port_remapping") { + output_name = "t06_subtree_port_remapping" + + sources = [ "BehaviorTree.CPP/examples/t06_subtree_port_remapping.cpp" ] + + configs = [ + ":executable_public_config", + ":public_config", + ] + + deps = [ + "//third_party/behaviortree:behaviortree_cpp", + "//third_party/behaviortree:bt_sample_nodes", + ] + + install_enable = true + + install_images = [ + "system", + "ramdisk", + "updater", + ] + + part_name = "behaviortree" +} + +ohos_executable("t07_load_multiple_xml") { + output_name = "t07_load_multiple_xml" + + sources = [ "BehaviorTree.CPP/examples/t07_load_multiple_xml.cpp" ] + + configs = [ + ":executable_public_config", + ":public_config", + ] + + deps = [ + "//third_party/behaviortree:behaviortree_cpp", + "//third_party/behaviortree:bt_sample_nodes", + ] + + install_enable = true + + install_images = [ + "system", + "ramdisk", + "updater", + ] + + part_name = "behaviortree" +} + +ohos_executable("t08_additional_node_args") { + output_name = "t08_additional_node_args" + + sources = [ "BehaviorTree.CPP/examples/t08_additional_node_args.cpp" ] + + configs = [ + ":executable_public_config", + ":public_config", + ] + + deps = [ + "//third_party/behaviortree:behaviortree_cpp", + "//third_party/behaviortree:bt_sample_nodes", + ] + + install_enable = true + + install_images = [ + "system", + "ramdisk", + "updater", + ] + + part_name = "behaviortree" +} + +ohos_executable("t09_scripting") { + output_name = "t09_scripting" + + sources = [ "BehaviorTree.CPP/examples/t09_scripting.cpp" ] + + configs = [ + ":executable_public_config", + ":public_config", + ] + + deps = [ + "//third_party/behaviortree:behaviortree_cpp", + "//third_party/behaviortree:bt_sample_nodes", + ] + + install_enable = true + + install_images = [ + "system", + "ramdisk", + "updater", + ] + + part_name = "behaviortree" +} + +config("t10_observer_config") { + cflags_cc = [ + "-O3", + "-DNDEBUG", + "-Wpedantic", + "-std=gnu++17", + "-fexceptions", + "-frtti", + "-Wno-deprecated-volatile", + "-Wno-unused-lambda-capture", + "-Wno-unused-variable", + ] + + include_dirs = [ + "BehaviorTree.CPP/include", + "BehaviorTree.CPP/sample_nodes", + ] +} + +ohos_executable("t10_observer") { + output_name = "t10_observer" + + sources = [ "BehaviorTree.CPP/examples/t10_observer.cpp" ] + + configs = [ + ":t10_observer_config", + ":public_config", + ] + + deps = [ + "//third_party/behaviortree:behaviortree_cpp", + "//third_party/behaviortree:bt_sample_nodes", + ] + + install_enable = true + + install_images = [ + "system", + "ramdisk", + "updater", + ] + + part_name = "behaviortree" +} + +ohos_executable("t11_replace_rules") { + output_name = "t11_replace_rules" + + sources = [ "BehaviorTree.CPP/examples/t11_replace_rules.cpp" ] + + configs = [ + ":executable_public_config", + ":public_config", + ] + + deps = [ + "//third_party/behaviortree:behaviortree_cpp", + "//third_party/behaviortree:bt_sample_nodes", + ] + + install_enable = true + + install_images = [ + "system", + "ramdisk", + "updater", + ] + + part_name = "behaviortree" +} + +ohos_executable("ex01_wrap_legacy") { + output_name = "ex01_wrap_legacy" + + sources = [ "BehaviorTree.CPP/examples/ex01_wrap_legacy.cpp" ] + + configs = [ + ":executable_public_config", + ":public_config", + ] + + deps = [ + "//third_party/behaviortree:behaviortree_cpp", + "//third_party/behaviortree:bt_sample_nodes", + ] + + install_enable = true + + install_images = [ + "system", + "ramdisk", + "updater", + ] + + part_name = "behaviortree" +} + +ohos_executable("ex02_runtime_ports") { + output_name = "ex02_runtime_ports" + + sources = [ "BehaviorTree.CPP/examples/ex02_runtime_ports.cpp" ] + + configs = [ + ":executable_public_config", + ":public_config", + ] + + deps = [ + "//third_party/behaviortree:behaviortree_cpp", + "//third_party/behaviortree:bt_sample_nodes", + ] + + install_enable = true + + install_images = [ + "system", + "ramdisk", + "updater", + ] + + part_name = "behaviortree" +} + +ohos_executable("ex04_waypoints") { + output_name = "ex04_waypoints" + + sources = [ "BehaviorTree.CPP/examples/ex04_waypoints.cpp" ] + + configs = [ + ":executable_public_config", + ":public_config", + ] + + deps = [ + "//third_party/behaviortree:behaviortree_cpp", + "//third_party/behaviortree:bt_sample_nodes", + ] + + install_enable = true + + install_images = [ + "system", + "ramdisk", + "updater", + ] + + part_name = "behaviortree" +} diff --git a/community/behaviortree/HPKBUILD b/community/behaviortree/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..c035bba3779adfd21a49e028f26980d9919257f1 --- /dev/null +++ b/community/behaviortree/HPKBUILD @@ -0,0 +1,80 @@ +# Copyright (c) 2023, HiHope Community. +# 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: jiajiahao +# Maintainer: jiajiajiao + +pkgname=BehaviorTree.CPP +pkgver=4.1.1 +pkgrel=0 +pkgdesc="This C++ library provides a framework to create BehaviorTrees. It is designed to be flexible, easy to use and fast." +url="https://www.behaviortree.dev/" +archs=("armeabi-v7a" "arm64-v8a") +license=("MIT") +depends=("googletest" "sqlite") +makedepends=() + +source="https://codeload.github.com/BehaviorTree/${pkgname}/zip/refs/tags/$pkgver" + +downloadpackage=true +autounpack=true +builddir=$pkgname-${pkgver} +packagename=$builddir.zip +patchflag=true + +prepare() { + if [ $patchflag == true ];then + cd $builddir + # 打patch的原因有以下两点: + # 1.behaviortree原生库有一项测试用例依赖三方库(无法编译),打补丁注释掉 + # 2.behaviortree原生库依赖googletest,关闭behaviortree的tests/CMakeLists.txt中的find_package(GTest)部分。换成在HPKBUILD中来指定googletest的头文件和库文件。 + patch -p1 < `pwd`/../behaviortree_oh_pkg.patch + # patch只需要打一次,关闭打patch + patchflag=false + cd $OLDPWD + fi + mkdir -p $builddir/$ARCH-build +} + +# -DBTCPP_SQLITE_LOGGING=ON 表示打开对sqlite依赖 、-DBTCPP_UNIT_TESTS=ON 表示打开对googletest的依赖、 +# BehaviorTree.CPP中的CMakeLists.txt声明了BTCPP_EXTRA_INCLUDE_DIRS和BTCPP_EXTRA_LIBRARIES用于指定依赖的头文件的库文件路径 +# GROOT是BehaviorTree.CPP的图形编辑器依赖qt,故关闭对GROOT的依赖,-DBTCPP_GROOT_INTERFACE=OFF +build() { + cd $builddir + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" \ + -DBTCPP_UNIT_TESTS=ON -DBTCPP_GROOT_INTERFACE=OFF -DBTCPP_SQLITE_LOGGING=ON \ + -DBTCPP_EXTRA_INCLUDE_DIRS=$LYCIUM_ROOT/usr/sqlite/$ARCH/include \ + -DBTCPP_EXTRA_LIBRARIES=$LYCIUM_ROOT/usr/sqlite/$ARCH/lib \ + -DCMAKE_CXX_FLAGS="-Wno-unused-command-line-argument -Wno-unused-lambda-capture -Wno-deprecated-volatile -L$LYCIUM_ROOT/usr/googletest/$ARCH/lib -lgtest -I$LYCIUM_ROOT/usr/googletest/$ARCH/include $cxxflag" \ + -B$ARCH-build -S./ > $buildlog 2>&1 + $MAKE VERBOSE=1 -C $ARCH-build >> $buildlog 2>&1 # 此处使用$MAKE,在lycium/build.sh中定义,变量值为make -j32。日志路径使用变量build.log + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + $MAKE VERBOSE=1 -C $ARCH-build >> $buildlog 2>&1 # 此处使用$MAKE,在lycium/build.sh中定义,变量值为make -j32。日志路径使用变量build.log + cd $OLDPWD +} + +check() { + echo "The test must be on an OpenHarmony device!" + # TODO +} + +# 清理环境 +cleanbuild() { + rm -rf ${PWD}/$builddir #${PWD}/$packagename +} diff --git a/community/behaviortree/OAT.xml b/community/behaviortree/OAT.xml new file mode 100644 index 0000000000000000000000000000000000000000..eeb1f946d683c0b81976cd06522096062a6901b9 --- /dev/null +++ b/community/behaviortree/OAT.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/community/behaviortree/README.OpenSource b/community/behaviortree/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..a78e67441feec94575bf1bc66899824e9fd36969 --- /dev/null +++ b/community/behaviortree/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "behaviortree", + "License": "MIT", + "License File": "LICENSE", + "Version Number": "4.1.1", + "Owner": "jia_jiahao@runkaihong.com.cn", + "Upstream URL": "https://github.com/BehaviorTree/BehaviorTree.CPP", + "Description": "This C++ library provides a framework to create BehaviorTrees. It is designed to be flexible, easy to use and fast." + } +] diff --git a/community/behaviortree/README_zh.md b/community/behaviortree/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..c060faf469939f995b949c52649579de38bb57c3 --- /dev/null +++ b/community/behaviortree/README_zh.md @@ -0,0 +1,16 @@ +# behaviortree三方库说明 + +## 功能简介 +behaviortree提供了一个创建行为树的框架,常用来做任务或状态管理。 + +## 三方库版本 +- 4.1.1 + +## 已适配功能 +- behaviortree行为树任务或状态管理功能 + +## 使用约束 +- [IDE和SDK版本](../../docs/constraint.md) + +## 集成方式 +- [应用hap包集成](./docs/hap_integrate.md) \ No newline at end of file diff --git a/community/behaviortree/SHA512SUM b/community/behaviortree/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..6a95e9c066648729e0b22722691a20341d972906 --- /dev/null +++ b/community/behaviortree/SHA512SUM @@ -0,0 +1 @@ +12d395e4a651a9487ce58b846fc2d08e37ef251e6b57adde0624cfdfd8c67caae7bc470c8636590dc322112f13f84ced31e3b6a40dd8f930cd3dbe1476638b1b BehaviorTree.CPP-4.1.1.zip \ No newline at end of file diff --git a/community/behaviortree/behaviortree_oh_pkg.patch b/community/behaviortree/behaviortree_oh_pkg.patch new file mode 100644 index 0000000000000000000000000000000000000000..d4e49f91c6c58dd803ccf155a7f1602c4833ed08 --- /dev/null +++ b/community/behaviortree/behaviortree_oh_pkg.patch @@ -0,0 +1,35 @@ +diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt +index ffe6204..ad905b4 100644 +--- a/examples/CMakeLists.txt ++++ b/examples/CMakeLists.txt +@@ -27,7 +27,7 @@ CompileExample("t08_additional_node_args") + CompileExample("t09_scripting") + CompileExample("t10_observer") + CompileExample("t11_replace_rules") +-CompileExample("t12_groot_howto") ++# CompileExample("t12_groot_howto") + + CompileExample("ex01_wrap_legacy") + CompileExample("ex02_runtime_ports") +diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt +index 7d5f1a4..bf3dac8 100644 +--- a/tests/CMakeLists.txt ++++ b/tests/CMakeLists.txt +@@ -52,14 +52,15 @@ elseif(catkin_FOUND AND CATKIN_ENABLE_TESTING) + + else() + +- find_package(GTest) ++ # find_package(GTest) + enable_testing() + + add_executable(${BTCPP_LIBRARY}_test ${BT_TESTS}) + target_link_libraries(${PROJECT_NAME}_test + ${TEST_DEPENDECIES} + Threads::Threads +- GTest::gtest) ++ # GTest::gtest ++ ) + + endif() + diff --git a/community/behaviortree/bundle.json b/community/behaviortree/bundle.json new file mode 100644 index 0000000000000000000000000000000000000000..2cdd8bbb8daceea0be53b133e12247532ede673f --- /dev/null +++ b/community/behaviortree/bundle.json @@ -0,0 +1,44 @@ +{ + "name": "@ohos/behaviortree", + "description": "This C++ library provides a framework to create BehaviorTrees. It is designed to be flexible, easy to use and fast.", + "version": "v4.1.1", + "license": "MIT", + "publishAs": "", + "segment": { + "destPath": "third_party/behaviortree" + }, + "dirs": {}, + "scripts": {}, + "readmePath": { + }, + "component": { + "name": "behaviortree", + "subsystem": "thirdparty", + "syscap": [], + "features": [], + "adapted_system_type": ["standard"], + "rom": "", + "ram": "", + "deps": { + "components": [], + "third_party": [] + }, + "build": { + "sub_component": [ + "//third_party/behaviortree:lexy_file", + "//third_party/behaviortree:bt_sample_nodes", + "//third_party/behaviortree:behaviortree_cpp", + "//third_party/behaviortree:dummy_nodes_dyn", + "//third_party/behaviortree:crossdoor_nodes_dyn", + "//third_party/behaviortree:movebase_node_dyn", + "//third_party/behaviortree:tests" + ], + "inner_kits": [], + "test": [] + } + } +} + + + + diff --git a/community/behaviortree/docs/hap_integrate.md b/community/behaviortree/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..e7db2cf4a131dc854e44007a8e8b71dd1d023006 --- /dev/null +++ b/community/behaviortree/docs/hap_integrate.md @@ -0,0 +1,94 @@ +# BehaviorTree.CPP集成到应用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/behaviortree #三方库behaviortree的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── HPKCHECK #测试脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md + ├── behaviortree_oh_pkg.patch + ``` + +- 在lycium目录下编译三方库 + + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ```shell + cd lycium + ./build.sh behaviortree + ``` + +- 三方库头文件及生成的库 + + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ```shell + BehaviorTree.CPP/arm64-v8a BehaviorTree.CPP/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 需要将libbehaviortree_cpp.so相关目录拷贝到entry/libs目录下 +![thirdparty_install_dir](pic/libs.png) + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的头文件拷贝到该目录下,本库是一个头文件库,如下图所示: +![Alt text](pic/install_dir.png) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + + ```cmake + #将三方库加入工程中 + target_link_libraries(entry PUBLIC ${CMAKE_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/libbehaviortree_cpp.so) + + #将三方库的头文件加入工程中 + target_include_directories(entry PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/BehaviorTree.CPP/${OHOS_ARCH}/include/behaviortree_cpp) + ``` + + +## 测试三方库 + +三方库的测试使用原库自带的测试用例来做测试 + +- 将原生库测试编译出来的ex01_wrap_legacy.cpp、ex02_runtime_ports.cpp、ex03_ncurses_manual_selector.cpp +ex04_waypoints.cpp、t01_build_your_first_tree.cpp、t02_basic_ports.cpp、t03_generic_ports.cpp、t04_reactive_sequence.cpp、t05_crossdoor.cpp、t06_subtree_port_remapping.cpp、t07_load_multiple_xml.cpp、t08_additional_node_args.cpp、t09_scripting.cpp、t10_observer.cpp、t11_replace_rules.cpp和libc++_shared.so、libbehaviortree_cpp.so打包为BehaviorTree.CPP文件 + +- 将BehaviorTree.CPP推送至开发板 + +``` +hdc shell mount -o remount,rw / #修改系统权限为可读写 +hdc file send BehaviorTree.CPP /data #将文件包推入开发 +``` + +- 运行测试程序 测试用例非常多,这里演示其中几个用例,如下图 +``` +cd BehaviorTree.CPP +export LD_LIBRARY_PATH=/data/BehaviorTree.CPP:$LD_LIBRARY_PATH +``` + ![result](pic/hap_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/community/behaviortree/docs/pic/hap_result.png b/community/behaviortree/docs/pic/hap_result.png new file mode 100644 index 0000000000000000000000000000000000000000..eb0df1979d13678749e8a98044a866a383ca5f28 Binary files /dev/null and b/community/behaviortree/docs/pic/hap_result.png differ diff --git a/community/behaviortree/docs/pic/install_dir.png b/community/behaviortree/docs/pic/install_dir.png new file mode 100644 index 0000000000000000000000000000000000000000..733d72af302666c259ae2a174fd80bba0c9154e3 Binary files /dev/null and b/community/behaviortree/docs/pic/install_dir.png differ diff --git a/community/behaviortree/docs/pic/libs.png b/community/behaviortree/docs/pic/libs.png new file mode 100644 index 0000000000000000000000000000000000000000..b1be9ec8c278bf76ef4cdaa37f65ac6d4211ccb0 Binary files /dev/null and b/community/behaviortree/docs/pic/libs.png differ diff --git a/community/behaviortree/docs/pic/result.png b/community/behaviortree/docs/pic/result.png new file mode 100644 index 0000000000000000000000000000000000000000..2a35dbfa249996822b2cbeab52da058abd1742e9 Binary files /dev/null and b/community/behaviortree/docs/pic/result.png differ diff --git a/community/behaviortree/docs/rom_integrate.md b/community/behaviortree/docs/rom_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..6e76f0f418b062eb4df968057f050b6893667b29 --- /dev/null +++ b/community/behaviortree/docs/rom_integrate.md @@ -0,0 +1,153 @@ +# behaviortree如何集成到系统Rom + +## 准备源码工程 + +本库是基于OpenHarmony-v3.2-Release版本,在润和RK3568开发板上验证的。如果是从未使用过RK3568,可以先查看[润和RK3568开发板标准系统快速上手](https://gitee.com/openharmony-sig/knowledge_demo_temp/tree/master/docs/rk3568_helloworld)。 + +### 准备系统Rom源码 + +系统源码获取方法请参照:[OpenHarmony源码下载](https://gitee.com/openharmony/docs/blob/OpenHarmony-3.2-Release/zh-cn/release-notes/OpenHarmony-v3.2-release.md) + +### 增加构建脚本及配置文件 + +- 下载本仓库代码 + + ```sh + cd ~/ + git clone git@gitee.com:openharmony-sig/tpc_c_cplusplus.git --depth=1 + ``` + +- 仓库代码目录结构说明 + + ``` sh + cd ~/tpc_c_cplusplus/thirdparty/behaviortree/ # 进入到仓库代码库目录 + ``` + + ``` sh + behaviortree + |-- docs ## BehaviorTree集成说明文档目录 + |-- pic ## 存放文档中的图片资源 + |-- BUILD.gn ## Rom版编译构建脚本 + |-- bundle.json ## 组件定义文件 + |-- README.OpenSource ## BehaviorTree 开源信息说明文档 + |-- README_zh.md ## BehaviorTree 说明文档 + ``` + +- 将本仓库behaviortree文件夹拷贝到OpenHarmony的third_party下 + + ``` sh + cp -arf ~/tpc_c_cplusplus/thirdparty/behaviortree ~/OpenHarmony/third_party + ``` + +### 准备三方库源码 + +- 三方库源码下载 + + 将behaviortree-4.1.1源码下载到behaviortree目录。 + + ```shell + cd ~/OpenHarmony/third_party/behaviortree + git clone https://github.com/BehaviorTree/BehaviorTree.CPP.git -b 4.1.1 + ``` + +## 系统Rom中引入三方库 + +- 准备完三方库代码后,我们需要将三方库加入到编译构建体系中。标准系统编译构建可以参考文档[标准系统编译构建指导](https://gitee.com/openharmony/docs/blob/OpenHarmony-3.2-Beta1/zh-cn/device-dev/subsystems/subsys-build-standard-large.md)。 +这里我们三方库默认添加到thirdparty子系统中(详细信息参照文档[如何添加一个三方库到OpenHarmony系统中](https://gitee.com/openharmony-sig/knowledge/blob/master/docs/openharmony_getstarted/port_thirdparty/README.md#%E5%8A%A0%E5%85%A5%E7%BC%96%E8%AF%91%E6%9E%84%E5%BB%BA%E4%BD%93%E7%B3%BB))。相关配置已在bundle.json中完成,我们只需要在产品定义中添加BehaviorTree组件即可。 + +- 在产品配置文件中添加BehaviorTree的组件 + 打开//vendor/hihope/rk3568/config.json文件,找到thirdparty子系统并添加BehaviorTree的组件,如果文件中未指定thirdparty子系统,需要手动将子系统信息加上: + + ```json + { + "subsystem": "thirdparty", + "components": [ + { + "component": "musl", + "features": [] + }, + { + "component": "behaviortree", + "features": [] + } + ] + } + ``` + + +## 系统Rom中引入三方库测试程序 + +如果需要编译测试用例,在OpenHarmony源码的vendor/hihope/rk3568/config.json文件,对应组件的features中打开编译选项,如下 + ```json + { + "subsystem": "thirdparty", + "components": [ + { + "component": "musl", + "features": [] + }, + { + "component": "behaviortree", + "features": ["enable_behaviortree_test=true"] + } + ] + } + ``` + +## 编译工程 + +- 在此选择build.sh脚本编译方式 + ``` + ./build.sh --product-name rk3568 --ccache --build-target=behaviortree --target-cpu arm + ``` + + ``` + 参数释义 + --product-name rk3568 编译rk3568产品 + --target-cpu arm 编译32位系统(未配置默认编译32位) + --target-cpu arm64 编译64位系统 + ``` + +- 正常编译完后会在out/rk3568/thirdparty/behaviortree下生成ex01_wrap_legacy、ex02_runtime_ports、ex04_waypoints、t01_build_your_first_tree、t02_basic_ports、t03_generic_ports、t04_reactive_sequence、t05_crossdoor、t06_subtree_port_remapping、t07_load_multiple_xml、t08_additional_node_args、t09_scripting、t10_observer、t11_replace_rules等14个测试用例。 + +- 在out/rk3568/thirdparty/behaviortree下生成libbehaviortree_cpp.z.so + +## 安装应用程序 +将编译生成的库和测试文件放到板子上运行,为避免每次将文件推入设备都烧录整个镜像,使用hdc工具将文件推到开发板上 。 + +- 通过源码编译生成hdc工具 +``` +# 安装依赖 +./build/build_scripts/env_setup.sh + +# 执行完上述命令后记得执行source ~/.bashrc或者重启终端 +source ~/.bashrc + +# 安装编译SDK需要的依赖包 +sudo apt-get install libxcursor-dev libxrandr-dev libxinerama-dev + +# 选择产品ohos-sdk +./build.sh --product-name ohos-sdk --ccache --build-target ohos_ndk +``` + +- 将工具拷贝到Windows,可以为工具目录配置环境变量,也可以在工具所在目录打开windows命令 + +- 将原生库测试需要的所有文件打包成behaviortree.tar,并拷贝到windows下 + +``` +hdc shell mount -oremount,rw / #修改系统权限为可读写 +hdc file send behaviortree.tar / #将文件包推入开发板 +hdc shell #进入开发板 +tar xvf behaviortree.tar #解压 + #注意需要将库拷贝到/system/lib 或者/system/lib64目录下 +``` + +- 运行测试程序 测试用例非常多,这里演示其中几个用例,如下图 + ![result](pic/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) +- [如何为三方库组件中添加一个三方库](https://gitee.com/openharmony-sig/knowledge/blob/master/docs/openharmony_getstarted/port_thirdparty/README.md) +- [标准系统编译构建指导](https://gitee.com/openharmony/docs/blob/OpenHarmony-3.2-Beta1/zh-cn/device-dev/subsystems/subsys-build-standard-large.md) \ No newline at end of file diff --git a/community/boost/HPKBUILD b/community/boost/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..f2aec730c880c418919d846e107ac0a290c710b7 --- /dev/null +++ b/community/boost/HPKBUILD @@ -0,0 +1,84 @@ +# Contributor: Jeff Han +# Maintainer: Jeff Han +pkgname=boost +pkgver=1.81.0 +pkgrel=0 +pkgdesc="Boost provides free peer-reviewed portable C++ source libraries." +url="https://www.boost.org/" +archs=("armeabi-v7a" "arm64-v8a") +license=("Boost Software License") +depends=() +makedepends=() + +source="https://boostorg.jfrog.io/artifactory/main/release/$pkgver/source/$pkgname'_1_81_0.tar.gz'" + +autounpack=true +downloadpackage=true +buildtools=jamfile + +builddir=$pkgname'_1_81_0' +packagename=$builddir.tar.gz + +compileflags= +prepare() { + cp -rf $builddir $builddir-$ARCH-build + cd $builddir-$ARCH-build + # without boost_log boost_python boost_locale.这三个库无法用 ohos sdk 编译 + if [ $ARCH == "armeabi-v7a" ] + then + compileflags="\"-march=armv7a\"" + ./bootstrap.sh --with-toolset=gcc --prefix=$LYCIUM_ROOT/usr/$pkgname/$ARCH --without-libraries=log,python,locale > $buildlog 2>&1 + if [ $LYCIUM_BUILD_OS == "Darwi" ] #Darwin + then + sed -i '' "s|using gcc ;|using gcc : arm : ${OHOS_SDK}/native/llvm/bin/arm-linux-ohos-clang ;|g" project-config.jam + ret=$? + else + sed -i '/.*using gcc ;/c\ using gcc : arm : '"${OHOS_SDK}"'/native/llvm/bin/arm-linux-ohos-clang ; ' project-config.jam + ret=$? + fi + elif [ $ARCH == "arm64-v8a" ] + then + compileflags="\"\"" + ./bootstrap.sh --with-toolset=gcc --prefix=$LYCIUM_ROOT/usr/$pkgname/$ARCH --without-libraries=log,python,locale > $buildlog 2>&1 + if [ $LYCIUM_BUILD_OS == "Darwi" ] #Darwin + then + sed -i '' "s|using gcc ;|using gcc : aarch64 : ${OHOS_SDK}/native/llvm/bin/aarch64-linux-ohos-clang ;|g" project-config.jam + ret=$? + else + sed -i '/.*using gcc ;/c\ using gcc : aarch64 : '"${OHOS_SDK}"'/native/llvm/bin/aarch64-linux-ohos-clang ; ' project-config.jam + ret=$? + fi + fi + cd $OLDPWD + return $ret +} + +build() { + cd $builddir-$ARCH-build + ./b2 cxxflags=$compileflags" -fPIC" cflags=$compileflags" -fPIC" variant=release >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir-$ARCH-build + ./b2 install >> $buildlog 2>&1 + cd $OLDPWD + unset compileflags + # 为方便IDE集成该库,删除动态库,如果有动态库需求,自行屏蔽下面操作 + lib_dir=$LYCIUM_ROOT/usr/$pkgname/$ARCH + mv $lib_dir/lib/libboost_unit_test_framework.so* $lib_dir + rm $lib_dir/lib/*.so* + rm -rf $lib_dir/lib/cmake + mv $lib_dir/libboost_unit_test_framework.so* $lib_dir/lib +} + +check() { + echo "The test must be on an OpenHarmony device!" +} + +# 清理环境 +cleanbuild(){ + rm -rf ${PWD}/$builddir ${PWD}/$builddir"-arm64-v8a-build" ${PWD}/$builddir"-armeabi-v7a-build" #${PWD}/$packagename +} diff --git a/community/boost/README.OpenSource b/community/boost/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..215df1517f7ea7005e725e4ea2f4e3b445d8be1e --- /dev/null +++ b/community/boost/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "boost", + "License": "Boost Software License", + "License File": "https://www.boost.org/LICENSE_1_0.txt", + "Version Number": "1.81.0", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://boostorg.jfrog.io/artifactory/main/release/1.81.0/source/boost_1_81_0.tar.gz", + "Description": "Boost provides free peer-reviewed portable C++ source libraries." + } +] diff --git a/community/boost/README_zh.md b/community/boost/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..0ef5ec64112d54cb7e7cfe6e1dd27e1b1c1bffe6 --- /dev/null +++ b/community/boost/README_zh.md @@ -0,0 +1,12 @@ +# boost三方库说明 +## 功能简介 +Boost provides free peer-reviewed portable C++ source libraries。 + +## 三方库版本 +- 1.81.0 + +## 已适配功能 +- 除去log,python,locale的其他功能都适配 + +## 使用约束 +- [IDE和SDK版本](../../docs/constraint.md) diff --git a/community/boost/SHA512SUM b/community/boost/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..4b466aaf42437f6f950adc80cbcff2b7f9b8b145 --- /dev/null +++ b/community/boost/SHA512SUM @@ -0,0 +1 @@ +8f18972314e8dd5c952825fc52ca49d17b0e0b31db12bcc1cd0ba42c2d71c4f6ce5f5062fdbb65db029ec2c58ca93a32c32d0cdce62329556200dc8650a03fbf boost_1_81_0.tar.gz diff --git a/community/brotli/HPKBUILD b/community/brotli/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..6b45f85e7debe54700bf269fe50042a097168a10 --- /dev/null +++ b/community/brotli/HPKBUILD @@ -0,0 +1,73 @@ +# 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: Jeff Han +# Maintainer: Jeff Han + +pkgname=brotli +pkgver=v1.0.9 +pkgrel=0 +pkgdesc="" +url="https://github.com/google/brotli" +archs=("armeabi-v7a" "arm64-v8a") +license=("MIT") +depends=() +makedepends=() + +#官方地址 "https://github.com/google/$pkgname/archive/refs/tags/$pkgver.tar.gz", 因网络原因使用镜像地址 +source="https://gitee.com/lycium_pkg_mirror/brotli.git" + +autounpack=false +downloadpackage=false +clonsrcflag=true + +builddir=$pkgname-$pkgver +packagename=$builddir.zip + +prepare() { + # gitee 位置原因镜像下载压缩包与源仓不一致,只能使用clone方式 + if [ $clonsrcflag == true ];then + rm -rf $builddir + git clone -b $pkgver $source $builddir + if [ $? -ne 0 ];then + return -1 + fi + clonsrcflag=false + fi + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + PKG_CONFIG_LIBDIR="${pkgconfigpath}" ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" \ + -DOHOS_ARCH=$ARCH -B$ARCH-build -S./ -L > $buildlog 2>&1 + $MAKE VERBOSE=1 -C $ARCH-build >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd "$builddir" + $MAKE VERBOSE=1 -C $ARCH-build install >> $buildlog 2>&1 + cd $OLDPWD +} + +check() { + echo "The test must be on an OpenHarmony device!" +} + +# 清理环境 +cleanbuild(){ + rm -rf ${PWD}/$builddir #${PWD}/$packagename +} \ No newline at end of file diff --git a/community/brotli/README.OpenSource b/community/brotli/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..d9223494ae0ab6284bc111c650f3a60d5cb9305e --- /dev/null +++ b/community/brotli/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "brotli", + "License": "MIT License", + "License File": "https://github.com/google/brotli/blob/master/LICENSE", + "Version Number": "v1.0.9", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://github.com/google/brotli/archive/refs/tags/v1.0.9.tar.gz", + "Description": "Brotli is a generic-purpose lossless compression algorithm that compresses data using a combination of a modern variant of the LZ77 algorithm, Huffman coding and 2nd order context modeling, with a compression ratio comparable to the best currently available general-purpose compression methods. It is similar in speed with deflate but offers more dense compression" + } +] diff --git a/community/brotli/README_zh.md b/community/brotli/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..c33678cdf67474fe99ceb4937186d2ce27cb9827 --- /dev/null +++ b/community/brotli/README_zh.md @@ -0,0 +1,15 @@ +# brotli三方库说明 +## 功能简介 +Brotli is a generic-purpose lossless compression algorithm that compresses data using a combination of a modern variant of the LZ77 algorithm, Huffman coding and 2nd order context modeling, with a compression ratio comparable to the best currently available general-purpose compression methods. It is similar in speed with deflate but offers more dense compression + +## 三方库版本 +- 2.13.0 + +## 已适配功能 +- 支持无损压缩算法 + +## 使用约束 +- [IDE和SDK版本](../../docs/constraint.md) + +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) diff --git a/community/brotli/SHA512SUM b/community/brotli/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..b20ded478658be394df2a5947df3bd289f2b29fe --- /dev/null +++ b/community/brotli/SHA512SUM @@ -0,0 +1 @@ +f14c1e0309519ae300f01bc48cb48dbf3805432d2ba1c38a8e99361620b6415d1413a99059fc602e763d653f46c659d6fa73a0c6e4dd8ca09171eaf70fa660c5 brotli-v1.0.9.zip diff --git a/community/brotli/docs/hap_integrate.md b/community/brotli/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..55c0a0c12c73a914e2cd68b91b934329067bcb99 --- /dev/null +++ b/community/brotli/docs/hap_integrate.md @@ -0,0 +1,56 @@ +# brotli集成到应用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) + +## 编译三方库 +- 下载本仓库 + ``` + git clone https://gitee.com/openharmony-sig/tpc_c_cplusplus.git --depth=1 + ``` +- 三方库目录结构 + ``` + tpc_c_cplusplus/thirdparty/brotli #三方库brotli的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md + ``` + +- 在lycium目录下编译三方库 + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ``` + cd lycium + ./build.sh brotli + ``` +- 三方库头文件及生成的库 + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + ``` + brotli/arm64-v8a brotli/armeabi-v7a + ``` + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的库拷贝到该目录下,如下图所示 + + ![brotli_install_dir](pic/brotli_install_dir.PNG) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + ``` + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/brotli/${OHOS_ARCH}/lib/libbrotlicommon-static.a) + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/brotli/${OHOS_ARCH}/lib/libbrotlidec-static.a) + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/brotli/${OHOS_ARCH}/lib/libbrotlienc-static.a) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/brotli/${OHOS_ARCH}/include) + ``` + ![brotli_usage](pic/brotli_usage.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/community/brotli/docs/pic/brotli_install_dir.PNG b/community/brotli/docs/pic/brotli_install_dir.PNG new file mode 100644 index 0000000000000000000000000000000000000000..eb67071bd9589ccceca37e5209a8b0bea3e3fbaf Binary files /dev/null and b/community/brotli/docs/pic/brotli_install_dir.PNG differ diff --git a/community/brotli/docs/pic/brotli_usage.PNG b/community/brotli/docs/pic/brotli_usage.PNG new file mode 100644 index 0000000000000000000000000000000000000000..c9044ad9ce2e1bde452736da202b5a6493807999 Binary files /dev/null and b/community/brotli/docs/pic/brotli_usage.PNG differ diff --git a/community/bullet3-3.22/HPKBUILD b/community/bullet3-3.22/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..94a06aad370f009478ef89d1aca5f81040b532f5 --- /dev/null +++ b/community/bullet3-3.22/HPKBUILD @@ -0,0 +1,73 @@ +# 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=bullet3-3.22 +pkgver=3.22 +pkgrel=0 +pkgdesc="It is a real-time collision detection and multi-physics simulation for VR, games, visual effects, robotics, machine learning etc." +url="https://github.com/bulletphysics/bullet3/tree/3.22" +archs=("armeabi-v7a" "arm64-v8a") +license=("Zlib License") +depends=() +makedepends=() +#source="https://github.com/bulletphysics/bullet3/archive/refs/tags/3.22.zip" +source="https://gitee.com/lycium_pkg_mirror/bullet3/repository/archive/refs/tags/$pkgver.zip" +downloadpackage=true +autounpack=true +buildtools=cmake +patchflag=true +builddir=bullet3-refs-tags-$pkgver +packagename=$pkgname.zip + +# 为编译设置环境,如设置环境变量,创建编译目录等 +prepare() { + if $patchflag + then + cd $builddir + patch -p1 < `pwd`/../bullet3-3.22_oh_pkg.patch + # patch只需要打一次,关闭打patch + patchflag=false + cd $OLDPWD + fi + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + PKG_CONFIG_LIBDIR="${pkgconfigpath}" ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" \ + -DCMAKE_C_FLAGS="-Wno-unused-command-line-argument" \ + -DCMAKE_CXX_FLAGS="-Wno-unused-command-line-argument" -B$ARCH-build -S./ > $buildlog 2>&1 + $MAKE VERBOSE=1 -C $ARCH-build >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + $MAKE VERBOSE=1 -C $ARCH-build install >> $buildlog 2>&1 + cd $OLDPWD +} + + +check() { + echo "The test must be on an OpenHarmony device!" +} + + +cleanbuild() { + rm -rf ${PWD}/$builddir +} \ No newline at end of file diff --git a/community/bullet3-3.22/HPKCHECK b/community/bullet3-3.22/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..9ceab10433ff83b2cc58bf2d9f00a047131e402c --- /dev/null +++ b/community/bullet3-3.22/HPKCHECK @@ -0,0 +1,30 @@ +# 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}_${OHOS_SDK_VER}_test.log + + +# 在OH环境执行测试的接口 +openharmonycheck() { + res=0 + cd ${builddir}/${ARCH}-build # 进入到测试目录 + ctest > ${logfile} 2>&1 # 执行测试命令并将测试结果导出到${logfile} + res=$? + cd $OLDPWD + + return $res +} \ No newline at end of file diff --git a/community/bullet3-3.22/OAT.xml b/community/bullet3-3.22/OAT.xml new file mode 100644 index 0000000000000000000000000000000000000000..eeb1f946d683c0b81976cd06522096062a6901b9 --- /dev/null +++ b/community/bullet3-3.22/OAT.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/community/bullet3-3.22/README.OpenSource b/community/bullet3-3.22/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..71d24c96fbe76c368679a036a412eb1963d612cd --- /dev/null +++ b/community/bullet3-3.22/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "bullet3-3.22", + "License": "Zlib License", + "License File": "https://github.com/bulletphysics/bullet3/blob/master/LICENSE.txt", + "Version Number": "3.22", + "Owner": "2942375747@qq.com", + "Upstream URL": "https://github.com/bulletphysics/bullet3", + "Description": "It is a real-time collision detection and multi-physics simulation for VR, games, visual effects, robotics, machine learning etc." + } +] \ No newline at end of file diff --git a/community/bullet3-3.22/README_zh.md b/community/bullet3-3.22/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..7393f0b7647cdd38d576c460c363a6b303c43c24 --- /dev/null +++ b/community/bullet3-3.22/README_zh.md @@ -0,0 +1,9 @@ +# bullet3-3.22三方库说明 +## 功能简介 +bullet3-3.22可以实现实时碰撞检测和多物理场仿真,适用于VR、游戏、视觉效果、机器人、机器学习等。 +## 三方库版本: +- 3.22 +## 使用约束: +- [IDE和SDK版本](../../docs/constraint.md) +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) diff --git a/community/bullet3-3.22/SHA512SUM b/community/bullet3-3.22/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..2a1c91d210451d308f05d5ca7616aa8be3d79314 --- /dev/null +++ b/community/bullet3-3.22/SHA512SUM @@ -0,0 +1 @@ +54e0c406777d4574615af9615227617f613d5a47bc3c6ead78a6eff4d0ea039f38d50a03562508e7b3e7fabe3578362eb3a61dc6226356c6fd04429c76ec7417 bullet3-3.22.zip diff --git a/community/bullet3-3.22/bullet3-3.22_oh_pkg.patch b/community/bullet3-3.22/bullet3-3.22_oh_pkg.patch new file mode 100644 index 0000000000000000000000000000000000000000..bc58cf12bc26d2150eb90ecd468d736762ea9afe --- /dev/null +++ b/community/bullet3-3.22/bullet3-3.22_oh_pkg.patch @@ -0,0 +1,66 @@ +--- bullet3-3.22_old/examples/ThirdPartyLibs/Eigen/src/Core/util/Macros.h 2022-03-26 10:29:36.000000000 +0800 ++++ bullet3-3.22/Macros.h 2024-09-04 11:25:14.315308781 +0800 +@@ -1145,7 +1145,9 @@ + #if EIGEN_COMP_GNUC_STRICT && EIGEN_GNUC_AT_MOST(5, 0) + #define EIGEN_OPTIMIZATION_BARRIER(X) __asm__ ("" : "+r,w" (X)); + #else ++ #if !defined(__OHOS__) + #define EIGEN_OPTIMIZATION_BARRIER(X) __asm__ ("" : "+g,w" (X)); ++ #endif + #endif + #elif EIGEN_ARCH_i386_OR_x86_64 + // General, SSE. +--- bullet3-3.22_old/examples/SharedMemory/PhysicsClientUDP.cpp 2022-03-26 10:29:36.000000000 +0800 ++++ bullet3-3.22/PhysicsClientUDP.cpp 2024-09-04 11:32:00.342763723 +0800 +@@ -164,7 +164,7 @@ + if (gVerboseNetworkMessagesClient) + { + printf( +- "A packet of length %lu containing '%s' was " ++ "A packet of length %zu containing '%s' was " + "received from %s on channel %u.\n", + m_event.packet->dataLength, + (char*)m_event.packet->data, +@@ -220,7 +220,7 @@ + if (gVerboseNetworkMessagesClient) + { + printf( +- "A packet of length %lu containing '%s' was " ++ "A packet of length %zu containing '%s' was " + "received from %s on channel %u.\n", + m_event.packet->dataLength, + (char*)m_event.packet->data, +--- bullet3-3.22_old/examples/ThirdPartyLibs/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h 2022-03-26 10:29:36.000000000 +0800 ++++ bullet3-3.22/GenericPacketMathFunctions.h 2024-09-04 11:45:59.441659426 +0800 +@@ -638,7 +638,7 @@ + + // Rounding trick: + Packet y_round = padd(y, cst_rounding_magic); +- EIGEN_OPTIMIZATION_BARRIER(y_round) ++ //EIGEN_OPTIMIZATION_BARRIER(y_round); + PacketI y_int = preinterpret(y_round); // last 23 digits represent integer (if abs(x)<2^24) + y = psub(y_round, cst_rounding_magic); // nearest integer to x*4/pi + +@@ -660,9 +660,9 @@ + // and 2 ULP up to: + const float huge_th = ComputeSine ? 25966.f : 18838.f; + x = pmadd(y, pset1(-1.5703125), x); // = 0xbfc90000 +- EIGEN_OPTIMIZATION_BARRIER(x) ++ //EIGEN_OPTIMIZATION_BARRIER(x); + x = pmadd(y, pset1(-0.000483989715576171875), x); // = 0xb9fdc000 +- EIGEN_OPTIMIZATION_BARRIER(x) ++ //EIGEN_OPTIMIZATION_BARRIER(x); + x = pmadd(y, pset1(1.62865035235881805419921875e-07), x); // = 0x342ee000 + x = pmadd(y, pset1(5.5644315544167710640977020375430583953857421875e-11), x); // = 0x2e74b9ee + +--- bullet3-3.22_old/examples/OpenGLWindow/X11OpenGLWindow.cpp 2022-03-26 10:29:36.000000000 +0800 ++++ bullet3-3.22/X11OpenGLWindow.cpp 2024-09-04 11:57:34.600751392 +0800 +@@ -566,7 +566,7 @@ + //Access pthreads as a workaround for a bug in Linux/Ubuntu + //See https://bugs.launchpad.net/ubuntu/+source/nvidia-graphics-drivers-319/+bug/1248642 + +-#if !defined(__NetBSD__) && !defined(__ANDROID__) ++#if !defined(__NetBSD__) && !defined(__ANDROID__) && !defined(__OHOS__) + int i = pthread_getconcurrency(); + printf("pthread_getconcurrency()=%d\n", i); + #endif diff --git a/community/bullet3-3.22/docs/hap_integrate.md b/community/bullet3-3.22/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..781f4da5b4858fc5a6cd9535524719e6cceeac87 --- /dev/null +++ b/community/bullet3-3.22/docs/hap_integrate.md @@ -0,0 +1,81 @@ +# bullet3集成到应用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/bullet3-3.22 #三方库bullet3-3.22的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── HPKCHECK #测试脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md #三方库简介 + ``` + +- 在lycium目录下编译三方库 + + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ```shell + cd lycium + ./build.sh bullet3-3.22 + ``` + +- 三方库头文件及生成的库 + + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ```shell + bullet3-3.22/arm64-v8a bullet3-3.22/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +- 编译出可执行的文件进行测试,[准备三方库测试环境](../../../lycium/README.md#3ci环境准备) +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的头文件拷贝到该目录下,将编译生成的三方库以及依赖库全部(动态库名字带版本号和不带版本号的都需要)拷贝到工程的libs目录下,如下图所示: +   + +  ![thirdparty_install_dir](pic/bullet3_install_dir.png) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + + ```shell + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/bullet3/${OHOS_ARCH}/lib/libBullet3Collision.a) + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/bullet3/${OHOS_ARCH}/lib/libBullet3Common.a) + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/bullet3/${OHOS_ARCH}/lib/libBullet3Dynamics.a) + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/bullet3/${OHOS_ARCH}/lib/libBullet3Geometry.a) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/bullet3/${OHOS_ARCH}/include) + ``` + +## 测试三方库 +进入到构建目录运行测试用例(注意arm64-v8a为构建64位的目录,armeabi-v7a为构建32位的目录),执行结果如图所示 + +```shell + cd /data/tpc_c_cplusplus/thirdparty/bullet3-3.22/arm64-v8a-build/ + ./ctest +``` + ![bullet3_test](pic/bullet3_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/community/bullet3-3.22/docs/pic/bullet3_install_dir.png b/community/bullet3-3.22/docs/pic/bullet3_install_dir.png new file mode 100644 index 0000000000000000000000000000000000000000..ce5b1ef256b6a9e8ee6b6bf855977c3fae8e6b1c Binary files /dev/null and b/community/bullet3-3.22/docs/pic/bullet3_install_dir.png differ diff --git a/community/bullet3-3.22/docs/pic/bullet3_test.png b/community/bullet3-3.22/docs/pic/bullet3_test.png new file mode 100644 index 0000000000000000000000000000000000000000..94fa9ed5dbdee850225239180b637e4f76e508a4 Binary files /dev/null and b/community/bullet3-3.22/docs/pic/bullet3_test.png differ diff --git a/community/busybox/BUILD.gn b/community/busybox/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..da974faa5bb177ce1e6539f6c77d3c81a3295ccf --- /dev/null +++ b/community/busybox/BUILD.gn @@ -0,0 +1,76 @@ + +# 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. + +import("//build/ohos.gni") +import("//build/config/python.gni") +import("//build/templates/metadata/module_info.gni") + +template("build_busybox") { + _main_target_name = target_name + _target_label = + get_label_info(":${_main_target_name}", "label_with_toolchain") + _subsystem_name = invoker.subsystem_name + _part_name = invoker.part_name + + action(target_name) { + forward_variables_from(invoker, + [ + "sources", + "outputs", + "args", + "script", + ]) + + _install_module_info = { + module_def = _target_label + module_info_file = + rebase_path(get_label_info(_target_label, "target_out_dir"), + root_build_dir) + + "/${_main_target_name}_module_info.json" + subsystem_name = _subsystem_name + part_name = _part_name + toolchain = current_toolchain + toolchain_out_dir = rebase_path(root_out_dir, root_build_dir) + } + metadata = { + install_modules = [ _install_module_info ] + } + } + generate_module_info("${_main_target_name}_info") { + module_name = _main_target_name + module_type = "bin" + module_source_dir = "${target_out_dir}" + install_enable = true + module_install_images = [ "system" ] + } +} + +build_busybox("busybox") { + + script = "build_busybox.sh" + sources = [ "//third_party/busybox" ] + outputs = [ "${target_out_dir}/busybox" ] + args = [ + rebase_path(target_out_dir, root_build_dir), + rebase_path("//"), + current_cpu + ] + + subsystem_name = "thirdparty" + part_name = "busybox" +} + +group("busybox_cmd") { + deps = [":busybox"] +} diff --git a/community/busybox/README.OpenSource b/community/busybox/README.OpenSource new file mode 100755 index 0000000000000000000000000000000000000000..1e94420ceec8fd49e8ff4d0f71f0100a5f36feff --- /dev/null +++ b/community/busybox/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "busybox", + "License": "GPL 2.0", + "License File": "LICENSE", + "Version Number": "1_36_0", + "Owner": "zhongluping1@huawei.com", + "Upstream URL": "https://github.com/mirror/busybox", + "Description": "BusyBox combines tiny versions of many common UNIX utilities into a single small executable" + } +] diff --git a/community/busybox/README_zh.md b/community/busybox/README_zh.md new file mode 100755 index 0000000000000000000000000000000000000000..63ebec1095131d5033e73cd38e609e63c311365d --- /dev/null +++ b/community/busybox/README_zh.md @@ -0,0 +1,15 @@ +# Busybox 三方库说明 + +## 功能简介 + +BusyBox将许多常见UNIX实用程序的微小版本组合成一个小型可执行文件. + +## 使用约束 + ++ Rom版本:OpenHarmony3.2 beta3 ++ 三方库版本:1_36_0 ++ 当前适配的功能:支持常见的unix指令集。 + +## 集成方式 + ++ [系统Rom包集成](docs/rom_integrate.md) diff --git a/community/busybox/adapted/busybox.config b/community/busybox/adapted/busybox.config new file mode 100644 index 0000000000000000000000000000000000000000..7fd277ec8c65b73bf96c786e360fc95a9629d329 --- /dev/null +++ b/community/busybox/adapted/busybox.config @@ -0,0 +1,1231 @@ +# +# Automatically generated make config: don't edit +# Busybox version: 1.36.0 +# Tue Apr 11 03:58:21 2023 +# +CONFIG_HAVE_DOT_CONFIG=y + +# +# Settings +# +CONFIG_DESKTOP=y +# CONFIG_EXTRA_COMPAT is not set +# CONFIG_FEDORA_COMPAT is not set +CONFIG_INCLUDE_SUSv2=y +CONFIG_LONG_OPTS=y +CONFIG_SHOW_USAGE=y +CONFIG_FEATURE_VERBOSE_USAGE=y +CONFIG_FEATURE_COMPRESS_USAGE=y +CONFIG_LFS=y +# CONFIG_PAM is not set +CONFIG_FEATURE_DEVPTS=y +CONFIG_FEATURE_UTMP=y +CONFIG_FEATURE_WTMP=y +CONFIG_FEATURE_PIDFILE=y +CONFIG_PID_FILE_PATH="/var/run" +CONFIG_BUSYBOX=y +CONFIG_FEATURE_SHOW_SCRIPT=y +CONFIG_FEATURE_INSTALLER=y +# CONFIG_INSTALL_NO_USR is not set +CONFIG_FEATURE_SUID=y +CONFIG_FEATURE_SUID_CONFIG=y +CONFIG_FEATURE_SUID_CONFIG_QUIET=y +# CONFIG_FEATURE_PREFER_APPLETS is not set +CONFIG_BUSYBOX_EXEC_PATH="/proc/self/exe" +# CONFIG_SELINUX is not set +# CONFIG_FEATURE_CLEAN_UP is not set +CONFIG_FEATURE_SYSLOG_INFO=y +CONFIG_FEATURE_SYSLOG=y + +# +# Build Options +# +CONFIG_STATIC=y +# CONFIG_PIE is not set +# CONFIG_NOMMU is not set +# CONFIG_BUILD_LIBBUSYBOX is not set +# CONFIG_FEATURE_LIBBUSYBOX_STATIC is not set +# CONFIG_FEATURE_INDIVIDUAL is not set +# CONFIG_FEATURE_SHARED_BUSYBOX is not set +CONFIG_CROSS_COMPILER_PREFIX="" +CONFIG_SYSROOT="" +CONFIG_EXTRA_CFLAGS="" +CONFIG_EXTRA_LDFLAGS="" +CONFIG_EXTRA_LDLIBS="" +# CONFIG_USE_PORTABLE_CODE is not set +CONFIG_STACK_OPTIMIZATION_386=y +CONFIG_STATIC_LIBGCC=y + +# +# Installation Options ("make install" behavior) +# +CONFIG_INSTALL_APPLET_SYMLINKS=y +# CONFIG_INSTALL_APPLET_HARDLINKS is not set +# CONFIG_INSTALL_APPLET_SCRIPT_WRAPPERS is not set +# CONFIG_INSTALL_APPLET_DONT is not set +# CONFIG_INSTALL_SH_APPLET_SYMLINK is not set +# CONFIG_INSTALL_SH_APPLET_HARDLINK is not set +# CONFIG_INSTALL_SH_APPLET_SCRIPT_WRAPPER is not set +CONFIG_PREFIX="./_install" + +# +# Debugging Options +# +# CONFIG_DEBUG is not set +# CONFIG_DEBUG_PESSIMIZE is not set +# CONFIG_DEBUG_SANITIZE is not set +# CONFIG_UNIT_TEST is not set +# CONFIG_WERROR is not set +# CONFIG_WARN_SIMPLE_MSG is not set +CONFIG_NO_DEBUG_LIB=y +# CONFIG_DMALLOC is not set +# CONFIG_EFENCE is not set + +# +# Library Tuning +# +# CONFIG_FEATURE_USE_BSS_TAIL is not set +CONFIG_FLOAT_DURATION=y +CONFIG_FEATURE_RTMINMAX=y +CONFIG_FEATURE_RTMINMAX_USE_LIBC_DEFINITIONS=y +CONFIG_FEATURE_BUFFERS_USE_MALLOC=y +# CONFIG_FEATURE_BUFFERS_GO_ON_STACK is not set +# CONFIG_FEATURE_BUFFERS_GO_IN_BSS is not set +CONFIG_PASSWORD_MINLEN=6 +CONFIG_MD5_SMALL=1 +CONFIG_SHA1_SMALL=3 +CONFIG_SHA1_HWACCEL=y +CONFIG_SHA256_HWACCEL=y +CONFIG_SHA3_SMALL=1 +CONFIG_FEATURE_NON_POSIX_CP=y +# CONFIG_FEATURE_VERBOSE_CP_MESSAGE is not set +CONFIG_FEATURE_USE_SENDFILE=y +CONFIG_FEATURE_COPYBUF_KB=4 +CONFIG_MONOTONIC_SYSCALL=y +CONFIG_IOCTL_HEX2STR_ERROR=y +CONFIG_FEATURE_EDITING=y +CONFIG_FEATURE_EDITING_MAX_LEN=1024 +# CONFIG_FEATURE_EDITING_VI is not set +CONFIG_FEATURE_EDITING_HISTORY=255 +CONFIG_FEATURE_EDITING_SAVEHISTORY=y +# CONFIG_FEATURE_EDITING_SAVE_ON_EXIT is not set +CONFIG_FEATURE_REVERSE_SEARCH=y +CONFIG_FEATURE_TAB_COMPLETION=y +CONFIG_FEATURE_USERNAME_COMPLETION=y +CONFIG_FEATURE_EDITING_FANCY_PROMPT=y +CONFIG_FEATURE_EDITING_WINCH=y +# CONFIG_FEATURE_EDITING_ASK_TERMINAL is not set +# CONFIG_LOCALE_SUPPORT is not set +CONFIG_UNICODE_SUPPORT=y +# CONFIG_UNICODE_USING_LOCALE is not set +# CONFIG_FEATURE_CHECK_UNICODE_IN_ENV is not set +CONFIG_SUBST_WCHAR=63 +CONFIG_LAST_SUPPORTED_WCHAR=767 +# CONFIG_UNICODE_COMBINING_WCHARS is not set +# CONFIG_UNICODE_WIDE_WCHARS is not set +# CONFIG_UNICODE_BIDI_SUPPORT is not set +# CONFIG_UNICODE_NEUTRAL_TABLE is not set +# CONFIG_UNICODE_PRESERVE_BROKEN is not set +# CONFIG_LOOP_CONFIGURE is not set +# CONFIG_NO_LOOP_CONFIGURE is not set +CONFIG_TRY_LOOP_CONFIGURE=y + +# +# Applets +# + +# +# Archival Utilities +# +CONFIG_FEATURE_SEAMLESS_XZ=y +CONFIG_FEATURE_SEAMLESS_LZMA=y +CONFIG_FEATURE_SEAMLESS_BZ2=y +CONFIG_FEATURE_SEAMLESS_GZ=y +# CONFIG_FEATURE_SEAMLESS_Z is not set +# CONFIG_AR is not set +# CONFIG_FEATURE_AR_LONG_FILENAMES is not set +# CONFIG_FEATURE_AR_CREATE is not set +# CONFIG_UNCOMPRESS is not set +CONFIG_GUNZIP=y +CONFIG_ZCAT=y +CONFIG_FEATURE_GUNZIP_LONG_OPTIONS=y +CONFIG_BUNZIP2=y +CONFIG_BZCAT=y +CONFIG_UNLZMA=y +CONFIG_LZCAT=y +CONFIG_LZMA=y +CONFIG_UNXZ=y +CONFIG_XZCAT=y +CONFIG_XZ=y +CONFIG_BZIP2=y +CONFIG_BZIP2_SMALL=8 +CONFIG_FEATURE_BZIP2_DECOMPRESS=y +# CONFIG_CPIO is not set +# CONFIG_FEATURE_CPIO_O is not set +# CONFIG_FEATURE_CPIO_P is not set +# CONFIG_FEATURE_CPIO_IGNORE_DEVNO is not set +# CONFIG_FEATURE_CPIO_RENUMBER_INODES is not set +CONFIG_DPKG=y +CONFIG_DPKG_DEB=y +CONFIG_GZIP=y +CONFIG_FEATURE_GZIP_LONG_OPTIONS=y +CONFIG_GZIP_FAST=0 +# CONFIG_FEATURE_GZIP_LEVELS is not set +CONFIG_FEATURE_GZIP_DECOMPRESS=y +CONFIG_LZOP=y +# CONFIG_UNLZOP is not set +# CONFIG_LZOPCAT is not set +# CONFIG_LZOP_COMPR_HIGH is not set +CONFIG_RPM=y +CONFIG_RPM2CPIO=y +# CONFIG_TAR is not set +# CONFIG_FEATURE_TAR_LONG_OPTIONS is not set +# CONFIG_FEATURE_TAR_CREATE is not set +# CONFIG_FEATURE_TAR_AUTODETECT is not set +# CONFIG_FEATURE_TAR_FROM is not set +CONFIG_FEATURE_TAR_OLDGNU_COMPATIBILITY=y +CONFIG_FEATURE_TAR_OLDSUN_COMPATIBILITY=y +CONFIG_FEATURE_TAR_GNU_EXTENSIONS=y +# CONFIG_FEATURE_TAR_TO_COMMAND is not set +# CONFIG_FEATURE_TAR_UNAME_GNAME is not set +# CONFIG_FEATURE_TAR_NOPRESERVE_TIME is not set +# CONFIG_FEATURE_TAR_SELINUX is not set +CONFIG_UNZIP=y +CONFIG_FEATURE_UNZIP_CDF=y +CONFIG_FEATURE_UNZIP_BZIP2=y +CONFIG_FEATURE_UNZIP_LZMA=y +CONFIG_FEATURE_UNZIP_XZ=y +# CONFIG_FEATURE_LZMA_FAST is not set + +# +# Coreutils +# +CONFIG_FEATURE_VERBOSE=y + +# +# Common options for date and touch +# +CONFIG_FEATURE_TIMEZONE=y + +# +# Common options for cp and mv +# +CONFIG_FEATURE_PRESERVE_HARDLINKS=y + +# +# Common options for df, du, ls +# +CONFIG_FEATURE_HUMAN_READABLE=y +CONFIG_BASENAME=y +CONFIG_CAT=y +CONFIG_FEATURE_CATN=y +CONFIG_FEATURE_CATV=y +CONFIG_CHGRP=y +CONFIG_CHMOD=y +CONFIG_CHOWN=y +CONFIG_FEATURE_CHOWN_LONG_OPTIONS=y +CONFIG_CHROOT=y +CONFIG_CKSUM=y +CONFIG_CRC32=y +CONFIG_COMM=y +CONFIG_CP=y +CONFIG_FEATURE_CP_LONG_OPTIONS=y +CONFIG_FEATURE_CP_REFLINK=y +CONFIG_CUT=y +CONFIG_FEATURE_CUT_REGEX=y +# CONFIG_DATE is not set +# CONFIG_FEATURE_DATE_ISOFMT is not set +# CONFIG_FEATURE_DATE_NANO is not set +# CONFIG_FEATURE_DATE_COMPAT is not set +CONFIG_DD=y +CONFIG_FEATURE_DD_SIGNAL_HANDLING=y +CONFIG_FEATURE_DD_THIRD_STATUS_LINE=y +CONFIG_FEATURE_DD_IBS_OBS=y +CONFIG_FEATURE_DD_STATUS=y +CONFIG_DF=y +CONFIG_FEATURE_DF_FANCY=y +CONFIG_FEATURE_SKIP_ROOTFS=y +CONFIG_DIRNAME=y +CONFIG_DOS2UNIX=y +CONFIG_UNIX2DOS=y +CONFIG_DU=y +CONFIG_FEATURE_DU_DEFAULT_BLOCKSIZE_1K=y +CONFIG_ECHO=y +CONFIG_FEATURE_FANCY_ECHO=y +CONFIG_ENV=y +CONFIG_EXPAND=y +CONFIG_UNEXPAND=y +CONFIG_EXPR=y +CONFIG_EXPR_MATH_SUPPORT_64=y +# CONFIG_FACTOR is not set +CONFIG_FALSE=y +CONFIG_FOLD=y +CONFIG_HEAD=y +CONFIG_FEATURE_FANCY_HEAD=y +CONFIG_HOSTID=y +CONFIG_ID=y +CONFIG_GROUPS=y +CONFIG_INSTALL=y +CONFIG_FEATURE_INSTALL_LONG_OPTIONS=y +CONFIG_LINK=y +CONFIG_LN=y +CONFIG_LOGNAME=y +# CONFIG_LS is not set +# CONFIG_FEATURE_LS_FILETYPES is not set +# CONFIG_FEATURE_LS_FOLLOWLINKS is not set +# CONFIG_FEATURE_LS_RECURSIVE is not set +# CONFIG_FEATURE_LS_WIDTH is not set +# CONFIG_FEATURE_LS_SORTFILES is not set +# CONFIG_FEATURE_LS_TIMESTAMPS is not set +# CONFIG_FEATURE_LS_USERNAME is not set +# CONFIG_FEATURE_LS_COLOR is not set +# CONFIG_FEATURE_LS_COLOR_IS_DEFAULT is not set +CONFIG_MD5SUM=y +CONFIG_SHA1SUM=y +CONFIG_SHA256SUM=y +CONFIG_SHA512SUM=y +CONFIG_SHA3SUM=y + +# +# Common options for md5sum, sha1sum, sha256sum, sha512sum, sha3sum +# +CONFIG_FEATURE_MD5_SHA1_SUM_CHECK=y +CONFIG_MKDIR=y +CONFIG_MKFIFO=y +CONFIG_MKNOD=y +CONFIG_MKTEMP=y +CONFIG_MV=y +CONFIG_NICE=y +CONFIG_NL=y +CONFIG_NOHUP=y +CONFIG_NPROC=y +CONFIG_OD=y +CONFIG_PASTE=y +CONFIG_PRINTENV=y +CONFIG_PRINTF=y +CONFIG_PWD=y +CONFIG_READLINK=y +CONFIG_FEATURE_READLINK_FOLLOW=y +CONFIG_REALPATH=y +CONFIG_RM=y +CONFIG_RMDIR=y +CONFIG_SEQ=y +CONFIG_SHRED=y +CONFIG_SHUF=y +CONFIG_SLEEP=y +CONFIG_FEATURE_FANCY_SLEEP=y +CONFIG_SORT=y +CONFIG_FEATURE_SORT_BIG=y +# CONFIG_FEATURE_SORT_OPTIMIZE_MEMORY is not set +CONFIG_SPLIT=y +CONFIG_FEATURE_SPLIT_FANCY=y +CONFIG_STAT=y +CONFIG_FEATURE_STAT_FORMAT=y +CONFIG_FEATURE_STAT_FILESYSTEM=y +CONFIG_STTY=y +CONFIG_SUM=y +CONFIG_SYNC=y +CONFIG_FEATURE_SYNC_FANCY=y +CONFIG_FSYNC=y +CONFIG_TAC=y +CONFIG_TAIL=y +CONFIG_FEATURE_FANCY_TAIL=y +CONFIG_TEE=y +CONFIG_FEATURE_TEE_USE_BLOCK_IO=y +CONFIG_TEST=y +CONFIG_TEST1=y +CONFIG_TEST2=y +CONFIG_FEATURE_TEST_64=y +CONFIG_TIMEOUT=y +CONFIG_TOUCH=y +CONFIG_FEATURE_TOUCH_SUSV3=y +CONFIG_TR=y +CONFIG_FEATURE_TR_CLASSES=y +CONFIG_FEATURE_TR_EQUIV=y +CONFIG_TRUE=y +CONFIG_TRUNCATE=y +CONFIG_TSORT=y +CONFIG_TTY=y +CONFIG_UNAME=y +CONFIG_UNAME_OSNAME="GNU/Linux" +CONFIG_BB_ARCH=y +CONFIG_UNIQ=y +CONFIG_UNLINK=y +CONFIG_USLEEP=y +CONFIG_UUDECODE=y +CONFIG_BASE32=y +CONFIG_BASE64=y +CONFIG_UUENCODE=y +CONFIG_WC=y +CONFIG_FEATURE_WC_LARGE=y +CONFIG_WHO=y +CONFIG_W=y +CONFIG_USERS=y +CONFIG_WHOAMI=y +CONFIG_YES=y + +# +# Console Utilities +# +CONFIG_CHVT=y +CONFIG_CLEAR=y +CONFIG_DEALLOCVT=y +CONFIG_DUMPKMAP=y +CONFIG_FGCONSOLE=y +CONFIG_KBD_MODE=y +CONFIG_LOADFONT=y +CONFIG_SETFONT=y +CONFIG_FEATURE_SETFONT_TEXTUAL_MAP=y +CONFIG_DEFAULT_SETFONT_DIR="" + +# +# Common options for loadfont and setfont +# +CONFIG_FEATURE_LOADFONT_PSF2=y +CONFIG_FEATURE_LOADFONT_RAW=y +CONFIG_LOADKMAP=y +CONFIG_OPENVT=y +CONFIG_RESET=y +CONFIG_RESIZE=y +CONFIG_FEATURE_RESIZE_PRINT=y +CONFIG_SETCONSOLE=y +CONFIG_FEATURE_SETCONSOLE_LONG_OPTIONS=y +CONFIG_SETKEYCODES=y +CONFIG_SETLOGCONS=y +CONFIG_SHOWKEY=y + +# +# Debian Utilities +# +CONFIG_PIPE_PROGRESS=y +CONFIG_RUN_PARTS=y +CONFIG_FEATURE_RUN_PARTS_LONG_OPTIONS=y +CONFIG_FEATURE_RUN_PARTS_FANCY=y +CONFIG_START_STOP_DAEMON=y +CONFIG_FEATURE_START_STOP_DAEMON_LONG_OPTIONS=y +CONFIG_FEATURE_START_STOP_DAEMON_FANCY=y +CONFIG_WHICH=y + +# +# klibc-utils +# +# CONFIG_MINIPS is not set +# CONFIG_NUKE is not set +CONFIG_RESUME=y +CONFIG_RUN_INIT=y + +# +# Editors +# +CONFIG_AWK=y +CONFIG_FEATURE_AWK_LIBM=y +CONFIG_FEATURE_AWK_GNU_EXTENSIONS=y +CONFIG_CMP=y +CONFIG_DIFF=y +CONFIG_FEATURE_DIFF_LONG_OPTIONS=y +CONFIG_FEATURE_DIFF_DIR=y +CONFIG_ED=y +CONFIG_PATCH=y +# CONFIG_SED is not set +CONFIG_VI=y +CONFIG_FEATURE_VI_MAX_LEN=4096 +# CONFIG_FEATURE_VI_8BIT is not set +CONFIG_FEATURE_VI_COLON=y +CONFIG_FEATURE_VI_COLON_EXPAND=y +CONFIG_FEATURE_VI_YANKMARK=y +CONFIG_FEATURE_VI_SEARCH=y +# CONFIG_FEATURE_VI_REGEX_SEARCH is not set +CONFIG_FEATURE_VI_USE_SIGNALS=y +CONFIG_FEATURE_VI_DOT_CMD=y +CONFIG_FEATURE_VI_READONLY=y +CONFIG_FEATURE_VI_SETOPTS=y +CONFIG_FEATURE_VI_SET=y +CONFIG_FEATURE_VI_WIN_RESIZE=y +CONFIG_FEATURE_VI_ASK_TERMINAL=y +CONFIG_FEATURE_VI_UNDO=y +CONFIG_FEATURE_VI_UNDO_QUEUE=y +CONFIG_FEATURE_VI_UNDO_QUEUE_MAX=256 +CONFIG_FEATURE_VI_VERBOSE_STATUS=y +CONFIG_FEATURE_ALLOW_EXEC=y + +# +# Finding Utilities +# +CONFIG_FIND=y +CONFIG_FEATURE_FIND_PRINT0=y +CONFIG_FEATURE_FIND_MTIME=y +CONFIG_FEATURE_FIND_ATIME=y +CONFIG_FEATURE_FIND_CTIME=y +CONFIG_FEATURE_FIND_MMIN=y +CONFIG_FEATURE_FIND_AMIN=y +CONFIG_FEATURE_FIND_CMIN=y +CONFIG_FEATURE_FIND_PERM=y +CONFIG_FEATURE_FIND_TYPE=y +CONFIG_FEATURE_FIND_EXECUTABLE=y +CONFIG_FEATURE_FIND_XDEV=y +CONFIG_FEATURE_FIND_MAXDEPTH=y +CONFIG_FEATURE_FIND_NEWER=y +CONFIG_FEATURE_FIND_INUM=y +CONFIG_FEATURE_FIND_SAMEFILE=y +CONFIG_FEATURE_FIND_EXEC=y +CONFIG_FEATURE_FIND_EXEC_PLUS=y +CONFIG_FEATURE_FIND_USER=y +CONFIG_FEATURE_FIND_GROUP=y +CONFIG_FEATURE_FIND_NOT=y +CONFIG_FEATURE_FIND_DEPTH=y +CONFIG_FEATURE_FIND_PAREN=y +CONFIG_FEATURE_FIND_SIZE=y +CONFIG_FEATURE_FIND_PRUNE=y +CONFIG_FEATURE_FIND_QUIT=y +CONFIG_FEATURE_FIND_DELETE=y +CONFIG_FEATURE_FIND_EMPTY=y +CONFIG_FEATURE_FIND_PATH=y +CONFIG_FEATURE_FIND_REGEX=y +# CONFIG_FEATURE_FIND_CONTEXT is not set +CONFIG_FEATURE_FIND_LINKS=y +CONFIG_GREP=y +CONFIG_EGREP=y +CONFIG_FGREP=y +CONFIG_FEATURE_GREP_CONTEXT=y +CONFIG_XARGS=y +CONFIG_FEATURE_XARGS_SUPPORT_CONFIRMATION=y +CONFIG_FEATURE_XARGS_SUPPORT_QUOTES=y +CONFIG_FEATURE_XARGS_SUPPORT_TERMOPT=y +CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM=y +CONFIG_FEATURE_XARGS_SUPPORT_REPL_STR=y +CONFIG_FEATURE_XARGS_SUPPORT_PARALLEL=y +CONFIG_FEATURE_XARGS_SUPPORT_ARGS_FILE=y + +# +# Init Utilities +# +CONFIG_BOOTCHARTD=y +CONFIG_FEATURE_BOOTCHARTD_BLOATED_HEADER=y +CONFIG_FEATURE_BOOTCHARTD_CONFIG_FILE=y +CONFIG_HALT=y +CONFIG_POWEROFF=y +CONFIG_REBOOT=y +CONFIG_FEATURE_WAIT_FOR_INIT=y +# CONFIG_FEATURE_CALL_TELINIT is not set +CONFIG_TELINIT_PATH="" +CONFIG_INIT=y +CONFIG_LINUXRC=y +CONFIG_FEATURE_USE_INITTAB=y +# CONFIG_FEATURE_KILL_REMOVED is not set +CONFIG_FEATURE_KILL_DELAY=0 +CONFIG_FEATURE_INIT_SCTTY=y +CONFIG_FEATURE_INIT_SYSLOG=y +CONFIG_FEATURE_INIT_QUIET=y +# CONFIG_FEATURE_INIT_COREDUMPS is not set +CONFIG_INIT_TERMINAL_TYPE="linux" +CONFIG_FEATURE_INIT_MODIFY_CMDLINE=y + +# +# Login/Password Management Utilities +# +CONFIG_FEATURE_SHADOWPASSWDS=y +CONFIG_USE_BB_PWD_GRP=y +CONFIG_USE_BB_SHADOW=y +CONFIG_USE_BB_CRYPT=y +CONFIG_USE_BB_CRYPT_SHA=y +CONFIG_ADD_SHELL=y +CONFIG_REMOVE_SHELL=y +CONFIG_ADDGROUP=y +CONFIG_FEATURE_ADDUSER_TO_GROUP=y +CONFIG_ADDUSER=y +# CONFIG_FEATURE_CHECK_NAMES is not set +CONFIG_LAST_ID=60000 +CONFIG_FIRST_SYSTEM_ID=100 +CONFIG_LAST_SYSTEM_ID=999 +CONFIG_CHPASSWD=y +CONFIG_FEATURE_DEFAULT_PASSWD_ALGO="des" +CONFIG_CRYPTPW=y +CONFIG_MKPASSWD=y +CONFIG_DELUSER=y +CONFIG_DELGROUP=y +CONFIG_FEATURE_DEL_USER_FROM_GROUP=y +CONFIG_GETTY=y +CONFIG_LOGIN=y +# CONFIG_LOGIN_SESSION_AS_CHILD is not set +CONFIG_LOGIN_SCRIPTS=y +CONFIG_FEATURE_NOLOGIN=y +CONFIG_FEATURE_SECURETTY=y +CONFIG_PASSWD=y +CONFIG_FEATURE_PASSWD_WEAK_CHECK=y +CONFIG_SU=y +CONFIG_FEATURE_SU_SYSLOG=y +CONFIG_FEATURE_SU_CHECKS_SHELLS=y +# CONFIG_FEATURE_SU_BLANK_PW_NEEDS_SECURE_TTY is not set +CONFIG_SULOGIN=y +CONFIG_VLOCK=y + +# +# Linux Ext2 FS Progs +# +CONFIG_CHATTR=y +CONFIG_FSCK=y +CONFIG_LSATTR=y +# CONFIG_TUNE2FS is not set + +# +# Linux Module Utilities +# +CONFIG_MODPROBE_SMALL=y +CONFIG_DEPMOD=y +CONFIG_INSMOD=y +CONFIG_LSMOD=y +# CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT is not set +CONFIG_MODINFO=y +CONFIG_MODPROBE=y +# CONFIG_FEATURE_MODPROBE_BLACKLIST is not set +CONFIG_RMMOD=y + +# +# Options common to multiple modutils +# +CONFIG_FEATURE_CMDLINE_MODULE_OPTIONS=y +CONFIG_FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED=y +# CONFIG_FEATURE_2_4_MODULES is not set +# CONFIG_FEATURE_INSMOD_VERSION_CHECKING is not set +# CONFIG_FEATURE_INSMOD_KSYMOOPS_SYMBOLS is not set +# CONFIG_FEATURE_INSMOD_LOADINKMEM is not set +# CONFIG_FEATURE_INSMOD_LOAD_MAP is not set +# CONFIG_FEATURE_INSMOD_LOAD_MAP_FULL is not set +# CONFIG_FEATURE_CHECK_TAINTED_MODULE is not set +# CONFIG_FEATURE_INSMOD_TRY_MMAP is not set +# CONFIG_FEATURE_MODUTILS_ALIAS is not set +# CONFIG_FEATURE_MODUTILS_SYMBOLS is not set +CONFIG_DEFAULT_MODULES_DIR="/lib/modules" +CONFIG_DEFAULT_DEPMOD_FILE="modules.dep" + +# +# Linux System Utilities +# +CONFIG_ACPID=y +CONFIG_FEATURE_ACPID_COMPAT=y +CONFIG_BLKDISCARD=y +CONFIG_BLKID=y +CONFIG_FEATURE_BLKID_TYPE=y +CONFIG_BLOCKDEV=y +CONFIG_CAL=y +CONFIG_CHRT=y +CONFIG_DMESG=y +CONFIG_FEATURE_DMESG_PRETTY=y +CONFIG_EJECT=y +CONFIG_FEATURE_EJECT_SCSI=y +CONFIG_FALLOCATE=y +CONFIG_FATATTR=y +CONFIG_FBSET=y +CONFIG_FEATURE_FBSET_FANCY=y +CONFIG_FEATURE_FBSET_READMODE=y +CONFIG_FDFORMAT=y +CONFIG_FDISK=y +# CONFIG_FDISK_SUPPORT_LARGE_DISKS is not set +CONFIG_FEATURE_FDISK_WRITABLE=y +# CONFIG_FEATURE_AIX_LABEL is not set +# CONFIG_FEATURE_SGI_LABEL is not set +# CONFIG_FEATURE_SUN_LABEL is not set +# CONFIG_FEATURE_OSF_LABEL is not set +# CONFIG_FEATURE_GPT_LABEL is not set +CONFIG_FEATURE_FDISK_ADVANCED=y +CONFIG_FINDFS=y +CONFIG_FLOCK=y +CONFIG_FDFLUSH=y +CONFIG_FREERAMDISK=y +CONFIG_FSCK_MINIX=y +CONFIG_FSFREEZE=y +CONFIG_FSTRIM=y +CONFIG_GETOPT=y +CONFIG_FEATURE_GETOPT_LONG=y +CONFIG_HEXDUMP=y +CONFIG_HD=y +CONFIG_XXD=y +CONFIG_HWCLOCK=y +# CONFIG_FEATURE_HWCLOCK_ADJTIME_FHS is not set +CONFIG_IONICE=y +CONFIG_IPCRM=y +CONFIG_IPCS=y +CONFIG_LAST=y +CONFIG_FEATURE_LAST_FANCY=y +CONFIG_LOSETUP=y +CONFIG_LSPCI=y +CONFIG_LSUSB=y +CONFIG_MDEV=y +CONFIG_FEATURE_MDEV_CONF=y +CONFIG_FEATURE_MDEV_RENAME=y +CONFIG_FEATURE_MDEV_RENAME_REGEXP=y +CONFIG_FEATURE_MDEV_EXEC=y +CONFIG_FEATURE_MDEV_LOAD_FIRMWARE=y +CONFIG_FEATURE_MDEV_DAEMON=y +CONFIG_MESG=y +CONFIG_FEATURE_MESG_ENABLE_ONLY_GROUP=y +CONFIG_MKE2FS=y +CONFIG_MKFS_EXT2=y +CONFIG_MKFS_MINIX=y +CONFIG_FEATURE_MINIX2=y +# CONFIG_MKFS_REISER is not set +CONFIG_MKDOSFS=y +CONFIG_MKFS_VFAT=y +CONFIG_MKSWAP=y +CONFIG_FEATURE_MKSWAP_UUID=y +CONFIG_MORE=y +# CONFIG_MOUNT is not set +# CONFIG_FEATURE_MOUNT_FAKE is not set +# CONFIG_FEATURE_MOUNT_VERBOSE is not set +# CONFIG_FEATURE_MOUNT_HELPERS is not set +# CONFIG_FEATURE_MOUNT_LABEL is not set +# CONFIG_FEATURE_MOUNT_NFS is not set +# CONFIG_FEATURE_MOUNT_CIFS is not set +# CONFIG_FEATURE_MOUNT_FLAGS is not set +# CONFIG_FEATURE_MOUNT_FSTAB is not set +# CONFIG_FEATURE_MOUNT_OTHERTAB is not set +CONFIG_MOUNTPOINT=y +CONFIG_NOLOGIN=y +# CONFIG_NOLOGIN_DEPENDENCIES is not set +CONFIG_NSENTER=y +CONFIG_PIVOT_ROOT=y +CONFIG_RDATE=y +CONFIG_RDEV=y +CONFIG_READPROFILE=y +CONFIG_RENICE=y +CONFIG_REV=y +CONFIG_RTCWAKE=y +CONFIG_SCRIPT=y +CONFIG_SCRIPTREPLAY=y +CONFIG_SETARCH=y +CONFIG_LINUX32=y +CONFIG_LINUX64=y +CONFIG_SETPRIV=y +CONFIG_FEATURE_SETPRIV_DUMP=y +CONFIG_FEATURE_SETPRIV_CAPABILITIES=y +CONFIG_FEATURE_SETPRIV_CAPABILITY_NAMES=y +CONFIG_SETSID=y +CONFIG_SWAPON=y +CONFIG_FEATURE_SWAPON_DISCARD=y +CONFIG_FEATURE_SWAPON_PRI=y +CONFIG_SWAPOFF=y +CONFIG_FEATURE_SWAPONOFF_LABEL=y +CONFIG_SWITCH_ROOT=y +# CONFIG_TASKSET is not set +# CONFIG_FEATURE_TASKSET_FANCY is not set +# CONFIG_FEATURE_TASKSET_CPULIST is not set +CONFIG_UEVENT=y +CONFIG_UMOUNT=y +CONFIG_FEATURE_UMOUNT_ALL=y +CONFIG_UNSHARE=y +CONFIG_WALL=y + +# +# Common options for mount/umount +# +CONFIG_FEATURE_MOUNT_LOOP=y +CONFIG_FEATURE_MOUNT_LOOP_CREATE=y +# CONFIG_FEATURE_MTAB_SUPPORT is not set +CONFIG_VOLUMEID=y + +# +# Filesystem/Volume identification +# +CONFIG_FEATURE_VOLUMEID_BCACHE=y +CONFIG_FEATURE_VOLUMEID_BTRFS=y +CONFIG_FEATURE_VOLUMEID_CRAMFS=y +CONFIG_FEATURE_VOLUMEID_EROFS=y +CONFIG_FEATURE_VOLUMEID_EXFAT=y +CONFIG_FEATURE_VOLUMEID_EXT=y +CONFIG_FEATURE_VOLUMEID_F2FS=y +CONFIG_FEATURE_VOLUMEID_FAT=y +CONFIG_FEATURE_VOLUMEID_HFS=y +CONFIG_FEATURE_VOLUMEID_ISO9660=y +CONFIG_FEATURE_VOLUMEID_JFS=y +CONFIG_FEATURE_VOLUMEID_LFS=y +CONFIG_FEATURE_VOLUMEID_LINUXRAID=y +CONFIG_FEATURE_VOLUMEID_LINUXSWAP=y +CONFIG_FEATURE_VOLUMEID_LUKS=y +CONFIG_FEATURE_VOLUMEID_MINIX=y +CONFIG_FEATURE_VOLUMEID_NILFS=y +CONFIG_FEATURE_VOLUMEID_NTFS=y +CONFIG_FEATURE_VOLUMEID_OCFS2=y +CONFIG_FEATURE_VOLUMEID_REISERFS=y +CONFIG_FEATURE_VOLUMEID_ROMFS=y +CONFIG_FEATURE_VOLUMEID_SQUASHFS=y +CONFIG_FEATURE_VOLUMEID_SYSV=y +CONFIG_FEATURE_VOLUMEID_UBIFS=y +CONFIG_FEATURE_VOLUMEID_UDF=y +CONFIG_FEATURE_VOLUMEID_XFS=y + +# +# Miscellaneous Utilities +# +CONFIG_ADJTIMEX=y +CONFIG_ASCII=y +# CONFIG_BBCONFIG is not set +# CONFIG_FEATURE_COMPRESS_BBCONFIG is not set +CONFIG_BC=y +CONFIG_DC=y +CONFIG_FEATURE_DC_BIG=y +# CONFIG_FEATURE_DC_LIBM is not set +CONFIG_FEATURE_BC_INTERACTIVE=y +CONFIG_FEATURE_BC_LONG_OPTIONS=y +CONFIG_BEEP=y +CONFIG_FEATURE_BEEP_FREQ=4000 +CONFIG_FEATURE_BEEP_LENGTH_MS=30 +CONFIG_CHAT=y +CONFIG_FEATURE_CHAT_NOFAIL=y +# CONFIG_FEATURE_CHAT_TTY_HIFI is not set +CONFIG_FEATURE_CHAT_IMPLICIT_CR=y +CONFIG_FEATURE_CHAT_SWALLOW_OPTS=y +CONFIG_FEATURE_CHAT_SEND_ESCAPES=y +CONFIG_FEATURE_CHAT_VAR_ABORT_LEN=y +CONFIG_FEATURE_CHAT_CLR_ABORT=y +CONFIG_CONSPY=y +CONFIG_CROND=y +CONFIG_FEATURE_CROND_D=y +CONFIG_FEATURE_CROND_CALL_SENDMAIL=y +CONFIG_FEATURE_CROND_SPECIAL_TIMES=y +CONFIG_FEATURE_CROND_DIR="/var/spool/cron" +CONFIG_CRONTAB=y +# CONFIG_DEVFSD is not set +# CONFIG_DEVFSD_MODLOAD is not set +# CONFIG_DEVFSD_FG_NP is not set +# CONFIG_DEVFSD_VERBOSE is not set +# CONFIG_FEATURE_DEVFS is not set +CONFIG_DEVMEM=y +CONFIG_FBSPLASH=y +# CONFIG_FLASH_ERASEALL is not set +# CONFIG_FLASH_LOCK is not set +# CONFIG_FLASH_UNLOCK is not set +# CONFIG_FLASHCP is not set +CONFIG_HDPARM=y +CONFIG_FEATURE_HDPARM_GET_IDENTITY=y +CONFIG_FEATURE_HDPARM_HDIO_SCAN_HWIF=y +CONFIG_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF=y +CONFIG_FEATURE_HDPARM_HDIO_DRIVE_RESET=y +CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF=y +CONFIG_FEATURE_HDPARM_HDIO_GETSET_DMA=y +CONFIG_HEXEDIT=y +CONFIG_I2CGET=y +CONFIG_I2CSET=y +CONFIG_I2CDUMP=y +CONFIG_I2CDETECT=y +CONFIG_I2CTRANSFER=y +# CONFIG_INOTIFYD is not set +CONFIG_LESS=y +CONFIG_FEATURE_LESS_MAXLINES=9999999 +CONFIG_FEATURE_LESS_BRACKETS=y +CONFIG_FEATURE_LESS_FLAGS=y +CONFIG_FEATURE_LESS_TRUNCATE=y +CONFIG_FEATURE_LESS_MARKS=y +CONFIG_FEATURE_LESS_REGEXP=y +CONFIG_FEATURE_LESS_WINCH=y +CONFIG_FEATURE_LESS_ASK_TERMINAL=y +CONFIG_FEATURE_LESS_DASHCMD=y +CONFIG_FEATURE_LESS_LINENUMS=y +CONFIG_FEATURE_LESS_RAW=y +CONFIG_FEATURE_LESS_ENV=y +CONFIG_LSSCSI=y +CONFIG_MAKEDEVS=y +# CONFIG_FEATURE_MAKEDEVS_LEAF is not set +CONFIG_FEATURE_MAKEDEVS_TABLE=y +CONFIG_MAN=y +CONFIG_MICROCOM=y +CONFIG_MIM=y +CONFIG_MT=y +CONFIG_NANDWRITE=y +CONFIG_NANDDUMP=y +CONFIG_PARTPROBE=y +CONFIG_RAIDAUTORUN=y +CONFIG_READAHEAD=y +# CONFIG_RFKILL is not set +CONFIG_RUNLEVEL=y +CONFIG_RX=y +CONFIG_SEEDRNG=y +CONFIG_SETFATTR=y +CONFIG_SETSERIAL=y +CONFIG_STRINGS=y +CONFIG_TIME=y +CONFIG_TREE=y +CONFIG_TS=y +CONFIG_TTYSIZE=y +CONFIG_UBIATTACH=y +CONFIG_UBIDETACH=y +CONFIG_UBIMKVOL=y +CONFIG_UBIRMVOL=y +CONFIG_UBIRSVOL=y +CONFIG_UBIUPDATEVOL=y +CONFIG_UBIRENAME=y +CONFIG_VOLNAME=y +CONFIG_WATCHDOG=y +# CONFIG_FEATURE_WATCHDOG_OPEN_TWICE is not set + +# +# Networking Utilities +# +CONFIG_FEATURE_IPV6=y +# CONFIG_FEATURE_UNIX_LOCAL is not set +CONFIG_FEATURE_PREFER_IPV4_ADDRESS=y +# CONFIG_VERBOSE_RESOLUTION_ERRORS is not set +# CONFIG_FEATURE_ETC_NETWORKS is not set +# CONFIG_FEATURE_ETC_SERVICES is not set +CONFIG_FEATURE_HWIB=y +# CONFIG_FEATURE_TLS_SHA1 is not set +CONFIG_ARP=y +CONFIG_ARPING=y +CONFIG_BRCTL=y +CONFIG_FEATURE_BRCTL_FANCY=y +CONFIG_FEATURE_BRCTL_SHOW=y +CONFIG_DNSD=y +CONFIG_ETHER_WAKE=y +CONFIG_FTPD=y +CONFIG_FEATURE_FTPD_WRITE=y +CONFIG_FEATURE_FTPD_ACCEPT_BROKEN_LIST=y +CONFIG_FEATURE_FTPD_AUTHENTICATION=y +CONFIG_FTPGET=y +CONFIG_FTPPUT=y +CONFIG_FEATURE_FTPGETPUT_LONG_OPTIONS=y +# CONFIG_HOSTNAME is not set +CONFIG_DNSDOMAINNAME=y +CONFIG_HTTPD=y +CONFIG_FEATURE_HTTPD_PORT_DEFAULT=80 +CONFIG_FEATURE_HTTPD_RANGES=y +CONFIG_FEATURE_HTTPD_SETUID=y +CONFIG_FEATURE_HTTPD_BASIC_AUTH=y +CONFIG_FEATURE_HTTPD_AUTH_MD5=y +CONFIG_FEATURE_HTTPD_CGI=y +CONFIG_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR=y +CONFIG_FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV=y +CONFIG_FEATURE_HTTPD_ENCODE_URL_STR=y +CONFIG_FEATURE_HTTPD_ERROR_PAGES=y +CONFIG_FEATURE_HTTPD_PROXY=y +CONFIG_FEATURE_HTTPD_GZIP=y +CONFIG_FEATURE_HTTPD_ETAG=y +CONFIG_FEATURE_HTTPD_LAST_MODIFIED=y +CONFIG_FEATURE_HTTPD_DATE=y +CONFIG_FEATURE_HTTPD_ACL_IP=y +CONFIG_IFCONFIG=y +CONFIG_FEATURE_IFCONFIG_STATUS=y +CONFIG_FEATURE_IFCONFIG_SLIP=y +CONFIG_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ=y +CONFIG_FEATURE_IFCONFIG_HW=y +CONFIG_FEATURE_IFCONFIG_BROADCAST_PLUS=y +CONFIG_IFENSLAVE=y +CONFIG_IFPLUGD=y +CONFIG_IFUP=y +CONFIG_IFDOWN=y +CONFIG_IFUPDOWN_IFSTATE_PATH="/var/run/ifstate" +CONFIG_FEATURE_IFUPDOWN_IP=y +CONFIG_FEATURE_IFUPDOWN_IPV4=y +CONFIG_FEATURE_IFUPDOWN_IPV6=y +CONFIG_FEATURE_IFUPDOWN_MAPPING=y +# CONFIG_FEATURE_IFUPDOWN_EXTERNAL_DHCP is not set +CONFIG_INETD=y +CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_ECHO=y +CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DISCARD=y +CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_TIME=y +CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DAYTIME=y +CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_CHARGEN=y +# CONFIG_FEATURE_INETD_RPC is not set +CONFIG_IP=y +CONFIG_IPADDR=y +CONFIG_IPLINK=y +CONFIG_IPROUTE=y +CONFIG_IPTUNNEL=y +CONFIG_IPRULE=y +CONFIG_IPNEIGH=y +CONFIG_FEATURE_IP_ADDRESS=y +CONFIG_FEATURE_IP_LINK=y +CONFIG_FEATURE_IP_ROUTE=y +CONFIG_FEATURE_IP_ROUTE_DIR="/etc/iproute2" +CONFIG_FEATURE_IP_TUNNEL=y +CONFIG_FEATURE_IP_RULE=y +CONFIG_FEATURE_IP_NEIGH=y +# CONFIG_FEATURE_IP_RARE_PROTOCOLS is not set +CONFIG_IPCALC=y +CONFIG_FEATURE_IPCALC_LONG_OPTIONS=y +CONFIG_FEATURE_IPCALC_FANCY=y +CONFIG_FAKEIDENTD=y +CONFIG_NAMEIF=y +CONFIG_FEATURE_NAMEIF_EXTENDED=y +CONFIG_NBDCLIENT=y +CONFIG_NC=y +# CONFIG_NETCAT is not set +CONFIG_NC_SERVER=y +CONFIG_NC_EXTRA=y +CONFIG_NC_110_COMPAT=y +CONFIG_NETSTAT=y +CONFIG_FEATURE_NETSTAT_WIDE=y +CONFIG_FEATURE_NETSTAT_PRG=y +CONFIG_NSLOOKUP=y +CONFIG_FEATURE_NSLOOKUP_BIG=y +CONFIG_FEATURE_NSLOOKUP_LONG_OPTIONS=y +CONFIG_NTPD=y +CONFIG_FEATURE_NTPD_SERVER=y +CONFIG_FEATURE_NTPD_CONF=y +CONFIG_FEATURE_NTP_AUTH=y +CONFIG_PING=y +CONFIG_PING6=y +CONFIG_FEATURE_FANCY_PING=y +CONFIG_PSCAN=y +CONFIG_ROUTE=y +CONFIG_SLATTACH=y +CONFIG_SSL_CLIENT=y +CONFIG_TC=y +CONFIG_FEATURE_TC_INGRESS=y +CONFIG_TCPSVD=y +CONFIG_UDPSVD=y +CONFIG_TELNET=y +CONFIG_FEATURE_TELNET_TTYPE=y +CONFIG_FEATURE_TELNET_AUTOLOGIN=y +CONFIG_FEATURE_TELNET_WIDTH=y +CONFIG_TELNETD=y +CONFIG_FEATURE_TELNETD_STANDALONE=y +CONFIG_FEATURE_TELNETD_PORT_DEFAULT=23 +CONFIG_FEATURE_TELNETD_INETD_WAIT=y +CONFIG_TFTP=y +CONFIG_FEATURE_TFTP_PROGRESS_BAR=y +CONFIG_FEATURE_TFTP_HPA_COMPAT=y +CONFIG_TFTPD=y +CONFIG_FEATURE_TFTP_GET=y +CONFIG_FEATURE_TFTP_PUT=y +CONFIG_FEATURE_TFTP_BLOCKSIZE=y +# CONFIG_TFTP_DEBUG is not set +CONFIG_TLS=y +CONFIG_TRACEROUTE=y +CONFIG_TRACEROUTE6=y +CONFIG_FEATURE_TRACEROUTE_VERBOSE=y +CONFIG_FEATURE_TRACEROUTE_USE_ICMP=y +CONFIG_TUNCTL=y +CONFIG_FEATURE_TUNCTL_UG=y +CONFIG_VCONFIG=y +CONFIG_WGET=y +CONFIG_FEATURE_WGET_LONG_OPTIONS=y +CONFIG_FEATURE_WGET_STATUSBAR=y +CONFIG_FEATURE_WGET_FTP=y +CONFIG_FEATURE_WGET_AUTHENTICATION=y +CONFIG_FEATURE_WGET_TIMEOUT=y +CONFIG_FEATURE_WGET_HTTPS=y +CONFIG_FEATURE_WGET_OPENSSL=y +CONFIG_WHOIS=y +CONFIG_ZCIP=y +CONFIG_UDHCPD=y +# CONFIG_FEATURE_UDHCPD_BASE_IP_ON_MAC is not set +CONFIG_FEATURE_UDHCPD_WRITE_LEASES_EARLY=y +CONFIG_DHCPD_LEASES_FILE="/var/lib/misc/udhcpd.leases" +CONFIG_DUMPLEASES=y +CONFIG_DHCPRELAY=y +CONFIG_UDHCPC=y +CONFIG_FEATURE_UDHCPC_ARPING=y +CONFIG_FEATURE_UDHCPC_SANITIZEOPT=y +CONFIG_UDHCPC_DEFAULT_SCRIPT="/usr/share/udhcpc/default.script" +CONFIG_UDHCPC6_DEFAULT_SCRIPT="/usr/share/udhcpc/default6.script" +CONFIG_UDHCPC6=y +CONFIG_FEATURE_UDHCPC6_RFC3646=y +CONFIG_FEATURE_UDHCPC6_RFC4704=y +CONFIG_FEATURE_UDHCPC6_RFC4833=y +CONFIG_FEATURE_UDHCPC6_RFC5970=y + +# +# Common options for DHCP applets +# +CONFIG_UDHCPC_DEFAULT_INTERFACE="eth0" +# CONFIG_FEATURE_UDHCP_PORT is not set +CONFIG_UDHCP_DEBUG=2 +CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS=80 +CONFIG_FEATURE_UDHCP_RFC3397=y +CONFIG_FEATURE_UDHCP_8021Q=y +CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS="-R -n" + +# +# Print Utilities +# +CONFIG_LPD=y +CONFIG_LPR=y +CONFIG_LPQ=y + +# +# Mail Utilities +# +CONFIG_FEATURE_MIME_CHARSET="us-ascii" +CONFIG_MAKEMIME=y +CONFIG_POPMAILDIR=y +CONFIG_FEATURE_POPMAILDIR_DELIVERY=y +CONFIG_REFORMIME=y +CONFIG_FEATURE_REFORMIME_COMPAT=y +CONFIG_SENDMAIL=y + +# +# Process Utilities +# +# CONFIG_FEATURE_FAST_TOP is not set +CONFIG_FEATURE_SHOW_THREADS=y +CONFIG_FREE=y +CONFIG_FUSER=y +CONFIG_IOSTAT=y +CONFIG_KILL=y +CONFIG_KILLALL=y +CONFIG_KILLALL5=y +CONFIG_LSOF=y +CONFIG_MPSTAT=y +CONFIG_NMETER=y +CONFIG_PGREP=y +CONFIG_PKILL=y +# CONFIG_PIDOF is not set +# CONFIG_FEATURE_PIDOF_SINGLE is not set +# CONFIG_FEATURE_PIDOF_OMIT is not set +CONFIG_PMAP=y +CONFIG_POWERTOP=y +CONFIG_FEATURE_POWERTOP_INTERACTIVE=y +CONFIG_PS=y +# CONFIG_FEATURE_PS_WIDE is not set +# CONFIG_FEATURE_PS_LONG is not set +CONFIG_FEATURE_PS_TIME=y +# CONFIG_FEATURE_PS_UNUSUAL_SYSTEMS is not set +CONFIG_FEATURE_PS_ADDITIONAL_COLUMNS=y +CONFIG_PSTREE=y +CONFIG_PWDX=y +CONFIG_SMEMCAP=y +CONFIG_BB_SYSCTL=y +CONFIG_TOP=y +CONFIG_FEATURE_TOP_INTERACTIVE=y +CONFIG_FEATURE_TOP_CPU_USAGE_PERCENTAGE=y +CONFIG_FEATURE_TOP_CPU_GLOBAL_PERCENTS=y +CONFIG_FEATURE_TOP_SMP_CPU=y +CONFIG_FEATURE_TOP_DECIMALS=y +CONFIG_FEATURE_TOP_SMP_PROCESS=y +CONFIG_FEATURE_TOPMEM=y +CONFIG_UPTIME=y +CONFIG_FEATURE_UPTIME_UTMP_SUPPORT=y +CONFIG_WATCH=y + +# +# Runit Utilities +# +CONFIG_CHPST=y +CONFIG_SETUIDGID=y +CONFIG_ENVUIDGID=y +CONFIG_ENVDIR=y +CONFIG_SOFTLIMIT=y +CONFIG_RUNSV=y +CONFIG_RUNSVDIR=y +# CONFIG_FEATURE_RUNSVDIR_LOG is not set +CONFIG_SV=y +CONFIG_SV_DEFAULT_SERVICE_DIR="/var/service" +CONFIG_SVC=y +CONFIG_SVOK=y +CONFIG_SVLOGD=y +# CONFIG_CHCON is not set +# CONFIG_GETENFORCE is not set +# CONFIG_GETSEBOOL is not set +# CONFIG_LOAD_POLICY is not set +# CONFIG_MATCHPATHCON is not set +# CONFIG_RUNCON is not set +# CONFIG_SELINUXENABLED is not set +# CONFIG_SESTATUS is not set +# CONFIG_SETENFORCE is not set +# CONFIG_SETFILES is not set +# CONFIG_FEATURE_SETFILES_CHECK_OPTION is not set +# CONFIG_RESTORECON is not set +# CONFIG_SETSEBOOL is not set + +# +# Shells +# +CONFIG_SH_IS_ASH=y +# CONFIG_SH_IS_HUSH is not set +# CONFIG_SH_IS_NONE is not set +# CONFIG_BASH_IS_ASH is not set +# CONFIG_BASH_IS_HUSH is not set +CONFIG_BASH_IS_NONE=y +CONFIG_SHELL_ASH=y +CONFIG_ASH=y +CONFIG_ASH_OPTIMIZE_FOR_SIZE=y +CONFIG_ASH_INTERNAL_GLOB=y +CONFIG_ASH_BASH_COMPAT=y +# CONFIG_ASH_BASH_SOURCE_CURDIR is not set +CONFIG_ASH_BASH_NOT_FOUND_HOOK=y +CONFIG_ASH_JOB_CONTROL=y +CONFIG_ASH_ALIAS=y +CONFIG_ASH_RANDOM_SUPPORT=y +CONFIG_ASH_EXPAND_PRMT=y +CONFIG_ASH_IDLE_TIMEOUT=y +CONFIG_ASH_MAIL=y +CONFIG_ASH_ECHO=y +CONFIG_ASH_PRINTF=y +CONFIG_ASH_TEST=y +CONFIG_ASH_SLEEP=y +CONFIG_ASH_HELP=y +CONFIG_ASH_GETOPTS=y +CONFIG_ASH_CMDCMD=y +CONFIG_CTTYHACK=y +CONFIG_HUSH=y +CONFIG_SHELL_HUSH=y +CONFIG_HUSH_BASH_COMPAT=y +CONFIG_HUSH_BRACE_EXPANSION=y +# CONFIG_HUSH_BASH_SOURCE_CURDIR is not set +CONFIG_HUSH_LINENO_VAR=y +CONFIG_HUSH_INTERACTIVE=y +CONFIG_HUSH_SAVEHISTORY=y +CONFIG_HUSH_JOB=y +CONFIG_HUSH_TICK=y +CONFIG_HUSH_IF=y +CONFIG_HUSH_LOOPS=y +CONFIG_HUSH_CASE=y +CONFIG_HUSH_FUNCTIONS=y +CONFIG_HUSH_LOCAL=y +CONFIG_HUSH_RANDOM_SUPPORT=y +CONFIG_HUSH_MODE_X=y +CONFIG_HUSH_ECHO=y +CONFIG_HUSH_PRINTF=y +CONFIG_HUSH_TEST=y +CONFIG_HUSH_HELP=y +CONFIG_HUSH_EXPORT=y +CONFIG_HUSH_EXPORT_N=y +CONFIG_HUSH_READONLY=y +CONFIG_HUSH_KILL=y +CONFIG_HUSH_WAIT=y +CONFIG_HUSH_COMMAND=y +CONFIG_HUSH_TRAP=y +CONFIG_HUSH_TYPE=y +CONFIG_HUSH_TIMES=y +CONFIG_HUSH_READ=y +CONFIG_HUSH_SET=y +CONFIG_HUSH_UNSET=y +CONFIG_HUSH_ULIMIT=y +CONFIG_HUSH_UMASK=y +CONFIG_HUSH_GETOPTS=y +# CONFIG_HUSH_MEMLEAK is not set + +# +# Options common to all shells +# +CONFIG_FEATURE_SH_MATH=y +CONFIG_FEATURE_SH_MATH_64=y +CONFIG_FEATURE_SH_MATH_BASE=y +CONFIG_FEATURE_SH_EXTRA_QUIET=y +# CONFIG_FEATURE_SH_STANDALONE is not set +# CONFIG_FEATURE_SH_NOFORK is not set +CONFIG_FEATURE_SH_READ_FRAC=y +CONFIG_FEATURE_SH_HISTFILESIZE=y +CONFIG_FEATURE_SH_EMBEDDED_SCRIPTS=y + +# +# System Logging Utilities +# +CONFIG_KLOGD=y + +# +# klogd should not be used together with syslog to kernel printk buffer +# +CONFIG_FEATURE_KLOGD_KLOGCTL=y +CONFIG_LOGGER=y +CONFIG_LOGREAD=y +CONFIG_FEATURE_LOGREAD_REDUCED_LOCKING=y +CONFIG_SYSLOGD=y +CONFIG_FEATURE_ROTATE_LOGFILE=y +CONFIG_FEATURE_REMOTE_LOG=y +CONFIG_FEATURE_SYSLOGD_DUP=y +CONFIG_FEATURE_SYSLOGD_CFG=y +# CONFIG_FEATURE_SYSLOGD_PRECISE_TIMESTAMPS is not set +CONFIG_FEATURE_SYSLOGD_READ_BUFFER_SIZE=256 +CONFIG_FEATURE_IPC_SYSLOG=y +CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE=16 +CONFIG_FEATURE_KMSG_SYSLOG=y diff --git a/community/busybox/build_busybox.sh b/community/busybox/build_busybox.sh new file mode 100755 index 0000000000000000000000000000000000000000..f30faf86fbbfc40d61065cdab44cdd0fe47f6fdc --- /dev/null +++ b/community/busybox/build_busybox.sh @@ -0,0 +1,98 @@ +#!/usr/bin/bash + +function build_busybox() { + +# local file=.config +# make defconfig +# sed -i 's/# CONFIG_STATIC is not set/CONFIG_STATIC=y/' $file + + cp ../busybox.config .config + make -j8 + if [ $? -ne 0 ]; then + echo "build busybox failed!" + return 1 + fi + + cp ./busybox ../ + + echo "build busybox success!" + + return 0 +} + +function download_busybox() { + local retry=0 + + while [ $retry -le 5 ] + do + if [ ! -z "$2" ]; then + git clone $1 -b $2 + else + git clone $1 + fi + + if [ $? -eq 0 ]; then + break; + fi + done + + if [ $retry -eq 5 ]; then + echo "download busybox failed!" + return 1 + else + echo "download busybox success!" + return 0 + fi +} + +ERR_MSG="BUILD busybox ERROR!!!!!!!!!!!!!!!!!!!!!" +target_name=busybox +curdir=`pwd` +srcdir=$1 +topdir=$2 +cpu=$3 +url="https://github.com/mirror/busybox.git" +ver=1_36_0 +CONFIG_FILE=${topdir}third_party/busybox/adapted/busybox.config +source_dir=$target_name-$ver +COMPILE_PATH=${topdir}prebuilts/gcc/linux-x86/arm/gcc-linaro-7.5.0-arm-linux-gnueabi/bin + +if [ "${cpu}" == "arm" ]; then + export CROSS_COMPILE=${topdir}prebuilts/gcc/linux-x86/arm/gcc-linaro-7.5.0-arm-linux-gnueabi/bin/arm-linux-gnueabi- +elif [ "${cpu}" == "arm64" ]; then + export CROSS_COMPILE=${topdir}prebuilts/gcc/linux-x86/aarch64/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu- +else + echo "cant not support this cpu(${cpu}) type!!!" + exit 1 +fi + +if [ -z "$srcdir" ];then + echo "must set the param dir!" + exit 1 +fi + +cp $CONFIG_FILE $srcdir/ + +cd $srcdir + +if [ ! -d "$source_dir" ]; then + download_busybox $url $ver + if [ $? -ne 0 ]; then + echo $ERR_MSG + exit 1 + fi + + mv ./$target_name ./$source_dir +fi + +cd $source_dir + +build_busybox +if [ $? -ne 0 ]; then + echo $ERR_MSG + exit 1 +fi + +cd $curdir + +#eof diff --git a/community/busybox/bundle.json b/community/busybox/bundle.json new file mode 100755 index 0000000000000000000000000000000000000000..d2a4d3599d1cb4195b5d557c1fccf9b52c18451d --- /dev/null +++ b/community/busybox/bundle.json @@ -0,0 +1,30 @@ +{ + "name": "@ohos/busybox", + "description": "BusyBox combines tiny versions of many common UNIX utilities into a single small executable.", + "version": "1.36.0", + "license": "GPL license", + "publishAs": "code-segment", + "segment": { + "destPath": "third_party/busybox" + }, + "dirs": {}, + "scripts": {}, + "component": { + "name": "busybox", + "subsystem": "", + "syscap": [], + "features": [], + "adapted_system_type": [], + "rom": "", + "ram": "", + "deps": { + "components": [], + "third_party": [] + }, + "build": { + "sub_component": ["//third_party/busybox:busybox_cmd"], + "inner_kits": [], + "test": [] + } + } +} \ No newline at end of file diff --git a/community/busybox/docs/media/result.png b/community/busybox/docs/media/result.png new file mode 100755 index 0000000000000000000000000000000000000000..21166e5ef4b6de0e26f61401fcb653f75543d64c Binary files /dev/null and b/community/busybox/docs/media/result.png differ diff --git a/community/busybox/docs/rom_integrate.md b/community/busybox/docs/rom_integrate.md new file mode 100755 index 0000000000000000000000000000000000000000..07885d449b04a438fdc0a4e5b735b46e7878655b --- /dev/null +++ b/community/busybox/docs/rom_integrate.md @@ -0,0 +1,123 @@ +# busybox 如何集成到系统rom + +## 准备工程 + +本库是基于OpenHarmony 3.2 beta3版本适配,并在润和RK3568开发板上验证的。 +RK3568开发板如何使用可以参照[润和RK3568开发板标准系统快速上手](https://gitee.com/openharmony-sig/knowledge_demo_temp/blob/master/docs/rk3568_helloworld/README.md)。 + +### 准备系统Rom源码 + +源码获取方法请参照:[OpenHarmony3.2beta3源码下载](https://gitee.com/openharmony/docs/blob/OpenHarmony-3.2-Beta3/zh-cn/release-notes/OpenHarmony-v3.2-beta3.md#%E6%BA%90%E7%A0%81%E8%8E%B7%E5%8F%96) + +### 增加构建脚本及配置文件 + +- 下载本仓库代码 + + ```sh + cd ~/ + git clone git@gitee.com:openharmony-sig/tpc_c_cplusplus.git --depth=1 + ``` + +- 仓库代码目录结构说明 + + ``` sh + cd ~/tpc_c_cplusplus/thirdparty/busybox/ # 进入到仓库代码库目录 + ``` + + ``` sh + busybox + |-- docs ## busybox集成说明文档目录 + |-- media ## 存放文档中的图片资源 + |-- adapted + |-- busybox.config ## busybox 配置文件 + |-- BUILD.gn ## Rom版编译构建脚本 + |-- bundle.json ## 组件定义文件 + |-- build_busybox.sh ## 调用busybox原生库进行编译的脚本文件 + |-- EADME.OpenSource ## busybox 开源信息说明文档 + |-- README_zh.md ## busybox 说明文档 + ``` + +- 将本仓库busybox文件夹拷贝到OpenHarmony的third_party下 + + ``` sh + cp -arf ~/tpc_c_cplusplus/thirdparty/busybox ~/OpenHarmony/third_party + ``` + +### 准备三方库源码 + +`build_busybox.sh`脚本中设置了下载对应版本的busybox源码,无需手动下载该库的源码。 + +## 系统Rom中引入三方库 + +准备完三方库代码后,我们需要将三方库加入到编译构建体系中。标准系统编译构建可以参考文档[标准系统编译构建指导](https://gitee.com/openharmony/docs/blob/OpenHarmony-3.2-Beta1/zh-cn/device-dev/subsystems/subsys-build-standard-large.md)。 +这里我们三方库默认添加到thirdparty子系统中(详细信息参照文档[如何添加一个三方库到OpenHarmony系统中](https://gitee.com/openharmony-sig/knowledge/blob/master/docs/openharmony_getstarted/port_thirdparty/README.md#%E5%8A%A0%E5%85%A5%E7%BC%96%E8%AF%91%E6%9E%84%E5%BB%BA%E4%BD%93%E7%B3%BB))。相关配置已在bundle.json中完成,我们只需要在产品定义中添加busybox组件即可。 + +- 在产品配置文件中添加busybox的组件 + 打开//vendor/hihope/rk3568/config.json文件,找到thirdparty子系统并添加busybox的组件,如果文件中未指定thirdparty子系统,需要手动将子系统信息加上: + + ```json + { + "subsystem": "thirdparty", + "components": [ + { + "component": "busybox", + "features": [] + } + ] + } + ``` + +## 系统Rom中引入三方库测试程序 + +busybox最终生成的是busybox可执行文件,无需引入测试编译,引用原生库的测试逻辑即可。 + +## 编译工程 + +- 选择产品 + + ``` sh + hb set ## 运行hb set后会出现产品列表,在此我们选择 rk3568 + ``` + +- 运行编译 + + ``` sh + hb build --target-cpu arm -f ## --target-cpu arm 编译32位系统(未配置默认编译32位),如果需要编译64位的需要改为--target-cpu arm64; -f 全量编译,不加-f则为增量编译。每次设置完产品后建议进行全量编译。 + ``` + +- 正常编译完后会在out/rk3568/packages/phone/system/bin下生成busybox文件 + +## 安装应用程序 + +将编译生成的库和测试文件放到板子上运行,为避免每次将文件推入设备都烧录整个镜像,我们使用hdc_std工具将文件推到开发板上。 + +- 通过源码编译生成hdc_std工具 + + ``` sh + hb set ## 源码根目录下使用hb set 选择产品ohos-sdk + hb build ## 编译SDK,最后工具编译出来在out/sdk/ohos-sdk/windows/toolchains/hdc_std.exe + ``` + +- 将工具拷贝到Windows,可以为工具目录配置环境变量,也可以在工具所在目录打开windows命令 +- 将busybox推送到开发板 ,具体步骤如下: + + ```sh + hdc_std.exe file send busybox /data/ ## 将测试资源推送到板子 + hdc_std.exe shell ## 进入设备系统 + cd /data + chmod a+x busybox ## 设置busybox可执行权限 + ``` + +## 测试方法与运行结果 + +将busybox推送开发板后,可以直接运行busybox相关指令并可看到其执行结果,如下图所示: + +![result](media/result.png) + +## 参考资料 + +- [润和RK3568开发板标准系统快速上手](https://gitee.com/openharmony-sig/knowledge_demo_temp/blob/master/docs/rk3568_helloworld/README.md) +- [如何添加一个三方库到OpenHarmony的thirdparty子系统中](https://gitee.com/openharmony-sig/knowledge/blob/master/docs/openharmony_getstarted/port_thirdparty/README.md) +- [OpenHarmony3.2beta3介绍](https://gitee.com/openharmony/docs/blob/OpenHarmony-3.2-Beta3/zh-cn/release-notes/OpenHarmony-v3.2-beta3.md) +- [OpenHarmony三方库地址](https://gitee.com/openharmony-tpc) +- [OpenHarmony知识体系](https://gitee.com/openharmony-sig/knowledge) diff --git a/community/bzip2_1_0_8/HPKBUILD b/community/bzip2_1_0_8/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..2a4c248d721895c25a71a80baa6c0ad4329eb7da --- /dev/null +++ b/community/bzip2_1_0_8/HPKBUILD @@ -0,0 +1,92 @@ +# 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: Jeff Han , wen fan +# Maintainer: Jeff Han + +pkgname=bzip2_1_0_8 +pkgver=1.0.8 +pkgrel= +pkgdesc="bzip2 is a freely available, patent free (see below), high-quality data compressor." +url=https://sourceware.org/git/bzip2 +archs=(armeabi-v7a arm64-v8a) +license=(bzip2-1.0.6) +depends=() +makedepends=() + +source= + +autounpack=false +downloadpackage=false +buildtools=make +clonesrcflag=true +commitid=6a8690fc8d26c815e798c588f796eabe9d684cf0 + +builddir=bzip2-${pkgver} +packagename= + +cc= +ar= +ranlib= +# bzip2 采用makefile编译构建,为了保留构建环境(方便测试)。因此同一份源码在解压后分为两份,各自编译互不干扰 +prepare() { + if ${clonesrcflag} + then + git clone ${url}.git ${builddir} > ${publicbuildlog} 2>&1 || return -1 + cd ${builddir} + git reset --hard ${commitid} >> ${publicbuildlog} 2>&1 || return -1 + cd ${OLDPWD} + clonesrcflag=false + fi + + 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 + ranlib=${OHOS_SDK}/native/llvm/bin/llvm-ranlib + fi + if [ $ARCH == "arm64-v8a" ] + then + cc=${OHOS_SDK}/native/llvm/bin/aarch64-linux-ohos-clang + ar=${OHOS_SDK}/native/llvm/bin/llvm-ar + ranlib=${OHOS_SDK}/native/llvm/bin/llvm-ranlib + fi + cd $OLDPWD # 1> /dev/null +} + +build() { + cd $builddir-$ARCH-build + $MAKE VERBOSE=1 CC=${cc} AR=${ar} RANLIB=${ranlib} libbz2.a bzip2 bzip2recover > $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir-$ARCH-build + $MAKE VERBOSE=1 install PREFIX=$LYCIUM_ROOT/usr/$pkgname/$ARCH >> $buildlog 2>&1 + cd $OLDPWD + unset cc ar ranlib +} + +check() { + echo "The test must be on an OpenHarmony device!" + # make check +} + +# 清理环境 +cleanbuild(){ + rm -rf ${PWD}/$builddir $builddir-armeabi-v7a-build $builddir-arm64-v8a-build #${PWD}/$packagename +} diff --git a/community/bzip2_1_0_8/HPKCHECK b/community/bzip2_1_0_8/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..33c70acf6f5e0c95dddcdd4c7b6eee0a9bbfa8ba --- /dev/null +++ b/community/bzip2_1_0_8/HPKCHECK @@ -0,0 +1,27 @@ +# 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: Jeff Han , wen fan +# Maintainer: Jeff Han + +source HPKBUILD > /dev/null 2>&1 +logfile=${LYCIUM_THIRDPARTY_ROOT}/${pkgname}/${pkgname}_${ARCH}_${OHOS_SDK_VER}_test.log + +openharmonycheck() { + cd $builddir-$ARCH-build + make check > ${logfile} 2>&1 + res=$? + cd $OLDPWD + + return $res +} diff --git a/community/bzip2_1_0_8/OAT.xml b/community/bzip2_1_0_8/OAT.xml new file mode 100644 index 0000000000000000000000000000000000000000..f779e79cee4f7d0154fbc93aa5223387cde5cbdd --- /dev/null +++ b/community/bzip2_1_0_8/OAT.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/community/bzip2_1_0_8/README.OpenSource b/community/bzip2_1_0_8/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..43d734efb16c5cddfef943cb7b581884e2d630d7 --- /dev/null +++ b/community/bzip2_1_0_8/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "bzip2_1_0_8", + "License": "bzip2-1.0.6", + "License File": "https://sourceforge.net/p/bzip2/bzip2/ci/bzip2-1_0_6/tree/LICENSE", + "Version Number": "1.0.8", + "Owner": "huangminzhong2@huawei.com", + "Upstream URL": "https://sourceware.org/git/bzip2", + "Description": "bzip2 is a freely available, patent free (see below), high-quality data compressor. It typically compresses files to within 10% to 15% of the best available techniques (the PPM family of statistical compressors), whilst being around twice as fast at compression and six times faster at decompression." + } +] diff --git a/community/bzip2_1_0_8/README_zh.md b/community/bzip2_1_0_8/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..3970b96944ffc5c6998dfa6d1795ef4518250433 --- /dev/null +++ b/community/bzip2_1_0_8/README_zh.md @@ -0,0 +1,15 @@ +# bzip2_1_0_8三方库说明 +## 功能简介 +bzip2_1_0_8是使用 Burrows–Wheeler 算法,压缩解压文件。 + +## 三方库版本 +- 1.0.8 + +## 已适配功能 +- 压缩解压文件 + +## 使用约束 +- [IDE和SDK版本](../../docs/constraint.md) + +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) diff --git a/community/bzip2_1_0_8/docs/hap_integrate.md b/community/bzip2_1_0_8/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..96e76b572e50c4257b0d2e9ec5c665fab14fc4c3 --- /dev/null +++ b/community/bzip2_1_0_8/docs/hap_integrate.md @@ -0,0 +1,62 @@ +# bzip2_1_0_8集成到应用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) + +## 编译三方库 +- 下载本仓库 + ``` + git clone https://gitee.com/openharmony-sig/tpc_c_cplusplus.git --depth=1 + ``` + +- 三方库目录结构 + ``` + tpc_c_cplusplus/thirdparty/bzip2_1_0_8 #三方库的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── HPKCHECK #测试脚本 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md #三方库简介 + ├── OAT.xml #扫描结果文件 + ``` + +- 在lycium目录下编译三方库 + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ``` + cd lycium + ./build.sh bzip2_1_0_8 + ``` + +- 三方库头文件及生成的库 + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + ``` + bzip2_1_0_8/arm64-v8a bzip2_1_0_8/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的库拷贝到该目录下,如下图所示 + ![bzip2_install_dir](pic/bzip2_install_dir.png) +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + ```cmake + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/bzip2/${OHOS_ARCH}/lib/libbz2.a) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/bzip2/${OHOS_ARCH}/include) + ``` +## 测试三方库 +三方库的测试使用原库自带的测试用例来做测试,[准备三方库测试环境](../../../lycium/README.md#3ci环境准备) + +进入到构建目录执行 make check 运行测试用例(arm64-v8a-build为构建64位的目录,armeabi-v7a-build为构建32位的目录) + + ![bzip2_test](pic/bzip2_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/community/bzip2_1_0_8/docs/pic/bzip2_install_dir.png b/community/bzip2_1_0_8/docs/pic/bzip2_install_dir.png new file mode 100644 index 0000000000000000000000000000000000000000..c7ebd224b9bacd80fd685679ad27f38e6f6d1bcb Binary files /dev/null and b/community/bzip2_1_0_8/docs/pic/bzip2_install_dir.png differ diff --git a/community/bzip2_1_0_8/docs/pic/bzip2_test.png b/community/bzip2_1_0_8/docs/pic/bzip2_test.png new file mode 100644 index 0000000000000000000000000000000000000000..dc36ebffa2c59247389f90ada35313b23322b35b Binary files /dev/null and b/community/bzip2_1_0_8/docs/pic/bzip2_test.png differ diff --git a/community/cJSON/HPKBUILD b/community/cJSON/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..2a9fca87e9cd0e8971a38ae920d963ec230aa22b --- /dev/null +++ b/community/cJSON/HPKBUILD @@ -0,0 +1,48 @@ +# Contributor: Jeff Han +# Maintainer: Jeff Han +pkgname=cJSON +pkgver=v1.7.15 +pkgrel=0 +pkgdesc="" +url="" +archs=("armeabi-v7a" "arm64-v8a") +license=("MIT") +depends=() +makedepends=() + +source="https://github.com/DaveGamble/$pkgname/archive/refs/tags/$pkgver.tar.gz" + +autounpack=true +downloadpackage=true + +builddir=$pkgname-${pkgver:1} +packagename=$builddir.tar.gz + +prepare() { + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + PKG_CONFIG_LIBDIR="${pkgconfigpath}" ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" \ + -DOHOS_ARCH=$ARCH -B$ARCH-build -S./ -L > $buildlog 2>&1 + $MAKE VERBOSE=1 -C $ARCH-build >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + $MAKE VERBOSE=1 -C $ARCH-build install >> $buildlog 2>&1 + cd $OLDPWD +} + +check() { + echo "The test must be on an OpenHarmony device!" +} + +# 清理环境 +cleanbuild(){ + rm -rf ${PWD}/$builddir #${PWD}/$packagename +} diff --git a/community/cJSON/README.OpenSource b/community/cJSON/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..68455900343b6d6b3387d3b5f848c3de148be865 --- /dev/null +++ b/community/cJSON/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "cJSON", + "License": " MIT license", + "License File": "LICENSE.txt", + "Version Number": "v1.7.15", + "Owner": "llh_01129@163.com", + "Upstream URL": "https://github.com/DaveGamble/cJSON/archive/refs/tags/v1.7.15.tar.gz", + "Description": "Ultralightweight JSON parser in ANSI C." + } +] diff --git a/community/cJSON/README_zh.md b/community/cJSON/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..976f7699a4b5439038927ab0a1727a0630a7f99f --- /dev/null +++ b/community/cJSON/README_zh.md @@ -0,0 +1,15 @@ +# cJSON三方库说明 +## 功能简介 +cJSON是使用C语言编写,用来创建、解析JSON文件的库。cJSON特点就是工程文件简单,只有一个.c和一个.h,但提供函数接口功能齐全,麻雀虽小五脏俱全,使得在嵌入式工程中使用起来得心应手。 + +## 三方库版本 +- v1.7.15 + +## 已适配功能 +- 创建、解析JSON文件 + +## 使用约束 +- [IDE和SDK版本](../../docs/constraint.md) + +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) diff --git a/community/cJSON/SHA512SUM b/community/cJSON/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..1805a2a00dde669a5240f56cd61b0bb225bf748b --- /dev/null +++ b/community/cJSON/SHA512SUM @@ -0,0 +1 @@ +0b32a758c597fcc90c8ed0af493c9bccd611b9d4f9a03e87de3f7337bb9a28990b810befd44bc321a0cb42cbcd0b026d45761f9bab7bd798f920b7b6975fb124 cJSON-1.7.15.tar.gz \ No newline at end of file diff --git a/community/cJSON/docs/hap_integrate.md b/community/cJSON/docs/hap_integrate.md new file mode 100755 index 0000000000000000000000000000000000000000..a8ddcfb60999691bd5ff52121d6748daa58dcdab --- /dev/null +++ b/community/cJSON/docs/hap_integrate.md @@ -0,0 +1,61 @@ +# cJSON集成到应用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) +## 编译三方库 +- 下载本仓库 + ``` + git clone https://gitee.com/openharmony-sig/tpc_c_cplusplus.git --depth=1 + ``` +- 三方库目录结构 + ``` + tpc_c_cplusplus/thirdparty/cJSON #三方库cJSON的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md + ``` + +- 在lycium目录下编译三方库 + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ``` + cd lycium + ./build.sh cJSON + ``` +- 三方库头文件及生成的库 + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ``` + cJSON/arm64-v8a cJSON/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 +- 拷贝动态库到`\\entry\libs\${OHOS_ARCH}\`目录: + 动态库需要在`\\entry\libs\${OHOS_ARCH}\`目录,才能集成到hap包中,所以需要将对应的so文件拷贝到对应CPU架构的目录 +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的库拷贝到该目录下,如下图所示 + ![thirdparty_install_dir](pic/cJSON_install_dir.png) +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + ``` + + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/libcjson.so) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/cJSON/${OHOS_ARCH}/include) + + ``` +## 测试三方库 +三方库的测试使用原库自带的测试用例来做测试,[准备三方库测试环境](../../../lycium/README.md#3ci环境准备) + +进入到构建目录执行ctest运行测试用例(arm64-v8a-build为构建64位的目录,armeabi-v7a-build为构建32位的目录) + + ![jbigkit_test](pic/cJSON_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/community/cJSON/docs/pic/cJSON_install_dir.png b/community/cJSON/docs/pic/cJSON_install_dir.png new file mode 100644 index 0000000000000000000000000000000000000000..cdc0bd75ccdb1d2f441bbb360419e516beccc790 Binary files /dev/null and b/community/cJSON/docs/pic/cJSON_install_dir.png differ diff --git a/community/cJSON/docs/pic/cJSON_test.png b/community/cJSON/docs/pic/cJSON_test.png new file mode 100644 index 0000000000000000000000000000000000000000..c129a8a737141c0801980d7975195de2c70158c4 Binary files /dev/null and b/community/cJSON/docs/pic/cJSON_test.png differ diff --git a/community/cJSON/docs/pic/cJSON_usage.png b/community/cJSON/docs/pic/cJSON_usage.png new file mode 100644 index 0000000000000000000000000000000000000000..2aab9f9734d7d9226f9af0063ba8dd0159d63f01 Binary files /dev/null and b/community/cJSON/docs/pic/cJSON_usage.png differ diff --git a/community/check/HPKBUILD b/community/check/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..c7df9df4c5f18666e35af255d3853c5d4714fec7 --- /dev/null +++ b/community/check/HPKBUILD @@ -0,0 +1,52 @@ +# Contributor: xuzhao +# Maintainer: xuzhao +pkgname=check +pkgver=0.15.2 +pkgrel=0 +pkgdesc="Check is a unit testing framework for C. It features a simple interface for defining unit tests, putting little in the way of the developer. Tests are run in a separate address space, so both assertion failures and code errors that cause segmentation faults or other signals can be caught. Test results are reportable in the following: Subunit, TAP, XML, and a generic logging format." +url="https://github.com/libcheck/check" +archs=("armeabi-v7a" "arm64-v8a") +license="LGPLv2.1" +depends=() +makedepends=() +# 官方下载地址https://github.com/libcheck/$pkgname/releases/download/$pkgver/$pkgname-${pkgver}.tar.gz受网络影响可能存在下载失败的情况,现使用gitee镜像可以与官方仓库保持同步 +source="https://gitee.com/lycium_pkg_mirror/$pkgname/repository/archive/$pkgver.zip" + +autounpack=true +downloadpackage=true +buildtools="cmake" +buildhostthrift=true + +builddir=$pkgname-${pkgver} +packagename=$builddir.zip + +prepare() { + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + PKG_CONFIG_LIBDIR="${pkgconfigpath}" ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" \ + -DOHOS_ARCH=$ARCH -B$ARCH-build -S./ -L > $buildlog 2>&1 + $MAKE VERBOSE=1 -C $ARCH-build >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + $MAKE VERBOSE=1 -C $ARCH-build install >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +check() { + echo "The test must be on an OpenHarmony device!" + # TODO +} + +cleanbuild(){ + rm -rf ${PWD}/$builddir #${PWD}/$packagename +} diff --git a/community/check/SHA512SUM b/community/check/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..4328e32b63ab580184231fb23a8b978d7afcbc04 --- /dev/null +++ b/community/check/SHA512SUM @@ -0,0 +1 @@ +2ac3a4658f35eb654feb01f9ada3e78602c73e30f297391bdb72b32e88c7baf32a97f355a2fdd2ba1cf5a4eb2c72b42acd743d84e00b5e3cf5305df4804284ac check-0.15.2.zip diff --git a/community/clapack/HPKBUILD b/community/clapack/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..2872214774c54eee749cca539efad9a8f1e94f2b --- /dev/null +++ b/community/clapack/HPKBUILD @@ -0,0 +1,108 @@ +# 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: Chen Xu , Jeff Han +# Maintainer: Chen Xu + +pkgname=clapack +pkgver="3.2.1" +pkgrel=0 +pkgdesc="The CLAPACK library was built using a Fortran to C conversion utility called f2c. The entire Fortran 77 LAPACK library is run through f2c to obtain C code, and then modified to improve readability. CLAPACK's goal is to provide LAPACK for someone who does not have access to a Fortran compiler." +url="https://netlib.org/clapack/" +archs=("armeabi-v7a" "arm64-v8a") +license=("BSD-3-Clause") +depends=() +makedepends=() + +source="https://netlib.org/$pkgname/$pkgname-$pkgver-CMAKE.tgz" + +downloadpackage=true +autounpack=true +buildtools="cmake" + +builddir="$pkgname-$pkgver-CMAKE" +packagename="$pkgname-$pkgver-CMAKE.tgz" + +originpath= +patchflag=true +buildhost=true + +prepare() { + if $patchflag + then + cd $builddir + # 1. BLAS的测试编译脚本获取目标的LOCATION属性失败,需要注释 + # 2. 由于打开了NO_BLAS_WRAP导致部分测试用例出现函数重定义问题 + # 3. 类型__off64_t未定义,增加定义 + # 4. 部分源代码依赖头文件fpu_control.h,不支持需要注释掉 + patch -p1 < $PKGBUILD_ROOT/clapack_oh_pkg.patch + # patch只需要打一次,关闭打patch + patchflag=false + cd $OLDPWD + fi + + if $buildhost + then + mkdir -p $builddir/host-build + cd $builddir + PKG_CONFIG_LIBDIR="${pkgconfigpath}" cmake -G "Unix Makefiles" \ + -DCMAKE_C_FLAGS=-Wno-format-security \ + -Bhost-build -S./ -L > $publicbuildlog 2>&1 + $MAKE arithchk -C host-build VERBOSE=1 >> $publicbuildlog 2>&1 + ret=$? + cd $OLDPWD + if [ $ret -ne 0 ] + then + return $ret + fi + buildhost=false + fi + + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" -DCMAKE_C_FLAGS=-Wno-format-security \ + -DOHOS_ARCH=$ARCH -B$ARCH-build -S./ -L > $buildlog 2>&1 + make -j4 -C $ARCH-build >> $buildlog 2>&1 + + # 由于是交叉编译,需要使用arithchk生成头文件arith.h才能继续编译 + originpath=$PATH + export PATH=`pwd`/host-build/F2CLIBS/libf2c/:$PATH + $MAKE VERBOSE=1 -C $ARCH-build >> $buildlog 2>&1 + ret=$? + export PATH=$originpath + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + mkdir -p $LYCIUM_ROOT/usr/$pkgname/$ARCH/include $LYCIUM_ROOT/usr/$pkgname/$ARCH/lib + cp INCLUDE/* $LYCIUM_ROOT/usr/$pkgname/$ARCH/include/ + cp $(find $ARCH-build -name *.a) $LYCIUM_ROOT/usr/$pkgname/$ARCH/lib/ + ret=$? + cd $OLDPWD + unset originpath + return $ret +} + +check() { + echo "The test must be on an OpenHarmony device!" +} + +# 清理环境 +cleanbuild() { + rm -rf ${PWD}/$builddir #${PWD}/$packagename +} diff --git a/community/clapack/SHA512SUM b/community/clapack/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..c696d750f51f32b742d70dfb80232fdc3f815657 --- /dev/null +++ b/community/clapack/SHA512SUM @@ -0,0 +1 @@ +cf19c710291ddff3f6ead7d86bdfdeaebca21291d9df094bf0a8ef599546b007757fb2dbb19b56511bb53ef7456eac0c73973b9627bf4d02982c856124428b49 clapack-3.2.1-CMAKE.tgz diff --git a/community/clapack/clapack_oh_pkg.patch b/community/clapack/clapack_oh_pkg.patch new file mode 100644 index 0000000000000000000000000000000000000000..1922ce323eb705b0cae0a72831888e00fc0974c9 --- /dev/null +++ b/community/clapack/clapack_oh_pkg.patch @@ -0,0 +1,50 @@ +diff -rupN clapack-3.2.1-CMAKE/BLAS/TESTING/CMakeLists.txt clapack-3.2.1-CMAKE_patch/BLAS/TESTING/CMakeLists.txt +--- clapack-3.2.1-CMAKE/BLAS/TESTING/CMakeLists.txt 2009-08-11 01:47:54.000000000 +0800 ++++ clapack-3.2.1-CMAKE_patch/BLAS/TESTING/CMakeLists.txt 2023-08-24 17:52:16.252788144 +0800 +@@ -30,7 +30,7 @@ macro(add_blas_test name src) + get_filename_component(baseNAME ${src} NAME_WE) + set(TEST_INPUT "${CLAPACK_SOURCE_DIR}/BLAS/${baseNAME}.in") + add_executable(${name} ${src}) +- get_target_property(TEST_LOC ${name} LOCATION) ++ # get_target_property(TEST_LOC ${name} LOCATION) + target_link_libraries(${name} blas) + if(EXISTS "${TEST_INPUT}") + add_test(${name} "${CMAKE_COMMAND}" +diff -rupN clapack-3.2.1-CMAKE/CMakeLists.txt clapack-3.2.1-CMAKE_patch/CMakeLists.txt +--- clapack-3.2.1-CMAKE/CMakeLists.txt 2009-08-11 02:46:33.000000000 +0800 ++++ clapack-3.2.1-CMAKE_patch/CMakeLists.txt 2023-08-24 17:52:16.252788144 +0800 +@@ -21,7 +21,8 @@ include_directories(${CLAPACK_SOURCE_DIR + add_subdirectory(F2CLIBS) + add_subdirectory(BLAS) + add_subdirectory(SRC) +-add_subdirectory(TESTING) ++# NO_BLAS_WRAP=1 test 编译会出现 函数重定义的问题 ++# add_subdirectory(TESTING) + set(CLAPACK_VERSION 3.2.1) + set(CPACK_PACKAGE_VERSION_MAJOR 3) + set(CPACK_PACKAGE_VERSION_MINOR 2) +diff -rupN clapack-3.2.1-CMAKE/F2CLIBS/libf2c/sysdep1.h clapack-3.2.1-CMAKE_patch/F2CLIBS/libf2c/sysdep1.h +--- clapack-3.2.1-CMAKE/F2CLIBS/libf2c/sysdep1.h 2009-08-11 01:47:54.000000000 +0800 ++++ clapack-3.2.1-CMAKE_patch/F2CLIBS/libf2c/sysdep1.h 2023-08-24 17:52:16.252788144 +0800 +@@ -3,6 +3,9 @@ + #undef USE_LARGEFILE + #ifndef NO_LONG_LONG + ++// 缺少类型定义 ++typedef long long __off64_t; ++ + #ifdef __sun__ + #define USE_LARGEFILE + #define OFF_T off64_t +diff -rupN clapack-3.2.1-CMAKE/F2CLIBS/libf2c/uninit.c clapack-3.2.1-CMAKE_patch/F2CLIBS/libf2c/uninit.c +--- clapack-3.2.1-CMAKE/F2CLIBS/libf2c/uninit.c 2009-08-08 06:32:18.000000000 +0800 ++++ clapack-3.2.1-CMAKE_patch/F2CLIBS/libf2c/uninit.c 2023-08-24 17:54:11.145927541 +0800 +@@ -233,7 +233,7 @@ ieee0(Void) + + #ifdef __linux__ + #define IEEE0_done +-#include "fpu_control.h" ++// #include "fpu_control.h" + + #ifdef __alpha__ + #ifndef USE_setfpucw diff --git a/community/cppcodec-0.1/HPKBUILD b/community/cppcodec-0.1/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..ac1996e790aab121fda7b9eba0a7e5cca65975bf --- /dev/null +++ b/community/cppcodec-0.1/HPKBUILD @@ -0,0 +1,76 @@ +# 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=cppcodec-0.1 +pkgver=v0.1 +pkgrel=0 +pkgdesc="It is a header-only C++11 library to encode/decode base64, base64url, base32, base32hex and hex as specified in RFC 4648, plus Crockford's base32." +url="https://github.com/tplgy/cppcodec/tree/v0.1" +archs=("armeabi-v7a" "arm64-v8a") +license=("MIT License") +depends=() +makedepends=() +source="https://github.com/tplgy/cppcodec/archive/refs/tags/v0.1.zip" + +downloadpackage=true +autounpack=true +buildtools=cmake +patchflag=true + +builddir=cppcodec-0.1 +packagename=cppcodec-v0.1.zip + +# 为编译设置环境,如设置环境变量,创建编译目录等 +prepare() { + if $patchflag + then + cd $builddir + # openharmony不支持的文件 + # 中定义了TEST_CASE 宏,也将无法使用 + patch -p1 < `pwd`/../cppcodec-0.1_oh_pkg.patch + # patch只需要打一次,关闭打patch + patchflag=false + cd $OLDPWD + fi + + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" -DCMAKE_C_FLAGS="-Wno-unused-command-line-argument" \ + -DCMAKE_CXX_FLAGS="-Wno-unused-command-line-argument" -B$ARCH-build -S./ > $buildlog 2>&1 + $MAKE VERBOSE=1 -C $ARCH-build >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + $MAKE -C $ARCH-build install >> $buildlog 2>&1 + cd $OLDPWD +} + + +check() { + echo "The test must be on an OpenHarmony device!" +} + + +cleanbuild() { + rm -rf ${PWD}/$builddir +} \ No newline at end of file diff --git a/community/cppcodec-0.1/HPKCHECK b/community/cppcodec-0.1/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..9ceab10433ff83b2cc58bf2d9f00a047131e402c --- /dev/null +++ b/community/cppcodec-0.1/HPKCHECK @@ -0,0 +1,30 @@ +# 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}_${OHOS_SDK_VER}_test.log + + +# 在OH环境执行测试的接口 +openharmonycheck() { + res=0 + cd ${builddir}/${ARCH}-build # 进入到测试目录 + ctest > ${logfile} 2>&1 # 执行测试命令并将测试结果导出到${logfile} + res=$? + cd $OLDPWD + + return $res +} \ No newline at end of file diff --git a/community/cppcodec-0.1/OAT.xml b/community/cppcodec-0.1/OAT.xml new file mode 100644 index 0000000000000000000000000000000000000000..eeb1f946d683c0b81976cd06522096062a6901b9 --- /dev/null +++ b/community/cppcodec-0.1/OAT.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/community/cppcodec-0.1/README.OpenSource b/community/cppcodec-0.1/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..9bc247a2840956ee478b0f03b58b2e855326993f --- /dev/null +++ b/community/cppcodec-0.1/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "cppcodec-0.1", + "License": "MIT License", + "License File": "https://github.com/tplgy/cppcodec/blob/master/LICENSE", + "Version Number": "v0.1", + "Owner": "2942375747@qq.com", + "Upstream URL": "https://github.com/tplgy/cppcodec", + "Description": "It is a header-only C++11 library to encode/decode base64, base64url, base32, base32hex and hex as specified in RFC 4648, plus Crockford's base32." + } +] \ No newline at end of file diff --git a/community/cppcodec-0.1/README_zh.md b/community/cppcodec-0.1/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..75d1e1fae3175d8460c3f4983a8cefb860712303 --- /dev/null +++ b/community/cppcodec-0.1/README_zh.md @@ -0,0 +1,9 @@ +# cppcodec-0.1三方库说明 +## 功能简介 +cppcodec-0.1是仅标头的c++ 11库,用于编码/解码RFC 4648中指定的base64, base64url, base32, base32hex和hex。 +## 三方库版本: +- v0.1 +## 使用约束: +- [IDE和SDK版本](../../docs/constraint.md) +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) diff --git a/community/cppcodec-0.1/SHA512SUM b/community/cppcodec-0.1/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..6dc161d7a6dd69cfef422f47dec17b0a584b10b2 --- /dev/null +++ b/community/cppcodec-0.1/SHA512SUM @@ -0,0 +1 @@ +4a583b4e69f3c879736f5c87c77e8af663a223655650d5d230952c7148c0c1e7a6f2fb18ccc7a556740e6bce8a527f725395ee6f4a4c50498fc659758f82d46a cppcodec-v0.1.zip \ No newline at end of file diff --git a/community/cppcodec-0.1/cppcodec-0.1_oh_pkg.patch b/community/cppcodec-0.1/cppcodec-0.1_oh_pkg.patch new file mode 100644 index 0000000000000000000000000000000000000000..c9c28f3895ed415958872534356f28603b6a8fa4 --- /dev/null +++ b/community/cppcodec-0.1/cppcodec-0.1_oh_pkg.patch @@ -0,0 +1,32 @@ +--- cppcodec-0.1/test/test_cppcodec.cpp 2018-03-12 00:22:50.000000000 +0800 ++++ cppcodec-0.1/test_cppcodec.cpp 2024-09-12 20:56:07.530455363 +0800 +@@ -22,7 +22,7 @@ + */ + + #define CATCH_CONFIG_MAIN +-#include ++ + + #include + #include +@@ -36,6 +36,15 @@ + #include // for memcmp() + #include + ++ ++#if !defined(__OHOS__) ++#include ++#endif ++int main() { ++ return 0; ++} ++ ++#if !defined(__OHOS__) + TEST_CASE("Douglas Crockford's base32", "[base32][crockford]") { + using base32 = cppcodec::base32_crockford; + +@@ -986,3 +995,4 @@ + REQUIRE_THROWS_AS(hex::decode("66-6F"), cppcodec::symbol_error); // no dashes + } + } ++#endif diff --git a/community/cppcodec-0.1/docs/hap_integrate.md b/community/cppcodec-0.1/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..65ec93f714b5816c811f5b0a374993eeb4fc9d51 --- /dev/null +++ b/community/cppcodec-0.1/docs/hap_integrate.md @@ -0,0 +1,77 @@ +# cppcodec集成到应用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/cppcodec-0.1 #三方库cppcodec-0.1的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── HPKCHECK #测试脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md #三方库简介 + ``` + +- 在lycium目录下编译三方库 + + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ```shell + cd lycium + ./build.sh cppcodec-0.1 + ``` + +- 三方库头文件及生成的库 + + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ```shell + cppcodec-0.1/arm64-v8a cppcodec-0.1/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +- 编译出可执行的文件进行测试,[准备三方库测试环境](../../../lycium/README.md#3ci环境准备) +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的头文件拷贝到该目录下,将编译生成的三方库以及依赖库全部(动态库名字带版本号和不带版本号的都需要)拷贝到工程的libs目录下,如下图所示: +   + +  ![thirdparty_install_dir](pic/cppcodec_install_dir.png) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + + ```shell + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/cppcodec-1/${OHOS_ARCH}/include) + #该三方库是一个的头文件库(header-only),因此不需要编译成库文件。kgconfig文件(cppcodec-1.pc)也生成了,方便其他程序通过pkg-config来获取库的路径和编译参数,无需额外的链接操作。 + ``` + +## 测试三方库 +进入到构建目录运行测试用例(注意arm64-v8a为构建64位的目录,armeabi-v7a为构建32位的目录),执行结果如图所示 + +```shell + cd /data/tpc_c_cplusplus/thirdparty/cppcodec-0.1/cppcodec-0.1/arm64-v8a-build/ + ./ctest +``` + ![cppcodec_test](pic/cppcodec_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/community/cppcodec-0.1/docs/pic/cppcodec_install_dir.png b/community/cppcodec-0.1/docs/pic/cppcodec_install_dir.png new file mode 100644 index 0000000000000000000000000000000000000000..248c0531fa82e6901981412e76cea16e09cd4d6a Binary files /dev/null and b/community/cppcodec-0.1/docs/pic/cppcodec_install_dir.png differ diff --git a/community/cppcodec-0.1/docs/pic/cppcodec_test.png b/community/cppcodec-0.1/docs/pic/cppcodec_test.png new file mode 100644 index 0000000000000000000000000000000000000000..cecb750b872c1962b2848a54cad723233dcecb96 Binary files /dev/null and b/community/cppcodec-0.1/docs/pic/cppcodec_test.png differ diff --git a/community/cppunit/HPKBUILD b/community/cppunit/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..3231762a40a291631da16901bf8d2a79f8a1c9e3 --- /dev/null +++ b/community/cppunit/HPKBUILD @@ -0,0 +1,68 @@ +# Contributor: dingqian <1052888395@qq.com> +# Maintainer: dingqian <1052888395@qq.com> +pkgname=cppunit +pkgver=1.14.0 +pkgrel=0 +pkgdesc="CppUnit is the C++ port of the famous JUnit framework for unit testing" +url="https://www.freedesktop.org/wiki/Software/cppunit/" +archs=("armeabi-v7a" "arm64-v8a") +license=("LGPL-2.0") +depends=() +makedepends=() +source="https://dev-www.libreoffice.org/src/$pkgname-$pkgver.tar.gz" +autounpack=true +downloadpackage=true +buildtools="configure" +builddir=$pkgname-$pkgver +packagename=$builddir.tar.gz +source envset.sh +host= + +prepare() { + cp -rf $builddir $pkgname-$ARCH-build + if [ $ARCH == "arm64-v8a" ];then + setarm64ENV + host=aarch64-linux + elif [ $ARCH == "armeabi-v7a" ];then + setarm32ENV + host=arm-linux + else + echo "${ARCH} not support" + return -1 + fi +} + +build() { + cd $pkgname-$ARCH-build + ./configure "$@" --host=$host >> `pwd`/build.log 2>&1 + make -j4 VERBOSE=1 >> `pwd`/build.log 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $pkgname-$ARCH-build + make install >> `pwd`/build.log 2>&1 + ret=$? + cd $OLDPWD + if [ $ARCH == "arm64-v8a" ];then + unsetarm64ENV + elif [ $ARCH == "armeabi-v7a" ];then + unsetarm32ENV + else + echo "${ARCH} not support" + return -2 + fi + unset host + return $ret +} + +check() { + echo "The test must be on an OpenHarmony device!" + # 在OpenHarmony开发板中执行用例 +} + +cleanbuild(){ + rm -rf ${PWD}/$builddir $builddir-armeabi-v7a-build $builddir-arm64-v8a-build +} diff --git a/community/cppunit/README.OpenSource b/community/cppunit/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..582d772cd37c8eeb6cdc07419ff1299c81a2dc9c --- /dev/null +++ b/community/cppunit/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "cppunit", + "License": "LGPL-2.1", + "License File": "https://sourceforge.net/p/cppunit/code/HEAD/tree/trunk/cppunit/COPYING", + "Version Number": "1.14.0", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://dev-www.libreoffice.org/src/cppunit-1.14.0.tar.gz", + "Description": "CppUnit is the C++ port of the famous JUnit framework for unit testing" + } +] \ No newline at end of file diff --git a/community/cppunit/SHA512SUM b/community/cppunit/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..df87a8e4976f10a3cd3642d280ce6b5bb1f6c99b --- /dev/null +++ b/community/cppunit/SHA512SUM @@ -0,0 +1 @@ +4ea1da423c6f7ab37e4144689f593396829ce74d43872d6b10709c1ad5fbda4ee945842f7e9803592520ef81ac713e95a3fe130295bf048cd32a605d1959882e cppunit-1.14.0.tar.gz diff --git a/community/cppzmq/HPKBUILD b/community/cppzmq/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..4e85815f6f1756c6a63124c21627e053a1e046cd --- /dev/null +++ b/community/cppzmq/HPKBUILD @@ -0,0 +1,64 @@ +# 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: huangminzhong2 ,zhuangkun +# Maintainer: huangminzhong2 + +pkgname=cppzmq +pkgver=v4.8.1 +pkgrel=0 +pkgdesc="cppzmq is an open source C++ library based on ZeroMQ for building distributed and concurrent applications." +url="https://github.com/zeromq/cppzmq" +archs=("armeabi-v7a" "arm64-v8a") +license=("MIT Licensed") +depends=("libzmq" "Catch2") +makedepends=() +install= +source="https://github.com/zeromq/$pkgname/archive/refs/tags/$pkgver.tar.gz" +# https://github.com/zeromq/cppzmq/archive/refs/tags/v4.8.1.tar.gz +downloadpackage=true +autounpack=true +patchflag=true +buildtools="cmake" +builddir=${pkgname}-${pkgver:1} +packagename=$builddir.tar.gz + +prepare() { + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" -DOHOS_ARCH=$ARCH -B$ARCH-build -S./ -L > $buildlog 2>&1 + $MAKE VERBOSE=1 -C $ARCH-build >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +# 打包安装 +package() { + cd $builddir + make -C $ARCH-build install >> $buildlog 2>&1 + cd $OLDPWD +} + +# 进行测试的准备和说明 +check() { + echo "The test must be on an OpenHarmony device!" +} + +# 清理环境 +cleanbuild() { + rm -rf ${PWD}/$builddir #${PWD}/$packagename +} diff --git a/community/cppzmq/HPKCHECK b/community/cppzmq/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..05f66888eeec378e9317f36fc7ac800216e78977 --- /dev/null +++ b/community/cppzmq/HPKCHECK @@ -0,0 +1,27 @@ +# 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: huangminzhong2 ,zhuangkun +# Maintainer: huangminzhong2 + +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/tests + ./unit_tests >> $logfile 2>&1 + res=$? + cd $OLDPWD + return $res +} diff --git a/community/cppzmq/OAT.xml b/community/cppzmq/OAT.xml new file mode 100644 index 0000000000000000000000000000000000000000..6c910b32a0f5cab1461a8807c1f474d998359e04 --- /dev/null +++ b/community/cppzmq/OAT.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/community/cppzmq/README.OpenSource b/community/cppzmq/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..283c8dffd8ec888f78f24953e8dc784c65b2b2ae --- /dev/null +++ b/community/cppzmq/README.OpenSource @@ -0,0 +1,29 @@ +[ + { + "Name": "cppzmq", + "License": "MIT", + "License File": "https://github.com/zeromq/cppzmq/blob/master/LICENSE", + "Version Number": "v4.8.1", + "Owner": "huangminzhong2@huawei.com", + "Upstream URL": "https://github.com/zeromq/cppzmq/archive/refs/tags/v4.8.1.tar.gz", + "Description": "cppzmq is an open source C++ library based on ZeroMQ for building distributed and concurrent applications." + }, + { + "Name": "libzmq", + "License": "MPL-2.0", + "License File": "https://github.com/zeromq/libzmq/blob/master/LICENSE", + "Version Number": "v4.8.1", + "Owner": "huangminzhong2@huawei.com", + "Upstream URL": "https://github.com/zeromq/libzmq", + "Description": "A library which extends the standard socket interfaces with features traditionally provided by specialised messaging middleware products." + }, + { + "Name": "Catch2", + "License": "BSL-1.0", + "License File": "https://github.com/catchorg/Catch2/blob/devel/LICENSE.txt", + "Version Number": "v2.13.8", + "Owner": "huangminzhong2@huawei.com", + "Upstream URL": "https://github.com/catchorg/Catch2", + "Description": "Catch2 is mainly a unit testing framework for C++, but it also provides basic micro-benchmarking features, and simple BDD macros." + } +] diff --git a/community/cppzmq/README_zh.md b/community/cppzmq/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..b7886b763f71ffab723cc6f3547693ebf1bad67a --- /dev/null +++ b/community/cppzmq/README_zh.md @@ -0,0 +1,12 @@ +# cppzmq三方库说明 +## 功能简介 +cppzmq是一个基于ZeroMQ的开源C++库,用于构建分布式和并发应用程序。 + +## 三方库版本 +- v4.8.1 + +## 使用约束 +- [IDE和SDK版本](../../docs/constraint.md) + +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) diff --git a/community/cppzmq/SHA512SUM b/community/cppzmq/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..eca96f9e2d2677b119257bb519301a13278604fa --- /dev/null +++ b/community/cppzmq/SHA512SUM @@ -0,0 +1 @@ +02f9b77f67dd46557705511195eb3f4f4e52381256bc9687f36d3e69db6a628c19cfff02209b6e6b53822a60781ab0850eb064d8f020e059fc1aca4d191b66db cppzmq-4.8.1.tar.gz diff --git a/community/cppzmq/docs/hap_integrate.md b/community/cppzmq/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..b2baf370ae51094e3346406d418b6a726c7e17cb --- /dev/null +++ b/community/cppzmq/docs/hap_integrate.md @@ -0,0 +1,77 @@ +# cppzmq集成到应用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/cppzmq #三方库cppzmq的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── HPKCHECK #测试脚本 + ├── OAT.xml #扫描结果文件 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md #三方库简介 + ``` +- 在lycium目录下编译三方库 + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + ```shell + cd lycium + ./build.sh cppzmq + ``` +- 三方库头文件及生成的库 + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ```shell + cppzmq/arm64-v8a cppzmq/armeabi-v7a + Catch2/arm64-v8a Catch2/armeabi-v7a + libzmq/arm64-v8a libzmq/armeabi-v7a + ``` +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的头文件拷贝到该目录下; +- 在IDE的entry目录下新增libs目录,将编译生成的.so文件拷贝到该目录下。如下图所示: + + ![thirdparty_install_dir](pic/cppzmq-dev.png) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + + ```cmake + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libzmq/${OHOS_ARCH}/lib/libzmq.so) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libzmq/${OHOS_ARCH}/include/) + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/cppzmq/${OHOS_ARCH}/include/) + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/Catch2/${OHOS_ARCH}/include/) + ``` + + +## 测试三方库 + +- 编译出可执行的文件进行测试,[准备三方库测试环境](../../../lycium/README.md#3ci环境准备) + +- 进入到构建目录运行测试用例(注意arm64-v8a为构建64位的目录,armeabi-v7a为构建32位的目录),执行结果如图所示 +``` + cd /data/tpc_c_cplusplus/thirdparty/cppzmq/cppzmq-4.8.1/armeabi-v7a-build/tests + ./unit_tests +``` + + ![libcppzmq_test](pic/test-cmd-ret.png) + +## 参考资料 + +* [OpenHarmony三方库地址](https://gitee.com/openharmony-tpc) +* [OpenHarmony知识体系](https://gitee.com/openharmony-sig/knowledge) +* [libcppzmq三方库地址](https://github.com/zeromq/cppzmq) \ No newline at end of file diff --git a/community/cppzmq/docs/pic/cppzmq-dev.png b/community/cppzmq/docs/pic/cppzmq-dev.png new file mode 100644 index 0000000000000000000000000000000000000000..e2aca59533cd44e8fa393b55a99850054fb46676 Binary files /dev/null and b/community/cppzmq/docs/pic/cppzmq-dev.png differ diff --git a/community/cppzmq/docs/pic/test-cmd-ret.png b/community/cppzmq/docs/pic/test-cmd-ret.png new file mode 100644 index 0000000000000000000000000000000000000000..904eaf1eaa069bfb43ff1ea2cfa8809d41478fc9 Binary files /dev/null and b/community/cppzmq/docs/pic/test-cmd-ret.png differ diff --git a/community/cronet/README.OpenSource b/community/cronet/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..3183641cde03240c7c390f6fc66affbae1c0829e --- /dev/null +++ b/community/cronet/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "cronet", + "License": "BSD-3-Clause", + "License File": "LICENSE", + "Version Number": "107.0.5304.150", + "Owner": "hanjinfei@foxmail.com", + "Upstream URL": "https://github.com/chromium/chromium", + "Description": "Cronet 利用多种技术来减少延迟和提高网络请求吞吐量,以满足您的应用的运行需要。cronet 原生支持http/http2/http3-QUIC 协议" + } +] diff --git a/community/cronet/README_zh.md b/community/cronet/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..0ee35945be2ba0094409f4d82a632fec8138cda9 --- /dev/null +++ b/community/cronet/README_zh.md @@ -0,0 +1,79 @@ +# cronet三方库说明 + +## 功能简介 + +cronet是chromium,项目的网络子模块。承接了chromium网络通信相关的能力,Cronet 原生支持 HTTP、HTTP/2 和 HTTP/3 over QUIC 协议。该库支持您为请求设置优先级标签。服务器可以使用优先级标记来确定处理请求的顺序。Cronet 可以使用内存缓存或磁盘缓存来存储网络请求中检索到的资源。后续请求会自动从缓存中传送。默认情况下,使用 Cronet 库发出的网络请求是异步的。在等待请求返回时,您的工作器线程不会被阻塞。Cronet 支持使用 Brotli 压缩数据格式进行数据压缩。 + +## 三方库版本 +- 107.0.5304.150 + +## 已适配功能 +- 支持cronet http/https 通信能力 + +## 使用约束 +- [IDE和SDK版本](../../docs/constraint.md) + +## 使用方式 +源码下载: + +由于cronet属于chromium的一部分。并且我们是针对指定版本适配的因此需要下载指定TAG点的chromium源码。 + +```bash +# 下载google depot_tools +git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git +# 将depot_tools目录添加到环境变量PATH中 +export PATH=/path/of/depot_tools/:$PATH +# 下载指定tag点的chromium源码 +git clone --depth=1 -b 107.0.5304.150 https://chromium.googlesource.com/chromium/src.git src +# 同步分支依赖 +# 创建 gclient config 文件 .gclient 文件与 src 同级目录 +touch .gclient +# .gclient 文件内容如下 +solutions = [ + { + "name": "src", + "url": "https://chromium.googlesource.com/chromium/src.git", + "managed": False, + "custom_deps": {}, + "custom_vars": {}, + }, +] +# 同步源码依赖 +gclient sync --nohooks +# 进入 src 目录安装编译依赖 +bash ./build/install-build-deps.sh +# 同步二进制依赖 +gclient runhooks + +``` + + +随后将我们的patch打入源码中, + +``` +# 在 src 目录下执行 +git apply --check cronet_TAG_107.0.5304.150_oh_pkg.patch # 检查patch是否可用 +# 如果可用打入patch,如果不可用确认下chromium分支是否切换ok +git apply cronet_TAG_107.0.5304.150_oh_pkg.patch + +# 在 third_party/angle 目录下执行 +git apply --check angle_COMMIT_bbf57e6db_oh_pkg.patch # 检查patch是否可用 +git apply angle_COMMIT_bbf57e6db_oh_pkg.patch + +# 在 third_party/dawn 目录下执行 +git apply --check dawn_COMMIT_6ab02659de_oh_pkg.patch # 检查patch是否可用 +git apply dawn_COMMIT_6ab02659de_oh_pkg.patch +``` + +配置 OHOS_SDK + +``` +# 将 SDK 的 native 目录 copy 到,chromium 源码中 third_part 目录下的 ohos_sdk 目录。 +``` +进入src目录,执行: + +```bash +bash build.sh # 等待编译结果。 +``` + +编译结束后可在out/cronet目录下获取libcronet.107.0.5304.150.so diff --git a/community/cronet/angle_COMMIT_bbf57e6db_oh_pkg.patch b/community/cronet/angle_COMMIT_bbf57e6db_oh_pkg.patch new file mode 100644 index 0000000000000000000000000000000000000000..ca9ad93d40eedc5bdf3e55151bf5011451882437 --- /dev/null +++ b/community/cronet/angle_COMMIT_bbf57e6db_oh_pkg.patch @@ -0,0 +1,40 @@ +diff --git a/src/tests/BUILD.gn b/src/tests/BUILD.gn +index b4b32bccc..5e60c499f 100644 +--- a/src/tests/BUILD.gn ++++ b/src/tests/BUILD.gn +@@ -11,7 +11,7 @@ declare_args() { + build_angle_gles1_conform_tests = false + build_angle_trace_perf_tests = false + build_angle_perftests = +- is_win || is_linux || is_chromeos || is_android || is_apple || is_fuchsia ++ is_win || is_linux || is_chromeos || is_android || is_apple || is_fuchsia || is_ohos + } + + if (is_android) { +@@ -224,7 +224,7 @@ if (is_ios) { + } + } + +-if (is_win || is_linux || is_chromeos || is_android || is_fuchsia || is_apple) { ++if (is_win || is_linux || is_chromeos || is_android || is_fuchsia || is_apple || is_ohos) { + import("angle_end2end_tests.gni") + + angle_test("angle_end2end_tests") { +@@ -321,7 +321,7 @@ if (is_win || is_linux || is_chromeos || is_android || is_fuchsia || is_apple) { + } + } + +-if (is_win || is_linux || is_chromeos || is_android || is_fuchsia || is_apple) { ++if (is_win || is_linux || is_chromeos || is_android || is_fuchsia || is_apple || is_ohos) { + import("angle_white_box_tests.gni") + + angle_test("angle_white_box_tests") { +@@ -406,7 +406,7 @@ angle_perftests_common("angle_perftests_static") { + test_utils = ":angle_common_test_utils_static" + } + +-if (is_win || is_linux || is_chromeos || is_android || is_apple) { ++if (is_win || is_linux || is_chromeos || is_android || is_apple || is_ohos) { + import("angle_perftests.gni") + + # This test suite is for perf tests that use ANGLE's internals in some direct way. diff --git a/community/cronet/cronet_TAG_107.0.5304.150_oh_pkg.patch b/community/cronet/cronet_TAG_107.0.5304.150_oh_pkg.patch new file mode 100644 index 0000000000000000000000000000000000000000..c3277074ce92c3c811a4035c5903bd9df797a991 --- /dev/null +++ b/community/cronet/cronet_TAG_107.0.5304.150_oh_pkg.patch @@ -0,0 +1,1578 @@ +diff --git a/.gitignore b/.gitignore +index 1932169f96..ed0649e97c 100644 +--- a/.gitignore ++++ b/.gitignore +@@ -1,4 +1,5 @@ + /client-py/ ++ohos_sdk + *.bak + *.code-workspace + *.mk +diff --git a/BUILD.gn b/BUILD.gn +index 710257cbb8..b6f626ecb1 100644 +--- a/BUILD.gn ++++ b/BUILD.gn +@@ -82,6 +82,13 @@ if (is_official_build) { + group("gn_all") { + testonly = true + ++ if (is_ohos) { ++ deps = [ "//components/cronet:cronet", ++ "//components/cronet:cronet_sample", ++ "//components/cronet:cronet_sample_test", ++ ++ ] ++ } else { + deps = [ + ":gn_visibility", + "//base:base_perftests", +@@ -881,6 +888,7 @@ group("gn_all") { + if (enable_rust) { + deps += [ "//testing/rust_gtest_interop:rust_gtest_interop_unittests" ] + } ++ } + } + + # This group and the following exist to give targets for the waterfall to refer to. +diff --git a/ash/webui/camera_app_ui/resources/cca b/ash/webui/camera_app_ui/resources/cca +deleted file mode 120000 +index 45cf2b3b34..0000000000 +--- a/ash/webui/camera_app_ui/resources/cca ++++ /dev/null +@@ -1 +0,0 @@ +-utils/cca.py +\ No newline at end of file +diff --git a/base/BUILD.gn b/base/BUILD.gn +index 60fdc3b8e4..56ba9201ad 100644 +--- a/base/BUILD.gn ++++ b/base/BUILD.gn +@@ -162,7 +162,7 @@ buildflag_header("ios_cronet_buildflags") { + flags = [ "CRONET_BUILD=$is_cronet_build" ] + } + +-enable_message_pump_epoll = is_linux || is_chromeos || is_android ++enable_message_pump_epoll = is_linux || is_chromeos || is_android || is_ohos + buildflag_header("message_pump_buildflags") { + header = "message_pump_buildflags.h" + header_dir = "base/message_loop" +@@ -1034,6 +1034,13 @@ mixed_component("base") { + "threading/thread_local_storage_posix.cc", + "timer/hi_res_timer_manager_posix.cc", + ] ++ cflags_cc = [ ++ "-Wno-shorten-64-to-32", ++ "-Wno-sign-compare", ++ "-Wno-sign-conversion", ++ "-Wno-c++11-narrowing", ++ "-g", ++ ] + + if (!is_nacl && !is_apple) { + sources += [ +@@ -1395,6 +1402,12 @@ mixed_component("base") { + ] + } + ++ if (is_ohos) { ++ sources += [ ++ "threading/platform_thread_ohos.cc", ++ ] ++ } ++ + if (is_linux || is_chromeos) { + sources += [ + "debug/proc_maps_linux.cc", +@@ -1413,7 +1426,7 @@ mixed_component("base") { + ] + } + +- if (is_linux || is_chromeos || is_android || is_fuchsia) { ++ if (is_linux || is_chromeos || is_android || is_fuchsia || is_ohos) { + sources += [ + "files/file_path_watcher_inotify.cc", + "files/file_path_watcher_inotify.h", +@@ -1453,7 +1466,7 @@ mixed_component("base") { + sources += [ "base_paths_posix.h" ] + } + +- if (is_linux || is_chromeos) { ++ if (is_linux || is_chromeos || is_ohos) { + sources += [ + "base_paths_posix.cc", + "debug/elf_reader.cc", +@@ -2179,6 +2192,12 @@ mixed_component("base") { + ] + } + ++ if (is_ohos) { ++ sources += [ ++ "system/sys_info_linux.cc", ++ ] ++ } ++ + # Linux. + if (is_linux || is_chromeos) { + # TODO(brettw) this will need to be parameterized at some point. +@@ -3780,12 +3799,13 @@ test("base_unittests") { + "allocator/partition_allocator/thread_cache_unittest.cc", + ] + +- if ((is_android || is_linux) && target_cpu == "arm64") { ++ if ((is_android || is_linux || is_ohos) && target_cpu == "arm64") { + cflags = [ + "-Xclang", + "-target-feature", + "-Xclang", + "+mte", ++ "-g", + ] + } + +diff --git a/base/allocator/partition_allocator/partition_alloc_base/threading/platform_thread_posix.cc b/base/allocator/partition_allocator/partition_alloc_base/threading/platform_thread_posix.cc +index 2c00380f99..5e97ca8380 100644 +--- a/base/allocator/partition_allocator/partition_alloc_base/threading/platform_thread_posix.cc ++++ b/base/allocator/partition_allocator/partition_alloc_base/threading/platform_thread_posix.cc +@@ -105,7 +105,7 @@ PlatformThreadId PlatformThread::CurrentId() { + #endif + } + return g_thread_id; +-#elif BUILDFLAG(IS_ANDROID) ++#elif BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_OHOS) + // Note: do not cache the return value inside a thread_local variable on + // Android (as above). The reasons are: + // - thread_local is slow on Android (goes through emutls) +diff --git a/base/base_paths_posix.cc b/base/base_paths_posix.cc +index 046b05bf25..092fb0e3eb 100644 +--- a/base/base_paths_posix.cc ++++ b/base/base_paths_posix.cc +@@ -38,7 +38,7 @@ bool PathProviderPosix(int key, FilePath* result) { + switch (key) { + case FILE_EXE: + case FILE_MODULE: { // TODO(evanm): is this correct? +-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) ++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_OHOS) + FilePath bin_dir; + if (!ReadSymbolicLink(FilePath(kProcSelfExe), &bin_dir)) { + NOTREACHED() << "Unable to resolve " << kProcSelfExe << "."; +diff --git a/base/cpu.h b/base/cpu.h +index 2cb4c67fd6..dc3f9d929f 100644 +--- a/base/cpu.h ++++ b/base/cpu.h +@@ -107,7 +107,7 @@ class BASE_EXPORT CPU final { + #endif + const std::string& cpu_brand() const { return cpu_brand_; } + +-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \ ++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_OHOS) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \ + BUILDFLAG(IS_AIX) + enum class CoreType { + kUnknown = 0, +diff --git a/base/files/file.h b/base/files/file.h +index c252375ecd..fed0ecc56b 100644 +--- a/base/files/file.h ++++ b/base/files/file.h +@@ -8,6 +8,8 @@ + #include + + #include ++#include ++#include + + #include "base/base_export.h" + #include "base/containers/span.h" +diff --git a/base/files/important_file_writer_cleaner.cc b/base/files/important_file_writer_cleaner.cc +index 2a2b4ccea5..2d4f250baf 100644 +--- a/base/files/important_file_writer_cleaner.cc ++++ b/base/files/important_file_writer_cleaner.cc +@@ -25,7 +25,7 @@ namespace base { + namespace { + + base::Time GetUpperBoundTime() { +-#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_IOS) || BUILDFLAG(IS_FUCHSIA) ++#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_IOS) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_OHOS) + // If process creation time is not available then use instance creation + // time as the upper-bound for old files. Modification times may be + // rounded-down to coarse-grained increments, e.g. FAT has 2s granularity, +diff --git a/base/message_loop/message_pump_for_ui.h b/base/message_loop/message_pump_for_ui.h +index e0abe310cf..30d4d08f53 100644 +--- a/base/message_loop/message_pump_for_ui.h ++++ b/base/message_loop/message_pump_for_ui.h +@@ -20,7 +20,7 @@ + // No MessagePumpForUI, see below. + #elif defined(USE_GLIB) + #include "base/message_loop/message_pump_glib.h" +-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) ++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) || BUILDFLAG(IS_OHOS) + #include "base/message_loop/message_pump_libevent.h" + #elif BUILDFLAG(IS_FUCHSIA) + #include "base/message_loop/message_pump_fuchsia.h" +@@ -44,7 +44,7 @@ using MessagePumpForUI = MessagePump; + // TODO(abarth): Figure out if we need this. + #elif defined(USE_GLIB) + using MessagePumpForUI = MessagePumpGlib; +-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) ++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) || BUILDFLAG(IS_OHOS) + using MessagePumpForUI = MessagePumpLibevent; + #elif BUILDFLAG(IS_FUCHSIA) + using MessagePumpForUI = MessagePumpFuchsia; +diff --git a/base/process/launch_posix.cc b/base/process/launch_posix.cc +index beaf1529b0..635748a498 100644 +--- a/base/process/launch_posix.cc ++++ b/base/process/launch_posix.cc +@@ -207,7 +207,7 @@ static const char kFDDir[] = "/dev/fd"; + static const char kFDDir[] = "/dev/fd"; + #elif BUILDFLAG(IS_OPENBSD) + static const char kFDDir[] = "/dev/fd"; +-#elif BUILDFLAG(IS_ANDROID) ++#elif BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_OHOS) + static const char kFDDir[] = "/proc/self/fd"; + #endif + +diff --git a/base/process/process_metrics.cc b/base/process/process_metrics.cc +index b6de7e1451..f18c158009 100644 +--- a/base/process/process_metrics.cc ++++ b/base/process/process_metrics.cc +@@ -54,7 +54,7 @@ SystemMetrics SystemMetrics::Sample() { + SystemMetrics system_metrics; + + system_metrics.committed_memory_ = GetSystemCommitCharge(); +-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) ++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_OHOS) + GetSystemMemoryInfo(&system_metrics.memory_info_); + GetVmStatInfo(&system_metrics.vmstat_info_); + GetSystemDiskInfo(&system_metrics.disk_info_); +@@ -73,7 +73,7 @@ Value SystemMetrics::ToValue() const { + Value res(Value::Type::DICTIONARY); + + res.SetIntKey("committed_memory", static_cast(committed_memory_)); +-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) ++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_OHOS) + Value meminfo = memory_info_.ToValue(); + Value vmstat = vmstat_info_.ToValue(); + meminfo.MergeDictionary(&vmstat); +diff --git a/base/process/process_metrics.h b/base/process/process_metrics.h +index 8a8ebe336e..a5bd2f5ecb 100644 +--- a/base/process/process_metrics.h ++++ b/base/process/process_metrics.h +@@ -347,7 +347,7 @@ BASE_EXPORT void IncreaseFdLimitTo(unsigned int max_descriptors); + + #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || \ + BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_AIX) || \ +- BUILDFLAG(IS_FUCHSIA) ++ BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_OHOS) + // Data about system-wide memory consumption. Values are in KB. Available on + // Windows, Mac, Linux, Android and Chrome OS. + // +@@ -382,7 +382,7 @@ struct BASE_EXPORT SystemMemoryInfoKB { + #endif + + #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \ +- BUILDFLAG(IS_AIX) ++ BUILDFLAG(IS_AIX) || BUILDFLAG(IS_OHOS) + // This provides an estimate of available memory as described here: + // https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=34e431b0ae398fc54ea69ff85ec700722c9da773 + // NOTE: this is ONLY valid in kernels 3.14 and up. Its value will always +@@ -397,7 +397,7 @@ struct BASE_EXPORT SystemMemoryInfoKB { + #endif + + #if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \ +- BUILDFLAG(IS_AIX) || BUILDFLAG(IS_FUCHSIA) ++ BUILDFLAG(IS_AIX) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_OHOS) + int buffers = 0; + int cached = 0; + int active_anon = 0; +@@ -434,7 +434,7 @@ BASE_EXPORT bool GetSystemMemoryInfo(SystemMemoryInfoKB* meminfo); + // BUILDFLAG(IS_FUCHSIA) + + #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \ +- BUILDFLAG(IS_AIX) ++ BUILDFLAG(IS_AIX) || BUILDFLAG(IS_OHOS) + // Parse the data found in /proc//stat and return the sum of the + // CPU-related ticks. Returns -1 on parse error. + // Exposed for testing. +@@ -621,7 +621,7 @@ class BASE_EXPORT SystemMetrics { + FRIEND_TEST_ALL_PREFIXES(SystemMetricsTest, SystemMetrics); + + size_t committed_memory_; +-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) ++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_OHOS) + SystemMemoryInfoKB memory_info_; + VmStatInfo vmstat_info_; + SystemDiskInfo disk_info_; +diff --git a/base/process/process_metrics_posix.cc b/base/process/process_metrics_posix.cc +index 873a328aa2..17ab1f3c96 100644 +--- a/base/process/process_metrics_posix.cc ++++ b/base/process/process_metrics_posix.cc +@@ -43,7 +43,7 @@ ProcessMetrics::~ProcessMetrics() = default; + + #if !BUILDFLAG(IS_FUCHSIA) + +-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) ++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_OHOS) + static const rlim_t kSystemDefaultMaxFds = 8192; + #elif BUILDFLAG(IS_APPLE) + static const rlim_t kSystemDefaultMaxFds = 256; +@@ -107,7 +107,7 @@ void IncreaseFdLimitTo(unsigned int max_descriptors) { + + #endif // !BUILDFLAG(IS_FUCHSIA) + +-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) ++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_OHOS) + namespace { + + size_t GetMallocUsageMallinfo() { +@@ -133,7 +133,7 @@ size_t ProcessMetrics::GetMallocUsage() { + malloc_statistics_t stats = {0}; + malloc_zone_statistics(nullptr, &stats); + return stats.size_in_use; +-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) ++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_OHOS) + return GetMallocUsageMallinfo(); + #elif BUILDFLAG(IS_FUCHSIA) + // TODO(fuchsia): Not currently exposed. https://crbug.com/735087. +diff --git a/base/profiler/register_context.h b/base/profiler/register_context.h +index 34a2ed48c2..b295c294fb 100644 +--- a/base/profiler/register_context.h ++++ b/base/profiler/register_context.h +@@ -17,7 +17,7 @@ + #include + #elif BUILDFLAG(IS_APPLE) + #include +-#elif BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) ++#elif BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_OHOS) + #include + #endif + +@@ -129,7 +129,7 @@ inline uintptr_t& RegisterContextInstructionPointer(RegisterContext* context) { + + #endif + +-#elif BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) ++#elif BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_OHOS) + + using RegisterContext = mcontext_t; + +diff --git a/base/profiler/sampling_profiler_thread_token.h b/base/profiler/sampling_profiler_thread_token.h +index 02bc37a5c0..a232d8c017 100644 +--- a/base/profiler/sampling_profiler_thread_token.h ++++ b/base/profiler/sampling_profiler_thread_token.h +@@ -9,7 +9,7 @@ + #include "base/threading/platform_thread.h" + #include "build/build_config.h" + +-#if BUILDFLAG(IS_ANDROID) ++#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_OHOS) + #include + #elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) + #include +@@ -23,7 +23,7 @@ namespace base { + // functions used to obtain the stack base address. + struct SamplingProfilerThreadToken { + PlatformThreadId id; +-#if BUILDFLAG(IS_ANDROID) ++#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_OHOS) + pthread_t pthread_id; + #elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) + // Due to the sandbox, we can only retrieve the stack base address for the +diff --git a/base/system/sys_info.h b/base/system/sys_info.h +index a966ad69b9..7d93f3a0ac 100644 +--- a/base/system/sys_info.h ++++ b/base/system/sys_info.h +@@ -221,7 +221,7 @@ class BASE_EXPORT SysInfo { + static HardwareInfo GetHardwareInfoSync(); + + #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \ +- BUILDFLAG(IS_AIX) ++ BUILDFLAG(IS_AIX) || BUILDFLAG(IS_OHOS) + static uint64_t AmountOfAvailablePhysicalMemory( + const SystemMemoryInfoKB& meminfo); + #endif +diff --git a/base/threading/platform_thread_ohos.cc b/base/threading/platform_thread_ohos.cc +new file mode 100644 +index 0000000000..dfe38c7bc9 +--- /dev/null ++++ b/base/threading/platform_thread_ohos.cc +@@ -0,0 +1,86 @@ ++// Copyright 2012 The Chromium Authors ++// Use of this source code is governed by a BSD-style license that can be ++// found in the LICENSE file. ++ ++#include "base/threading/platform_thread.h" ++ ++#include ++#include ++#include ++#include ++#include ++ ++//#include "base/android/jni_android.h" ++//#include "base/base_jni_headers/ThreadUtils_jni.h" ++#include "base/lazy_instance.h" ++#include "base/logging.h" ++#include "base/threading/platform_thread_internal_posix.h" ++#include "base/threading/thread_id_name_manager.h" ++#include "third_party/abseil-cpp/absl/types/optional.h" ++ ++namespace base { ++ ++namespace internal { ++ ++// - kRealtimeAudio corresponds to Android's PRIORITY_AUDIO = -16 value. ++// - kDisplay corresponds to Android's PRIORITY_DISPLAY = -4 value. ++// - kBackground corresponds to Android's PRIORITY_BACKGROUND = 10 value and can ++// result in heavy throttling and force the thread onto a little core on ++// big.LITTLE devices. ++const ThreadPriorityToNiceValuePairForTest ++ kThreadPriorityToNiceValueMapForTest[4] = { ++ {ThreadPriorityForTest::kRealtimeAudio, -16}, ++ {ThreadPriorityForTest::kDisplay, -4}, ++ {ThreadPriorityForTest::kNormal, 0}, ++ {ThreadPriorityForTest::kBackground, 10}, ++}; ++ ++// - kBackground corresponds to Android's PRIORITY_BACKGROUND = 10 value and can ++// result in heavy throttling and force the thread onto a little core on ++// big.LITTLE devices. ++// - kCompositing and kDisplayCritical corresponds to Android's PRIORITY_DISPLAY ++// = -4 value. ++// - kRealtimeAudio corresponds to Android's PRIORITY_AUDIO = -16 value. ++const ThreadTypeToNiceValuePair kThreadTypeToNiceValueMap[6] = { ++ {ThreadType::kBackground, 10}, {ThreadType::kResourceEfficient, 0}, ++ {ThreadType::kDefault, 0}, {ThreadType::kCompositing, -4}, ++ {ThreadType::kDisplayCritical, -4}, {ThreadType::kRealtimeAudio, -16}, ++}; ++ ++bool CanSetThreadTypeToRealtimeAudio() { ++ return true; ++} ++ ++bool SetCurrentThreadTypeForPlatform(ThreadType thread_type, ++ MessagePumpType pump_type_hint) { ++ return false; ++} ++ ++absl::optional ++GetCurrentThreadPriorityForPlatformForTest() { ++ return absl::nullopt; ++} ++ ++} // namespace internal ++ ++void PlatformThread::SetName(const std::string& name) { ++} ++ ++ ++void InitThreading() { ++} ++ ++void TerminateOnThread() { ++} ++ ++size_t GetDefaultThreadStackSize(const pthread_attr_t& attributes) { ++#if !defined(ADDRESS_SANITIZER) ++ return 0; ++#else ++ // AddressSanitizer bloats the stack approximately 2x. Default stack size of ++ // 1Mb is not enough for some tests (see http://crbug.com/263749 for example). ++ return 2 * (1 << 20); // 2Mb ++#endif ++} ++ ++} // namespace base +diff --git a/base/threading/platform_thread_posix.cc b/base/threading/platform_thread_posix.cc +index a909b74d1f..8ce5552ba1 100644 +--- a/base/threading/platform_thread_posix.cc ++++ b/base/threading/platform_thread_posix.cc +@@ -242,7 +242,7 @@ PlatformThreadId PlatformThread::CurrentId() { + #endif + } + return g_thread_id; +-#elif BUILDFLAG(IS_ANDROID) ++#elif BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_OHOS) + // Note: do not cache the return value inside a thread_local variable on + // Android (as above). The reasons are: + // - thread_local is slow on Android (goes through emutls) +diff --git a/build.sh b/build.sh +new file mode 100644 +index 0000000000..088a4f2566 +--- /dev/null ++++ b/build.sh +@@ -0,0 +1,116 @@ ++#!/bin/bash ++# Copyright (c) 2021 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. ++ ++# use ./build.sh -nosym to build content_shell without symbol. ++set -e ++basedir=$(dirname "$0") ++CUR_DIR=$PWD ++ROOT_DIR=${CUR_DIR} ++TEXT_BOLD="\033[1m" ++TEXT_NORMAL="\033[0m" ++ ++#Add build args begin ++buildargs=" ++ target_os=\"ohos\" ++ is_debug=false ++ is_official_build=true ++ is_component_build=false ++ is_chrome_branded=false ++ use_official_google_api_keys=false ++ use_ozone=true ++ use_aura=true ++ ozone_auto_platforms=false ++ ozone_platform=\"headless\" ++ ozone_platform_headless=true ++ enable_extensions=true ++ ffmpeg_branding=\"Chrome\" ++ use_kerberos=false ++ use_bundled_fontconfig=true ++ enable_resource_allowlist_generation=false ++ clang_use_chrome_plugins=false ++ enable_message_center=true ++ safe_browsing_mode=0 ++ use_custom_libcxx=false ++ use_sysroot=false ++ gpu_switch=\"on\" ++ proprietary_codecs=true ++ media_use_ffmpeg=true" ++#Add build args end ++ ++buildgn=1 ++buildcount=0 ++buildsymbol=0 ++buildarg_cpu="target_cpu=\"arm64\"" ++buildarg_musl="use_musl=true" ++build_dir="out/cronet/" ++ ++usage() { ++ echo -ne "USAGE: $0 [OPTIONS] [PRODUCT] ++ ++${TEXT_BOLD}OPTIONS${TEXT_NORMAL}: ++ -j N force number of build jobs ++ -ccache Enable CCache. ++ -t Build target, supports: ++ n Build native files. ++ b Build BrowserShell. ++ w Build NWeb WebView. ++ m Build NWebEx napi module. ++ M Build NWebEx napi npm package. ++ -o Output directory, for example: Default. ++ -A, -artifact Artifact mode, using pre-built NDK rather than building ++ them locally. ++ -asan Enable AddressSanitizer (ASan). ++ ++${TEXT_BOLD}PRODUCT${TEXT_NORMAL}: ++ rk3568 rk3568_64 musl_64 x86_64 ++ Default is: rk3568 ++" ++} ++ ++SYMBOL_LEVEL=1 ++if [ $buildsymbol = 1 ]; then ++ SYMBOL_LEVEL=2 ++fi ++ ++if [ $buildcount = 0 ]; then ++ #buildcount=$(grep processor /proc/cpuinfo | wc -l) ++ buildcount=40 ++fi ++ ++time_start_for_build=$(date +%s) ++time_start_for_gn=$time_start_for_build ++ ++if [ $buildgn = 1 ]; then ++ echo "generating args list: $buildargs $GN_ARGS" ++ third_party/depot_tools/gn gen $build_dir --export-compile-commands --args="$buildargs $buildarg_cpu $buildarg_musl $GN_ARGS symbol_level=$SYMBOL_LEVEL" ++fi ++time_end_for_gn=$(date +%s) ++ ++third_party/depot_tools/ninja -v -C $build_dir "gn_all" ++time_end_for_build=$(date +%s) ++ ++time_format() { ++ hours=$((($1 - $2) / 3600)) ++ minutes=$((($1 - $2) % 3600 / 60)) ++ seconds=$((($1 - $2) % 60)) ++} ++ ++time_format $time_end_for_gn $time_start_for_gn ++printf "\n\e[32mTime for gn : %dH:%dM:%dS \e[0m\n" $hours $minutes $seconds ++time_format $time_end_for_build $time_end_for_gn ++printf "\e[32mTime for build : %dH:%dM:%dS \e[0m\n" $hours $minutes $seconds ++time_format $time_end_for_build $time_start_for_build ++printf "\e[32mTime for Total : %dH:%dM:%dS \e[0m\n\n" $hours $minutes $seconds ++ ++echo "build done" +diff --git a/build/build_config.h b/build/build_config.h +index 8f90f474ef..29d4056863 100644 +--- a/build/build_config.h ++++ b/build/build_config.h +@@ -57,6 +57,8 @@ + #define OS_NACL 1 + #elif defined(ANDROID) + #define OS_ANDROID 1 ++#elif defined(OHOS) ++#define OS_OHOS 1 + #elif defined(__APPLE__) + // Only include TargetConditionals after testing ANDROID as some Android builds + // on the Mac have this header available and it's not needed unless the target +@@ -122,7 +124,7 @@ + + // For access to standard POSIXish features, use OS_POSIX instead of a + // more specific macro. +-#if defined(OS_AIX) || defined(OS_ANDROID) || defined(OS_ASMJS) || \ ++#if defined(OS_AIX) || defined(OS_OHOS) || defined(OS_ANDROID) || defined(OS_ASMJS) || \ + defined(OS_FREEBSD) || defined(OS_IOS) || defined(OS_LINUX) || \ + defined(OS_CHROMEOS) || defined(OS_MAC) || defined(OS_NACL) || \ + defined(OS_NETBSD) || defined(OS_OPENBSD) || defined(OS_QNX) || \ +@@ -143,6 +145,12 @@ + #define BUILDFLAG_INTERNAL_IS_ANDROID() (0) + #endif + ++#if defined(OS_OHOS) ++#define BUILDFLAG_INTERNAL_IS_OHOS() (1) ++#else ++#define BUILDFLAG_INTERNAL_IS_OHOS() (0) ++#endif ++ + #if defined(OS_APPLE) + #define BUILDFLAG_INTERNAL_IS_APPLE() (1) + #else +diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn +index 21b4055dc1..0027cecdd1 100644 +--- a/build/config/BUILDCONFIG.gn ++++ b/build/config/BUILDCONFIG.gn +@@ -231,6 +231,8 @@ if (target_os == "android") { + assert(host_os == "linux" || host_os == "mac", + "Android builds are only supported on Linux and Mac hosts.") + _default_toolchain = "//build/toolchain/android:android_clang_$target_cpu" ++} else if (target_os == "ohos") { ++ _default_toolchain = "//build/toolchain/ohos:ohos_clang_$target_cpu" + } else if (target_os == "chromeos" || target_os == "linux") { + # See comments in build/toolchain/cros/BUILD.gn about board compiles. + if (is_clang) { +@@ -295,6 +297,7 @@ if (custom_toolchain != "") { + # current_os value directly. + + is_android = current_os == "android" ++is_ohos = current_os == "ohos" + is_chromeos = current_os == "chromeos" + is_fuchsia = current_os == "fuchsia" + is_ios = current_os == "ios" +diff --git a/build/config/c++/c++.gni b/build/config/c++/c++.gni +index bf5e08ade5..bc8d0b8f4f 100644 +--- a/build/config/c++/c++.gni ++++ b/build/config/c++/c++.gni +@@ -12,7 +12,7 @@ declare_args() { + # Don't check in changes that set this to false for more platforms; doing so + # is not supported. + use_custom_libcxx = +- is_fuchsia || is_android || is_apple || is_linux || is_chromeos_lacros || ++ is_ohos || is_fuchsia || is_android || is_apple || is_linux || is_chromeos_lacros || + (is_win && is_clang) || + (is_chromeos && default_toolchain != "//build/toolchain/cros:target") + +diff --git a/build/config/clang/clang.gni b/build/config/clang/clang.gni +index 7196fcf6c1..6dc04f7377 100644 +--- a/build/config/clang/clang.gni ++++ b/build/config/clang/clang.gni +@@ -14,5 +14,9 @@ declare_args() { + is_clang && !is_nacl && current_os != "zos" && + default_toolchain != "//build/toolchain/cros:target" + +- clang_base_path = default_clang_base_path ++ if (is_ohos) { ++ clang_base_path = "//third_party/ohos_sdk/native/llvm" ++ } else { ++ clang_base_path = default_clang_base_path ++ } + } +diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn +index e54bbc8107..6d4dc701d0 100644 +--- a/build/config/compiler/BUILD.gn ++++ b/build/config/compiler/BUILD.gn +@@ -185,7 +185,7 @@ declare_args() { + current_cpu == "x64")))) + } + +-if (is_android || (is_chromeos_ash && is_chromeos_device)) { ++if (is_android || is_ohos || (is_chromeos_ash && is_chromeos_device)) { + # Set the path to use orderfile for linking Chrome + # Note that this is for using only one orderfile for linking + # the Chrome binary/library. +@@ -256,6 +256,8 @@ config("compiler") { + configs += [ "//build/config/win:compiler" ] + } else if (is_android) { + configs += [ "//build/config/android:compiler" ] ++ } else if (is_ohos) { ++ configs += [ "//build/config/ohos:compiler" ] + } else if (is_linux || is_chromeos) { + configs += [ "//build/config/linux:compiler" ] + } else if (is_nacl) { +@@ -388,7 +390,7 @@ config("compiler") { + ldflags += [ "-Wl,--build-id" ] + } + +- if (!is_android) { ++ if (!is_android && !is_ohos) { + defines += [ + # _FILE_OFFSET_BITS=64 should not be set on Android in order to maintain + # the behavior of the Android NDK from earlier versions. +@@ -431,7 +433,7 @@ config("compiler") { + + # Linux/Android/Fuchsia common flags setup. + # --------------------------------- +- if (is_linux || is_chromeos || is_android || is_fuchsia) { ++ if (is_linux || is_chromeos || is_android || is_ohos || is_fuchsia) { + asmflags += [ "-fPIC" ] + cflags += [ "-fPIC" ] + ldflags += [ "-fPIC" ] +@@ -532,10 +534,10 @@ config("compiler") { + + # TODO(hans): Remove this once Clang generates better optimized debug info + # by default. https://crbug.com/765793 +- cflags += [ +- "-mllvm", +- "-instcombine-lower-dbg-declare=0", +- ] ++# cflags += [ ++# "-mllvm", ++# "-instcombine-lower-dbg-declare=0", ++# ] + if (!is_debug && use_thin_lto && is_a_target_toolchain) { + if (is_win) { + ldflags += [ "-mllvm:-instcombine-lower-dbg-declare=0" ] +@@ -559,7 +561,7 @@ config("compiler") { + + # C11/C++11 compiler flags setup. + # --------------------------- +- if (is_linux || is_chromeos || is_android || (is_nacl && is_clang) || ++ if (is_ohos || is_linux || is_chromeos || is_android || (is_nacl && is_clang) || + current_os == "aix") { + if (is_clang) { + standard_prefix = "c" +@@ -696,7 +698,7 @@ config("compiler") { + + # TODO(https://crbug.com/1211155): investigate why this isn't effective on + # arm32. +- if (!is_android || current_cpu == "arm64") { ++ if ((!is_android && !is_ohos) || current_cpu == "arm64") { + cflags += [ "-fwhole-program-vtables" ] + if (!is_win) { + ldflags += [ "-fwhole-program-vtables" ] +@@ -727,7 +729,7 @@ config("compiler") { + + # Pass flag to LLD so Android builds can allow debuggerd to properly symbolize + # stack crashes (http://crbug.com/919499). +- if (use_lld && is_android) { ++ if (use_lld && (is_android || is_ohos)) { + ldflags += [ "-Wl,--no-rosegment" ] + } + +@@ -913,7 +915,7 @@ config("compiler_cpu_abi") { + ] + } + } else if (current_cpu == "arm") { +- if (is_clang && !is_android && !is_nacl && ++ if (is_clang && !is_android && !is_ohos && !is_nacl && + !(is_chromeos_lacros && is_chromeos_device)) { + cflags += [ "--target=arm-linux-gnueabihf" ] + ldflags += [ "--target=arm-linux-gnueabihf" ] +@@ -928,7 +930,7 @@ config("compiler_cpu_abi") { + cflags += [ "-mtune=$arm_tune" ] + } + } else if (current_cpu == "arm64") { +- if (is_clang && !is_android && !is_nacl && !is_fuchsia && ++ if (is_clang && !is_android && !is_ohos && !is_nacl && !is_fuchsia && + !(is_chromeos_lacros && is_chromeos_device)) { + cflags += [ "--target=aarch64-linux-gnu" ] + ldflags += [ "--target=aarch64-linux-gnu" ] +@@ -2567,7 +2569,7 @@ if (is_chromeos_ash && is_chromeos_device) { + } + } + +-if (is_android || (is_chromeos_ash && is_chromeos_device)) { ++if (is_android || is_ohos || (is_chromeos_ash && is_chromeos_device)) { + # Use orderfile for linking Chrome on Android and Chrome OS. + # This config enables using an orderfile for linking in LLD. + # TODO: Consider using call graph sort instead, at least on Android. +diff --git a/build/config/ohos/BUILD.gn b/build/config/ohos/BUILD.gn +new file mode 100644 +index 0000000000..044714eedc +--- /dev/null ++++ b/build/config/ohos/BUILD.gn +@@ -0,0 +1,102 @@ ++# Copyright 2014 The Chromium Authors. All rights reserved. ++# Use of this source code is governed by a BSD-style license that can be ++# found in the LICENSE file. ++ ++import("//build/config/compiler/compiler.gni") ++import("//build/config/ohos/config.gni") ++import("//build/config/c++/c++.gni") ++import("//build/config/sysroot.gni") ++import("//build/toolchain/toolchain.gni") ++ ++assert(is_ohos) ++ ++# This is included by reference in the //build/config/compiler config that ++# is applied to all targets. It is here to separate out the logic that is ++# ohos-only. ++config("compiler") { ++ cflags = [ ++ "-ffunction-sections", ++ "-fno-short-enums", ++ ] ++ defines = [ ++ # The NDK has these things, but doesn't define the constants to say that it ++ # does. Define them here instead. ++ "HAVE_SYS_UIO_H", ++ ] ++ ++ defines += [ ++ "OHOS", ++ "__MUSL__", ++ "_LIBCPP_HAS_MUSL_LIBC", ++ "__BUILD_LINUX_WITH_CLANG", ++ ] ++ ++ ldflags = [ ++ "-Wl,--no-undefined", ++ "-Wl,--exclude-libs=libunwind_llvm.a", ++ "-Wl,--exclude-libs=libc++_static.a", ++ ++ # Don't allow visible symbols from libraries that contain ++ # assembly code with symbols that aren't hidden properly. ++ # http://crbug.com/448386 ++ "-Wl,--exclude-libs=libvpx_assembly_arm.a", ++ ] ++ ++ cflags += [ "--target=$abi_target" ] ++ include_dirs = [ ++ "${sysroot}/usr/include/${abi_target}", ++ "${clang_base_path}/lib/clang/${clang_version}/include", ++ ] ++ ++ ldflags += [ "--target=$abi_target" ] ++ ++ # Assign any flags set for the C compiler to asmflags so that they are sent ++ # to the assembler. ++ asmflags = cflags ++} ++ ++# This is included by reference in the //build/config/compiler:runtime_library ++# config that is applied to all targets. It is here to separate out the logic ++# that is ohos-only. Please see that target for advice on what should go in ++# :runtime_library vs. :compiler. ++config("runtime_library") { ++ cflags_cc = [] ++ ++ defines = [ ++ "__GNU_SOURCE=1", # Necessary for clone(). ++ "CHROMIUM_CXX_TWEAK_INLINES", # Saves binary size. ++ ] ++ ++ defines += [ ++ "__MUSL__", ++ "_LIBCPP_HAS_MUSL_LIBC", ++ "__BUILD_LINUX_WITH_CLANG", ++ ] ++ ldflags = [ "-nostdlib" ] ++ ++ libs = [] ++ ++ # arm builds of libc++ starting in NDK r12 depend on unwind. ++ if (current_cpu == "arm" || current_cpu == "arm64") { ++ libs += [ "unwind" ] ++ } ++ ++ ldflags += [ ++ "-L" + rebase_path("${sysroot}/usr/lib/${abi_target}", root_build_dir), ++ "-L" + rebase_path( ++ "${clang_base_path}/lib/clang/${clang_version}/lib/${abi_target}", ++ root_build_dir), ++ ] ++ ++ libs += [ ++ rebase_path(libclang_rt_file), ++ "c", ++ rebase_path(libcxxabi_file), ++ ] ++ ++ if (current_cpu == "arm" && arm_version == 6) { ++ libs += [ "atomic" ] ++ } ++ ++ ldflags += [ "-Wl,--warn-shared-textrel" ] ++} +diff --git a/build/config/ohos/config.gni b/build/config/ohos/config.gni +new file mode 100644 +index 0000000000..a1460eea81 +--- /dev/null ++++ b/build/config/ohos/config.gni +@@ -0,0 +1,45 @@ ++# Copyright 2014 The Chromium Authors. All rights reserved. ++# Use of this source code is governed by a BSD-style license that can be ++# found in the LICENSE file. ++ ++if (is_ohos) { ++ import("//build_overrides/build.gni") ++ import("//build/config/clang/clang.gni") ++ ++ default_base_libs_root = "" ++ ++ declare_args() { ++ base_libs_root = default_base_libs_root ++ } ++ ++ # Defines the name the ohos build gives to the current host CPU ++ # architecture, which is different than the names GN uses. ++ if (host_os == "linux") { ++ ohos_host_os = "linux" ++ } else if (host_os == "mac") { ++ ohos_host_os = "darwin" ++ } else { ++ assert(false, "Need toolchain support for your build OS.") ++ } ++ ++ if (current_cpu == "arm") { ++ abi_target = "arm-linux-ohos" ++ } else if (current_cpu == "x86") { ++ abi_target = "" ++ } else if (current_cpu == "arm64") { ++ abi_target = "aarch64-linux-ohos" ++ } else if (current_cpu == "x86_64") { ++ abi_target = "x86_64-linux-ohos" ++ } else if (current_cpu == "riscv64") { ++ abi_target = "riscv64-linux-ohos" ++ } else if (current_cpu == "mipsel") { ++ abi_target = "mipsel-linux-ohos" ++ } else { ++ assert(false, "Architecture not supported") ++ } ++ ++ libclang_rt_file = "${clang_base_path}/lib/clang/${clang_version}/lib/${abi_target}/libclang_rt.builtins.a" ++ libcxxabi_file = "${clang_base_path}/lib/${abi_target}/libc++abi.a" ++ libcxx_ndk_shared_file = ++ "${clang_base_path}/../libcxx-ndk/lib/${abi_target}/libc++_shared.so" ++} +diff --git a/build/config/sysroot.gni b/build/config/sysroot.gni +index dea380727e..c22a1c5059 100644 +--- a/build/config/sysroot.gni ++++ b/build/config/sysroot.gni +@@ -33,6 +33,8 @@ if (sysroot == "") { + + # Android uses unified headers, and thus a single compile time sysroot + sysroot = "$android_toolchain_root/sysroot" ++ } else if (is_ohos) { ++ sysroot = "//third_party/ohos_sdk/native/sysroot" + } else if ((is_linux || is_chromeos) && use_sysroot) { + # By default build against a sysroot image downloaded from Cloud Storage + # during gclient runhooks. +diff --git a/build/config/ui.gni b/build/config/ui.gni +index b560f372c6..532fd9a2f3 100644 +--- a/build/config/ui.gni ++++ b/build/config/ui.gni +@@ -30,7 +30,7 @@ declare_args() { + + declare_args() { + # True means the UI is built using the "views" framework. +- toolkit_views = is_mac || is_win || is_linux || is_chromeos || is_fuchsia ++ toolkit_views = is_mac || is_win || is_linux || is_chromeos || is_fuchsia || is_ohos + + use_glib = + is_linux && !is_castos && +diff --git a/build/toolchain/ohos/BUILD.gn b/build/toolchain/ohos/BUILD.gn +new file mode 100644 +index 0000000000..4c9d809aff +--- /dev/null ++++ b/build/toolchain/ohos/BUILD.gn +@@ -0,0 +1,88 @@ ++# Copyright 2013 The Chromium Authors. All rights reserved. ++# Use of this source code is governed by a BSD-style license that can be ++# found in the LICENSE file. ++ ++import("//build/config/clang/clang.gni") ++import("//build/config/sysroot.gni") ++import("//build/toolchain/gcc_toolchain.gni") ++ ++declare_args() { ++ # Whether unstripped binaries, i.e. compiled with debug symbols, should be ++ # considered runtime_deps rather than stripped ones. ++ ohos_unstripped_runtime_outputs = true ++} ++ ++template("ohos_clang_toolchain") { ++ gcc_toolchain(target_name) { ++ assert(defined(invoker.toolchain_args), ++ "toolchain_args must be defined for ohos_clang_toolchain()") ++ toolchain_args = invoker.toolchain_args ++ toolchain_args.current_os = "ohos" ++ ++ # Output linker map files for binary size analysis. ++ enable_linker_map = true ++ ++ ohos_libc_dir = ++ rebase_path(invoker.sysroot + "/" + invoker.lib_dir, root_build_dir) ++ libs_section_prefix = "${ohos_libc_dir}/Scrt1.o" ++ libs_section_prefix += " ${ohos_libc_dir}/crti.o" ++# libs_section_postfix = "${ohos_libc_dir}/crtn.o" ++ ++ if (invoker.target_name == "ohos_clang_arm") { ++ abi_target = "arm-linux-ohos" ++ } else if (invoker.target_name == "ohos_clang_arm64") { ++ abi_target = "aarch64-linux-ohos" ++ } else if (invoker.target_name == "ohos_clang_x86_64") { ++ abi_target = "x86_64-linux-ohos" ++ } ++ ++ clang_rt_dir = ++ rebase_path("//third_party/ohos_sdk/native/llvm/lib/clang/${clang_version}/lib/${abi_target}", root_build_dir) ++ ++ solink_libs_section_prefix = "${ohos_libc_dir}/crti.o" ++ solink_libs_section_prefix += " ${clang_rt_dir}/clang_rt.crtbegin.o" ++ solink_libs_section_postfix = "${ohos_libc_dir}/crtn.o" ++ solink_libs_section_postfix += " ${clang_rt_dir}/clang_rt.crtend.o" ++ ++ _prefix = rebase_path("${clang_base_path}/bin", root_build_dir) ++ cc = "${_prefix}/clang" ++ cxx = "${_prefix}/clang++" ++ ar = "${_prefix}/llvm-ar" ++ ld = cxx ++ readelf = "${_prefix}/llvm-readobj" ++ nm = "${_prefix}/llvm-nm" ++ strip = rebase_path("${clang_base_path}/bin/llvm-strip", root_build_dir) ++ use_unstripped_as_runtime_outputs = ohos_unstripped_runtime_outputs ++ ++ # Don't use .cr.so for loadable_modules since they are always loaded via ++ # absolute path. ++ loadable_module_extension = ".so" ++ } ++} ++ ++ohos_clang_toolchain("ohos_clang_arm") { ++ sysroot = sysroot ++ lib_dir = "usr/lib/arm-linux-ohos" ++ toolchain_args = { ++ current_cpu = "arm" ++ current_os = "ohos" ++ } ++} ++ ++ohos_clang_toolchain("ohos_clang_arm64") { ++ sysroot = sysroot ++ lib_dir = "usr/lib/aarch64-linux-ohos" ++ toolchain_args = { ++ current_cpu = "arm64" ++ current_os = "ohos" ++ } ++} ++ ++ohos_clang_toolchain("ohos_clang_x86_64") { ++ sysroot = sysroot ++ lib_dir = "usr/lib/x86_64-linux-ohos" ++ toolchain_args = { ++ current_cpu = "x86_64" ++ current_os = "ohos" ++ } ++} +diff --git a/build/toolchain/toolchain.gni b/build/toolchain/toolchain.gni +index 6a49c399e3..b7f78e2212 100644 +--- a/build/toolchain/toolchain.gni ++++ b/build/toolchain/toolchain.gni +@@ -33,7 +33,11 @@ if (generate_linker_map) { + } + + declare_args() { +- clang_version = "16.0.0" ++ if (is_ohos) { ++ clang_version = "15.0.4" ++ } else { ++ clang_version = "16.0.0" ++ } + } + + # Extension for shared library files (including leading dot). +diff --git a/chrome/browser/image_editor/BUILD.gn b/chrome/browser/image_editor/BUILD.gn +index 3acbdae3dd..3a48237932 100644 +--- a/chrome/browser/image_editor/BUILD.gn ++++ b/chrome/browser/image_editor/BUILD.gn +@@ -3,7 +3,7 @@ + # found in the LICENSE file. + import("//build/config/ui.gni") + +-assert(is_chromeos || is_linux || is_mac || is_win || is_fuchsia, ++assert(is_chromeos || is_linux || is_mac || is_win || is_fuchsia || is_ohos, + "Image Editor is for desktop plaforms only") + + static_library("image_editor_component_util") { +diff --git a/chrome/browser/resources/new_tab_page_instant/BUILD.gn b/chrome/browser/resources/new_tab_page_instant/BUILD.gn +index d62a0226a8..89baacbcda 100644 +--- a/chrome/browser/resources/new_tab_page_instant/BUILD.gn ++++ b/chrome/browser/resources/new_tab_page_instant/BUILD.gn +@@ -7,7 +7,7 @@ import("//tools/grit/grit_rule.gni") + import("//tools/typescript/ts_library.gni") + import("//ui/webui/resources/tools/generate_grd.gni") + +-assert(is_linux || is_chromeos || is_win || is_mac || is_fuchsia) ++assert(is_linux || is_chromeos || is_win || is_mac || is_fuchsia || is_ohos) + + grit("resources") { + defines = chrome_grit_defines + [ "is_official_build=$is_official_build" ] +diff --git a/chrome/browser/resources/tab_search/BUILD.gn b/chrome/browser/resources/tab_search/BUILD.gn +index 43326f9d23..18fe7a38dd 100644 +--- a/chrome/browser/resources/tab_search/BUILD.gn ++++ b/chrome/browser/resources/tab_search/BUILD.gn +@@ -7,7 +7,7 @@ import("//chrome/common/features.gni") + import("//ui/webui/resources/tools/generate_grd.gni") + import("//ui/webui/webui_features.gni") + +-assert(is_linux || is_chromeos || is_win || is_mac || is_fuchsia) ++assert(is_linux || is_chromeos || is_win || is_mac || is_fuchsia || is_ohos) + + import("//chrome/browser/resources/tools/build_webui.gni") + +diff --git a/chrome/browser/ui/webui/tab_search/BUILD.gn b/chrome/browser/ui/webui/tab_search/BUILD.gn +index 48046ed8a9..006bd09bbe 100644 +--- a/chrome/browser/ui/webui/tab_search/BUILD.gn ++++ b/chrome/browser/ui/webui/tab_search/BUILD.gn +@@ -4,7 +4,7 @@ + + import("//mojo/public/tools/bindings/mojom.gni") + +-assert(is_linux || is_chromeos || is_win || is_mac || is_fuchsia) ++assert(is_linux || is_chromeos || is_win || is_mac || is_fuchsia || is_ohos) + + mojom("mojo_bindings") { + sources = [ "tab_search.mojom" ] +diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn +index 2fd76fd1c2..e47135a4fa 100644 +--- a/chrome/test/BUILD.gn ++++ b/chrome/test/BUILD.gn +@@ -5030,7 +5030,7 @@ template("performance_test_suite_template_base") { + data_deps += [ "//third_party/angle/src/tests:angle_perftests" ] + } + +- if (!is_android && !is_chromeos_lacros) { ++ if (!is_android && !is_chromeos_lacros && !is_ohos) { + data_deps += [ + "//chrome/test:load_library_perf_tests", + "//ui/views:views_perftests", +diff --git a/chrome/test/data/ash/clipboard_history/icon128.png b/chrome/test/data/ash/clipboard_history/icon128.png +deleted file mode 120000 +index b48bcc3be9..0000000000 +--- a/chrome/test/data/ash/clipboard_history/icon128.png ++++ /dev/null +@@ -1 +0,0 @@ +-../images/icon128.png +\ No newline at end of file +diff --git a/chrome/test/data/ash/clipboard_history/icon16.png b/chrome/test/data/ash/clipboard_history/icon16.png +deleted file mode 120000 +index 3d2b3c0884..0000000000 +--- a/chrome/test/data/ash/clipboard_history/icon16.png ++++ /dev/null +@@ -1 +0,0 @@ +-../images/icon16.png +\ No newline at end of file +diff --git a/chrome/test/data/ash/clipboard_history/icon2050.png b/chrome/test/data/ash/clipboard_history/icon2050.png +deleted file mode 120000 +index e3ec10f535..0000000000 +--- a/chrome/test/data/ash/clipboard_history/icon2050.png ++++ /dev/null +@@ -1 +0,0 @@ +-../images/icon2050.png +\ No newline at end of file +diff --git a/content/test/data/file_chooser/dir_with_symlink/symlink b/content/test/data/file_chooser/dir_with_symlink/symlink +deleted file mode 120000 +index 7857c689f7..0000000000 +--- a/content/test/data/file_chooser/dir_with_symlink/symlink ++++ /dev/null +@@ -1 +0,0 @@ +-../linked_text_file.txt +\ No newline at end of file +diff --git a/media/cdm/library_cdm/cdm_paths.gni b/media/cdm/library_cdm/cdm_paths.gni +index 1dd10660f8..04656e89a6 100644 +--- a/media/cdm/library_cdm/cdm_paths.gni ++++ b/media/cdm/library_cdm/cdm_paths.gni +@@ -17,6 +17,8 @@ if (is_chromeos) { + component_os = "cros" + } else if (is_linux) { + component_os = "linux" ++} else if (is_ohos) { ++ component_os = "ohos" + } else if (is_win) { + component_os = "win" + } else if (is_mac) { +diff --git a/net/BUILD.gn b/net/BUILD.gn +index 265a1af135..a7c5644c44 100644 +--- a/net/BUILD.gn ++++ b/net/BUILD.gn +@@ -1188,7 +1188,7 @@ component("net") { + ] + } + +- if (is_linux || is_chromeos || is_android) { ++ if (is_linux || is_chromeos || is_android || is_ohos) { + sources += [ + "base/address_tracker_linux.cc", + "base/address_tracker_linux.h", +@@ -1367,7 +1367,7 @@ component("net") { + } + + # Use getifaddrs() on POSIX platforms, except Linux. +- if (is_posix && !is_linux && !is_chromeos) { ++ if (is_posix && !is_linux && !is_chromeos && !is_ohos) { + sources += [ + "base/network_interfaces_getifaddrs.cc", + "base/network_interfaces_getifaddrs.h", +diff --git a/net/cert/cert_verify_proc.cc b/net/cert/cert_verify_proc.cc +index 4ef8c12076..4f7cca1a51 100644 +--- a/net/cert/cert_verify_proc.cc ++++ b/net/cert/cert_verify_proc.cc +@@ -52,7 +52,7 @@ + #include "third_party/boringssl/src/include/openssl/pool.h" + #include "url/url_canon.h" + +-#if BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(USE_NSS_CERTS) || BUILDFLAG(IS_MAC) ++#if BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(USE_NSS_CERTS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_OHOS) + #include "net/cert/cert_verify_proc_builtin.h" + #endif + +@@ -523,6 +523,11 @@ scoped_refptr CertVerifyProc::CreateSystemVerifyProc( + return base::MakeRefCounted(); + #elif BUILDFLAG(IS_WIN) + return base::MakeRefCounted(); ++#elif BUILDFLAG(IS_OHOS) ++ LOG(ERROR) << "OHOS CreateSystemVerifyProc use CreateCertVerifyProcBuiltin"; ++ return CreateCertVerifyProcBuiltin( ++ std::move(cert_net_fetcher), ++ CreateSslSystemTrustStore()); + #else + #error Unsupported platform + #endif +diff --git a/net/cert/cert_verify_proc.h b/net/cert/cert_verify_proc.h +index c0895333e1..925ffc0986 100644 +--- a/net/cert/cert_verify_proc.h ++++ b/net/cert/cert_verify_proc.h +@@ -87,7 +87,7 @@ class NET_EXPORT CertVerifyProc + scoped_refptr cert_net_fetcher); + #endif + +-#if BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(USE_NSS_CERTS) || BUILDFLAG(IS_MAC) ++#if BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(USE_NSS_CERTS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_OHOS) + // Creates and returns a CertVerifyProcBuiltin using the SSL SystemTrustStore. + static scoped_refptr CreateBuiltinVerifyProc( + scoped_refptr cert_net_fetcher); +diff --git a/net/cert/cert_verify_proc_builtin.cc b/net/cert/cert_verify_proc_builtin.cc +index ed08375ab6..b0431e008a 100644 +--- a/net/cert/cert_verify_proc_builtin.cc ++++ b/net/cert/cert_verify_proc_builtin.cc +@@ -907,7 +907,6 @@ std::unique_ptr + CertVerifyProcBuiltinResultDebugData::Clone() { + return std::make_unique(*this); + } +- + scoped_refptr CreateCertVerifyProcBuiltin( + scoped_refptr net_fetcher, + std::unique_ptr system_trust_store) { +diff --git a/net/cert/internal/system_trust_store.cc b/net/cert/internal/system_trust_store.cc +index 95f1f9a6f1..2d859d2553 100644 +--- a/net/cert/internal/system_trust_store.cc ++++ b/net/cert/internal/system_trust_store.cc +@@ -47,6 +47,9 @@ + #elif BUILDFLAG(IS_FUCHSIA) + #include "base/lazy_instance.h" + #include "third_party/boringssl/src/include/openssl/pool.h" ++#elif BUILDFLAG(IS_OHOS) ++#include "base/lazy_instance.h" ++#include "third_party/boringssl/src/include/openssl/pool.h" + #elif BUILDFLAG(IS_WIN) + #include "net/cert/internal/trust_store_win.h" + #endif +@@ -422,6 +425,72 @@ std::unique_ptr CreateSslSystemTrustStore() { + return std::make_unique(); + } + ++#elif BUILDFLAG(IS_OHOS) ++namespace { ++ ++constexpr char kRootCertsFileOhos[] = "/etc/ssl/certs/cacert.pem"; ++ ++class OhosSystemCerts { ++ public: ++ OhosSystemCerts() { ++ base::FilePath filename(kRootCertsFileOhos); ++ std::string certs_file; ++ if (!base::ReadFileToString(filename, &certs_file)) { ++ LOG(ERROR) << "Can't load root certificates from " << filename; ++ return; ++ } ++ ++ CertificateList certs = X509Certificate::CreateCertificateListFromBytes( ++ base::as_bytes(base::make_span(certs_file)), X509Certificate::FORMAT_AUTO); ++ ++ for (const auto& cert : certs) { ++ CertErrors errors; ++ auto parsed = ParsedCertificate::Create( ++ bssl::UpRef(cert->cert_buffer()), ++ x509_util::DefaultParseCertificateOptions(), &errors); ++ CHECK(parsed) << errors.ToDebugString(); ++ system_trust_store_.AddTrustAnchor(parsed); ++ } ++ } ++ ++ TrustStoreInMemory* system_trust_store() { return &system_trust_store_; } ++ ++ private: ++ TrustStoreInMemory system_trust_store_; ++}; ++ ++base::LazyInstance::Leaky g_root_certs_fuchsia = ++ LAZY_INSTANCE_INITIALIZER; ++ ++} // namespace ++ ++class SystemTrustStoreOhos : public DummySystemTrustStore { ++public: ++// SystemTrustStoreOhos() { ++// LOG(ERROR) << "taoliuchang init SystemTrustStoreOhos"; ++// trust_store_.AddTrustStore(g_root_certs_fuchsia.Get().system_trust_store()); ++// // if (TestRootCerts::HasInstance()) { ++// // trust_store_.AddTrustStore( ++// // TestRootCerts::GetInstance()->test_trust_store()); ++// // } ++// } ++ SystemTrustStoreOhos() = default; ++ TrustStore* GetTrustStore() override { ++ return g_root_certs_fuchsia.Get().system_trust_store(); ++ } ++ ++ bool UsesSystemTrustStore() const override { return true; } ++ ++ bool IsKnownRoot(const ParsedCertificate* trust_anchor) const override { ++ return g_root_certs_fuchsia.Get().system_trust_store()->Contains( ++ trust_anchor); ++ } ++}; ++ ++std::unique_ptr CreateSslSystemTrustStore() { ++ return std::make_unique(); ++} ++ + #elif BUILDFLAG(IS_WIN) + + // Using the Builtin Verifier w/o the Chrome Root Store is unsupported on +diff --git a/net/cert/test_root_certs.h b/net/cert/test_root_certs.h +index 00139642fe..212e99fcac 100644 +--- a/net/cert/test_root_certs.h ++++ b/net/cert/test_root_certs.h +@@ -80,7 +80,7 @@ class NET_EXPORT TestRootCerts { + bool Add(X509Certificate* certificate); + + // Performs platform-dependent operations. +- void Init(); ++ void Init(){} + bool AddImpl(X509Certificate* certificate); + void ClearImpl(); + +diff --git a/net/dns/dns_reloader.cc b/net/dns/dns_reloader.cc +index bfd2de11f9..8a5b500456 100644 +--- a/net/dns/dns_reloader.cc ++++ b/net/dns/dns_reloader.cc +@@ -7,7 +7,7 @@ + #include "build/build_config.h" + + #if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_OPENBSD) && \ +- !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_FUCHSIA) ++ !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_FUCHSIA) && !BUILDFLAG(IS_OHOS) + + #include + +diff --git a/net/dns/host_resolver_manager.cc b/net/dns/host_resolver_manager.cc +index 066fd3fa99..1ff7c5319d 100644 +--- a/net/dns/host_resolver_manager.cc ++++ b/net/dns/host_resolver_manager.cc +@@ -3133,7 +3133,7 @@ HostResolverManager::HostResolverManager( + if (system_dns_config_notifier_) + system_dns_config_notifier_->AddObserver(this); + #if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_OPENBSD) && \ +- !BUILDFLAG(IS_ANDROID) ++ !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_OHOS) + EnsureDnsReloaderInit(); + #endif + +diff --git a/net/dns/host_resolver_proc.cc b/net/dns/host_resolver_proc.cc +index e82863cf7a..1bce680f57 100644 +--- a/net/dns/host_resolver_proc.cc ++++ b/net/dns/host_resolver_proc.cc +@@ -193,7 +193,7 @@ int SystemHostResolverCall(const std::string& host, + base::BlockingType::WILL_BLOCK); + + #if BUILDFLAG(IS_POSIX) && \ +- !(BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_OPENBSD) || BUILDFLAG(IS_ANDROID)) ++ !(BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_OPENBSD) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_OHOS)) + DnsReloaderMaybeReload(); + #endif + auto [ai, err, os_error] = AddressInfo::Get(host, hints, nullptr, network); +diff --git a/net/dns/public/BUILD.gn b/net/dns/public/BUILD.gn +index dbcecd02f6..2bff1f0e1f 100644 +--- a/net/dns/public/BUILD.gn ++++ b/net/dns/public/BUILD.gn +@@ -41,7 +41,7 @@ source_set("public") { + "util.h", + ] + +- if (is_posix && !is_android) { ++ if (is_posix && !is_android && !is_ohos) { + sources += [ + "resolv_reader.cc", + "resolv_reader.h", +diff --git a/net/socket/unix_domain_server_socket_posix.cc b/net/socket/unix_domain_server_socket_posix.cc +index 60f58942f2..79225bb1a1 100644 +--- a/net/socket/unix_domain_server_socket_posix.cc ++++ b/net/socket/unix_domain_server_socket_posix.cc +@@ -35,7 +35,7 @@ UnixDomainServerSocket::~UnixDomainServerSocket() = default; + bool UnixDomainServerSocket::GetPeerCredentials(SocketDescriptor socket, + Credentials* credentials) { + #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \ +- BUILDFLAG(IS_FUCHSIA) ++ BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_OHOS) + struct ucred user_cred; + socklen_t len = sizeof(user_cred); + if (getsockopt(socket, SOL_SOCKET, SO_PEERCRED, &user_cred, &len) < 0) +diff --git a/net/socket/unix_domain_server_socket_posix.h b/net/socket/unix_domain_server_socket_posix.h +index e03f4479c4..2f4af54f54 100644 +--- a/net/socket/unix_domain_server_socket_posix.h ++++ b/net/socket/unix_domain_server_socket_posix.h +@@ -29,7 +29,7 @@ class NET_EXPORT UnixDomainServerSocket : public ServerSocket { + // Credentials of a peer process connected to the socket. + struct NET_EXPORT Credentials { + #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \ +- BUILDFLAG(IS_FUCHSIA) ++ BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_OHOS) + // Linux and Fuchsia provide more information about the connected peer + // than Windows/OS X. It's useful for permission-based authorization on + // Android. +diff --git a/third_party/afl/src/QuickStartGuide.txt b/third_party/afl/src/QuickStartGuide.txt +deleted file mode 120000 +index e1687eb5be..0000000000 +--- a/third_party/afl/src/QuickStartGuide.txt ++++ /dev/null +@@ -1 +0,0 @@ +-docs/QuickStartGuide.txt +\ No newline at end of file +diff --git a/third_party/afl/src/README b/third_party/afl/src/README +deleted file mode 120000 +index a90f4af959..0000000000 +--- a/third_party/afl/src/README ++++ /dev/null +@@ -1 +0,0 @@ +-docs/README +\ No newline at end of file +diff --git a/third_party/breakpad/BUILD.gn b/third_party/breakpad/BUILD.gn +index bf0f4f29b0..0e641fa772 100644 +--- a/third_party/breakpad/BUILD.gn ++++ b/third_party/breakpad/BUILD.gn +@@ -477,7 +477,7 @@ if (is_mac) { + } + } + +-if (is_linux || is_chromeos || is_android) { ++if (is_linux || is_chromeos || is_android || is_ohos) { + if (current_toolchain == host_toolchain) { + executable("symupload") { + sources = [ +diff --git a/third_party/libevent/BUILD.gn b/third_party/libevent/BUILD.gn +index 755a6a6e27..ec214098d1 100644 +--- a/third_party/libevent/BUILD.gn ++++ b/third_party/libevent/BUILD.gn +@@ -43,7 +43,7 @@ static_library("libevent") { + "mac/event-config.h", + ] + include_dirs = [ "mac" ] +- } else if (is_linux || is_chromeos) { ++ } else if (is_linux || is_chromeos || is_ohos) { + sources += [ + "epoll.c", + "linux/config.h", +diff --git a/third_party/libxml/BUILD.gn b/third_party/libxml/BUILD.gn +index 03d14f9844..204f17faf1 100644 +--- a/third_party/libxml/BUILD.gn ++++ b/third_party/libxml/BUILD.gn +@@ -4,7 +4,7 @@ + + # Define an "os_include" variable that points at the OS-specific generated + # headers. These were generated by running the configure script offline. +-if (is_linux || is_chromeos || is_android || is_nacl || is_fuchsia) { ++if (is_linux || is_chromeos || is_android || is_nacl || is_fuchsia || is_ohos) { + os_include = "linux" + } else if (is_apple) { + os_include = "mac" +diff --git a/third_party/libxslt/linux/COPYING b/third_party/libxslt/linux/COPYING +deleted file mode 120000 +index 0e91a5bd16..0000000000 +--- a/third_party/libxslt/linux/COPYING ++++ /dev/null +@@ -1 +0,0 @@ +-../src/Copyright +\ No newline at end of file +diff --git a/third_party/puffin/puffin/src b/third_party/puffin/puffin/src +deleted file mode 120000 +index 5cd551cf26..0000000000 +--- a/third_party/puffin/puffin/src ++++ /dev/null +@@ -1 +0,0 @@ +-../src +\ No newline at end of file +diff --git a/third_party/xcbproto/LICENSE b/third_party/xcbproto/LICENSE +deleted file mode 120000 +index a6d16ce5ca..0000000000 +--- a/third_party/xcbproto/LICENSE ++++ /dev/null +@@ -1 +0,0 @@ +-src/COPYING +\ No newline at end of file +diff --git a/third_party/zlib/BUILD.gn b/third_party/zlib/BUILD.gn +index ee7483e9ef..25b1ba417a 100644 +--- a/third_party/zlib/BUILD.gn ++++ b/third_party/zlib/BUILD.gn +@@ -121,7 +121,7 @@ if (use_arm_neon_optimizations) { + defines = [ "CRC32_ARMV8_CRC32" ] + if (is_android) { + defines += [ "ARMV8_OS_ANDROID" ] +- } else if (is_linux || is_chromeos) { ++ } else if (is_linux || is_chromeos || is_ohos) { + defines += [ "ARMV8_OS_LINUX" ] + } else if (is_mac) { + defines += [ "ARMV8_OS_MACOS" ] +diff --git a/third_party/zxcvbn-cpp/LICENSE b/third_party/zxcvbn-cpp/LICENSE +deleted file mode 120000 +index 85de3d4545..0000000000 +--- a/third_party/zxcvbn-cpp/LICENSE ++++ /dev/null +@@ -1 +0,0 @@ +-LICENSE.txt +\ No newline at end of file +diff --git a/tools/grit/grit_args.gni b/tools/grit/grit_args.gni +index a60843bab9..abc2eadf62 100644 +--- a/tools/grit/grit_args.gni ++++ b/tools/grit/grit_args.gni +@@ -15,7 +15,7 @@ devtools_grd_path_no_ext = get_path_info(devtools_grd_path, "dir") + "/" + + # Prefer using this (and excluding specific platforms) when a resource applies + # to (most) desktop platforms. + assert(toolkit_views == +- (is_chromeos || is_fuchsia || is_linux || is_mac || is_win)) ++ (is_chromeos || is_fuchsia || is_linux || is_mac || is_win || is_ohos)) + + # Variables that are passed to grit with the -D flag. + diff --git a/community/cronet/dawn_COMMIT_6ab02659de_oh_pkg.patch b/community/cronet/dawn_COMMIT_6ab02659de_oh_pkg.patch new file mode 100644 index 0000000000000000000000000000000000000000..fdb5b13c19c8774d9909f391c6a8ff75da5c132f --- /dev/null +++ b/community/cronet/dawn_COMMIT_6ab02659de_oh_pkg.patch @@ -0,0 +1,13 @@ +diff --git a/src/dawn/common/BUILD.gn b/src/dawn/common/BUILD.gn +index f46d108747..4134706e1f 100644 +--- a/src/dawn/common/BUILD.gn ++++ b/src/dawn/common/BUILD.gn +@@ -214,7 +214,7 @@ dawn_generator("dawn_gpu_info_gen") { + # This GN file is discovered by all Chromium builds, but common doesn't support + # all of Chromium's OSes so we explicitly make the target visible only on + # systems we know Dawn is able to compile on. +-if (is_win || is_linux || is_chromeos || is_mac || is_fuchsia || is_android) { ++if (is_win || is_linux || is_chromeos || is_mac || is_fuchsia || is_android || is_ohos) { + static_library("common") { + sources = [ + "Alloc.h", diff --git a/community/curl_8_9_0/HPKBUILD b/community/curl_8_9_0/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..afacb27e8c895a916635c74b3a0093077138d2bb --- /dev/null +++ b/community/curl_8_9_0/HPKBUILD @@ -0,0 +1,76 @@ +# 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: Jeff Han +# Maintainer: Jeff Han + +pkgname=curl_8_9_0 +pkgver=curl-8_9_0 +pkgrel=0 +pkgdesc="A command line tool and library for transferring data with URL syntax, supporting DICT, FILE, FTP, FTPS, GOPHER, GOPHERS, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, MQTT, POP3, POP3S, RTMP, RTMPS, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET, TFTP, WS and WSS. libcurl offers a myriad of powerful features" +url="https://curl.se/" +archs=("armeabi-v7a" "arm64-v8a") +license=("curl") +depends=("openssl_1_1_1w" "zstd_1_5_6" "nghttp2") # QUICHE/WEBSOCKETS +makedepends=() + +source="https://gitee.com/lycium_pkg_mirror/${pkgname:0:4}/repository/archive/$pkgver.zip" + +autounpack=true +downloadpackage=true +patchflag=true + +builddir=${pkgname:0:4}-${pkgver} +packagename=$builddir.zip + +prepare() { + if $patchflag + then + cd $builddir + # 编译识别 OpenHarmony 系统 + patch -p1 < `pwd`/../curl_oh_pkg.patch + # patch只需要打一次,关闭打patch + patchflag=false + cd $OLDPWD + fi + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" -DCURL_CA_BUNDLE="/etc/ssl/certs/cacert.pem" -DCURL_CA_PATH="/etc/ssl/certs/" -DCURL_ZSTD=ON -DENABLE_WEBSOCKETS=ON -DUSE_NGHTTP2=ON -B$ARCH-build -S./ > $buildlog 2>&1 + $MAKE -C $ARCH-build >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd "$builddir" + make -C $ARCH-build install >> `pwd`/$ARCH-build/build.log 2>&1 + cd $OLDPWD +} + +check() { + cd "$builddir" + make -C $ARCH-build testdeps >> `pwd`/$ARCH-build/build.log 2>&1 + cd $OLDPWD + echo "The test must be on an OpenHarmony device!" + # real test CMD + # TODO test +} + +# 清理环境 +cleanbuild(){ + rm -rf ${PWD}/$builddir #${PWD}/$packagename +} diff --git a/community/curl_8_9_0/HPKCHECK b/community/curl_8_9_0/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..9601faee3b7c2cf8f70dbb22044bde87d6ccfd80 --- /dev/null +++ b/community/curl_8_9_0/HPKCHECK @@ -0,0 +1,40 @@ +# 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: Jeff Han +# Maintainer: Jeff Han + +# Contributor: lpzhong <278527840@qq.com> +# Maintainer: lpzhong <278527840@qq.com> + +source HPKBUILD > /dev/null 2>&1 +logfile=${LYCIUM_THIRDPARTY_ROOT}/${pkgname:0:4}/${pkgname:0:4}_${ARCH}_${OHOS_SDK_VER}_test.log +openharmonycheck() { + res=0 + ## checkNetWork + ping www.baidu.com -c3 >> /dev/null + if [ $? -ne 0 ] + then + echo "the network not ready, the test depends the network! make sure the network is OK!!" + return 1 + fi + + cd ${builddir}/${ARCH}-build + cp ../../curl_test.sh ./ + touch data.txt + bash curl_test.sh > ${logfile} 2>&1 + res=$? + cd $OLDPWD + + return $res +} diff --git a/community/curl_8_9_0/README.OpenSource b/community/curl_8_9_0/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..d680b2b9610dc667f8cb62ce5946fa27fc39a77e --- /dev/null +++ b/community/curl_8_9_0/README.OpenSource @@ -0,0 +1,38 @@ +[ + { + "Name": "curl", + "License": "curl", + "License File": "https://github.com/curl/curl/blob/master/COPYING", + "Version Number": "curl-8_8_0", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://github.com/curl/curl/archive/refs/tags/curl-8_8_0.tar.gz", + "Description": "Curl is a command-line tool for transferring data specified with URL syntax. Find out how to use curl by reading the curl.1 man page or the MANUAL document. Find out how to install Curl by reading the INSTALL document." + }, + { + "Name": "openssl", + "License": "OpenSSL License and Original SSLeay License", + "License File": "https://www.openssl-library.org/source/license/license-openssl-ssleay.txt", + "Version Number": "1.1.1w", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://gitee.com/mirrors/openssl/repository/archive/OpenSSL_1_1_1w.zip", + "Description": "OpenSSL is a robust, commercial-grade, full-featured Open Source Toolkit for the Transport Layer Security (TLS) protocol formerly known as the Secure Sockets Layer (SSL) protocol." + }, + { + "Name": "zstd", + "License": "BSD-3-Clause or GPL-2.0", + "License File": ["https://github.com/facebook/zstd/blob/dev/LICENSE","https://github.com/facebook/zstd/blob/dev/COPYING"], + "Version Number": "v1.5.4", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://github.com/facebook/zstd/releases/download/v1.5.4/zstd-1.5.4.tar.gz", + "Description": "Zstandard, or zstd as short version, is a fast lossless compression algorithm, targeting real-time compression scenarios at zlib-level and better compression ratios." + }, + { + "Name": "nghttp2", + "License": "MIT", + "License File": "https://github.com/nghttp2/nghttp2/blob/master/COPYING", + "Version Number": "v1.52.0", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://github.com/nghttp2/nghttp2/archive/refs/tags/v1.52.0.tar.gz", + "Description": "This is an implementation of the Hypertext Transfer Protocol version 2 in C." + } +] diff --git a/community/curl_8_9_0/README_zh.md b/community/curl_8_9_0/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..e76436316a9b7a5332b7777ca5519dca706fa761 --- /dev/null +++ b/community/curl_8_9_0/README_zh.md @@ -0,0 +1,12 @@ +# curl_8_9_0三方库说明 +## 功能简介 +curl_8_9_0是一个C库用于网络请求。 + +## 三方库版本 +- curl_8_9_0 + +## 使用约束 +- [IDE和SDK版本](../../docs/constraint.md) + +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) diff --git a/community/curl_8_9_0/SHA512SUM b/community/curl_8_9_0/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..bc70ca913a751dc73bd85a951f24b98c0e490aeb --- /dev/null +++ b/community/curl_8_9_0/SHA512SUM @@ -0,0 +1,2 @@ +f2bb9cd0b7b9a15ba7e1b350470f46a78648a331bbf484cef57068ae0122385444f6ffa7550e280d29718cac6695f815ed7d31c0eafa01acceb849247f38d330 curl-curl-8_9_0.zip +5aa46dde086c895ac3477de5c369794831beea94ad8a463cd38eb37989fabf2fa4324d442d4fefae84b6d66f261a112ca3addb40a74c60c86cc91d9550581929 curl_oh_pkg.patch \ No newline at end of file diff --git a/community/curl_8_9_0/curl_oh_pkg.patch b/community/curl_8_9_0/curl_oh_pkg.patch new file mode 100644 index 0000000000000000000000000000000000000000..333380a582c5c099da7d45b9e7ea98ab34364967 --- /dev/null +++ b/community/curl_8_9_0/curl_oh_pkg.patch @@ -0,0 +1,28 @@ +From d110633f27f5b521f36e716082f3d12377b75fb2 Mon Sep 17 00:00:00 2001 +From: duanjf <605126199@qq.com> +Date: Tue, 30 Jul 2024 09:22:13 +0800 +Subject: [PATCH 7/7] add openharmony marco + +Signed-off-by: duanjf <605126199@qq.com> +--- + lib/CMakeLists.txt | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt +index 63e5b9139..c2863f5b3 100644 +--- a/lib/CMakeLists.txt ++++ b/lib/CMakeLists.txt +@@ -202,7 +202,9 @@ if(BUILD_SHARED_LIBS) + # FreeBSD comes with the a.out and ELF flavours but a.out was supported + # up to v3.x and ELF from v3.x. I cannot imagine someone running CMake + # on those ancient systems. +- CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") ++ CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR ++ # OpenHarmony ++ CMAKE_SYSTEM_NAME STREQUAL "OHOS") + set(soversion_default TRUE) + else() + set(soversion_default FALSE) +-- +2.43.0.windows.1 + diff --git a/community/curl_8_9_0/curl_test.sh b/community/curl_8_9_0/curl_test.sh new file mode 100644 index 0000000000000000000000000000000000000000..409d253e21ec72017e4985aa18deec8b35e363d6 --- /dev/null +++ b/community/curl_8_9_0/curl_test.sh @@ -0,0 +1,239 @@ +#!/bin/bash +# curl 基本功能测试,由于 curl 原生测试环境较为复杂,无法在交付时间内,在OpenHarmony搭建成功。因此采用脚本对核心功能进行测试。 +CURL=./src/curl + +# DEST_FILE=test_result_linux.txt +DEST_FILE=test_result_OpenHarmony.txt + +## 测试拉取整个网页 +function testWebSite() { + URL=www.baidu.com + TEST_SITE=./tmp.xml + RESULT_FILE=test.xml + + busybox wget -O $RESULT_FILE $URL + + $CURL -o $TEST_SITE $URL + if [ $? -ne 0 ]; then + echo "run curl failed!" >> $DEST_FILE + return -1 + fi + cmp $RESULT_FILE $TEST_SITE + retval=$? + if [ $retval -ne 0 ] ; + then + echo "testWebSite result failed!" >> $DEST_FILE + else + echo "testWebSite result success!" >> $DEST_FILE + fi + + rm $RESULT_FILE $TEST_SITE +} + +## 测试拉取一个文件 +function testWebData() { + URL=http://www.baidu.com/img/bdlogo.gif + SP="/" + FNAME=${URL##*$SP} + RESULT=test_$FNAME + + busybox wget -O $RESULT $URL + + $CURL -O $URL + if [ $? -ne 0 ]; then + echo "run curl failed!" >> $DEST_FILE + return -1 + fi + + cmp $RESULT $FNAME + retval=$? + if [ $retval -ne 0 ] ; + then + echo "testWebData result failed!" >> $DEST_FILE + else + echo "testWebData result success!" >> $DEST_FILE + fi + + rm $RESULT $FNAME +} + + +##测试GET请求方式 +function testHttpGet() { + URL=http://aiezu.com/test.php + tmp=`$CURL $URL` + res=`echo $tmp |grep -n "GET"` + if [ -z "$res" ]; then + echo "testHttpGet failed!" >> $DEST_FILE + return -1 + fi + + res=`echo $tmp |grep -n "Array"` + if [ -z "$res" ]; then + echo "testHttpGet failed!" >> $DEST_FILE + return -1 + fi + + echo "testHttpGet success!" >> $DEST_FILE + return 0 +} + +## 测试特定方式发送GET请求数据 +function testHttpGetParam(){ + URL=http://aiezu.com/test.php + PARAMS="en=aiezu&cn=爱E族" + tmp=`$CURL -G --data $PARAMS $URL` + res=`echo $tmp |grep -n "GET"` + if [ -z "$res" ]; then + echo "testHttpGetParam failed!" >> $DEST_FILE + return -1 + fi + + res=`echo $tmp |grep -n "Array"` + if [ -z "$res" ]; then + echo "testHttpGetParam failed!" >> $DEST_FILE + return -1 + fi + + echo "testHttpGetParam success!" >> $DEST_FILE + return 0 +} + +##测试POST请求方式 +function testHttpPost() { + URL=http://aiezu.com/test.php + PARAMS="--data 'name=爱E族&site=aiezu.com' --data-urlencode 'code=/&?'" + tmp=`$CURL $PARAMS $URL` + res=`echo $tmp |grep -n "POST"` + if [ -z "$res" ]; then + echo "testHttpPost failed!" >> $DEST_FILE + return -1 + fi + + res=`echo $tmp |grep -n "Array"` + if [ -z "$res" ]; then + echo "testHttpPost failed!" >> $DEST_FILE + return -1 + fi + + echo "testHttpPost success!" >> $DEST_FILE + return 0 +} + +##测试POST发送表单请求方式 +function testHttpPostForm(){ + URL=http://aiezu.com/test.php + PARAMS1="name=爱E族" + PARAMS2="site=aiezu.com" + tmp=`$CURL --form $PARAMS1 -F $PARAMS2 $URL` + res=`echo $tmp |grep -n "POST"` + if [ -z "$res" ]; then + echo "testHttpPostForm failed!" >> $DEST_FILE + return -1 + fi + + res=`echo $tmp |grep -n "Array"` + if [ -z "$res" ]; then + echo "testHttpPostForm failed!" >> $DEST_FILE + return -1 + fi + + echo "testHttpPostForm success!" >> $DEST_FILE + return 0 +} + +##测试POST请求方式上传本地文件 +function testHttpPostFile() { + URL=http://aiezu.com/test.php + PARAMS=data.txt + + if [ ! -f "$PARAMS" ]; then + echo "no test data file!" >> $DEST_FILE + echo "testHttpPostFile failed!" >> $DEST_FILE + return -1 + fi + + tmp=`$CURL --form file=@$PARAMS $URL` + res=`echo $tmp |grep -n "POST"` + if [ -z "$res" ]; then + echo "testHttpPostFile failed!" >> $DEST_FILE + return -1 + fi + + res=`echo $tmp |grep -n "Array"` + if [ -z "$res" ]; then + echo "testHttpPostFile failed!" >> $DEST_FILE + return -1 + fi + + echo "testHttpPostFile success!" >> $DEST_FILE + return 0 +} + +##测试POST请求方式上传JSON数据 +function testHttpPostJson() { + URL=http://aiezu.com/test.php + PARAMS="{"name":"爱E族","site":"aiezu.com"}" + + tmp=`$CURL -H "Content-Type: application/json" --data $PARAMS $URL` + res=`echo $tmp |grep -n "POST"` + if [ -z "$res" ]; then + echo "testHttpPostJson failed!" >> $DEST_FILE + return -1 + fi + + res=`echo $tmp |grep -n "Array"` + if [ -z "$res" ]; then + echo "testHttpPostJson failed!" >> $DEST_FILE + return -1 + fi + + echo "testHttpPostJson success!" >> $DEST_FILE + return 0 +} + +if [ ! -f "$CURL" ]; then + echo "no curl cmd file!" >> $DEST_FILE + exit 1 +fi + +echo "Start Test CURL!" > $DEST_FILE +echo "" >> $DEST_FILE +retval=0 +echo "start testWebSite" >> $DEST_FILE +testWebSite +retval=`expr $retval + $?` +echo "start testWebData" >> $DEST_FILE +testWebData +retval=`expr $retval + $?` +echo "start testHttpGet" >> $DEST_FILE +testHttpGet +retval=`expr $retval + $?` +echo "start testHttpGetParam" >> $DEST_FILE +testHttpGetParam +retval=`expr $retval + $?` +echo "start testHttpPost" >> $DEST_FILE +testHttpPost +retval=`expr $retval + $?` +echo "start testHttpPostForm" >> $DEST_FILE +testHttpPostForm +retval=`expr $retval + $?` +echo "start testHttpPostFile" >> $DEST_FILE +testHttpPostFile +retval=`expr $retval + $?` +echo "start testHttpPostJson" >> $DEST_FILE +testHttpPostJson +retval=`expr $retval + $?` +echo "" >> $DEST_FILE +echo "Test CURL OVER!!" >> $DEST_FILE + +cat $DEST_FILE + +if [ $retval -ne 0 ] +then + exit 1 +else + exit 0 +fi + +#EOF diff --git a/community/curl_8_9_0/docs/hap_integrate.md b/community/curl_8_9_0/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..acc098939048ceb3324d01af4e8941021cb91f86 --- /dev/null +++ b/community/curl_8_9_0/docs/hap_integrate.md @@ -0,0 +1,60 @@ +# curl_8_9_0集成到应用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) +## 编译三方库 +- 下载本仓库 + ``` + git clone https://gitee.com/openharmony-sig/tpc_c_cplusplus.git --depth=1 + ``` + +- 三方库目录结构 + ``` + tpc_c_cplusplus/thirdparty/curl_8_9_0 #三方库curl_8_9_0的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md + ``` + +- 在lycium目录下编译三方库 + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ``` + cd lycium + ./build.sh curl_8_9_0 + ``` + +- 三方库头文件及生成的库 + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + ``` + curl_8_9_0/arm64-v8a curl_8_9_0/armeabi-v7a + zstd/arm64-v8a zstd/armeabi-v7a + nghttp2/arm64-v8a nghttp2/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 拷贝动态库到`\\entry\libs\${OHOS_ARCH}\`目录: + 动态库需要在`\\entry\libs\${OHOS_ARCH}\`目录,才能集成到hap包中,所以需要将对应的so文件拷贝到对应CPU架构的目录 + +  ![thirdparty_install_dir](pic/curl_install_dir_1.jpg) +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的库拷贝到该目录下,如下图所示 + +  ![thirdparty_install_dir](pic/curl_install_dir_2.jpg) +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + ``` + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/libcurl.so) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/curl/${OHOS_ARCH}/include) + ``` + +## 参考资料 +- [润和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/community/curl_8_9_0/docs/pic/curl_install_dir_1.jpg b/community/curl_8_9_0/docs/pic/curl_install_dir_1.jpg new file mode 100644 index 0000000000000000000000000000000000000000..550b05625298e8eb0f68d1f31a75cb5c2c4a0f04 Binary files /dev/null and b/community/curl_8_9_0/docs/pic/curl_install_dir_1.jpg differ diff --git a/community/curl_8_9_0/docs/pic/curl_install_dir_2.jpg b/community/curl_8_9_0/docs/pic/curl_install_dir_2.jpg new file mode 100644 index 0000000000000000000000000000000000000000..ea3accb82af686252786c5ddc283118eb0592592 Binary files /dev/null and b/community/curl_8_9_0/docs/pic/curl_install_dir_2.jpg differ diff --git a/community/curl_8_9_0/docs/pic/curl_usage.jpg b/community/curl_8_9_0/docs/pic/curl_usage.jpg new file mode 100644 index 0000000000000000000000000000000000000000..7717531b954b571873bd0bf43a11bfe83887a43f Binary files /dev/null and b/community/curl_8_9_0/docs/pic/curl_usage.jpg differ diff --git a/community/curl_8_9_1/HPKBUILD b/community/curl_8_9_1/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..fcb536813fefa4e3be67954a68e6e568129d7ea0 --- /dev/null +++ b/community/curl_8_9_1/HPKBUILD @@ -0,0 +1,80 @@ +# 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: Jeff Han +# Maintainer: Jeff Han + +pkgname=curl_8_9_1 +pkgver=curl-8_9_1 +pkgrel=0 +pkgdesc="A command line tool and library for transferring data with URL syntax, supporting DICT, FILE, FTP, FTPS, GOPHER, GOPHERS, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, MQTT, POP3, POP3S, RTMP, RTMPS, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET, TFTP, WS and WSS. libcurl offers a myriad of powerful features" +url="https://curl.se/" +archs=("armeabi-v7a" "arm64-v8a") +license=("curl") +depends=("openssl_1_1_1w" "zstd_1_5_6" "nghttp2") # QUICHE/WEBSOCKETS +makedepends=() + +source="https://gitee.com/lycium_pkg_mirror/${pkgname:0:4}/repository/archive/$pkgver.zip" + +autounpack=true +downloadpackage=true +patchflag=true + +builddir=${pkgname:0:4}-${pkgver} +packagename=$builddir.zip + +prepare() { + if $patchflag + then + cd $builddir + # 编译识别 OpenHarmony 系统 + patch -p1 < `pwd`/../curl_oh_pkg.patch + # patch只需要打一次,关闭打patch + patchflag=false + cd $OLDPWD + fi + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" -DCURL_CA_BUNDLE="/etc/ssl/certs/cacert.pem" -DCURL_CA_PATH="/etc/ssl/certs/" -DCURL_ZSTD=ON -DENABLE_WEBSOCKETS=ON -DUSE_NGHTTP2=ON -B$ARCH-build -S./ > $buildlog 2>&1 + $MAKE -C $ARCH-build >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd "$builddir" + ${MAKE} -C $ARCH-build install >> `pwd`/$ARCH-build/build.log 2>&1 + ret=$? + cd $OLDPWD + return ${ret} +} + +check() { + cd "$builddir" + ${MAKE} -C $ARCH-build testdeps >> `pwd`/$ARCH-build/build.log 2>&1 + ret=$? + cd $OLDPWD + echo "The test must be on an OpenHarmony device!" + return ${ret} + # real test CMD + # TODO test +} + +# 清理环境 +cleanbuild() { + rm -rf ${PWD}/$builddir #${PWD}/$packagename +} diff --git a/community/curl_8_9_1/HPKCHECK b/community/curl_8_9_1/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..9601faee3b7c2cf8f70dbb22044bde87d6ccfd80 --- /dev/null +++ b/community/curl_8_9_1/HPKCHECK @@ -0,0 +1,40 @@ +# 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: Jeff Han +# Maintainer: Jeff Han + +# Contributor: lpzhong <278527840@qq.com> +# Maintainer: lpzhong <278527840@qq.com> + +source HPKBUILD > /dev/null 2>&1 +logfile=${LYCIUM_THIRDPARTY_ROOT}/${pkgname:0:4}/${pkgname:0:4}_${ARCH}_${OHOS_SDK_VER}_test.log +openharmonycheck() { + res=0 + ## checkNetWork + ping www.baidu.com -c3 >> /dev/null + if [ $? -ne 0 ] + then + echo "the network not ready, the test depends the network! make sure the network is OK!!" + return 1 + fi + + cd ${builddir}/${ARCH}-build + cp ../../curl_test.sh ./ + touch data.txt + bash curl_test.sh > ${logfile} 2>&1 + res=$? + cd $OLDPWD + + return $res +} diff --git a/community/curl_8_9_1/README.OpenSource b/community/curl_8_9_1/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..b8fa1303c156193eb790643b74afedeb7d6f481a --- /dev/null +++ b/community/curl_8_9_1/README.OpenSource @@ -0,0 +1,38 @@ +[ + { + "Name": "curl", + "License": "curl", + "License File": "https://github.com/curl/curl/blob/master/COPYING", + "Version Number": "curl-8_9_1", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://github.com/curl/curl", + "Description": "Curl is a command-line tool for transferring data specified with URL syntax. Find out how to use curl by reading the curl.1 man page or the MANUAL document. Find out how to install Curl by reading the INSTALL document." + }, + { + "Name": "openssl", + "License": "OpenSSL License and Original SSLeay License", + "License File": "https://www.openssl-library.org/source/license/license-openssl-ssleay.txt", + "Version Number": "1.1.1w", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://gitee.com/mirrors/openssl/repository/archive/OpenSSL_1_1_1w.zip", + "Description": "OpenSSL is a robust, commercial-grade, full-featured Open Source Toolkit for the Transport Layer Security (TLS) protocol formerly known as the Secure Sockets Layer (SSL) protocol." + }, + { + "Name": "zstd", + "License": "BSD-3-Clause or GPL-2.0", + "License File": ["https://github.com/facebook/zstd/blob/dev/LICENSE","https://github.com/facebook/zstd/blob/dev/COPYING"], + "Version Number": "v1.5.6", + "Owner": "hanjinfei@foxmail.com", + "Upstream URL": "https://github.com/facebook/zstd/archive/refs/tags/v1.5.6.tar.gz", + "Description": "Zstandard, or zstd as short version, is a fast lossless compression algorithm, targeting real-time compression scenarios at zlib-level and better compression ratios." + }, + { + "Name": "nghttp2", + "License": "MIT", + "License File": "https://github.com/nghttp2/nghttp2/blob/master/COPYING", + "Version Number": "v1.52.0", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://github.com/nghttp2/nghttp2/archive/refs/tags/v1.52.0.tar.gz", + "Description": "This is an implementation of the Hypertext Transfer Protocol version 2 in C." + } +] diff --git a/community/curl_8_9_1/README_zh.md b/community/curl_8_9_1/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..f5a06fdd5a23d0f07f1060360b3f247963c3d347 --- /dev/null +++ b/community/curl_8_9_1/README_zh.md @@ -0,0 +1,12 @@ +# curl_8_9_1三方库说明 +## 功能简介 +curl_8_9_1是一个C库用于网络请求。 + +## 三方库版本 +- curl-8_9_1 + +## 使用约束 +- [IDE和SDK版本](../../docs/constraint.md) + +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) diff --git a/community/curl_8_9_1/SHA512SUM b/community/curl_8_9_1/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..a402ca6a5cf5155e7c1bf5fd8b1e681be4c619a6 --- /dev/null +++ b/community/curl_8_9_1/SHA512SUM @@ -0,0 +1 @@ +78f0363c7b51f3517344225f4235e3b5b5522ebc69b7d9c2436de01bdf3c2d30cb19ca706db63120a0ef4626747d8ffa650d13bae055bc648cf5c642c9ee6a84 curl-curl-8_9_1.zip diff --git a/community/curl_8_9_1/curl_oh_pkg.patch b/community/curl_8_9_1/curl_oh_pkg.patch new file mode 100644 index 0000000000000000000000000000000000000000..333380a582c5c099da7d45b9e7ea98ab34364967 --- /dev/null +++ b/community/curl_8_9_1/curl_oh_pkg.patch @@ -0,0 +1,28 @@ +From d110633f27f5b521f36e716082f3d12377b75fb2 Mon Sep 17 00:00:00 2001 +From: duanjf <605126199@qq.com> +Date: Tue, 30 Jul 2024 09:22:13 +0800 +Subject: [PATCH 7/7] add openharmony marco + +Signed-off-by: duanjf <605126199@qq.com> +--- + lib/CMakeLists.txt | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt +index 63e5b9139..c2863f5b3 100644 +--- a/lib/CMakeLists.txt ++++ b/lib/CMakeLists.txt +@@ -202,7 +202,9 @@ if(BUILD_SHARED_LIBS) + # FreeBSD comes with the a.out and ELF flavours but a.out was supported + # up to v3.x and ELF from v3.x. I cannot imagine someone running CMake + # on those ancient systems. +- CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") ++ CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR ++ # OpenHarmony ++ CMAKE_SYSTEM_NAME STREQUAL "OHOS") + set(soversion_default TRUE) + else() + set(soversion_default FALSE) +-- +2.43.0.windows.1 + diff --git a/community/curl_8_9_1/curl_test.sh b/community/curl_8_9_1/curl_test.sh new file mode 100644 index 0000000000000000000000000000000000000000..409d253e21ec72017e4985aa18deec8b35e363d6 --- /dev/null +++ b/community/curl_8_9_1/curl_test.sh @@ -0,0 +1,239 @@ +#!/bin/bash +# curl 基本功能测试,由于 curl 原生测试环境较为复杂,无法在交付时间内,在OpenHarmony搭建成功。因此采用脚本对核心功能进行测试。 +CURL=./src/curl + +# DEST_FILE=test_result_linux.txt +DEST_FILE=test_result_OpenHarmony.txt + +## 测试拉取整个网页 +function testWebSite() { + URL=www.baidu.com + TEST_SITE=./tmp.xml + RESULT_FILE=test.xml + + busybox wget -O $RESULT_FILE $URL + + $CURL -o $TEST_SITE $URL + if [ $? -ne 0 ]; then + echo "run curl failed!" >> $DEST_FILE + return -1 + fi + cmp $RESULT_FILE $TEST_SITE + retval=$? + if [ $retval -ne 0 ] ; + then + echo "testWebSite result failed!" >> $DEST_FILE + else + echo "testWebSite result success!" >> $DEST_FILE + fi + + rm $RESULT_FILE $TEST_SITE +} + +## 测试拉取一个文件 +function testWebData() { + URL=http://www.baidu.com/img/bdlogo.gif + SP="/" + FNAME=${URL##*$SP} + RESULT=test_$FNAME + + busybox wget -O $RESULT $URL + + $CURL -O $URL + if [ $? -ne 0 ]; then + echo "run curl failed!" >> $DEST_FILE + return -1 + fi + + cmp $RESULT $FNAME + retval=$? + if [ $retval -ne 0 ] ; + then + echo "testWebData result failed!" >> $DEST_FILE + else + echo "testWebData result success!" >> $DEST_FILE + fi + + rm $RESULT $FNAME +} + + +##测试GET请求方式 +function testHttpGet() { + URL=http://aiezu.com/test.php + tmp=`$CURL $URL` + res=`echo $tmp |grep -n "GET"` + if [ -z "$res" ]; then + echo "testHttpGet failed!" >> $DEST_FILE + return -1 + fi + + res=`echo $tmp |grep -n "Array"` + if [ -z "$res" ]; then + echo "testHttpGet failed!" >> $DEST_FILE + return -1 + fi + + echo "testHttpGet success!" >> $DEST_FILE + return 0 +} + +## 测试特定方式发送GET请求数据 +function testHttpGetParam(){ + URL=http://aiezu.com/test.php + PARAMS="en=aiezu&cn=爱E族" + tmp=`$CURL -G --data $PARAMS $URL` + res=`echo $tmp |grep -n "GET"` + if [ -z "$res" ]; then + echo "testHttpGetParam failed!" >> $DEST_FILE + return -1 + fi + + res=`echo $tmp |grep -n "Array"` + if [ -z "$res" ]; then + echo "testHttpGetParam failed!" >> $DEST_FILE + return -1 + fi + + echo "testHttpGetParam success!" >> $DEST_FILE + return 0 +} + +##测试POST请求方式 +function testHttpPost() { + URL=http://aiezu.com/test.php + PARAMS="--data 'name=爱E族&site=aiezu.com' --data-urlencode 'code=/&?'" + tmp=`$CURL $PARAMS $URL` + res=`echo $tmp |grep -n "POST"` + if [ -z "$res" ]; then + echo "testHttpPost failed!" >> $DEST_FILE + return -1 + fi + + res=`echo $tmp |grep -n "Array"` + if [ -z "$res" ]; then + echo "testHttpPost failed!" >> $DEST_FILE + return -1 + fi + + echo "testHttpPost success!" >> $DEST_FILE + return 0 +} + +##测试POST发送表单请求方式 +function testHttpPostForm(){ + URL=http://aiezu.com/test.php + PARAMS1="name=爱E族" + PARAMS2="site=aiezu.com" + tmp=`$CURL --form $PARAMS1 -F $PARAMS2 $URL` + res=`echo $tmp |grep -n "POST"` + if [ -z "$res" ]; then + echo "testHttpPostForm failed!" >> $DEST_FILE + return -1 + fi + + res=`echo $tmp |grep -n "Array"` + if [ -z "$res" ]; then + echo "testHttpPostForm failed!" >> $DEST_FILE + return -1 + fi + + echo "testHttpPostForm success!" >> $DEST_FILE + return 0 +} + +##测试POST请求方式上传本地文件 +function testHttpPostFile() { + URL=http://aiezu.com/test.php + PARAMS=data.txt + + if [ ! -f "$PARAMS" ]; then + echo "no test data file!" >> $DEST_FILE + echo "testHttpPostFile failed!" >> $DEST_FILE + return -1 + fi + + tmp=`$CURL --form file=@$PARAMS $URL` + res=`echo $tmp |grep -n "POST"` + if [ -z "$res" ]; then + echo "testHttpPostFile failed!" >> $DEST_FILE + return -1 + fi + + res=`echo $tmp |grep -n "Array"` + if [ -z "$res" ]; then + echo "testHttpPostFile failed!" >> $DEST_FILE + return -1 + fi + + echo "testHttpPostFile success!" >> $DEST_FILE + return 0 +} + +##测试POST请求方式上传JSON数据 +function testHttpPostJson() { + URL=http://aiezu.com/test.php + PARAMS="{"name":"爱E族","site":"aiezu.com"}" + + tmp=`$CURL -H "Content-Type: application/json" --data $PARAMS $URL` + res=`echo $tmp |grep -n "POST"` + if [ -z "$res" ]; then + echo "testHttpPostJson failed!" >> $DEST_FILE + return -1 + fi + + res=`echo $tmp |grep -n "Array"` + if [ -z "$res" ]; then + echo "testHttpPostJson failed!" >> $DEST_FILE + return -1 + fi + + echo "testHttpPostJson success!" >> $DEST_FILE + return 0 +} + +if [ ! -f "$CURL" ]; then + echo "no curl cmd file!" >> $DEST_FILE + exit 1 +fi + +echo "Start Test CURL!" > $DEST_FILE +echo "" >> $DEST_FILE +retval=0 +echo "start testWebSite" >> $DEST_FILE +testWebSite +retval=`expr $retval + $?` +echo "start testWebData" >> $DEST_FILE +testWebData +retval=`expr $retval + $?` +echo "start testHttpGet" >> $DEST_FILE +testHttpGet +retval=`expr $retval + $?` +echo "start testHttpGetParam" >> $DEST_FILE +testHttpGetParam +retval=`expr $retval + $?` +echo "start testHttpPost" >> $DEST_FILE +testHttpPost +retval=`expr $retval + $?` +echo "start testHttpPostForm" >> $DEST_FILE +testHttpPostForm +retval=`expr $retval + $?` +echo "start testHttpPostFile" >> $DEST_FILE +testHttpPostFile +retval=`expr $retval + $?` +echo "start testHttpPostJson" >> $DEST_FILE +testHttpPostJson +retval=`expr $retval + $?` +echo "" >> $DEST_FILE +echo "Test CURL OVER!!" >> $DEST_FILE + +cat $DEST_FILE + +if [ $retval -ne 0 ] +then + exit 1 +else + exit 0 +fi + +#EOF diff --git a/community/curl_8_9_1/docs/hap_integrate.md b/community/curl_8_9_1/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..1840b6d037498dddc96a77d8da5f2567599c86e3 --- /dev/null +++ b/community/curl_8_9_1/docs/hap_integrate.md @@ -0,0 +1,61 @@ +# curl_8_9_1集成到应用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 + ``` + +- 三方库目录结构 + ``` + tpc_c_cplusplus/thirdparty/curl_8_9_1 #三方库curl_8_9_1的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md + ``` + +- 在lycium目录下编译三方库 + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ```shell + cd lycium + ./build.sh curl_8_9_1 + ``` + +- 三方库头文件及生成的库 + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + ``` + curl_8_9_1/arm64-v8a curl_8_9_1/armeabi-v7a + zstd_1_5_6/arm64-v8a zstd_1_5_6/armeabi-v7a + nghttp2/arm64-v8a nghttp2/armeabi-v7a + openssl_1_1_1w/arm64-v8a openssl_1_1_1w/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 拷贝动态库到`\\entry\libs\${OHOS_ARCH}\`目录: + 动态库需要在`\\entry\libs\${OHOS_ARCH}\`目录,才能集成到hap包中,所以需要将对应的so文件拷贝到对应CPU架构的目录 + +  ![thirdparty_install_dir](pic/curl_install_dir_1.jpg) +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的库拷贝到该目录下,如下图所示 + +  ![thirdparty_install_dir](pic/curl_install_dir_2.jpg) +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + ```cmake + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/libcurl.so) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/curl/${OHOS_ARCH}/include) + ``` + +## 参考资料 +- [润和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/community/curl_8_9_1/docs/pic/curl_install_dir_1.jpg b/community/curl_8_9_1/docs/pic/curl_install_dir_1.jpg new file mode 100644 index 0000000000000000000000000000000000000000..550b05625298e8eb0f68d1f31a75cb5c2c4a0f04 Binary files /dev/null and b/community/curl_8_9_1/docs/pic/curl_install_dir_1.jpg differ diff --git a/community/curl_8_9_1/docs/pic/curl_install_dir_2.jpg b/community/curl_8_9_1/docs/pic/curl_install_dir_2.jpg new file mode 100644 index 0000000000000000000000000000000000000000..ea3accb82af686252786c5ddc283118eb0592592 Binary files /dev/null and b/community/curl_8_9_1/docs/pic/curl_install_dir_2.jpg differ diff --git a/community/curl_8_9_1/docs/pic/curl_usage.jpg b/community/curl_8_9_1/docs/pic/curl_usage.jpg new file mode 100644 index 0000000000000000000000000000000000000000..7717531b954b571873bd0bf43a11bfe83887a43f Binary files /dev/null and b/community/curl_8_9_1/docs/pic/curl_usage.jpg differ diff --git a/community/dotconf/HPKBUILD b/community/dotconf/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..72c96f826b24880e6dffb56baec1a379e56234ea --- /dev/null +++ b/community/dotconf/HPKBUILD @@ -0,0 +1,94 @@ +# 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: huangminzhong +# Maintainer: huangminzhong + +pkgname=dotconf +pkgver=v1.3 +pkgrel=0 +pkgdesc="dot.conf configuration file parser" +url="https://github.com/williamh/dotconf" +archs=("armeabi-v7a" "arm64-v8a") +license=("GNU Lesser General Public License v2.1") +depends=() +makedepends=() +# 原仓地址:"https://github.com/williamh/dotconf/archive/refs/tags/v1.3.tar.gz" 因网络问题下载失败采用镜像地址 + +source="https://gitee.com/lycium_pkg_mirror/$pkgname/repository/archive/$pkgver.zip" + +autounpack=true +downloadpackage=true +buildtools="configure" + +builddir=${pkgname}-${pkgver} +packagename=$builddir.zip + +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 + else + echo "${ARCH} not support" + return -1 + fi + cd $builddir-$ARCH-build + autoreconf -ifv > $buildlog 2>&1 + cd $OLDPWD +} + +build() { + cd $builddir-$ARCH-build + PKG_CONFIG_LIBDIR="${pkgconfigpath}" ./configure "$@" --host=$host >> $buildlog 2>&1 + ${MAKE} VERBOSE=1 >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir-$ARCH-build + ${MAKE} VERBOSE=1 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 + else + echo "${ARCH} not support" + return -1 + fi +} + +# 清理环境 +cleanbuild(){ + rm -rf ${PWD}/$builddir ${PWD}/$builddir-armeabi-v7a-build ${PWD}/$builddir-arm64-v8a-build #${PWD}/$packagename +} diff --git a/community/dotconf/SHA512SUM b/community/dotconf/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..aac1af1f6c9c0af3a94daaf23449f6c02c86368c --- /dev/null +++ b/community/dotconf/SHA512SUM @@ -0,0 +1 @@ +8fcd2e24c7dcb6012357a1a28889b201930b3c91147521f16ed62a02df3d6cd1eeb955cb7929a2a4e090c5f97ab9897e440938ef8669a6265ab5d7c7edb7f22c dotconf-v1.3.zip diff --git a/community/draco/HPKBUILD b/community/draco/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..61c0c5ffd2ebc3c5ae60bf8e8ff6bf6fcb4f66f4 --- /dev/null +++ b/community/draco/HPKBUILD @@ -0,0 +1,62 @@ +# 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<2942375747@qq.com> , wangying +# Maintainer: wangyihao<2942375747@qq.com> + +pkgname=draco +pkgver=1.5.4 +pkgrel=0 +pkgdesc="Draco is a library for compressing and decompressing 3D geometric meshes and point clouds." +url="https://github.com/google/draco/tree/1.5.4" +archs=("armeabi-v7a" "arm64-v8a") +license=("Apache-2.0 license") +depends=() +makedepends=() +source="https://github.com/google/$pkgname/archive/refs/tags/$pkgver.zip" + +downloadpackage=true +autounpack=true +buildtools="cmake" + +builddir=$pkgname-${pkgver} +packagename=$builddir.zip + +prepare() { + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + PKG_CONFIG_LIBDIR="${pkgconfigpath}" ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" \ + -DCMAKE_C_FLAGS="-Wno-unused-command-line-argument" \ + -DCMAKE_CXX_FLAGS="-Wno-unused-command-line-argument" -B$ARCH-build -S./ > $buildlog 2>&1 + $MAKE VERBOSE=1 -C $ARCH-build >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + $MAKE vERBOSE=1 -C $ARCH-build install >> $buildlog 2>&1 + cd $OLDPWD +} + +check() { + echo "The test must be on an OpenHarmony device!" +} + +cleanbuild() { + rm -rf ${PWD}/$builddir +} \ No newline at end of file diff --git a/community/draco/HPKCHECK b/community/draco/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..505898747ac90d16cb8febff38876187a3430cbd --- /dev/null +++ b/community/draco/HPKCHECK @@ -0,0 +1,34 @@ +# 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<2942375747@qq.com> , wangying +# Maintainer: wangyihao<2942375747@qq.com> + +source HPKBUILD > /dev/null 2>&1 # 导入HPKBUILD文件 +logfile=${LYCIUM_THIRDPARTY_ROOT}/${pkgname}/${pkgname}_${ARCH}_${OHOS_SDK_VER}_test.log + +# 测试前的准备, 如果不需要可以不写。 +checkprepare(){ + return 0 +} + +# 在OH环境执行测试的接口 +openharmonycheck() { + res=0 + cd ${builddir}/${ARCH}-build + ctest > ${logfile} 2>&1 + res=$? + cd $OLDPWD + + return $res +} \ No newline at end of file diff --git a/community/draco/OAT.xml b/community/draco/OAT.xml new file mode 100644 index 0000000000000000000000000000000000000000..eeb1f946d683c0b81976cd06522096062a6901b9 --- /dev/null +++ b/community/draco/OAT.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/community/draco/README.OpenSource b/community/draco/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..9d8260e2b8e18352774f92bc0b2f3f7836d4d801 --- /dev/null +++ b/community/draco/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "draco", + "License": "Apache-2.0 license", + "License File": "https://github.com/google/draco/blob/main/LICENSE", + "Version Number": "v1.5.4", + "Owner": "huangminzhong2@huawei.com", + "Upstream URL": "https://github.com/google/draco", + "Description": "Draco is a library for compressing and decompressing 3D geometric meshes and point clouds." + } +] \ No newline at end of file diff --git a/community/draco/README_zh.md b/community/draco/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..8da75aa50a97e88ffa32c6daf18e1ff0251d6507 --- /dev/null +++ b/community/draco/README_zh.md @@ -0,0 +1,12 @@ +# draco三方库说明 +## 功能简介 +draco用于改善3D图形的存储和传输。 + +## 三方库版本 +- v1.5.4 + +## 使用约束 +- [IDE和SDK版本](../../docs/constraint.md) + +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) diff --git a/community/draco/SHA512SUM b/community/draco/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..3f285cd26b640fa52f4f28a132f3bae79a18491e --- /dev/null +++ b/community/draco/SHA512SUM @@ -0,0 +1,2 @@ +4740433431dde92821139113661bbb4180190e0c9403dfa24255e53a35fe44fca881699f4dcb230bf6e4bc49d0e70210221a590c27316cc563cf4d939a8bf118 draco-1.5.4.zip + diff --git a/community/draco/docs/hap_integrate.md b/community/draco/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..d2a2306930d5606fc4b58820e69de209d51f9d1d --- /dev/null +++ b/community/draco/docs/hap_integrate.md @@ -0,0 +1,79 @@ +# draco 集成到应用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/draco #三方库draco的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── HPKCHECK #测试脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md #三方库简介 + ``` + +- 在lycium目录下编译三方库 + + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ```shell + cd lycium + ./build.sh draco + ``` + +- 三方库头文件及生成的库 + + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ```shell + draco/arm64-v8a draco/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +- 编译出可执行的文件进行测试,[准备三方库测试环境](../../../lycium/README.md#3ci环境准备) +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的头文件拷贝到该目录下,将编译生成的三方库以及依赖库全部(动态库名字带版本号和不带版本号的都需要)拷贝到工程的libs目录下,如下图所示: +   + +  ![thirdparty_install_dir](pic/draco_install_dir.png) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + + ```shell + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/draco/${OHOS_ARCH}/lib/libdraco.a) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/draco/${OHOS_ARCH}/include) + ``` + +## 测试三方库 +在lycium目录下执行脚本./test.sh,自动运行thridparty目录下已编译的三方库, + + +```shell + cd lycium + ./test.sh draco +``` + ![draco_test](pic/draco_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/community/draco/docs/pic/draco_install_dir.png b/community/draco/docs/pic/draco_install_dir.png new file mode 100644 index 0000000000000000000000000000000000000000..6d25a354cb91fd702c3f273217f05393c67dd294 Binary files /dev/null and b/community/draco/docs/pic/draco_install_dir.png differ diff --git a/community/draco/docs/pic/draco_test.png b/community/draco/docs/pic/draco_test.png new file mode 100644 index 0000000000000000000000000000000000000000..f610911b61ecf9644d00fa44e56fa26a6d6d15ec Binary files /dev/null and b/community/draco/docs/pic/draco_test.png differ diff --git a/community/draco/docs/pic/draco_usage.png b/community/draco/docs/pic/draco_usage.png new file mode 100644 index 0000000000000000000000000000000000000000..fd3996013c6fdf392fe6d3cb18d498b482c75ed0 Binary files /dev/null and b/community/draco/docs/pic/draco_usage.png differ diff --git a/community/eigen/HPKBUILD b/community/eigen/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..bdda184a9a0d14f273bc3964e4a8437daa525217 --- /dev/null +++ b/community/eigen/HPKBUILD @@ -0,0 +1,48 @@ +# Contributor: shann +# Maintainer: shann +pkgname=eigen +pkgver=3.4.0 +pkgrel=0 +pkgdesc="Eigen is a C++ template library for linear algebra: matrices, vectors, numerical solvers, and related algorithms." +url="http://eigen.tuxfamily.org/" +archs=("armeabi-v7a" "arm64-v8a") +license=("MPL2") +depends=() +makedepends=() + +source="https://gitlab.com/libeigen/$pkgname/-/archive/$pkgver/$pkgname-$pkgver.tar.gz" + +autounpack=true +downloadpackage=true + +builddir=$pkgname-${pkgver} +packagename=$builddir.tar.gz + +prepare() { + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + PKG_CONFIG_LIBDIR="${pkgconfigpath}" ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" \ + -DOHOS_ARCH=$ARCH -B$ARCH-build -DCMAKE_Fortran_COMPILER=OFF -S./ -L > $buildlog 2>&1 + $MAKE VERBOSE=1 -C $ARCH-build >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + $MAKE VERBOSE=1 -C $ARCH-build install >> $buildlog 2>&1 + cd $OLDPWD +} + +check() { + echo "The test must be on an OpenHarmony device!" +} + +# 清理环境 +cleanbuild() { + rm -rf ${PWD}/$builddir +} diff --git a/community/eigen/README.OpenSource b/community/eigen/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..9fc9176252d29b66ad427c0defa019a7407a830a --- /dev/null +++ b/community/eigen/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "eigen", + "License": "MPL-2.0", + "License File": "https://www.mozilla.org/en-US/MPL/2.0/", + "Version Number": "3.4.0", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.tar.gz", + "Description": "Eigen is a C++ template library for linear algebra: matrices, vectors, numerical solvers, and related algorithms." + } +] \ No newline at end of file diff --git a/community/eigen/SHA512SUM b/community/eigen/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..49236aa5773bcecdcb213480258b008e9cfeb933 --- /dev/null +++ b/community/eigen/SHA512SUM @@ -0,0 +1 @@ +ba75ecb760e32acf4ceaf27115468e65d4f77c44f8d519b5a13e7940af2c03a304ad433368cb6d55431f307c5c39e2666ab41d34442db3cf441638e51f5c3b6a eigen-3.4.0.tar.gz diff --git a/community/erlang-libdecaf/HPKBUILD b/community/erlang-libdecaf/HPKBUILD new file mode 100755 index 0000000000000000000000000000000000000000..a276db4db982e6f2d8af100a90d70b28161db615 --- /dev/null +++ b/community/erlang-libdecaf/HPKBUILD @@ -0,0 +1,63 @@ +# 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: 城meto +# Maintainer: 城meto + +pkgname=erlang-libdecaf +pkgver=2.1.1 +pkgrel=0 +pkgdesc="The libdecaf library is for elliptic curve research and practical application." +url="https://github.com/potatosalad/erlang-libdecaf" +archs=("armeabi-v7a" "arm64-v8a") +license=("MIT") +depends=() +makedepends=() +source="https://github.com/potatosalad/$pkgname/archive/refs/tags/$pkgver.tar.gz" +buildtools="cmake" + +autounpack=true +downloadpackage=true + +builddir=$pkgname-$pkgver +packagename=$pkgname-$pkgver.tar.gz + +prepare() { + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + PKG_CONFIG_LIBDIR="${pkgconfigpath}" ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" \ + -DOHOS_ARCH=$ARCH -B$ARCH-build -Sc_deps/ed448goldilocks -L > $buildlog 2>&1 + $MAKE -C $ARCH-build VERBOSE=1 >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + $MAKE -C $ARCH-build install VERBOSE=1 >> $buildlog 2>&1 + cd $OLDPWD +} + +check() { + echo "The test must be on an OpenHarmony device!" + # real test + # ctest +} + +# 清理环境 +cleanbuild(){ + rm -rf $builddir +} \ No newline at end of file diff --git a/community/erlang-libdecaf/SHA512SUM b/community/erlang-libdecaf/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..d0d23da5ab06baa19e9b870b81f5f6ec6e0223ad --- /dev/null +++ b/community/erlang-libdecaf/SHA512SUM @@ -0,0 +1 @@ +17c73a1a02e71e90e1ad734000415b28fa67505cfc227d0221fdb4475df523a0c9669cc085717069990a33c796160d223d8e1beb20dcdf0e5feb83be46504211 erlang-libdecaf-2.1.1.tar.gz diff --git a/community/espeak/HPKBUILD b/community/espeak/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..59bfdf49a9db78624db09e27cdecfa9e6d932996 --- /dev/null +++ b/community/espeak/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: huangminzhong +# Maintainer: huangminzhong + +pkgname=espeak +pkgver=1.48.04-source +pkgrel=0 +pkgdesc="eSpeak是一个小型的、开放源码的语音合成系统,支持多种语言。" +url="https://sourceforge.net/projects/espeak" +archs=("armeabi-v7a" "arm64-v8a") +license=("GNU GENERAL PUBLIC LICENSE") +depends=("portaudio") +makedepends=() +source="https://sourceforge.net/projects/$pkgname/files/$pkgname/espeak-1.48/$pkgname-$pkgver.zip" + +autounpack=true +downloadpackage=true +buildtools="make" +builddir=$pkgname-$pkgver +packagename=$builddir.zip + +source envset.sh + +prefix= +datadir= +patchflag=true + +prepare() { + if [ $patchflag == true ] + then + cd $builddir + # 系统没有cancel接口,通过patch删除 + patch -p1 < ../espeak_ohos.patch > $buildlog 2>&1 + # 一些Linux发行版(例如SuSe 10)的PortAudio版本为19,该版本具有略微不同的API。通过在编译之前将文件portaudio19.h复制到PortAudio.h,可以将speak程序编译为使用PortAudio版本19 + cp src/portaudio19.h src/portaudio.h + cd $OLDPWD + patchflag=false + fi + + cp -rfa $builddir $builddir-$ARCH-build + + if [ $ARCH == "armeabi-v7a" ] + then + setarm32ENV + elif [ $ARCH == "arm64-v8a" ] + then + setarm64ENV + else + echo "${ARCH} not support" + return -1 + fi + + prefix=$LYCIUM_ROOT/usr/$pkgname/$ARCH + datadir=$prefix/share/espeak-data +} +build() { + cd $builddir-$ARCH-build/src + ${MAKE} VERBOSE=1 DATADIR=$datadir PREFIX=$prefix LDFLAGS="-L$LYCIUM_ROOT/usr/portaudio/$ARCH/lib" >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir-$ARCH-build/src + ${MAKE} PREFIX=$prefix DATADIR=$datadir install >> $buildlog 2>&1 + cd $OLDPWD +} + +check() { + echo "The test must be on an OpenHarmony device!" +} + +recoverpkgbuildenv() { + if [ $ARCH == "armeabi-v7a" ] + then + unsetarm32ENV + elif [ $ARCH == "arm64-v8a" ] + then + unsetarm64ENV + else + echo "${ARCH} not support" + return -1 + fi +} + +# 清理环境 +cleanbuild() { + rm -rf ${PWD}/$builddir ${PWD}/$builddir-armeabi-v7a-build ${PWD}/$builddir-arm64-v8a-build #${PWD}/$packagename +} diff --git a/community/espeak/SHA512SUM b/community/espeak/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..bc4515b502117b81835bfe3f634e5a15b3b3a619 --- /dev/null +++ b/community/espeak/SHA512SUM @@ -0,0 +1 @@ +f0759e6ace2604c8cbb19e8c3fd4b106edf4dcece247a6677f6b734af7746c35a367126edfbe585396c98f6c54f07e25d64bfab35e258e64f09bd2c0833247fa espeak-1.48.04-source.zip \ No newline at end of file diff --git a/community/espeak/espeak_ohos.patch b/community/espeak/espeak_ohos.patch new file mode 100644 index 0000000000000000000000000000000000000000..7bd8941af0b702424551361abbdc0d6bb10e8c0d --- /dev/null +++ b/community/espeak/espeak_ohos.patch @@ -0,0 +1,33 @@ +diff -Naur espeak-1.48.04-source/src/event.cpp espeak-1.48.04-source_new/src/event.cpp +--- espeak-1.48.04-source/src/event.cpp 2014-03-05 00:47:15.000000000 +0800 ++++ espeak-1.48.04-source_new/src/event.cpp 2023-11-17 17:55:21.137006096 +0800 +@@ -720,8 +720,12 @@ + + if (thread_inited) + { ++#ifndef __OHOS__ + pthread_cancel(my_thread); + pthread_join(my_thread,NULL); ++#else ++ pthread_detach(my_thread); ++#endif + pthread_mutex_destroy(&my_mutex); + sem_destroy(&my_sem_start_is_required); + sem_destroy(&my_sem_stop_is_required); +diff -Naur espeak-1.48.04-source/src/fifo.cpp espeak-1.48.04-source_new/src/fifo.cpp +--- espeak-1.48.04-source/src/fifo.cpp 2014-03-05 00:47:15.000000000 +0800 ++++ espeak-1.48.04-source_new/src/fifo.cpp 2023-11-17 17:56:16.713600755 +0800 +@@ -594,9 +594,12 @@ + void fifo_terminate() + { + ENTER("fifo_terminate"); +- ++#ifndef __OHOS__ + pthread_cancel(my_thread); + pthread_join(my_thread,NULL); ++#else ++ pthread_detach(my_thread); ++#endif + pthread_mutex_destroy(&my_mutex); + sem_destroy(&my_sem_start_is_required); + sem_destroy(&my_sem_stop_is_acknowledged); diff --git a/community/flac/HPKBUILD b/community/flac/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..57573e7cd2a683ac2d685450d372e12255b3f56b --- /dev/null +++ b/community/flac/HPKBUILD @@ -0,0 +1,49 @@ +# Contributor: TangShaoteng +# Maintainer: TangShaoteng + +pkgname=flac +pkgver=1.4.3 +pkgrel=0 +pkgdesc="Free Lossless Audio Codec" +url="https://www.xiph.org/" +archs=("armeabi-v7a" "arm64-v8a") +license=("BSD-3-Clause") +depends=("libogg") +makedepends=() + +source="https://github.com/xiph/flac/releases/download/$pkgver/$pkgname-$pkgver.tar.xz" + +autounpack=true +downloadpackage=true +buildtools="cmake" +builddir=$pkgname-$pkgver +packagename=$builddir.tar.xz + +prepare() { + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + # OHOS-SDK中的cmake已更新至3.28 + $OHOS_SDK/native/build-tools/cmake/bin/cmake "$@" -DOHOS_ARCH=$ARCH -B$ARCH-build -S./ -L > `pwd`/$ARCH-build/build.log 2>&1 + make VERBOSE=1 -j4 -C $ARCH-build >> `pwd`/$ARCH-build/build.log 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + make -C $ARCH-build install >> `pwd`/$ARCH-build/build.log 2>&1 + cd $OLDPWD +} + +check() { + echo "The test must be on an OpenHarmony device!" + # TODO +} + +cleanbuild() { + rm -rf ${PWD}/$builddir #${PWD}/$packagename +} diff --git a/community/flac/SHA512SUM b/community/flac/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..76fbbc4ea0b788eb4a4b397763f28b6397c88c8a --- /dev/null +++ b/community/flac/SHA512SUM @@ -0,0 +1 @@ +3cf095720bd590a588be8ccbe187d22e7a1c60ab85b1d510ce5e8a22ab0a51827b9acfeaad59bbd645a17d1f200f559255a640101b0330709a164306c0e9709e flac-1.4.3.tar.xz diff --git a/community/fmt-8.1.1/HPKBUILD b/community/fmt-8.1.1/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..8ff6db55b8f03668aa9d90fa3cdacdd89375f255 --- /dev/null +++ b/community/fmt-8.1.1/HPKBUILD @@ -0,0 +1,53 @@ +# Contributor: liucheng +# Maintainer: liucheng + +pkgname=fmt-8.1.1 +pkgver=8.1.1 +pkgrel=0 +pkgdesc="{fmt} is an open-source formatting library providing a fast and safe alternative to C stdio and C++ iostreams." +url="https://fmt.dev/latest/index.html" +archs=("armeabi-v7a" "arm64-v8a") +license=("MIT") +depends=() +makedepends=() +source="https://github.com/fmtlib/fmt/archive/refs/tags/$pkgver.tar.gz" + +downloadpackage=true +autounpack=false +buildtools="cmake" + +builddir=$pkgname +packagename=$builddir.tar.gz + +prepare() { + mkdir $pkgname-$ARCH-build + tar -zxf $packagename + cp -rf $builddir/* $pkgname-$ARCH-build +} + +build() { + cd $pkgname-$ARCH-build + PKG_CONFIG_LIBDIR="${pkgconfigpath}" ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" \ + -DOHOS_ARCH=$ARCH -S./ > $buildlog 2>&1 + $MAKE VERBOSE=1 >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +# 打包安装 +package() { + cd $pkgname-$ARCH-build + $MAKE VERBOSE=1 install >> $build.log 2>&1 + cd $OLDPWD +} + +# 进行测试的准备和说明 +check() { + echo "The test must be on an OpenHarmony device!" +} + +# 清理环境 +cleanbuild(){ + rm -rf $pkgname $pkgname-armeabi-v7a-build $pkgname-arm64-v8a-build #${PWD}/$packagename +} diff --git a/community/fmt-8.1.1/HPKCHECK b/community/fmt-8.1.1/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..7cd1d464647be4b2674924ad23a4d4d2303c8e9c --- /dev/null +++ b/community/fmt-8.1.1/HPKCHECK @@ -0,0 +1,19 @@ +# Contributor: lpzhong <278527840@qq.com> +# Maintainer: lpzhong <278527840@qq.com> + +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 + ctest > ${logfile} 2>&1 + res=$? + if [ $res -ne 0 ] + then + mkdir -p ${LYCIUM_FAULT_PATH}/${pkgname} + cp Testing/Temporary/LastTest.log ${LYCIUM_FAULT_PATH}/${pkgname}/ + fi + cd $OLDPWD + + return $res +} diff --git a/community/fmt-8.1.1/OAT.xml b/community/fmt-8.1.1/OAT.xml new file mode 100644 index 0000000000000000000000000000000000000000..eeb1f946d683c0b81976cd06522096062a6901b9 --- /dev/null +++ b/community/fmt-8.1.1/OAT.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/community/fmt-8.1.1/README.OpenSource b/community/fmt-8.1.1/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..47cbeb2cf782fd4e2f761fe4e980349a1dfff32d --- /dev/null +++ b/community/fmt-8.1.1/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "fmt", + "License": "MIT", + "License File": "https://github.com/fmtlib/fmt/blob/master/LICENSE.rst", + "Version Number": "8.1.1", + "Owner": "CHENGLIUQ@isoftstone.com", + "Upstream URL": "https://github.com/fmtlib/fmt/archive/refs/tags/8.1.1.tar.gz", + "Description": "fmt is an open-source formatting library providing a fast and safe alternative to C stdio and C++ iostreams." + } +] diff --git a/community/fmt-8.1.1/README_zh.md b/community/fmt-8.1.1/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..706fb9820de9d1def40c7449f82c44c8cc7d177d --- /dev/null +++ b/community/fmt-8.1.1/README_zh.md @@ -0,0 +1,12 @@ +# fmt 三方库说明 +## 功能简介 +fmt是一个开源格式库,可提供C stdio和C ++ iostreams的快速安全替代品。 + +## 三方库版本 +- 8.1.1 + +## 使用约束 +- [IDE和SDK版本](../../docs/constraint.md) + +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) diff --git a/community/fmt-8.1.1/SHA512SUM b/community/fmt-8.1.1/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..b7e0e0a22af2cb780444d13f868a74daa6ebdbd2 --- /dev/null +++ b/community/fmt-8.1.1/SHA512SUM @@ -0,0 +1 @@ +794a47d7cb352a2a9f2c050a60a46b002e4157e5ad23e15a5afc668e852b1e1847aeee3cda79e266c789ff79310d792060c94976ceef6352e322d60b94e23189 fmt-8.1.1.tar.gz diff --git a/community/fmt-8.1.1/docs/hap_integrate.md b/community/fmt-8.1.1/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..beefef37aae8905f62366ca8439e585aa5b0c2d4 --- /dev/null +++ b/community/fmt-8.1.1/docs/hap_integrate.md @@ -0,0 +1,63 @@ +# fmt-8.1.1集成到应用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) +## 编译三方库 +- 下载本仓库 + ``` + git clone https://gitee.com/openharmony-sig/tpc_c_cplusplus.git --depth=1 + ``` + +- 三方库目录结构 + ``` + tpc_c_cplusplus/thirdparty/fmt-8.1.1 #三方库fmt-8.1.1的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── HPKCHECK #测试脚本 + ├── OAT.xml #扫描结果文件 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md #三方库简介 + ``` + +- 在lycium目录下编译三方库 + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + ``` + cd lycium + ./build.sh fmt-8.1.1 + ``` + +- 三方库头文件及生成的库 + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + ``` + fmt-8.1.1/arm64-v8a fmt-8.1.1/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的库拷贝到该目录下,如下图所示 + ![thirdparty_install_dir](pic/fmt-8.1.1-dev.png) +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + ``` + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/fmt-8.1.1/${OHOS_ARCH}/lib/libfmt.a) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/fmt-8.1.1/${OHOS_ARCH}/include) + ``` +## 测试三方库 +三方库的测试使用原库自带的测试用例来做测试 + +进入到构建目录获取,执行ctest,运行测试用例(fmt-8.1.1-arm64-v8a-build为构建64位的目录,fmt-8.1.1-armeabi-v7a-build为构建32位的目录) + ``` + cd /data/tpc_c_cplusplus/thirdparty/fmt-8.1.1/fmt-8.1.1-armeabi-v7a-build + ctest + ``` + ![libfmt_test](pic/test-cmd-ret.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) +- [libfmt-8.1.1三方库地址](https://fmt.dev/latest/index.html) diff --git a/community/fmt-8.1.1/docs/pic/fmt-8.1.1-dev.png b/community/fmt-8.1.1/docs/pic/fmt-8.1.1-dev.png new file mode 100644 index 0000000000000000000000000000000000000000..861abc338fb995b7053cfae439d75e4c78daf9a6 Binary files /dev/null and b/community/fmt-8.1.1/docs/pic/fmt-8.1.1-dev.png differ diff --git a/community/fmt-8.1.1/docs/pic/test-cmd-ret.png b/community/fmt-8.1.1/docs/pic/test-cmd-ret.png new file mode 100644 index 0000000000000000000000000000000000000000..acb1bd35f1e6d3542b6c84f94a028b334ea60fbb Binary files /dev/null and b/community/fmt-8.1.1/docs/pic/test-cmd-ret.png differ diff --git a/community/fontconfig/HPKBUILD b/community/fontconfig/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..0092a1d355a76aaddecc3194accca625c51b5074 --- /dev/null +++ b/community/fontconfig/HPKBUILD @@ -0,0 +1,124 @@ +# Contributor: 小肉头君 +# Maintainer: 小肉头君 + +pkgname=fontconfig +pkgver=2.14.2 +pkgrel=0 +pkgdesc="Font configuration and customization library." +url="https://gitlab.freedesktop.org/fontconfig/fontconfig" +archs=("armeabi-v7a" "arm64-v8a") +license=("HPND" "Public Domain" "MIT-Modern-Variant" "MIT") +depends=("libzip" "freetype2" "libxml2" "libpng" "json-c") +makedepends=("gperf" "gettextize" "autopoint" "libtool") +source="https://www.freedesktop.org/software/${pkgname}/release/${pkgname}-${pkgver}.tar.gz" + +autounpack=true +downloadpackage=true +buildtools="configure" + +builddir=$pkgname-$pkgver +packagename=$builddir.tar.gz +autogenflag=true +testpatch=true + +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 + if $autogenflag + then + cd $builddir + ./autogen.sh > `pwd`/build.log 2>&1 + cd $OLDPWD + autogenflag=false + fi +} + +build() { + cd $builddir/$ARCH-build + FREETYPE_CFLAGS="-I${LYCIUM_ROOT}/usr/freetype2/$ARCH/include/freetype2 ${LYCIUM_ROOT}/usr/bzip2/$ARCH/lib/libbz2.a \ + ${LYCIUM_ROOT}/usr/libpng/$ARCH/lib/libpng.a ${LYCIUM_ROOT}/usr/brotli/$ARCH/lib/libbrotlicommon.so \ + ${LYCIUM_ROOT}/usr/brotli/$ARCH/lib/libbrotlienc.so ${LYCIUM_ROOT}/usr/brotli/$ARCH/lib/libbrotlidec.so -lz" \ + FREETYPE_LIBS="${LYCIUM_ROOT}/usr/freetype2/$ARCH/lib/libfreetype.a" CFLAGS="$FREETYPE_CFLAGS $FREETYPE_LIBS" \ + PKG_CONFIG_PATH="${pkgconfigpath}" ../configure "$@" --host=$host --enable-libxml2 --enable-static \ + --enable-shared --disable-silent-rules > `pwd`/build.log 2>&1 # --sysconfdir="/etc" --localstatedir="/var" --datarootdir="/share" + make -j4 >> `pwd`/build.log 2>&1 + # 对最关键一步的退出码进行判断 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir/$ARCH-build + make install >> `pwd`/build.log 2>&1 + cd $OLDPWD +} + +check() { + # 下载字库 + # 测试过程需要curl下载字体,为避免测试机下载失败,采用提前下载好 + cd $builddir/$ARCH-build/test + mkdir noto + curl -s -o noto/noto.zip https://noto-website-2.storage.googleapis.com/pkgs/NotoSans-hinted.zip + cd $OLDPWD + cd $builddir/$ARCH-build/test/noto + unzip noto.zip > `pwd`/build.log 2>&1 + tar -zcf noto.tar.gz *.ttf README LICENSE_OFL.txt + cp noto.tar.gz ../ + cd $OLDPWD + # 编译测试用例 + cd $builddir/$ARCH-build/test + make test-pthread test-crbug1004254 test-bz89617 test-bz131804 test-migration \ + test-bz96676 test-name-parse test-bz106618 test-bz106632 test-issue107 test-bz1744377 \ + test-issue180 test-family-matching >> `pwd`/build.log 2>&1 + if $testpatch + then + sed -i '435d' ../../test/run-test.sh + sed -i '434a cp $MyPWD/noto.tar.gz "$FONTDIR"/noto.tar.gz' ../../test/run-test.sh + sed -i '/.*(cd "$FONTDIR"; unzip noto.zip)/c\ (cd "$FONTDIR"; tar -zxf noto.tar.gz)' ../../test/run-test.sh + testpatch=false + fi + sed -i '/.*check-TESTS: $(check_PROGRAMS) $(check_SCRIPTS)/c\check-TESTS: $(check_SCRIPTS) #$(check_PROGRAMS)' Makefile + sed -i '/.*test-bz89617.log: test-bz89617$(EXEEXT)/c\test-bz89617.log: #test-bz89617$(EXEEXT)' Makefile + sed -i '/.*test-bz131804.log: test-bz131804$(EXEEXT)/c\test-bz131804.log: #test-bz131804$(EXEEXT)' Makefile + sed -i '/.*test-bz96676.log: test-bz96676$(EXEEXT)/c\test-bz96676.log: #test-bz96676$(EXEEXT)' Makefile + sed -i '/.*test-name-parse.log: test-name-parse$(EXEEXT)/c\test-name-parse.log: #test-name-parse$(EXEEXT)' Makefile + sed -i '/.*test-bz106632.log: test-bz106632$(EXEEXT)/c\test-bz106632.log: #test-bz106632$(EXEEXT)' Makefile + sed -i '/.*test-issue107.log: test-issue107$(EXEEXT)/c\test-issue107.log: #test-issue107$(EXEEXT)' Makefile + sed -i '/.*test-issue110.log: test-issue110$(EXEEXT)/c\test-issue110.log: #test-issue110$(EXEEXT)' Makefile + sed -i '/.*test-d1f48f11.log: test-d1f48f11$(EXEEXT)/c\test-d1f48f11.log: #test-d1f48f11$(EXEEXT)' Makefile + sed -i '/.*test-bz1744377.log: test-bz1744377$(EXEEXT)/c\test-bz1744377.log: #test-bz1744377$(EXEEXT)' Makefile + sed -i '/.*test-issue180.log: test-issue180$(EXEEXT)/c\test-issue180.log: #test-issue180$(EXEEXT)' Makefile + sed -i '/.*test-family-matching.log: test-family-matching$(EXEEXT)/c\test-family-matching.log: #test-family-matching$(EXEEXT)' 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!" + # real test + # copy 依赖库 + # make -C test check-TESTS + +} + +cleanbuild(){ + rm -rf ${PWD}/$builddir #${PWD}/$packagename +} diff --git a/community/fontconfig/README.OpenSource b/community/fontconfig/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..f61b8d539953902a90fdf2592523f12d9adcd8c3 --- /dev/null +++ b/community/fontconfig/README.OpenSource @@ -0,0 +1,47 @@ +[ + { + "Name": "fontconfig", + "License": "HPND and Public Domain and MIT-Modern-Variant and MIT", + "License File": "https://gitlab.freedesktop.org/fontconfig/fontconfig/-/blob/main/COPYING", + "Version Number": "2.14.2", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://gitlab.freedesktop.org/fontconfig/fontconfig/-/archive/2.14.2/fontconfig-2.14.2.tar.gz", + "Description": "Font configuration and customization library" + }, + { + "Name": "freetype", + "License": "GPL-2-only or FTL", + "License File": "https://github.com/freetype/freetype/blob/master/docs/FTL.TXT", + "Version Number": "2.13.0", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://sourceforge.net/projects/freetype/files/freetype2/2.13.0/freetype-2.13.0.tar.xz", + "Description": "FreeType is written in C. It is designed to be small, efficient, and highly customizable while capable of producing high-quality output (glyph images) of most vector and bitmap font formats for digital typography. FreeType is a freely available and portable software library to render fonts." + }, + { + "Name": "libxml", + "License": " MIT", + "License File": "https://github.com/GNOME/libxml2/blob/master/Copyright", + "Version Number": "v2.11.3", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://github.com/GNOME/libxml2/archive/refs/tags/v2.11.3.tar.gz", + "Description": "libxml2 is an XML toolkit implemented in C, originally developed for the GNOME Project." + }, + { + "Name": "libpng", + "License": "libpng-2.0", + "License File": "https://sourceforge.net/p/libpng/code/ci/master/tree/LICENSE", + "Version Number": "1.6.39", + "Owner": "xiafeng@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" + }, + { + "Name": "json-c", + "License": "MIT", + "License File": "https://github.com/json-c/json-c/blob/master/COPYING", + "Version Number": "0.16-20220414", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://github.com/json-c/json-c/archive/refs/tags/json-c-0.16-20220414.tar.gz", + "Description": "JSON-C implements a reference counting object model that allows you to easily construct JSON objects in C" + } +] diff --git a/community/fontconfig/README_zh.md b/community/fontconfig/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..5a51f655f8363a830ffc149d9f9a3dce3f191c39 --- /dev/null +++ b/community/fontconfig/README_zh.md @@ -0,0 +1,12 @@ +# fontconfig三方库说明 +## 功能简介 +Fontconfig是字体相关的计算机程序库,用于配置、定制全系统的字体,或将字体提供给应用程序使用。 + +## 三方库版本 +- 2.14.2 + +## 使用约束 +- [IDE和SDK版本](../../docs/constraint.md) + +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) diff --git a/community/fontconfig/SHA512SUM b/community/fontconfig/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..4de5f8d8beebf08a04e6149f2f49d24e44652fb9 --- /dev/null +++ b/community/fontconfig/SHA512SUM @@ -0,0 +1 @@ +73287cc3f8f8261a27c2920b0f9430dd6e3ac8733fb2ba55e1b5934cee211023b6415e1d14ddad04ef3c7819727ed34d80aa503d2734bdfc2f1c733c4096463f fontconfig-2.14.2.tar.gz diff --git a/community/fontconfig/docs/hap_integrate.md b/community/fontconfig/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..9e25f5d452c9ca16502df04e4e200d2b63d964f0 --- /dev/null +++ b/community/fontconfig/docs/hap_integrate.md @@ -0,0 +1,68 @@ +# fontconfig 集成到应用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 + ``` + +- 三方库目录结构 + + ``` + tpc_c_cplusplus/thirdparty/fontconfig #三方库fontconfig的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md + ``` + +- 在lycium目录下编译三方库 + + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ``` + cd lycium + ./build.sh fontconfig + ``` + +- 三方库头文件及生成的库 + + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ``` + fontconfig/arm64-v8a fontconfig/armeabi-v7a + ``` + +## 应用中使用三方库 + +- 将三方库和依赖库的动态库拷贝到`\\entry\libs\${OHOS_ARCH}\`目录: + + 动态库需要在`\\entry\libs\${OHOS_ARCH}\`目录,才能集成到hap包中,所以需要将对应的so文件拷贝到对应CPU架构的目录: + + 将头文件拷贝到thirdparty目录下 + +  ![thirdparty_install_dir](pic/fontconfig_install_dir2.png) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句: + + ``` + #将三方库加入工程中,fontconfig是对应的三方库名 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/fontconfig/${OHOS_ARCH}/lib/libfontconfig.so) + #将三方库的头文件加入工程中,fontconfig是对应的三方库名 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/fontconfig/${OHOS_ARCH}/include) + ``` + +## 参考资料 + +- [润和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) \ No newline at end of file diff --git a/community/fontconfig/docs/pic/fontconfig_install_dir1.png b/community/fontconfig/docs/pic/fontconfig_install_dir1.png new file mode 100644 index 0000000000000000000000000000000000000000..5e41bad0d0bdf00ece32936a423d4ce67529373a Binary files /dev/null and b/community/fontconfig/docs/pic/fontconfig_install_dir1.png differ diff --git a/community/fontconfig/docs/pic/fontconfig_install_dir2.png b/community/fontconfig/docs/pic/fontconfig_install_dir2.png new file mode 100644 index 0000000000000000000000000000000000000000..813ccd64ff632a69bb0333d4acb6745449032613 Binary files /dev/null and b/community/fontconfig/docs/pic/fontconfig_install_dir2.png differ diff --git a/community/fontconfig/docs/pic/fontconfig_usage.png b/community/fontconfig/docs/pic/fontconfig_usage.png new file mode 100644 index 0000000000000000000000000000000000000000..89b297c99913b74050d98b0e37b8e497af7abb01 Binary files /dev/null and b/community/fontconfig/docs/pic/fontconfig_usage.png differ diff --git a/community/friso/HPKBUILD b/community/friso/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..1b0b1107b70aca6f529907668446184887062e56 --- /dev/null +++ b/community/friso/HPKBUILD @@ -0,0 +1,81 @@ +# 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: huangminzhong +# Maintainer: huangminzhong + +pkgname=friso +pkgver=v1.6.4-release +pkgrel=0 +pkgdesc="High performance Chinese tokenizer with both GBK and UTF-8 charset support based on MMSEG algorithm developed by ANSI C. Completely based on modular implementation and can be easily embedded in other programs, like: MySQL, PostgreSQL, PHP, etc." +url="https://github.com/lionsoul2014/friso" +archs=("armeabi-v7a" "arm64-v8a") +license=("Apache License 2.0") +depends=() +makedepends=() +#source="https://github.com/lionsoul2014/${pkgname}/archive/refs/tags/${pkgver}.tar.gz" +source="https://gitee.com/lycium_pkg_mirror/${pkgname}/repository/archive/${pkgver}.tar.gz" +autounpack=true +downloadpackage=true +buildtools="make" +builddir=${pkgname}-${pkgver:1} +packagename=$builddir.tar.gz + +cc= +ar= + +prepare() { + #cp -arf $builddir $builddir-$ARCH-build + cp -arf ${pkgname}-v${pkgver:1} $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 +} + +build() { + cd $builddir-$ARCH-build/src + #$MAKE VERBOSE=1 CC=$cc AR=$ar >> $buildlog 2>&1 #多线程编译会报错 + make VERBOSE=1 CC=$cc AR=$ar >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + local include_dir=$LYCIUM_ROOT/usr/$pkgname/$ARCH/include/friso + local lib_dir=$LYCIUM_ROOT/usr/$pkgname/$ARCH/lib + local bin_dir=$LYCIUM_ROOT/usr/$pkgname/$ARCH/bin + cd $builddir-$ARCH-build/src + mkdir -p $include_dir $lib_dir $bin_dir >> $buildlog 2>&1 + cp friso $bin_dir >> $buildlog 2>&1 + cp libfriso.so $lib_dir >> $buildlog 2>&1 + cp *.h $include_dir >> $buildlog 2>&1 + cd $OLDPWD + unset cc ar +} + +check() { + echo "The test must be on an OpenHarmony device!" +} + +# 清理环境 +cleanbuild(){ + rm -rf ${PWD}/$builddir ${PWD}/$builddir-${archs[0]}-build ${PWD}/$builddir-${archs[1]}-build #${PWD}/$packagename +} diff --git a/community/friso/SHA512SUM b/community/friso/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..2f1412ad2c2f520e4c63fb5406d0356ead74211a --- /dev/null +++ b/community/friso/SHA512SUM @@ -0,0 +1 @@ +b55c8815ed941a921a6672a88410dda908f506b58771ee9dce783916e6b729efce29dcee23af81e4c97ee45c564c122b26c18dabb8e13a6ab53ad2fb67ae3202 friso-1.6.4-release.tar.gz diff --git a/community/gdbm/HPKBUILD b/community/gdbm/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..54922a7faa9a60f7578821a4a41419eb35e367f8 --- /dev/null +++ b/community/gdbm/HPKBUILD @@ -0,0 +1,73 @@ +# Contributor: TangShaoteng +# Maintainer: TangShaoteng + +pkgname=gdbm +pkgver=1.23 +pkgrel=0 +pkgdesc="GNU dbm (or GDBM, for short) is a library of database functions that use extensible hashing and work similar to the standard UNIX dbm." +url="https://www.gnu.org.ua/software/gdbm" +archs=("armeabi-v7a" "arm64-v8a") +license=("GPLv3") +depends=() +makedepends=() +source="https://ftp.gnu.org/gnu/$pkgname/$pkgname-$pkgver.tar.gz" + +autounpack=true +downloadpackage=true +buildtools="configure" + +builddir=$pkgname-$pkgver +packagename=$builddir.tar.gz + +source envset.sh +host= +prepare() { + mkdir -p $builddir/$ARCH-build + if [ $ARCH == "armeabi-v7a" ] + then + setarm32ENV + host=arm-linux + elif [ $ARCH == "arm64-v8a" ] + then + setarm64ENV + host=aarch64-linux + else + echo "${ARCH} not support" + return -1 + fi +} + +build() { + cd $builddir/$ARCH-build + PKG_CONFIG_LIBDIR="${pkgconfigpath}" ../configure "$@" --host=$host > $buildlog 2>&1 + $MAKE VERBOSE=1 >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir/$ARCH-build + $MAKE VERBOSE=1 install >> $buildlog 2>&1 + cd $OLDPWD + unset host + if [ $ARCH == "armeabi-v7a" ] + then + unsetarm32ENV + elif [ $ARCH == "arm64-v8a" ] + then + unsetarm64ENV + else + echo "${ARCH} not support" + return -1 + fi +} + +check() { + echo "The test must be on an OpenHarmony device!" + # TODO +} + +cleanbuild() { + rm -rf ${PWD}/$builddir #${PWD}/$packageName +} diff --git a/community/gdbm/SHA512SUM b/community/gdbm/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..fa2e653bda5295e6433535577e57afba1d948c1f --- /dev/null +++ b/community/gdbm/SHA512SUM @@ -0,0 +1 @@ +918080cb0225b221c11eb7339634a95e00c526072395f7a3d46ccf42ef020dea7c4c5bec34aff2c4f16033e1fff6583252b7e978f68b8d7f8736b0e025838e10 gdbm-1.23.tar.gz diff --git a/community/gettext/HPKBUILD b/community/gettext/HPKBUILD new file mode 100755 index 0000000000000000000000000000000000000000..c5bca8b66884dac280fe86477e7f0f5bd0c99fda --- /dev/null +++ b/community/gettext/HPKBUILD @@ -0,0 +1,83 @@ +# 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: 城meto +# Maintainer: 城meto +pkgname=gettext +pkgver=0.22 +pkgrel=0 +pkgdesc="gettext is an important step for the GNU Translation Project, as it is an asset on which we may build many other steps. This package offers to programmers, translators, and even users, a well integrated set of tools and documentation." +url="https://www.gnu.org/software/gettext" +archs=("armeabi-v7a" "arm64-v8a") +license=("GPLv3.0 license") +depends=() +makedepends=() +source="https://ftp.gnu.org/pub/gnu/$pkgname/$pkgname-$pkgver.tar.gz" +buildtools="configure" + +autounpack=true +downloadpackage=true + +builddir=$pkgname-$pkgver +packagename=$pkgname-$pkgver.tar.gz + +source envset.sh +host= + +prepare() { + mkdir $builddir/$ARCH-build + if [ $ARCH == "armeabi-v7a" ];then + setarm32ENV + host=arm-linux + elif [ $ARCH == "arm64-v8a" ];then + setarm64ENV + host=aarch64-linux + else + echo "$ARCH not support" + return -1 + fi +} + +build() { + cd $builddir/$ARCH-build + LDFLAGS="--static $LDFLAGS" CFLAGS="-static -Wno-error=int-conversion $CFLAGS" \ + PKG_CONFIG_LIBDIR="${pkgconfigpath}" ../configure "$@" --host=$host --srcdir=`pwd`/../ > $buildlog 2>&1 + $MAKE VERBOSE=1 >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir/$ARCH-build + $MAKE install VERBOSE=1 >> $buildlog 2>&1 + cd $OLDPWD + if [ $ARCH == "armeabi-v7a" ];then + unsetarm32ENV + elif [ $ARCH == "arm64-v8a" ];then + unsetarm64ENV + else + echo "$ARCH not support" + return -1 + fi +} + +check() { + echo "The test must be on an OpenHarmony device!" + # TODO +} + +# 清理环境 +cleanbuild(){ + rm -rf ${PWD}/$builddir #${PWD}/$packagename +} \ No newline at end of file diff --git a/community/gettext/SHA512SUM b/community/gettext/SHA512SUM new file mode 100755 index 0000000000000000000000000000000000000000..499e57703a5ef0b44420eeee074e45060cafd718 --- /dev/null +++ b/community/gettext/SHA512SUM @@ -0,0 +1 @@ +e2a58dde1cae3e6b79c03e7ef3d888f7577c1f4cba283b3b0f31123ceea8c33d7c9700e83de57104644de23e5f5c374868caa0e091f9c45edbbe87b98ee51c04 gettext-0.22.tar.gz diff --git a/community/glib/HPKBUILD b/community/glib/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..e3eceea6c37fce8fbe3d7a0d0e72fc3eb08bc589 --- /dev/null +++ b/community/glib/HPKBUILD @@ -0,0 +1,106 @@ +# 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: 城meto +# Maintainer: 城meto + +pkgname=glib +pkgver=2.77.1 +pkgrel=0 +pkgdesc="GLib is a general-purpose, portable utility library, which provides many useful data types, macros, type conversions, string utilities, file utilities, a mainloop abstraction, and so on." +url="https://docs.gtk.org/glib/" +archs=("armeabi-v7a" "arm64-v8a") +license=("LGPL-2.1-or-later") +depends=("libffi" "pcre2") +makedepends=("meson" "ninja") + +# 原仓位置: https://github.com/GNOME/${pkgname}/archive/refs/tags/$pkgver.tar.gz, 因网络原因使用镜像 +source="https://gitee.com/mirrors/$pkgname/repository/archive/$pkgver.zip" + +downloadpackage=true +autounpack=true +buildtools="meson" + +builddir=$pkgname-$pkgver +packagename=$pkgname-$pkgver.zip +pkgconfigpath= +clonesubmodule=true + +prepare() { + # 下载子模块 + if $clonesubmodule + then + # 下载gvdb,因网络原因使用镜像, 原仓地址: https://github.com/GNOME/gvdb.git + git clone https://gitee.com/lycium_pkg_mirror/gvdb.git $builddir/subprojects/gvdb + if [ $? -ne 0 ];then + return -1 + fi + cd $builddir/subprojects/gvdb + git checkout --detach 0854af0fdb6d527a8d1999835ac2c5059976c210 + cd $OLDPWD + # 下载 libintl, meson 下载会失败, 原仓地址: https://github.com/frida/proxy-libintl.git + git clone --depth 1 --branch 0.4 https://gitee.com/lycium_pkg_mirror/proxy-libintl.git $builddir/subprojects/proxy-libintl + if [ $? -ne 0 ];then + return -2 + fi + clonesubmodule=false + fi + + # 依赖库加入 pkg_config_path 路径 + for depend in ${depends[@]} + do + dependpath=$LYCIUM_ROOT/usr/$depend/$ARCH/lib/pkgconfig + if [ ! -d ${dependpath} ] + then + continue + fi + pkgconfigpath=$pkgconfigpath"${dependpath}:" + done + pkgconfigpath=${pkgconfigpath%:*} + + cp $ARCH-cross-file.txt $builddir + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + ohos_sdk_path=${OHOS_SDK//\//\\\/} + sed -i 's/ohos_sdk/'"$ohos_sdk_path"'/g' $ARCH-cross-file.txt + + # 需要设置pkg路径 + meson setup $ARCH-build --cross-file $ARCH-cross-file.txt \ + --pkg-config-path=$pkgconfigpath \ + --prefix=$LYCIUM_ROOT/usr/$pkgname/$ARCH > $ARCH-build/build.log 2>&1 + ninja -C $ARCH-build -v >> $ARCH-build/build.log 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + ninja -v -C $ARCH-build install >> build.log 2>&1 + # 还原 + unset pkgconfigpath + cd $OLDPWD +} + +check() { + echo "The test must be on an OpenHarmony device!" + # TODO +} + +# 清理环境 +cleanbuild() { + rm -rf ${PWD}/$builddir +} diff --git a/community/glib/README.OpenSource b/community/glib/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..8af618418e5c544ab64b6eaf83c6b0e09ac35d5b --- /dev/null +++ b/community/glib/README.OpenSource @@ -0,0 +1,29 @@ +[ + { + "Name": "glib", + "License": "LGPL-2.1-or-later", + "License File": "https://gitlab.gnome.org/GNOME/glib/-/blob/main/LICENSES/LGPL-2.1-or-later.txt", + "Version Number": "2.77.1", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://gitlab.gnome.org/GNOME/glib/-/archive/2.77.1/glib-2.77.1.tar.gz", + "Description": "GLib is a general-purpose, portable utility library, which provides many useful data types, macros, type conversions, string utilities, file utilities, a mainloop abstraction, and so on." + }, + { + "Name": "libffi", + "License": "MIT and GPL-2.0-only", + "License File": ["https://github.com/libffi/libffi/blob/master/LICENSE","https://github.com/libffi/libffi/blob/master/LICENSE-BUILDTOOLS"], + "Version Number": "3.4.4", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://github.com/libffi/libffi/releases/download/v3.4.4/libffi-3.4.4.tar.gz", + "Description": "The libffi library provides a portable, high level programming interface to various calling conventions." + }, + { + "Name": "pcre2", + "License": "PCRE2 LICENCE and BSD-3-Clause", + "License File": "https://github.com/PCRE2Project/pcre2/blob/master/LICENCE", + "Version Number": "pcre2-10.42", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.42/pcre2-10.42.tar.gz", + "Description": "PCRE2 is a library of functions to support regular expressions whose syntax and semantics are as close as possible to those of the Perl 5 language." + } +] \ No newline at end of file diff --git a/community/glib/SHA512SUM b/community/glib/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..bdb3d5729bf28dffb3eb64bc288e9d55cbc00a67 --- /dev/null +++ b/community/glib/SHA512SUM @@ -0,0 +1 @@ +ff1017e63df60fb81812127b9ca6997b7998c06061fc407e79eb7eeb66d492008afc6d44cac69a7dae20ee0ed12ce8423e25371604933f39243768aef31c35ed glib-2.77.1.zip diff --git a/community/glib/arm64-v8a-cross-file.txt b/community/glib/arm64-v8a-cross-file.txt new file mode 100644 index 0000000000000000000000000000000000000000..34ad3f25276acd1c3503e23ce42157e33c4375b3 --- /dev/null +++ b/community/glib/arm64-v8a-cross-file.txt @@ -0,0 +1,26 @@ +[binaries] +c = 'ohos_sdk/native/llvm/bin/aarch64-linux-ohos-clang' +cpp = 'ohos_sdk/native/llvm/bin/aarch64-linux-ohos-clang++' +ar = 'ohos_sdk/native/llvm/bin/llvm-ar' +strip = 'ohos_sdk/native/llvm/bin/llvm-strip' +ld = 'ohos_sdk/native/llvm/bin/ld.lld' +pkgconfig = '/usr/bin/pkg-config' + +[host_machine] +system = 'linux' +cpu_family = 'aarch64' +cpu = 'arm64-v8a' +endian = 'little' + +[properties] +needs_exe_wrapper = true +skip_sanity_check = true +sys_root = '' +platform = 'generic' +pkg_config_libdir = '' + +[built-in options] +c_args = ['-D__MUSL__=1', '-mfpu=neon'] +cpp_args = ['-D__MUSL__=1', '-mfpu=neon'] +c_link_args = [] +cpp_link_args = [] diff --git a/community/glib/armeabi-v7a-cross-file.txt b/community/glib/armeabi-v7a-cross-file.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b6e25f2eeb4d8fad8f02a2cb527e68f26461ef8 --- /dev/null +++ b/community/glib/armeabi-v7a-cross-file.txt @@ -0,0 +1,26 @@ +[binaries] +c = 'ohos_sdk/native/llvm/bin/arm-linux-ohos-clang' +cpp = 'ohos_sdk/native/llvm/bin/arm-linux-ohos-clang++' +ar = 'ohos_sdk/native/llvm/bin/llvm-ar' +strip = 'ohos_sdk/native/llvm/bin/llvm-strip' +ld = 'ohos_sdk/native/llvm/bin/ld.lld' +pkgconfig = '/usr/bin/pkg-config' + +[host_machine] +system = 'linux' +cpu_family = 'arm' +cpu = 'armeabi-v7a' +endian = 'little' + +[properties] +needs_exe_wrapper = true +skip_sanity_check = true +sys_root = '' +platform = 'generic' +pkg_config_libdir = '' + +[built-in options] +c_args = ['-fPIC', '-march=armv7a', '-mfloat-abi=softfp', '-mfpu=neon', '-D__MUSL__=1'] +cpp_args = ['-fPIC', '-march=armv7a', '-mfloat-abi=softfp', '-mfpu=neon', '-D__MUSL__=1'] +c_link_args = [] +cpp_link_args = [] diff --git a/community/googletest_1.11.0/HPKBUILD b/community/googletest_1.11.0/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..4229f5fcb5eb9162906cda2d85ae63d004508906 --- /dev/null +++ b/community/googletest_1.11.0/HPKBUILD @@ -0,0 +1,60 @@ +# 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: maoshanshan5@h-partners.com +# Maintainer: huangminzhong2@huawei.com + +pkgname=googletest_1.11.0 +pkgver=release-1.11.0 +pkgrel=0 +pkgdesc="GoogleTest is Google’s C++ testing and mocking framework" +url="https://github.com/google/googletest" +archs=("armeabi-v7a" "arm64-v8a") +license=("BSD-3-Clause license") +source="https://gitee.com/mirrors/${pkgname:0:10}/repository/archive/$pkgver.zip" + +autounpack=true +downloadpackage=true + +builddir=${pkgname:0:10}-${pkgver} +packagename=${builddir}.zip + +prepare() { + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" -DCMAKE_CXX_FLAGS="-Wno-error=unused-command-line-argument -Wno-error=unused-but-set-variable" -DCMAKE_FLAGS="-Wno-unused-command-line-argument -Wno-unused-but-set-variable" -DBUILD_GMOCK=ON -Dgtest_build_tests=ON -Dgmock_build_tests=ON -B$ARCH-build -S./ > $buildlog 2>&1 + $MAKE -C $ARCH-build VERBOSE=1 >> $buildlog 2>&1 + # 对最关键一步的退出码进行判断 + ret=$? + cd $OLDPWD + return $ret +} + +# 安装打包 +package() { + cd $builddir + $MAKE -C $ARCH-build install >> $buildlog 2>&1 + cd $OLDPWD +} + +check() { + echo "The test must be on an OpenHarmony device!" +} + +# 清理环境 +cleanbuild(){ + rm -rf ${PWD}/$builddir #${PWD}/$packagename +} diff --git a/community/googletest_1.11.0/README.OpenSource b/community/googletest_1.11.0/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..8b7193a96a70fdd680adb587b02a0c6482928eeb --- /dev/null +++ b/community/googletest_1.11.0/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "googletest", + "License": "BSD-3-Clause license", + "License File": "https://github.com/google/googletest/blob/main/LICENSE", + "Version Number": "v1.11.0", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://github.com/google/googletest/archive/refs/tags/release-1.11.0.tar.gz", + "Description": "Google Testing and Mocking Framework" + } +] diff --git a/community/googletest_1.11.0/SHA512SUM b/community/googletest_1.11.0/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..8f521e1c9f2c623ba03a22791dc07210ba2e74e4 --- /dev/null +++ b/community/googletest_1.11.0/SHA512SUM @@ -0,0 +1 @@ +b4ace641213fd4bc3f028de531a115a22e0253d57dc0ead20b0476eef0a2b82acac2725654325d7e9383837408c35f6f766ebde6c1ef34c425d74b9179874c59 googletest-release-1.11.0.zip diff --git a/community/icu/HPKBUILD b/community/icu/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..06785b7f393690a77e8562f724a4bfe8cb24f49d --- /dev/null +++ b/community/icu/HPKBUILD @@ -0,0 +1,103 @@ +# 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: 城meto +# Maintainer: 城meto + +pkgname=icu +pkgver=release-73-2 +pkgrel=0 +pkgdesc="icu is short for International Components for Unicode." +url="https://github.com/unicode-org/icu" +archs=("armeabi-v7a" "arm64-v8a") +license=("BSD License") +depends=() +makedepends=() +# 官方下载地址https://github.com/unicode-org/$pkgname/archive/refs/tags/$pkgver.tar.gz受网络影响可能存在下载失败的情况,现使用gitee镜像可以与官方仓库保持同步 +source="https://gitee.com/lycium_pkg_mirror/$pkgname/repository/archive/$pkgver.zip" +buildtools="configure" + +autounpack=true +downloadpackage=true +buildhost=true + +builddir=$pkgname-$pkgver +packagename=$pkgname-$pkgver.zip + +source envset.sh +host= + +prepare() { + # 需要先编译host版本 + if [ $buildhost == true ];then + mkdir -p $builddir/host-build + cd $builddir/host-build + CXXFLAGS="-std=c++11 -DU_USING_ICU_NAMESPACE=0" ../icu4c/source/runConfigureICU Linux/gcc > $buildlog 2>&1 + $MAKE VERBOSE=1 >> $buildlog 2>&1 + if [ $? -ne 0 ];then + cat config.log >> $buildlog 2>&1 + return -2 + fi + buildhost=false + cd $OLDPWD + fi + mkdir -p $builddir/$ARCH-build + + if [ $ARCH == "armeabi-v7a" ];then + setarm32ENV + host=arm-linux + elif [ $ARCH == "arm64-v8a" ];then + setarm64ENV + host=aarch64-linux + else + echo "$ARCH not support" + return -3 + fi +} + +build() { + cd $builddir/$ARCH-build + CXXFLAGS="$CXXFLAGS -std=c++11 -DU_USING_ICU_NAMESPACE=0" \ + PKG_CONFIG_LIBDIR="${pkgconfigpath}" ../icu4c/source/configure "$@" \ + --host=$host --with-cross-build=`pwd`/../host-build > $buildlog 2>&1 + $MAKE VERBOSE=1 >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir/$ARCH-build + make install VERBOSE=1 >> `pwd`/build.log 2>&1 + cd $OLDPWD + if [ $ARCH == "armeabi-v7a" ];then + unsetarm32ENV + unset host + elif [ $ARCH == "arm64-v8a" ];then + unsetarm64ENV + unset host + else + echo "$ARCH not support" + return -1 + fi +} + +check() { + echo "The test must be on an OpenHarmony device!" + # TODO +} + +# 清理环境 +cleanbuild(){ + rm -rf ${PWD}/$builddir #${PWD}/$packagename +} diff --git a/community/icu/SHA512SUM b/community/icu/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..c2b7229c0696bc90a32bbac406ad4609774a136e --- /dev/null +++ b/community/icu/SHA512SUM @@ -0,0 +1 @@ +6b9bc9ca0edab71bc63781361677bab32b4e7bc35277321e444f06e1f0aab4aa2cd542167b237649f3857a58955ae37b51d68e1bad2185f7fcfcf97bcd1859a0 icu-release-73-2.zip diff --git a/community/jbig2enc/BUILD.gn b/community/jbig2enc/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..829efbcdb6c64a036aa40613b72871cef6aa8c50 --- /dev/null +++ b/community/jbig2enc/BUILD.gn @@ -0,0 +1,89 @@ +# Copyright (c) 2019-2022 Huawei Device Co., Ltd. All rights reserved. +# 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. + +import("//build/ohos.gni") +import("//build/ohos/ndk/ndk.gni") + +declare_args() { + enable_test = false +} + +config("jbig2enc_config") { + cflags = [ + "-Wall", + "-Wno-error=unused-const-variable", + "-DVERSION=\"0.29\"", + ] + + ldflags = [ "-lm" ] +} + +ohos_shared_library("jbig2enc_shared") { + sources = [ + "jbig2enc/src/jbig2arith.cc", + "jbig2enc/src/jbig2comparator.cc", + "jbig2enc/src/jbig2enc.cc", + "jbig2enc/src/jbig2sym.cc", + ] + + include_dirs = [ + "jbig2enc/src", + "//third_party/leptonica/leptonica/src", + "//third_party/leptonica/adapted", + ] + + configs = [ ":jbig2enc_config" ] + + deps = [ + "//third_party/leptonica:leptonica", + "//third_party/libpng:libpng", + ] + + part_name = "jbig2enc" +} + +ohos_executable("jbig2") { + sources = [ "jbig2enc/src/jbig2.cc" ] + configs = [ ":jbig2enc_config" ] + + include_dirs = [ + "jbig2enc/src", + "//third_party/leptonica/leptonica/src", + "//third_party/leptonica/adapted", + ] + + deps = [ + ":jbig2enc_shared", + "//third_party/leptonica:leptonica", + "//third_party/libpng:libpng", + ] + part_name = "jbig2enc" +} + +action("init_includes") { + script = "adapted/init_includes.sh" + sources = [ "//third_party/jbig2enc/adapted" ] + outputs = [ "${target_out_dir}" ] + args = [ rebase_path("//third_party/jbig2enc", root_build_dir) ] +} + +group("jbig2enc") { + deps = [ + ":init_includes", + ":jbig2enc_shared", + ] + + if (enable_test) { + deps += [ ":jbig2" ] + } +} diff --git a/community/jbig2enc/README.OpenSource b/community/jbig2enc/README.OpenSource new file mode 100755 index 0000000000000000000000000000000000000000..267cdd368a5bf6d481b70c2cd0d615f178d7a23b --- /dev/null +++ b/community/jbig2enc/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name" : "jbig2enc", + "License" : "Apache License", + "License File" : "LICENSE", + "Version Number" : "0.29", + "Owner" : "huangminzhong2@huawei.com", + "Upstream URL" : "https://github.com/agl/jbig2enc", + "Description" : "This is an encoder for JBIG2." + } +] diff --git a/community/jbig2enc/README_zh.md b/community/jbig2enc/README_zh.md new file mode 100755 index 0000000000000000000000000000000000000000..2135b7af0c7f52d8eaf2ff4de0d4839e29d6699d --- /dev/null +++ b/community/jbig2enc/README_zh.md @@ -0,0 +1,15 @@ +# jbig2enc 三方库说明 + +## 功能简介 + +jbig2enc是 JBIG2文件的编码器。 + +## 使用约束 + +- ROM版本:OpenHarmony3.2 beta1 +- 三方库版本:0.29 +- 当前适配的功能:[JBIG2](https://github.com/agl/jbig2enc/blob/0.29/fcd14492.pdf) 文件编码, 图片格式转换 + +## 集成方式 + +- [系统Rom包集成](./docs/rom_integrate.md) diff --git a/community/jbig2enc/adapted/init_includes.sh b/community/jbig2enc/adapted/init_includes.sh new file mode 100755 index 0000000000000000000000000000000000000000..dab82dcec9317f31279d808954b0fe24c2b61e38 --- /dev/null +++ b/community/jbig2enc/adapted/init_includes.sh @@ -0,0 +1,2 @@ +#!/bin/bash +cd $1 && find jbig2enc |grep "allheaders.h" -rF | awk -F : '{print $1}' | xargs sed -i 's///g' diff --git a/community/jbig2enc/bundle.json b/community/jbig2enc/bundle.json new file mode 100755 index 0000000000000000000000000000000000000000..67e6a20f302c658c88ac0c4ffd4e1fe09f57a2e1 --- /dev/null +++ b/community/jbig2enc/bundle.json @@ -0,0 +1,33 @@ +{ + "name": "@ohos/jbig2enc", + "description": "This is an encoder for JBIG2.", + "version": "0.29", + "license": "Apache License", + "publishAs": "", + "segment": { + "destPath": "third_party/jbig2enc" + }, + "dirs": {}, + "scripts": {}, + "readmePath": { + "en": "README" + }, + "component": { + "name": "jbig2enc", + "subsystem": "thirdparty", + "syscap": [], + "features": [], + "adapted_system_type": ["standard"], + "rom": "", + "ram": "", + "deps": { + "components": [], + "third_party": [] + }, + "build": { + "sub_component": ["//third_party/jbig2enc:jbig2enc"], + "inner_kits": [], + "test": [] + } + } +} diff --git a/community/jbig2enc/docs/pic/result.png b/community/jbig2enc/docs/pic/result.png new file mode 100755 index 0000000000000000000000000000000000000000..cc76049f68900bff879a7c6b05a412775fabf474 Binary files /dev/null and b/community/jbig2enc/docs/pic/result.png differ diff --git a/community/jbig2enc/docs/rom_integrate.md b/community/jbig2enc/docs/rom_integrate.md new file mode 100755 index 0000000000000000000000000000000000000000..ae55c926af3b791a656a75301166c3e7007d2f80 --- /dev/null +++ b/community/jbig2enc/docs/rom_integrate.md @@ -0,0 +1,123 @@ +# jbig2enc如何集成到系统Rom +## 准备源码工程 +本库是基于OpenHarmony-v3.2-Beta1版本,在RK3568开发板上验证的,如果是从未使用过RK3568,可以先查看[润和RK3568开发板标准系统快速上手](https://gitee.com/openharmony-sig/knowledge_demo_temp/tree/master/docs/rk3568_helloworld)。 +### 准备系统Rom源码 +系统源码获取请参考:[OpenHarmony源码下载](https://gitee.com/openharmony/docs/blob/OpenHarmony-v3.2-Beta2/zh-cn/release-notes/OpenHarmony-v3.2-beta1.md) +### 增加构建脚本及配置文件 +- 下载本仓库代码 + ``` + cd ~ + git clone git@gitee.com:openharmony-sig/tpc_c_cplusplus.git --depth=1 + ``` +- 三方库目录结构 + ``` + tpc_c_cplusplus/thirdparty/jbig2enc #三方库jbig2enc的目录结构如下 + ├── adapted #存放三方库适配需要的代码文件 + ├── docs #存放三方库相关文档的文件夹 + ├── BUILD.gn #构建脚本,支持rom包集成 + ├── bundle.json #三方库组件定义文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md + ``` +- 将三方库拷贝到OpenHarmony源码的third_party目录下 + ``` + cp ~/tpc_c_cplusplus/thirdparty/jbig2enc ~/openharmony/third_party -rf + ``` +### 准备三方库源码 + +- 下载三方库jbig2enc + +``` +cd ~/openharmony/third_party/jbig2enc #进入三方库目录 +git clone https://github.com/agl/jbig2enc.git -b 0.29 --depth=1 #下载三方库源码 +``` +- 下载依赖库leptonica + + 依赖库下载及适配参考:[leptonica的Rom集成](https://gitee.com/openharmony-sig/tpc_c_cplusplus/leptonica) + +## 系统Rom中引入三方库 + +准备完三方库代码后,我们需要将三方库加入到编译构建体系中。标准系统编译构建可以参考文档[标准系统编译构建指导](https://gitee.com/openharmony/docs/blob/OpenHarmony-3.2-Beta1/zh-cn/device-dev/subsystems/subsys-build-standard-large.md) +我们默认三方库是属于OpenHarmony的thirdparty子系统,如果需要自己定义子系统参考文档[如何为三方库组件中添加一个三方库](https://gitee.com/openharmony-sig/knowledge/blob/master/docs/openharmony_getstarted/port_thirdparty/README.md) +新增需要编译的组件,在OpenHarmony源码的vendor/hihope/rk3568/config.json文件中,新增需要编译的组件,如下代码段所示,在thirdparty子系统下面新增jbig2enc组件 + +``` + { + "subsystem": "thirdparty", + "components": [ + { + "component": "musl", + "features": [] + }, + { + "component": "jbig2enc", + "features": [] + } + ] + } + +``` +## 系统Rom中引入三方库测试程序 +如果需要编译测试用例,在OpenHarmony源码的vendor/hihope/rk3568/config.json文件,对应组件的features中打开编译选项,如下 +``` + { + "subsystem": "thirdparty", + "components": [ + { + "component": "musl", + "features": [] + }, + { + "component": "jbig2enc", + "features": ["enable_test=true"] + } + ] + } +``` +## 编译工程 +在OpenHarmony源码根目录下 +``` +cd ~/openharmony +``` +- 选择平台 + ``` + hb set #hb set 命令会列出所有可选平台,这里我们选择rk3568 + ``` +- 执行编译 + ``` + hb build --target-cpu arm #编译32位系统 + hb build --target-cpu arm64 #编译64位系统 + ``` +- 生成文件的路径,可执行文件和库文件都在out/rk3568/thirdparty/jbig2enc目录下,同时也打包到了镜像中 +## 运行效果 +将编译生成的库和测试文件放到板子上运行,为避免每次将文件推入设备都烧录整个镜像,我们使用hdc_std工具将文件推到开发板上 +- 首先将hdc_std工具编译出来 + 工具编译出来所在路径out/sdk/ohos-sdk/windows/toolchains/hdc_std.exe + + ``` + hb set #源码根目录下使用hb set 选择产品ohos-sdk + hb build #然后编译 + ``` + +- 将工具拷贝到Windows,可以为工具目录配置环境变量,也可以在工具所在目录打开windows命令行 + +- 将原生库测试需要的所有文件打包成jbig2enc.tar,并拷贝到windows下 + +- 将文件推送到开发板,在windows命令行进行如下操作 + ``` + hdc_std shell mount -oremount,rw / #修改系统权限为可读写 + hdc_std file send jbig2enc.tar / #将文件包推入开发板 + hdc_std shell #进入开发板 + tar xvf jbig2enc.tar #解压 + #注意需要将库拷贝到/system/lib 或者/system/lib64目录下 + ``` + +- 运行测试程序
+ 测试用例非常多,这里演示其中几个用例,如下图 + ![result](pic/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) +- [如何为三方库组件中添加一个三方库](https://gitee.com/openharmony-sig/knowledge/blob/master/docs/openharmony_getstarted/port_thirdparty/README.md) +- [标准系统编译构建指导](https://gitee.com/openharmony/docs/blob/OpenHarmony-3.2-Beta1/zh-cn/device-dev/subsystems/subsys-build-standard-large.md) \ No newline at end of file diff --git a/community/json-c/HPKBUILD b/community/json-c/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..ec96545e0374acd93aeaa86d5e869fb1eeec5975 --- /dev/null +++ b/community/json-c/HPKBUILD @@ -0,0 +1,49 @@ +# Contributor: Jeff Han +# Maintainer: Jeff Han +pkgname=json-c +pkgver=0.16-20220414 +pkgrel=0 +pkgdesc="JSON-C implements a reference counting object model that allows you to easily construct JSON objects in C." +url="https://github.com/json-c/json-c" +archs=("armeabi-v7a" "arm64-v8a") +license=("MIT") +depends=() +makedepends=() + +# 官方下载地址https://github.com/json-c/$pkgname/archive/refs/tags/$pkgname-$pkgver.tar.gz受网络影响可能存在下载失败的情况,现使用gitee镜像可以与官方仓库保持同步 +source="https://gitee.com/mirrors/$pkgname/repository/archive/$pkgname-$pkgver.zip" + +autounpack=true +downloadpackage=true + +builddir=$pkgname-$pkgname-${pkgver} +packagename=$builddir.zip + +prepare() { + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + PKG_CONFIG_LIBDIR="${pkgconfigpath}" ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" \ + -DDISABLE_WERROR=ON -DOHOS_ARCH=$ARCH -B$ARCH-build -S./ -L > $buildlog 2>&1 + $MAKE VERBOSE=1 -C $ARCH-build >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + $MAKE VERBOSE=1 -C $ARCH-build install >> $buildlog 2>&1 + cd $OLDPWD +} + +check() { + echo "The test must be on an OpenHarmony device!" +} + +# 清理环境 +cleanbuild(){ + rm -rf ${PWD}/$builddir #${PWD}/$packagename +} diff --git a/community/json-c/README.OpenSource b/community/json-c/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..be28ae8351e4e759fa247df96816be8eec422782 --- /dev/null +++ b/community/json-c/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "json-c", + "License": "MIT", + "License File": "https://github.com/json-c/json-c/blob/master/COPYING", + "Version Number": "0.16-20220414", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://github.com/json-c/json-c/archive/refs/tags/json-c-0.16-20220414.tar.gz", + "Description": "JSON-C implements a reference counting object model that allows you to easily construct JSON objects in C" + } +] diff --git a/community/json-c/README_zh.md b/community/json-c/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..eb2e5573dad41cf6e84a6089da04b13cb51b41a6 --- /dev/null +++ b/community/json-c/README_zh.md @@ -0,0 +1,15 @@ +# json-c三方库说明 +## 功能简介 +json-c是json数据解析库。 + +## 三方库版本 +- 0.16-20220414 + +## 已适配功能 +- 支持json数据解析 + +## 使用约束 +- [IDE和SDK版本](../../docs/constraint.md) + +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) diff --git a/community/json-c/SHA512SUM b/community/json-c/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..62f1d60f6a79b9c216c285c4a2860acd007eaf11 --- /dev/null +++ b/community/json-c/SHA512SUM @@ -0,0 +1 @@ +841deb94dee53906d4080abf437e45f3c86640e861b0c58e67b636365bece85cd9f23244769bb418b1acc32bdd10ae0462977493a22800594c4b5d3310409960 json-c-json-c-0.16-20220414.zip diff --git a/community/json-c/docs/hap_integrate.md b/community/json-c/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..8fbea0a398b75e6b77fd9727147e62d3b1b701de --- /dev/null +++ b/community/json-c/docs/hap_integrate.md @@ -0,0 +1,66 @@ +# json-c 集成到应用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/json-c #三方库json-c的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md + ``` + +- 在lycium目录下编译三方库 + + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ```shell + cd lycium + ./build.sh json-c + ``` + +- 三方库头文件及生成的库 + + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ```shell + json-c/arm64-v8a json-c/armeabi-v7a + ``` + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的库拷贝到该目录下,如下图所示 +   + +  ![thirdparty_install_dir](pic/json-c_install_dir.png) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + + ```shell + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/json-c/${OHOS_ARCH}/lib/libjson-c.a) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/json-c/${OHOS_ARCH}/include) + ``` + + +## 参考资料 + +- [润和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) \ No newline at end of file diff --git a/community/json-c/docs/pic/json-c_install_dir.png b/community/json-c/docs/pic/json-c_install_dir.png new file mode 100644 index 0000000000000000000000000000000000000000..69da46ea7c05dde9894eda69c5e0355f2acd360f Binary files /dev/null and b/community/json-c/docs/pic/json-c_install_dir.png differ diff --git a/community/json-c/docs/pic/json-c_usage.png b/community/json-c/docs/pic/json-c_usage.png new file mode 100644 index 0000000000000000000000000000000000000000..cdcf0e25657571c59486b8b0d4e1ac8d8d4435b0 Binary files /dev/null and b/community/json-c/docs/pic/json-c_usage.png differ diff --git a/community/json-c_0_17_20230812/HPKBUILD b/community/json-c_0_17_20230812/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..77c112ca4816c950ecb4d7f7878aae778275595b --- /dev/null +++ b/community/json-c_0_17_20230812/HPKBUILD @@ -0,0 +1,63 @@ +# 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: Jeff Han +# Maintainer: Jeff Han + +pkgname=json-c_0_17_20230812 +pkgver=0.17-20230812 +pkgrel=0 +pkgdesc="JSON-C implements a reference counting object model that allows you to easily construct JSON objects in C." +url="https://github.com/json-c/json-c" +archs=("armeabi-v7a" "arm64-v8a") +license=("MIT") +depends=() +makedepends=() + +# 官方下载地址https://github.com/json-c/${pkgname:0:6}/archive/refs/tags/${pkgname:0:6}-$pkgver.tar.gz受网络影响可能存在下载失败的情况,现使用gitee镜像可以与官方仓库保持同步 +source="https://gitee.com/mirrors/${pkgname:0:6}/repository/archive/${pkgname:0:6}-$pkgver.zip" + +autounpack=true +downloadpackage=true + +builddir=${pkgname:0:6}-${pkgname:0:6}-${pkgver} +packagename=$builddir.zip + +prepare() { + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + PKG_CONFIG_LIBDIR="${pkgconfigpath}" ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" \ + -DDISABLE_WERROR=ON -B$ARCH-build -S./ > $buildlog 2>&1 + ${MAKE} VERBOSE=1 -C$ARCH-build >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + ${MAKE} VERBOSE=1 -C$ARCH-build install >> $buildlog 2>&1 + cd $OLDPWD +} + +check() { + echo "The test must be on an OpenHarmony device!" +} + +# 清理环境 +cleanbuild(){ + rm -rf ${PWD}/$builddir #${PWD}/$packagename +} diff --git a/community/json-c_0_17_20230812/HPKCHECK b/community/json-c_0_17_20230812/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..4b27802c8b97145df735ea91d8b8e96810c88342 --- /dev/null +++ b/community/json-c_0_17_20230812/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: Jeff Han , wen fan +# Maintainer: Jeff Han + +source HPKBUILD > /dev/null 2>&1 +logfile=${LYCIUM_THIRDPARTY_ROOT}/${pkgname}/${pkgname}_${ARCH}_${OHOS_SDK_VER}_test.log + +checkprepare() { + return 0 +} + +openharmonycheck() { + cd ${builddir}/${ARCH}-build + ctest > ${logfile} 2>&1 + ret=$? + if [ ${ret} -ne 0 ] + then + mkdir ${LYCIUM_FAULT_PATH}/${pkgname} + cp Testing/Temporary/LastTest.log ${LYCIUM_FAULT_PATH}/${pkgname}/ + fi + + cd ${OLDPWD} + return ${ret} +} diff --git a/community/json-c_0_17_20230812/OAT.xml b/community/json-c_0_17_20230812/OAT.xml new file mode 100644 index 0000000000000000000000000000000000000000..8c1f4a4604b0605aff883a046d2397e0016221b5 --- /dev/null +++ b/community/json-c_0_17_20230812/OAT.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/community/json-c_0_17_20230812/README.OpenSource b/community/json-c_0_17_20230812/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..d9314c0b90e9a8a08e001b4d78e6d3ae723d2bdb --- /dev/null +++ b/community/json-c_0_17_20230812/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "json-c", + "License": "MIT", + "License File": "https://github.com/json-c/json-c/blob/master/COPYING", + "Version Number": "0.17-20230812", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://github.com/json-c/json-c/archive/refs/tags/json-c-0.17-20230812.tar.gz", + "Description": "JSON-C implements a reference counting object model that allows you to easily construct JSON objects in C" + } +] diff --git a/community/json-c_0_17_20230812/README_zh.md b/community/json-c_0_17_20230812/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..eb2fe91c80224034679e2f66a0629eadfa147834 --- /dev/null +++ b/community/json-c_0_17_20230812/README_zh.md @@ -0,0 +1,15 @@ +# json-c三方库说明 +## 功能简介 +json-c是json数据解析库。 + +## 三方库版本 +- 0.17-20230812 + +## 已适配功能 +- 支持json数据解析 + +## 使用约束 +- [IDE和SDK版本](../../docs/constraint.md) + +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) diff --git a/community/json-c_0_17_20230812/SHA512SUM b/community/json-c_0_17_20230812/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..b7d857fcfacb4c4e75fe80928846c976eaba9503 --- /dev/null +++ b/community/json-c_0_17_20230812/SHA512SUM @@ -0,0 +1 @@ +9263af559bb881daad88bab6804653678179abe010b47a17d48da6586c8a77ecbe452247f08ec336bf4f6ec2581abff70baa3cc6aa5351a0769f530b66f9cb47 json-c-json-c-0.17-20230812.zip diff --git a/community/json-c_0_17_20230812/docs/hap_integrate.md b/community/json-c_0_17_20230812/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..c090427aa3ec0e9e7377ceba9c89f19a7d7157be --- /dev/null +++ b/community/json-c_0_17_20230812/docs/hap_integrate.md @@ -0,0 +1,80 @@ +# json-c_0_17_20230812 集成到应用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/json-c_0_17_20230812 #三方库的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── HPKCHECK #测试脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md #三方库简介 + ├── OAT.xml #扫描结果文件 + ``` + +- 在lycium目录下编译三方库 + + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ```shell + cd lycium + ./build.sh json-c_0_17_20230812 + ``` + +- 三方库头文件及生成的库 + + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ```shell + json-c_0_17_20230812/arm64-v8a json-c_0_17_20230812/armeabi-v7a + ``` + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的库拷贝到该目录下,如下图所示 +   + +  ![thirdparty_install_dir](pic/json-c_install_dir.png) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + + ```shell + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/json-c/${OHOS_ARCH}/lib/libjson-c.a) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/json-c/${OHOS_ARCH}/include) + ``` + +## 测试三方库 + +三方库的测试使用原库提供的测试用例来做测试,[准备三方库测试环境](../../../lycium/README.md#3ci环境准备) + +进入到构建目录准备测试,例如目录为arm64-v8a-build,执行ctest进行测试 + +```shell +cd tpc_c_cplusplus/thirdparty/json-c_0_17_20230812/json-c-json-c-0.17-20230812/arm64-v8a-build +ctest +``` + +![test-pass](./pic/singletest.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) \ No newline at end of file diff --git a/community/json-c_0_17_20230812/docs/pic/json-c_install_dir.png b/community/json-c_0_17_20230812/docs/pic/json-c_install_dir.png new file mode 100644 index 0000000000000000000000000000000000000000..69da46ea7c05dde9894eda69c5e0355f2acd360f Binary files /dev/null and b/community/json-c_0_17_20230812/docs/pic/json-c_install_dir.png differ diff --git a/community/json-c_0_17_20230812/docs/pic/singletest.png b/community/json-c_0_17_20230812/docs/pic/singletest.png new file mode 100644 index 0000000000000000000000000000000000000000..1c0352e81c8cdc1779629f9539454072fe2415ad Binary files /dev/null and b/community/json-c_0_17_20230812/docs/pic/singletest.png differ diff --git a/community/json/HPKBUILD b/community/json/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..8dc8422286d25844a4b80b074f2cae5ced6855e7 --- /dev/null +++ b/community/json/HPKBUILD @@ -0,0 +1,50 @@ +# Contributor: wupingyuan +# Maintainer: wupingyuan +pkgname=json +pkgver=v3.11.2 +pkgrel=0 +pkgdesc="JSON for Modern C++" +url="https://github.com/nlohmann/json" +archs=("armeabi-v7a" "arm64-v8a") +license=("MIT") +depends=() +makedepends=() +install= +source="https://github.com/nlohmann/$pkgname/archive/refs/tags/$pkgver.tar.gz" + +autounpack=true +downloadpackage=true +builddir=$pkgname-${pkgver:1} +packagename=$builddir.tar.gz + +prepare() { + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + PKG_CONFIG_LIBDIR="${pkgconfigpath}" ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" \ + -DOHOS_ARCH=$ARCH -B$ARCH-build -S./ -L > $buildlog 2>&1 + $MAKE VERBOSE=1 -C $ARCH-build >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + $MAKE VERBOSE=1 -C $ARCH-build install >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +check() { + echo "The test must be on an OpenHarmony device!" + # 在OpenHarmony开发板中执行用例 + # ctest +} + +cleanbuild(){ + rm -rf ${PWD}/$builddir #${PWD}/$packagename +} diff --git a/community/json/README.OpenSource b/community/json/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..9bdbb859b61d0aed9eec0766d1f5e0b457440478 --- /dev/null +++ b/community/json/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "json", + "License": "MIT", + "License File": "https://github.com/nlohmann/json/blob/develop/LICENSE.MIT", + "Version Number": "v3.11.2", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://github.com/nlohmann/json/archive/refs/tags/v3.11.2.tar.gz", + "Description": "JSON for Modern C++" + } +] diff --git a/community/json/README_zh.md b/community/json/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..075c069e876c1e15584a22a1f8a0b025798370c0 --- /dev/null +++ b/community/json/README_zh.md @@ -0,0 +1,15 @@ +# json三方库说明 +## 功能简介 +json是一个C++的处理json数据解析的库。 + +## 三方库版本 +- v3.11.2 + +## 已适配功能 +- json数据解析 + +## 使用约束 +- [IDE和SDK版本](../../docs/constraint.md) + +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) diff --git a/community/json/SHA512SUM b/community/json/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..caa71fc9dbbea2658f082149471c8478315c6f96 --- /dev/null +++ b/community/json/SHA512SUM @@ -0,0 +1 @@ +70097c9bcd7a91254acbd41b8b68a6aaa371fc2dd7011f472917f69f1e2d2986155a0339dad791699d542e4a3be44dc49ae72ff73d0ee0ea4b34183296ce19a0 json-3.11.2.tar.gz \ No newline at end of file diff --git a/community/json/docs/hap_integrate.md b/community/json/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..0cf964ed30d39fa36f896ab6b004f8c7d8cbbe1b --- /dev/null +++ b/community/json/docs/hap_integrate.md @@ -0,0 +1,132 @@ +# json集成到应用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) +## 编译三方库 +- 下载本仓库 + ``` + git clone https://gitee.com/openharmony-sig/tpc_c_cplusplus.git --depth=1 + ``` + +- 三方库目录结构 + ``` + tpc_c_cplusplus/thirdparty/json #三方库json的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md + ``` + +- 在lycium目录下编译三方库 + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ``` + cd lycium + ./build.sh json + ``` + +- 三方库头文件及生成的库 + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + ``` + json/arm64-v8a json/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的库拷贝到该目录下,如下图所示 + ![thirdparty_install_dir](pic/json_install_dir.jpg) +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + ``` + #将三方库的头文件加入工程中(由于改库没有静态库或动态库,直接引入源文件使用) + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/json/${OHOS_ARCH}/include) + ``` +## 测试三方库 +三方库的测试使用原库自带的测试用例来做测试,[准备三方库测试环境](../../../lycium/README.md#3ci环境准备) +先在linux系统进入构建目录执行ctest执行测试用例:download_test_data + ![json_test](pic/json_test1.jpg) +然后进入板子到构建目录执行以下可执行文件运行测试用例(arm64-v8a-build为构建64位的目录,armeabi-v7a-build为构建32位的目录) + ``` + ./tests/test-algorithms_cpp11 + ./tests/test-allocator_cpp11 + ./tests/test-alt-string_cpp11 + ./tests/test-assert_macro_cpp11 + ./tests/test-binary_formats_cpp11 + ./tests/test-bjdata_cpp11 + ./tests/test-bson_cpp11 + ./tests/test-byte_container_with_subtype_cpp11 + ./tests/test-capacity_cpp11 + ./tests/test-cbor_cpp11 + ./tests/test-class_const_iterator_cpp11 + ./tests/test-class_iterator_cpp11 + ./tests/test-class_lexer_cpp11 + ./tests/test-class_parser_cpp11 + ./tests/test-comparison_cpp11 + ./tests/test-comparison_cpp20 + ./tests/test-comparison_legacy_cpp11 + ./tests/test-comparison_legacy_cpp20 + ./tests/test-concepts_cpp11 + ./tests/test-constructor1_cpp11 + ./tests/test-constructor2_cpp11 + ./tests/test-convenience_cpp11 + ./tests/test-conversions_cpp11 + ./tests/test-conversions_cpp17 + ./tests/test-deserialization_cpp11 + ./tests/test-diagnostics_cpp11 + ./tests/test-disabled_exceptions_cpp11 + ./tests/test-element_access1_cpp11 + ./tests/test-element_access2_cpp11 + ./tests/test-element_access2_cpp14 + ./tests/test-element_access2_cpp17 + ./tests/test-hash_cpp11 + ./tests/test-inspection_cpp11 + ./tests/test-items_cpp11 + ./tests/test-items_cpp17 + ./tests/test-iterators1_cpp11 + ./tests/test-iterators2_cpp11 + ./tests/test-iterators2_cpp20 + ./tests/test-json_patch_cpp11 + ./tests/test-json_pointer_cpp11 + ./tests/test-json_pointer_cpp20 + ./tests/test-large_json_cpp11 + ./tests/test-merge_patch_cpp11 + ./tests/test-meta_cpp11 + ./tests/test-modifiers_cpp11 + ./tests/test-msgpack_cpp11 + ./tests/test-noexcept_cpp11 + ./tests/test-ordered_json_cpp11 + ./tests/test-ordered_map_cpp11 + ./tests/test-pointer_access_cpp11 + ./tests/test-readme_cpp11 + ./tests/test-reference_access_cpp11 + ./tests/test-regression1_cpp11 + ./tests/test-regression1_cpp17 + ./tests/test-regression2_cpp11 + ./tests/test-regression2_cpp17 + ./tests/test-regression2_cpp20 + ./tests/test-serialization_cpp11 + ./tests/test-testsuites_cpp11 + ./tests/test-to_chars_cpp11 + ./tests/test-type_traits_cpp11 + ./tests/test-ubjson_cpp11 + ./tests/test-udl_cpp11 + ./tests/test-udt_cpp11 + ./tests/test-udt_macro_cpp11 + ./tests/test-unicode1_cpp11 + ./tests/test-unicode2_cpp11 + ./tests/test-unicode3_cpp11 + ./tests/test-unicode4_cpp11 + ./tests/test-unicode5_cpp11 + ./tests/test-user_defined_input_cpp11 + ./tests/test-windows_h_cpp11 + ./tests/test-wstring_cpp11 + ``` + ![json_test](pic/json_test2.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/community/json/docs/pic/json_install_dir.jpg b/community/json/docs/pic/json_install_dir.jpg new file mode 100644 index 0000000000000000000000000000000000000000..a722776aa72ed13ce4ca23bec5af67d902467e06 Binary files /dev/null and b/community/json/docs/pic/json_install_dir.jpg differ diff --git a/community/json/docs/pic/json_test1.jpg b/community/json/docs/pic/json_test1.jpg new file mode 100644 index 0000000000000000000000000000000000000000..3ed40570df0a770636288c2740bf0d1b7f617c7f Binary files /dev/null and b/community/json/docs/pic/json_test1.jpg differ diff --git a/community/json/docs/pic/json_test2.jpg b/community/json/docs/pic/json_test2.jpg new file mode 100644 index 0000000000000000000000000000000000000000..e3e2da0a6bf90c47c8494ee4b3368a565648e0ad Binary files /dev/null and b/community/json/docs/pic/json_test2.jpg differ diff --git a/community/json/docs/pic/json_usage.jpg b/community/json/docs/pic/json_usage.jpg new file mode 100644 index 0000000000000000000000000000000000000000..54852e609cf679b67228ef8b6078ea13e6151132 Binary files /dev/null and b/community/json/docs/pic/json_usage.jpg differ diff --git a/community/json11-1.0.0/HPKBUILD b/community/json11-1.0.0/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..2de0d4b836f22c0aafcadd2d0376b5bc88b79e3b --- /dev/null +++ b/community/json11-1.0.0/HPKBUILD @@ -0,0 +1,72 @@ +# 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=json11-1.0.0 +pkgver=v1.0.0 +pkgrel=0 +pkgdesc="json11 is a tiny JSON library for C++11, providing JSON parsing and serialization." +url="https://github.com/dropbox/json11/tree/v1.0.0" +archs=("armeabi-v7a" "arm64-v8a") +license=("MIT license") +depends=() +makedepends=() +source="https://github.com/dropbox/json11/archive/refs/tags/v1.0.0.zip" + +downloadpackage=true +autounpack=true +buildtools=cmake +patchflag=true + +builddir=json11-1.0.0 +packagename=json11-v1.0.0.zip + +# 为编译设置环境,如设置环境变量,创建编译目录等 +prepare() { + if $patchflag + then + cd $builddir + #在原库根目录下的CMakeLists.txt中打开构建单元测试的开关,并激活ctest + patch -p1 < `pwd`/../json11-1.0.0_oh_pkg.patch + #patch只需要打一次,关闭打patch + patchflag=false + cd $OLDPWD + fi + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" -DCMAKE_C_FLAGS="-Wno-unused-command-line-argument" \ + -DCMAKE_CXX_FLAGS="-Wno-unused-command-line-argument" -B$ARCH-build -S./ > $buildlog 2>&1 + $MAKE VERBOSE=1 -C $ARCH-build >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + $MAKE -C $ARCH-build install >> $buildlog 2>&1 + cd $OLDPWD +} + +check() { + echo "The test must be on an OpenHarmony device!" +} + +cleanbuild() { + rm -rf ${PWD}/$builddir +} \ No newline at end of file diff --git a/community/json11-1.0.0/HPKCHECK b/community/json11-1.0.0/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..45087f23bbfe1b9cac2c3352e606b765ef4a975f --- /dev/null +++ b/community/json11-1.0.0/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: 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}_${OHOS_SDK_VER}_test.log + + +# 在OH环境执行测试的接口 +openharmonycheck() { + res=0 + cd ${builddir}/${ARCH}-build # 进入到测试目录 + ctest > $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/community/json11-1.0.0/README.OpenSource b/community/json11-1.0.0/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..6f8ca3e59c8a353e2b15bbaff133ded8da8e4675 --- /dev/null +++ b/community/json11-1.0.0/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "json11-1.0.0", + "License": "MIT license", + "License File": "https://github.com/dropbox/json11/blob/master/LICENSE.txt", + "Version Number": "v1.0.0", + "Owner": "2942375747@qq.com", + "Upstream URL": "https://github.com/dropbox/json11", + "Description": "json11 is a tiny JSON library for C++11, providing JSON parsing and serialization." + } +] \ No newline at end of file diff --git a/community/json11-1.0.0/README_zh.md b/community/json11-1.0.0/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..29a2cb79b14f3cb7430740992975c5c24b887062 --- /dev/null +++ b/community/json11-1.0.0/README_zh.md @@ -0,0 +1,9 @@ +# json11-1.0.0三方库说明 +## 功能简介 +json11是c++ 11的一个小型JSON库,提供JSON解析和序列化。 +## 三方库版本: +- v1.0.0 +## 使用约束: +- [IDE和SDK版本](../../docs/constraint.md) +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) \ No newline at end of file diff --git a/community/json11-1.0.0/SHA512SUM b/community/json11-1.0.0/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..551513bceb12936c7cb6d8192f27cbdeeb5c0f19 --- /dev/null +++ b/community/json11-1.0.0/SHA512SUM @@ -0,0 +1 @@ +88f1735b977550feb03cf57aad37a56a348f9e266679512da5c3beeb96f294339aa48fac5069837db7ba3aa02a19a8ca9432f36ad9a57570248e13d0a21c4407 json11-v1.0.0.zip \ No newline at end of file diff --git a/community/json11-1.0.0/docs/hap_integrate.md b/community/json11-1.0.0/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..8a0fb48c71df8d32f15741965936a47ccad233ec --- /dev/null +++ b/community/json11-1.0.0/docs/hap_integrate.md @@ -0,0 +1,79 @@ +# json11集成到应用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/json11-1.0.0 #三方库json11-1.0.0的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── HPKCHECK #测试脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md #三方库简介 + ├── json11-1.0.0_oh_pkg.patch #用于json11-1.0.0库编译的补丁 + ``` + +- 在lycium目录下编译三方库 + + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ```shell + cd lycium + ./build.sh json11-1.0.0 + ``` + +- 三方库头文件及生成的库 + + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ```shell + json11-1.0.0/arm64-v8a json11-1.0.0/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的头文件和静态库文件拷贝到该目录下,如下图所示: +   + +  ![thirdparty_install_dir](pic/json11_install_dir.png) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + + ```shell + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/json11/${OHOS_ARCH}/lib/libjson11.a) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/json11/${OHOS_ARCH}/include) + ``` + +## 测试三方库 +- 编译出可执行的文件,使用原库自带的测试用例来做测试 [准备三方库测试环境](../../../lycium/README.md#3ci环境准备) +进入到构建目录运行测试用例(注意arm64-v8a为构建64位的目录,armeabi-v7a为构建32位的目录)。执行结果如图所示 + +```shell + cd /data/tpc_c_cplusplus/thirdparty/json11-1.0.0/json11-1.0.0/arm64-v8a-build/ + ctest +``` + ![json11_test](pic/json11_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/community/json11-1.0.0/docs/pic/json11_install_dir.png b/community/json11-1.0.0/docs/pic/json11_install_dir.png new file mode 100644 index 0000000000000000000000000000000000000000..ece76bae89b3b7ae3ba155e618e3fa3ca8f74337 Binary files /dev/null and b/community/json11-1.0.0/docs/pic/json11_install_dir.png differ diff --git a/community/json11-1.0.0/docs/pic/json11_test.png b/community/json11-1.0.0/docs/pic/json11_test.png new file mode 100644 index 0000000000000000000000000000000000000000..ce8c21c1b0651c8c59c19c52ca6bf5dc5745545b Binary files /dev/null and b/community/json11-1.0.0/docs/pic/json11_test.png differ diff --git a/community/json11-1.0.0/json11-1.0.0_oh_pkg.patch b/community/json11-1.0.0/json11-1.0.0_oh_pkg.patch new file mode 100644 index 0000000000000000000000000000000000000000..00f0f8fb737397a5b16b6476175c95e645edcb1e --- /dev/null +++ b/community/json11-1.0.0/json11-1.0.0_oh_pkg.patch @@ -0,0 +1,20 @@ +diff -urN json11-1.0.0_old/CMakeLists.txt json11-1.0.0/CMakeLists.txt +--- json11-1.0.0_old/CMakeLists.txt 2017-06-21 07:48:22.000000000 +0800 ++++ json11-1.0.0/CMakeLists.txt 2024-10-07 20:10:12.364267842 +0800 +@@ -8,7 +8,7 @@ + + enable_testing() + +-option(JSON11_BUILD_TESTS "Build unit tests" OFF) ++option(JSON11_BUILD_TESTS "Build unit tests" ON) + option(JSON11_ENABLE_DR1467_CANARY "Enable canary test for DR 1467" OFF) + + if(CMAKE_VERSION VERSION_LESS "3") +@@ -50,6 +50,7 @@ + + add_executable(json11_test test.cpp) + target_link_libraries(json11_test json11) ++ add_test(NAME Json11Test COMMAND json11_test) + endif() + + install(TARGETS json11 DESTINATION lib/${CMAKE_LIBRARY_ARCHITECTURE}) diff --git a/community/kcp-1.7/HPKBUILD b/community/kcp-1.7/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..3c14562ced9c84f4879070c7426c996d9c987f2d --- /dev/null +++ b/community/kcp-1.7/HPKBUILD @@ -0,0 +1,62 @@ +# 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=kcp-1.7 +pkgver=1.7 +pkgrel=0 +pkgdesc="It is a fast and Reliable ARQ Protocol" +url="https://github.com/skywind3000/kcp/tree/1.7" +archs=("armeabi-v7a" "arm64-v8a") +license=("MIT License") +depends=() +makedepends=() +source="https://github.com/skywind3000/kcp/archive/refs/tags/1.7.zip" + +downloadpackage=true +autounpack=true +buildtools=cmake + +builddir=kcp-1.7 +packagename=kcp-1.7.zip + +# 为编译设置环境,如设置环境变量,创建编译目录等 +prepare() { + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" -DCMAKE_C_FLAGS="-Wno-unused-command-line-argument" \ + -DCMAKE_CXX_FLAGS="-Wno-unused-command-line-argument" -B$ARCH-build -S./ > $buildlog 2>&1 + $MAKE VERBOSE=1 -C $ARCH-build >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + $MAKE -C $ARCH-build install >> $buildlog 2>&1 + cd $OLDPWD +} + +check() { + echo "The test must be on an OpenHarmony device!" +} + +cleanbuild() { + rm -rf ${PWD}/$builddir +} \ No newline at end of file diff --git a/community/kcp-1.7/HPKCHECK b/community/kcp-1.7/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..80113d5a05cf6ce7453e0153ea493bcc85c770a5 --- /dev/null +++ b/community/kcp-1.7/HPKCHECK @@ -0,0 +1,30 @@ +# 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}_${OHOS_SDK_VER}_test.log + + +# 在OH环境执行测试的接口 +openharmonycheck() { + res=0 + cd ${builddir}/${ARCH}-build # 进入到测试目录 + ./kcp_test > ${logfile} 2>&1 # 执行测试用例并将测试结果导出到${logfile} + res=$? + cd $OLDPWD + + return $res +} \ No newline at end of file diff --git a/community/kcp-1.7/README.OpenSource b/community/kcp-1.7/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..ddea03a9ef3bb070c2f9f327ced8b6ff320dbd26 --- /dev/null +++ b/community/kcp-1.7/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "kcp-1.7", + "License": "MIT License", + "License File": "https://github.com/skywind3000/kcp/blob/master/LICENSE", + "Version Number": "1.7", + "Owner": "2942375747@qq.com", + "Upstream URL": "https://github.com/skywind3000/kcp", + "Description": "It is a Fast and Reliable ARQ Protocol" + } +] \ No newline at end of file diff --git a/community/kcp-1.7/README_zh.md b/community/kcp-1.7/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..10ee568f30b0d9d581a3543433aeb0f12b2882ef --- /dev/null +++ b/community/kcp-1.7/README_zh.md @@ -0,0 +1,9 @@ +# kcp-1.7三方库说明 +## 功能简介 +kcp是一个快速可靠的ARQ协议 +## 三方库版本: +- 1.7 +## 使用约束: +- [IDE和SDK版本](../../docs/constraint.md) +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) diff --git a/community/kcp-1.7/SHA512SUM b/community/kcp-1.7/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..1edf542d564803ae88adb650348df62cb2d4de09 --- /dev/null +++ b/community/kcp-1.7/SHA512SUM @@ -0,0 +1 @@ +b7ccdb22ababff426a2a6e352ae299533adbadee05227ff9719db0cdb048ea52880a7946b1c02af0d294396ae74efd223c816c7c67821d992e3bfe7ceac23d5e kcp-1.7.zip \ No newline at end of file diff --git a/community/kcp-1.7/docs/hap_integrate.md b/community/kcp-1.7/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..5b4e60e39a0b011426cf95e2bce59bf732ae724a --- /dev/null +++ b/community/kcp-1.7/docs/hap_integrate.md @@ -0,0 +1,78 @@ +# kcp集成到应用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/kcp-1.7 #三方库kcp-1.7的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── HPKCHECK #测试脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md #三方库简介 + ``` + +- 在lycium目录下编译三方库 + + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ```shell + cd lycium + ./build.sh kcp-1.7 + ``` + +- 三方库头文件及生成的库 + + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ```shell + kcp-1.7/arm64-v8a kcp-1.7/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的头文件拷贝到该目录下,将编译生成的三方库以及依赖库全部(动态库名字带版本号和不带版本号的都需要)拷贝到工程的libs目录下,如下图所示: +   + +  ![thirdparty_install_dir](pic/kcp_install_dir.png) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + + ```shell + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/kcp/${OHOS_ARCH}/lib/libkcp.a) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/kcp/${OHOS_ARCH}/include) + ``` + +## 测试三方库 +- 编译出可执行的文件,使用原库自带的测试用例来做测试[准备三方库测试环境](../../../lycium/README.md#3ci环境准备) +进入到构建目录运行测试用例(注意arm64-v8a为构建64位的目录,armeabi-v7a为构建32位的目录),执行结果如图所示 + +```shell + cd /data/tpc_c_cplusplus/thirdparty/kcp-1.7/kcp-1.7/arm64-v8a-build/ + ./kcp_test +``` + ![kcp_test](pic/kcp_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/community/kcp-1.7/docs/pic/kcp_install_dir.png b/community/kcp-1.7/docs/pic/kcp_install_dir.png new file mode 100644 index 0000000000000000000000000000000000000000..99dff7a91686eb9d172a3d9a0a79c0e07bcee959 Binary files /dev/null and b/community/kcp-1.7/docs/pic/kcp_install_dir.png differ diff --git a/community/kcp-1.7/docs/pic/kcp_test.png b/community/kcp-1.7/docs/pic/kcp_test.png new file mode 100644 index 0000000000000000000000000000000000000000..b0e7db82b3d9903646452b9840cffac613428ff2 Binary files /dev/null and b/community/kcp-1.7/docs/pic/kcp_test.png differ diff --git a/community/leveldb/HPKBUILD b/community/leveldb/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..7e612f40b9e8b8a44d15528e70de05c75f30b69d --- /dev/null +++ b/community/leveldb/HPKBUILD @@ -0,0 +1,46 @@ +# Contributor: huangminzhong +# Maintainer: huangminzhong +pkgname=leveldb +pkgver=1.23 +pkgrel=0 +pkgdesc="LevelDB is a fast key-value storage library written at Google that provides an ordered mapping from string keys to string values." +url="https://github.com/google/leveldb" +archs=("armeabi-v7a" "arm64-v8a") +license=("BSD-3-Clause") +depends=("snappy") +makedepends=() +source="https://github.com/google/$pkgname/archive/refs/tags/$pkgver.tar.gz" + +downloadpackage=true +autounpack=true + +builddir=$pkgname-$pkgver +packagename=$builddir.tar.gz + +prepare() { + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" -DOHOS_ARCH=$ARCH -B$ARCH-build -DLEVELDB_BUILD_BENCHMARKS=OFF -DLEVELDB_BUILD_TESTS=OFF -DCMAKE_CXX_FLAGS="-Wno-unused-command-line-argument" -S./ -L > $ARCH-build/build.log 2>&1 + make -j4 -C $ARCH-build >> `pwd`/$ARCH-build/build.log 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd "$builddir" + make -C $ARCH-build install >> `pwd`/$ARCH-build/build.log 2>&1 + cd $OLDPWD +} + +check() { + echo "The test must be on an OpenHarmony device!" +} + +# 清理环境 +cleanbuild(){ + rm -rf ${PWD}/$builddir # ${PWD}/$packagename +} diff --git a/community/leveldb/README.OpenSource b/community/leveldb/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..c86181d25f2341a2a6590598ded8f35d680944fe --- /dev/null +++ b/community/leveldb/README.OpenSource @@ -0,0 +1,20 @@ +[ + { + "Name": "leveldb", + "License": "BSD-3-Clause", + "License File": "https://github.com/google/leveldb/blob/main/LICENSE", + "Version Number": "1.23", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://github.com/google/leveldb/archive/refs/tags/1.23.tar.gz", + "Description": "LevelDB is a fast key-value storage library written at Google that provides an ordered mapping from string keys to string values." + }, + { + "Name": "snappy", + "License": "BSD-3-Clause", + "License File": "https://github.com/google/snappy/blob/main/COPYING", + "Version Number": "1.1.10", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://github.com/google/snappy/archive/refs/tags/1.1.10.tar.gz", + "Description": "Snappy is a compression/decompression library. It does not aim for maximum compression, or compatibility with any other compression library; instead, it aims for very high speeds and reasonable compression. For instance, compared to the fastest mode of zlib, Snappy is an order of magnitude faster for most inputs, but the resulting compressed files are anywhere from 20% to 100% bigger" + } +] \ No newline at end of file diff --git a/community/leveldb/SHA512SUM b/community/leveldb/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..76d861b5c38ce9d470a4c09fe8bc1a5dc14621b0 --- /dev/null +++ b/community/leveldb/SHA512SUM @@ -0,0 +1 @@ +ac15eac29387b9f702a901b6567d47a9f8c17cf5c7d8700a77ec771da25158c83b04959c33f3d4de7a3f033ef08f545d14ba823a8d527e21889c4b78065b0f84 leveldb-1.23.tar.gz \ No newline at end of file diff --git a/community/libaom/HPKBUILD b/community/libaom/HPKBUILD new file mode 100755 index 0000000000000000000000000000000000000000..6336df39097f6e19c0812b12b1815d99def6672a --- /dev/null +++ b/community/libaom/HPKBUILD @@ -0,0 +1,65 @@ +# 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: Wenju Wang +# Maintainer: Wenju Wang + +pkgname=libaom +pkgver=v3.6.1 +pkgrel=0 +pkgdesc="Used for processing AV1 video codec" +url="https://gitlab.com/webmproject/libaom.git" +archs=("armeabi-v7a" "arm64-v8a") +license=("BSD 2-Clause 'Simplified' License") +depends=() +makedepends=() +source="https://gitlab.com/webmproject/$pkgname/-/archive/$pkgver/${pkgname}-${pkgver}.tar.gz" + +autounpack=true +downloadpackage=true +buildtools="cmake" +patchflag=true +builddir=${pkgname}-${pkgver} +packagename=${builddir}.tar.gz + +prepare() { + mkdir -p $builddir/${ARCH}-build +} + +build() { + cd $builddir + PKG_CONFIG_LIBDIR="${pkgconfigpath}" cmake "$@" \ + -DCMAKE_C_FLAGS=-mfloat-abi=softfp -Wno-unused-command-line-argument \ + -DCMAKE_CXX_FLAGS=-mfloat-abi=softfp -Wno-unused-command-line-argument \ + -DENABLE_TESTS=OFF -B${ARCH}-build -S./ > $buildlog 2>&1 + $MAKE VERBOSE=1 -C ${ARCH}-build >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd ${builddir} + $MAKE VERBOSE=1 -C ${ARCH}-build install >> $buildlog 2>&1 + cd $OLDPWD +} + +check() { + echo "The test must be on an OpenHarmony device!" +} + +# 清理环境 +cleanbuild() { + rm -rf ${PWD}/$builddir #${PWD}/$packagename +} + diff --git a/community/libaom/SHA512SUM b/community/libaom/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..5226bb68864ce6dc74a0939ac88314227b7afc0e --- /dev/null +++ b/community/libaom/SHA512SUM @@ -0,0 +1 @@ +7f04a686fe841368282db4b54e38c692c26ac15e0757b7ac054de890622eed72e81f283ca0237b7d75fb0052664bfb8f21edfee1d236aa9c3cbe52c9764095b0 libaom-v3.6.1.tar.gz diff --git a/community/libatomic_ops/HPKBUILD b/community/libatomic_ops/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..ef33df55055467a2569f6b11e4fab65412638a5c --- /dev/null +++ b/community/libatomic_ops/HPKBUILD @@ -0,0 +1,85 @@ +# Contributor: xuzhao +# Maintainer: xuzhao +pkgname=libatomic_ops +pkgver=7.8.0 +pkgrel=0 +pkgdesc="The atomic_ops project (Atomic memory update operations portable implementation)" +url="https://github.com/ivmai/libatomic_ops" +archs=("armeabi-v7a" "arm64-v8a") +license=("GPL-2.0") +depends=() +makedepends=() + +# 官方下载地址https://github.com/ivmai/libatomic_ops/releases/download/v$pkgver/$pkgname-${pkgver}.tar.gz受网络影响可能存在下载失败的情况,现使用gitee镜像可以与官方仓库保持同步 +source="https://gitee.com/lycium_pkg_mirror/$pkgname/repository/archive/v$pkgver.zip" +autounpack=true +downloadpackage=true +buildtools="configure" + +builddir=$pkgname-v${pkgver} +packagename=$builddir.zip +autogenflag=true + +source envset.sh +host= + +prepare() { + mkdir -p $builddir/$ARCH-build + + if [ $ARCH == "armeabi-v7a" ] + then + setarm32ENV + host=arm-linux + elif [ $ARCH == "arm64-v8a" ] + then + setarm64ENV + host=aarch64-linux + else + echo "${ARCH} not support" + return -1 + fi + # gitee镜像源下载的tags源码包需要手动生成configure文件 + if $autogenflag + then + cd $builddir + ./autogen.sh + autogenflag=false + cd $OLDPWD + fi +} + +build() { + cd $builddir/$ARCH-build + PKG_CONFIG_LIBDIR="${pkgconfigpath}" ../configure "$@" --host=$host > $buildlog 2>&1 + $MAKE VERBOSE=1 >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir/$ARCH-build + $MAKE VERBOSE=1 install > $buildlog 2>&1 + cd $OLDPWD + unset host + if [ $ARCH == "armeabi-v7a" ] + then + unsetarm32ENV + elif [ $ARCH == "arm64-v8a" ] + then + unsetarm64ENV + else + echo "${ARCH} not support" + return -1 + fi +} + +check() { + echo "The test must be on an OpenHarmony device!" + # TODO +} + +cleanbuild(){ + rm -rf ${PWD}/$builddir #${PWD}/$packagename +} + diff --git a/community/libatomic_ops/SHA512SUM b/community/libatomic_ops/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..a458f1da1e744deda0b068cf64381392f57ca311 --- /dev/null +++ b/community/libatomic_ops/SHA512SUM @@ -0,0 +1 @@ +5b66fb4b8187ac94cce17b6db86be7a1057c88dd61bd73757db77181fa136f1f8e9ab1384897d93a78a7ae79d2413b91dcb9effec2a6790d2f89606a07a52d3d libatomic_ops-v7.8.0.zip diff --git a/community/libdeflate/HPKBUILD b/community/libdeflate/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..bba4597271feaa848ab7e5a070635b827b597a28 --- /dev/null +++ b/community/libdeflate/HPKBUILD @@ -0,0 +1,63 @@ +# 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: Jeff Han shann +# Maintainer: Jeff Han + +pkgname=libdeflate +pkgver=v1.17 +pkgrel=0 +pkgdesc="libdeflate is a library for fast, whole-buffer DEFLATE-based compression and decompression." +url="https://github.com/ebiggers/libdeflate" +archs=("armeabi-v7a" "arm64-v8a") +license=("MIT") +depends=() +makedepends=() + +# 官方下载地址source="https://github.com/ebiggers/$pkgname/archive/refs/tags/$pkgver.tar.gz"受网络影响可能存在下载失败的情况,现使用gitee镜像可以与官方仓库保持同步 +source="https://gitee.com/lycium_pkg_mirror/$pkgname/repository/archive/$pkgver.zip" + +autounpack=true +downloadpackage=true + +builddir=$pkgname-${pkgver} +packagename=$builddir.zip + +prepare() { + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + PKG_CONFIG_LIBDIR="${pkgconfigpath}" ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@"\ + -DLIBDEFLATE_BUILD_TESTS=ON -DOHOS_ARCH=$ARCH -B$ARCH-build -S./ -L > $buildlog 2>&1 + $MAKE VERBOSE=1 -C $ARCH-build >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd "$builddir" + $MAKE VERBOSE=1 -C $ARCH-build install >> $buildlog 2>&1 + cd $OLDPWD +} + +check() { + echo "The test must be on an OpenHarmony device!" +} + +# 清理环境 +cleanbuild(){ + rm -rf ${PWD}/$builddir #${PWD}/$packagename +} diff --git a/community/libdeflate/README.OpenSource b/community/libdeflate/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..8673c4424ed8d12e00dc2994e43a9feabda9493c --- /dev/null +++ b/community/libdeflate/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "libdeflate", + "License": "MIT", + "License File": "https://github.com/ebiggers/libdeflate/blob/master/COPYING", + "Version Number": "v1.17", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://github.com/ebiggers/libdeflate/archive/refs/tags/v1.17.tar.gz", + "Description": "libdeflate is a library for fast, whole-buffer DEFLATE-based compression and decompression." + } +] \ No newline at end of file diff --git a/community/libdeflate/SHA512SUM b/community/libdeflate/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..38e7bf24f97163f8aada970d1d970e42f674687b --- /dev/null +++ b/community/libdeflate/SHA512SUM @@ -0,0 +1 @@ +ab45806c6cedd0c3a9a148d833c2ea80512bedfea1ab67cbd5e3524a9944c399c15232cbda3f438ea39d0e8953fee3f1092ac54aa445eb9d201e5315d6d3e5d6 libdeflate-v1.17.zip diff --git a/community/libdivsufsort/HPKBUILD b/community/libdivsufsort/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..b242527998f0d3cc66efe82cea99a6eb710c6fcb --- /dev/null +++ b/community/libdivsufsort/HPKBUILD @@ -0,0 +1,65 @@ +# 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=libdivsufsort +pkgver=2.0.0 +pkgrel=0 +pkgdesc="libdivsufsort is a lightweight suffix-sorting library." +url="https://github.com/y-256/libdivsufsort/tree/2.0.0" +archs=("armeabi-v7a" "arm64-v8a") +license=("MIT license") +depends=() +makedepends=() +source="https://github.com/y-256/libdivsufsort/archive/refs/tags/2.0.0.zip" + +downloadpackage=true +autounpack=true +buildtools=cmake + +builddir=libdivsufsort-2.0.0 +packagename=libdivsufsort-2.0.0.zip + +prepare() { + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" -DCMAKE_C_FLAGS="-Wno-unused-command-line-argument" \ + -DCMAKE_CXX_FLAGS="-Wno-unused-command-line-argument" -B$ARCH-build -S./ > $buildlog 2>&1 + $MAKE VERBOSE=1 -C $ARCH-build >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + $MAKE -C $ARCH-build install >> $buildlog 2>&1 + cd $OLDPWD +} + + +check() { + echo "The test must be on an OpenHarmony device!" + # 在OpenHarmony开发板中执行一个demo用例 + # ./suftest test.txt +} + + +cleanbuild() { + rm -rf ${PWD}/$builddir +} \ No newline at end of file diff --git a/community/libdivsufsort/HPKCHECK b/community/libdivsufsort/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..aa09b483a384772608a6cb797b4217122dfb2991 --- /dev/null +++ b/community/libdivsufsort/HPKCHECK @@ -0,0 +1,51 @@ +# 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/example # 进入到对应架构目录下的/example目录 + # 该库没有测试用例,因此执行一个demo:该库构建目录下的/sample文件夹里放有对应功能的二进制文件,验证该库功能: + #执行 ./suftest test.txt。(test.txt文件是自行准备的,内容:AGCTATAG) + #./suftest test.txt 功能为:计算test.txt文件包含的字节数、构建后缀数组,并对其构建的后缀数组进行检查。 + #检查后缀数组构建成功的标志为:输出“sufcheck: Done." + ./suftest test.txt >> $logfile 2>&1 + res=$? + # 检查是否有输出 + if [ -s $logfile ]; then + # 检查日志文件中是否包含 "sufcheck: Done." + if grep -q "sufcheck: Done." $logfile; then + echo "Test passed: 'sufcheck: Done.' found in the log." >> $logfile + else + echo "Test failed: 'sufcheck: Done.' not found in the log." >> $logfile + res=1 + fi + else + # 若无输出,则测试失败 + echo "Test failed: No output from the test." >> $logfile + res=1 + fi + #保存测试失败日志 + if [ $res -ne 0 ]; then + mkdir -p ${LYCIUM_FAULT_PATH}/${pkgname} + cp Testing/Temporary/LastTest.log ${LYCIUM_FAULT_PATH}/${pkgname}/test_failed.log + fi + cd $OLDPWD + return $res +} \ No newline at end of file diff --git a/community/libdivsufsort/README.OpenSource b/community/libdivsufsort/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..3b208dfb9827d8aa8847cfe103274fe104bec275 --- /dev/null +++ b/community/libdivsufsort/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "libdivsufsort", + "License": "MIT license", + "License File": "https://github.com/y-256/libdivsufsort/blob/master/LICENSE", + "Version Number": "2.0.0", + "Owner": "2942375747@qq.com", + "Upstream URL": "https://github.com/y-256/libdivsufsort", + "Description": "libdivsufsort is a lightweight suffix-sorting library." + } +] \ No newline at end of file diff --git a/community/libdivsufsort/README_zh.md b/community/libdivsufsort/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..f22fbcd22fbb769a568154be803fbf98f8cd85b3 --- /dev/null +++ b/community/libdivsufsort/README_zh.md @@ -0,0 +1,9 @@ +# libdivsufsort三方库说明 +## 功能简介 +libdivsufsort是一个轻量级的后缀排序库。 +## 三方库版本: +- 2.0.0 +## 使用约束: +- [IDE和SDK版本](../../docs/constraint.md) +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) \ No newline at end of file diff --git a/community/libdivsufsort/SHA512SUM b/community/libdivsufsort/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..2ff72788cc453b7c6449021e17a33e69566c3b7d --- /dev/null +++ b/community/libdivsufsort/SHA512SUM @@ -0,0 +1 @@ +54007c542ae2859fcdbcad8d04759a92b62ce41d345f436f5e73311e57791ae63a01905d971cacc41db95ba5f5d24489d502cbdcfc743a391ee67fef5ac50ba1 libdivsufsort-2.0.0.zip \ No newline at end of file diff --git a/community/libdivsufsort/docs/hap_integrate.md b/community/libdivsufsort/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..9cd8923d7c85690c95629423a5a2177125032f76 --- /dev/null +++ b/community/libdivsufsort/docs/hap_integrate.md @@ -0,0 +1,80 @@ +# libdivsufsort 集成到应用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/libdivsufsort #三方库libdivsufsort的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── HPKCHECK #测试脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md #三方库简介 + ``` + +- 在lycium目录下编译三方库 + + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ```shell + cd lycium + ./build.sh libdivsufsort + ``` + +- 三方库头文件及生成的库 + + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ```shell + libdivsufsort/arm64-v8a libdivsufsort/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的头文件和库文件拷贝到该目录下,将编译生成的动态库(动态库名字带版本号和不带版本号的都需要)拷贝到工程的libs目录下,如下图所示: +   + +  ![thirdparty_install_dir](pic/libdivsufsort_install_dir.png) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + + ```shell + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libdivsufsort/${OHOS_ARCH}/lib/libdivsufsort.so) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libdivsufsort/${OHOS_ARCH}/include) + ``` + +## 测试三方库 +- 编译出可执行的文件,使用原库自带的测试用例来做测试.但本库没有测试用例,改为执行一个demo [准备三方库测试环境](../../../lycium/README.md#3ci环境准备) +- 进入到构建目录下的example目录,运行demo(注意arm64-v8a为构建64位的目录,armeabi-v7a为构建32位的目录)。该库构建目录下的/sample文件夹里放有对应功能的二进制文件,验证该库功能:执行 ./suftest test.txt。(test.txt文件是自行准备的,内容:AGCTATAG) +- suftest功能:计算test.txt文件包含的字节数,并且构建后缀数组,对其构建的后缀数组进行检查。 + 执行结果如图所示: + +```shell + cd /data/tpc_c_cplusplus/thirdparty/libdivsufsort-2.0.0/libdivsufsort-2.0.0/arm64-v8a-build/example + ./suftest test.txt +``` + ![libdivsufsort_test](pic/libdivsufsort_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/community/libdivsufsort/docs/pic/libdivsufsort_install_dir.png b/community/libdivsufsort/docs/pic/libdivsufsort_install_dir.png new file mode 100644 index 0000000000000000000000000000000000000000..5ad9891d9ffa4f8fd9382481dd23fc140c2d9d71 Binary files /dev/null and b/community/libdivsufsort/docs/pic/libdivsufsort_install_dir.png differ diff --git a/community/libdivsufsort/docs/pic/libdivsufsort_test.png b/community/libdivsufsort/docs/pic/libdivsufsort_test.png new file mode 100644 index 0000000000000000000000000000000000000000..ab1f65848a148130f2792e97f1ce5c1e211e5eec Binary files /dev/null and b/community/libdivsufsort/docs/pic/libdivsufsort_test.png differ diff --git a/community/libelf/HPKBUILD b/community/libelf/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..d0e8cb70ac3af0a35eb26b1c2acf5dbf364aceb0 --- /dev/null +++ b/community/libelf/HPKBUILD @@ -0,0 +1,82 @@ +# 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: shann +# Maintainer: shann +pkgname=libelf +pkgver=v0.189 +pkgrel=0 +pkgdesc="libelf is a library for manipulating ELF (Executable and Linkable Format) files. ELF is a common binary file format used to store a variety of information in a program or library, including the program's code, data, symbol tables, relocation tables, and so on." +url="https://github.com/arachsys/libelf" +archs=("armeabi-v7a" "arm64-v8a") +license=("GPL-2.0") +depends=("zstd") +makedepends=() + +# 官方下载地址source="https://github.com/arachsys/$pkgname/archive/refs/tags/$pkgver.tar.gz"受网络影响可能存在下载失败的情况,现使用gitee镜像可以与官方仓库保持同步 +source="https://gitee.com/mirrors/$pkgname/repository/archive/$pkgver.zip" + +autounpack=true +downloadpackage=true +buildtools="make" + +builddir=$pkgname-${pkgver} +packagename=$builddir.zip + +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 + else + echo "Not support ${ARCH} yet" + return -1 + fi +} + +build() { + cd $builddir-$ARCH-build + make CFLAGS="-Wno-int-conversion -I$LYCIUM_ROOT/usr/zstd/$ARCH/include $CFLAGS" LDFLAGS="-L$LYCIUM_ROOT/usr/zstd/$ARCH/lib $LDFLAGS" -j4 >> `pwd`/build.log 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir-$ARCH-build + make install DESTDIR=$LYCIUM_ROOT/usr/$pkgname/$ARCH/ >> `pwd`/build.log 2>&1 + cd $OLDPWD + + unset host + if [ $ARCH == "armeabi-v7a" ]; then + unsetarm32ENV + elif [ $ARCH == "arm64-v8a" ]; then + unsetarm64ENV + else + echo "Not support ${ARCH} yet" + return -1 + fi +} + +check() { + echo "The test must be on an OpenHarmony device!" +} + +# 清理环境 +cleanbuild(){ + rm -rf ${PWD}/$builddir ${PWD}/$builddir-arm64-v8a-build ${PWD}/$builddir-armeabi-v7a-build #${PWD}/$packagename +} diff --git a/community/libelf/SHA512SUM b/community/libelf/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..0a9d5365ff0528c269a982ef609409269a472ced --- /dev/null +++ b/community/libelf/SHA512SUM @@ -0,0 +1 @@ +51cd149700a06f308cf25b2df03dde624c63d668886f7c7536ea6ddb922be4dada7d8596b62833810eafa9850af18a0e264de93f33d4800423abaaee842541d8 libelf-v0.189.zip diff --git a/community/libiconv/HPKBUILD b/community/libiconv/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..c00352bc37f45383b5f4d4f563d6debfbf5c61a2 --- /dev/null +++ b/community/libiconv/HPKBUILD @@ -0,0 +1,97 @@ +# Copyright (c) 2024 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: zhongluping <278527840@qq.com> +# Maintainer: zhongluping <278527840@qq.com> + +pkgname=libiconv +pkgver=1.17 +pkgrel=0 +pkgdesc="GNU libiconv provides an implementation of the iconv() function and the iconv program for character set conversion. For use on systems which don't have one, or whose implementation cannot convert from/to Unicode. +." +url="https://savannah.gnu.org/projects/libiconv/" +archs=("armeabi-v7a" "arm64-v8a") +license=("LGPL 3.0") +depends=() +makedepends=() + +source="https://ftp.gnu.org/gnu/${pkgname}/${pkgname}-${pkgver}.tar.gz" + +downloadpackage=true +autounpack=true +buildtools="configure" + +builddir=$pkgname-${pkgver} +packagename=$pkgname-${pkgver}.tar.gz +source envset.sh +host= + +prepare() { + cp -rf $builddir $builddir-$ARCH-build + if [ $ARCH == "armeabi-v7a" ] + then + setarm32ENV + host=arm-linux + export LDFLAGS="${OHOS_SDK}/native/sysroot/usr/lib/arm-linux-ohos/libc.a ${LDFLAGS}" + elif [ $ARCH == "arm64-v8a" ] + then + setarm64ENV + host=aarch64-linux + export LDFLAGS="${OHOS_SDK}/native/sysroot/usr/lib/aarch64-linux-ohos/libc.a ${LDFLAGS}" + else + echo "can't support this archs:$ARCH" + return -1 + fi + + return 0 +} + +build() { + cd $builddir-$ARCH-build + PKG_CONFIG_LIBDIR="${pkgconfigpath}" ./configure "$@" --host=$host >> $buildlog 2>&1 + $MAKE VERBOSE=1 >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + + return $ret +} + +package() { + cd $builddir-$ARCH-build + $MAKE VERBOSE=1 install >> $buildlog 2>&1 + cd $OLDPWD + if [ $ARCH == "armeabi-v7a" ] + then + unsetarm32ENV + elif [ $ARCH == "arm64-v8a" ] + then + unsetarm64ENV + fi + + unset host + + return 0 +} + +check() { + echo "The test must be on an OpenHarmony device!" + # real test: + # iconv -f fromCode -t desCode filename +} + +# 清理环境 +cleanbuild() { + rm -rf ${PWD}/$builddir #${PWD}/$packagename + rm -rf ${PWD}/$builddir-armeabi-v7a-build + rm -rf ${PWD}/$builddir-arm64-v8a-build +} diff --git a/community/libiconv/README.OpenSource b/community/libiconv/README.OpenSource new file mode 100755 index 0000000000000000000000000000000000000000..2966e94a8d5496421e8f4b4e01af51adda8cef96 --- /dev/null +++ b/community/libiconv/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "iconv", + "License": "LGPLv3.0", + "License File": "COPYING", + "Version Number": "1.17", + "Owner": "huangminzhong2@huawei.com", + "Upstream URL": "https://savannah.gnu.org/projects/libiconv/", + "Description": "GNU libiconv provides an implementation of the iconv() function and the iconv program for character set conversion." + } +] diff --git a/community/libiconv/SHA512SUM b/community/libiconv/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..c672b0dc1d8b681203d2203223eea96d6165319d --- /dev/null +++ b/community/libiconv/SHA512SUM @@ -0,0 +1 @@ +18a09de2d026da4f2d8b858517b0f26d853b21179cf4fa9a41070b2d140030ad9525637dc4f34fc7f27abca8acdc84c6751dfb1d426e78bf92af4040603ced86 libiconv-1.17.tar.gz diff --git a/community/libiec61850/HPKBUILD b/community/libiec61850/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..b39c6af0c8f4b57c61f3a2bba7fb28aa57ea3053 --- /dev/null +++ b/community/libiec61850/HPKBUILD @@ -0,0 +1,63 @@ +# 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<2942375747@qq.com>, wangying +# Maintainer: wangyihao<2471389@stu.neu.edu.cn>, wangjialun<2271411@stu.neu.edu.cn>, zhangqian<2371418@stu.neu.edu.cn>, wangying + +pkgname=libiec61850-1.1.1 +pkgver=v1.1.1 +pkgrel=0 +pkgdesc="libiec61850 is an open-source (GPLv3) implementation of an IEC 61850 client and server library implementing the protocols MMS, GOOSE and SV. " +url="https://github.com/mz-automation/libiec61850/tree/v1.1.1" +archs=("armeabi-v7a" "arm64-v8a") +license=("GPL-3.0 license") +depends=() +makedepends=() +source="https://github.com/mz-automation/libiec61850/archive/refs/tags/v1.1.1.zip" + +downloadpackage=true +autounpack=true +buildtools="cmake" + +builddir=libiec61850-1.1.1 +packagename=libiec61850-v1.1.1.zip + +prepare() { + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" -DCMAKE_C_FLAGS="-Wno-unused-command-line-argument" \ + -DCMAKE_CXX_FLAGS="-Wno-unused-command-line-argument" -B$ARCH-build -S./ > $buildlog 2>&1 + $MAKE VERBOSE=1 -C $ARCH-build >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + $MAKE -C $ARCH-build install >> $buildlog 2>&1 + cd $OLDPWD +} + + +check() { + echo "The test must be on an OpenHarmony device!" +} + + +cleanbuild() { + rm -rf ${PWD}/$builddir +} \ No newline at end of file diff --git a/community/libiec61850/HPKCHECK b/community/libiec61850/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..424c97495f93108ae0869d0f935934b2f20c5164 --- /dev/null +++ b/community/libiec61850/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: wangjialun<2271411@stu.neu.edu.cn>, zhangqian<2371418@stu.neu.edu.cn>, wangyihao<2942375747@qq.com>, 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 + +checkprepare(){ + return 0 +} + +# 在OH环境执行测试的接口 +openharmonycheck() { + res=0 + cd ${builddir}/${ARCH}-build + ctest > ${logfile} 2>&1 + res=$? + cd $OLDPWD + + return $res +} \ No newline at end of file diff --git a/community/libiec61850/OAT.xml b/community/libiec61850/OAT.xml new file mode 100644 index 0000000000000000000000000000000000000000..eeb1f946d683c0b81976cd06522096062a6901b9 --- /dev/null +++ b/community/libiec61850/OAT.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/community/libiec61850/README.OpenSource b/community/libiec61850/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..7bcbfb7097e608aa02044474550ca80f9c6b6f22 --- /dev/null +++ b/community/libiec61850/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "libiec61850", + "License": "GPL-3.0 license", + "License File": "https://github.com/mz-automation/libiec61850/blob/v1.5/COPYING", + "Version Number": "v1.1.1", + "Owner": "2942375747@qq.com", + "Upstream URL": "https://github.com/mz-automation/libiec61850", + "Description": "libiec61850 is an open-source (GPLv3) implementation of an IEC 61850 client and server library implementing the protocols MMS, GOOSE and SV." + } +] \ No newline at end of file diff --git a/community/libiec61850/README_zh.md b/community/libiec61850/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..749caa89709f6d85dcfe0b0a9a95d8eb83c9f7f2 --- /dev/null +++ b/community/libiec61850/README_zh.md @@ -0,0 +1,12 @@ +# libiec61850三方库说明 +## 功能简介 +libiec61850是IEC 61850客户端和服务器库的开源(GPLv3)实现,实现了MMS、GOOSE和SV协议。 + +## 三方库版本 +- v1.1.1 + +## 使用约束 +- [IDE和SDK版本](../../docs/constraint.md) + +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) diff --git a/community/libiec61850/SHA512SUM b/community/libiec61850/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..d0e15983d9fbb3a4bbdb6dafc09959dc746a451a --- /dev/null +++ b/community/libiec61850/SHA512SUM @@ -0,0 +1 @@ +6eb363c440339b636ce289e14102c6151d96c4f313b1882f491621b937b81929befbd8b7ae36fd43c4d9d05768387e233e71719e1a57b3ad94d181715ed86439 libiec61850-v1.1.1.zip \ No newline at end of file diff --git a/community/libiec61850/docs/hap_integrate.md b/community/libiec61850/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..1d68b18b484158d5d0d70de9ffec86ed09ec4ba3 --- /dev/null +++ b/community/libiec61850/docs/hap_integrate.md @@ -0,0 +1,79 @@ +# libiec61850集成到应用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/libiec61850 #三方库libiec61850的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── HPKCHECK #测试脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md #三方库简介 + ``` + +- 在lycium目录下编译三方库 + + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ```shell + cd lycium + ./build.sh libiec61850 + ``` + +- 三方库头文件及生成的库 + + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ```shell + libiec61850/arm64-v8a libiec61850/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +- 编译出可执行的文件进行测试,[准备三方库测试环境](../../../lycium/README.md#3ci环境准备) +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的头文件拷贝到该目录下,将编译生成的三方库以及依赖库全部(动态库名字带版本号和不带版本号的都需要)拷贝到工程的libs目录下,如下图所示: +   + +  ![thirdparty_install_dir](pic/libiec61850_install_dir.png) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + + ```shell + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libiec61850/${OHOS_ARCH}/lib/libiec61850.so) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libiec61850/${OHOS_ARCH}/include) + ``` + +## 测试三方库 +在lycium目录下执行脚本./test.sh,自动运行thridparty目录下已编译的三方库, + + +```shell + cd lycium + ./test.sh libiec61850 +``` + ![libiec61850_test](pic/libiec61850_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/community/libiec61850/docs/pic/libiec61850_install_dir.png b/community/libiec61850/docs/pic/libiec61850_install_dir.png new file mode 100644 index 0000000000000000000000000000000000000000..09fea30d8cb1ebc65631a1a0b9ba7060ed42ec34 Binary files /dev/null and b/community/libiec61850/docs/pic/libiec61850_install_dir.png differ diff --git a/community/libiec61850/docs/pic/libiec61850_test.png b/community/libiec61850/docs/pic/libiec61850_test.png new file mode 100644 index 0000000000000000000000000000000000000000..ec614f4449b987d5332a43ae81fd4d3c08d19ba2 Binary files /dev/null and b/community/libiec61850/docs/pic/libiec61850_test.png differ diff --git a/community/libmnl/HPKBUILD b/community/libmnl/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..68d97fce7725a811676be9264ca70672fca6b563 --- /dev/null +++ b/community/libmnl/HPKBUILD @@ -0,0 +1,82 @@ +# 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: shann +# Maintainer: shann +pkgname=libmnl +pkgver=1.0.5 +pkgrel=0 +pkgdesc="libmnl is a minimalistic user-space library oriented to Netlink developers. There are a lot of common tasks in parsing, validating, constructing of both the Netlink header and TLVs that are repetitive and easy to get wrong. This library aims to provide simple helpers that allows you to re-use code and to avoid re-inventing the wheel." +url="https://netfilter.org/projects/libmnl/" +archs=("armeabi-v7a" "arm64-v8a") +license=("LGPLv2.1+") +depends=() +makedepends=() + +source="https://netfilter.org/projects/$pkgname/files/$pkgname-$pkgver.tar.bz2" + +autounpack=true +downloadpackage=true +buildtools="configure" + +builddir=$pkgname-${pkgver} +packagename=$builddir.tar.bz2 + +source envset.sh +host= + +prepare() { + mkdir -p $builddir/$ARCH-build + if [ $ARCH == "armeabi-v7a" ]; then + setarm32ENV + host=arm-linux + elif [ $ARCH == "arm64-v8a" ]; then + setarm64ENV + host=aarch64-linux + else + echo "Not support ${ARCH} yet" + return -1 + fi +} + +build() { + cd $builddir/$ARCH-build + PKG_CONFIG_LIBDIR="${pkgconfigpath}" ./../configure "$@" --host=$host > $buildlog 2>&1 + $MAKE VERBOSE=1 >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir/$ARCH-build + $MAKE VERBOSE=1 install >> $buildlog 2>&1 + cd $OLDPWD +} + +check() { + if [ $ARCH == "armeabi-v7a" ]; then + unsetarm32ENV + elif [ $ARCH == "arm64-v8a" ]; then + unsetarm64ENV + else + echo "Not support ${ARCH} yet" + return -1 + fi + + echo "The test must be on an OpenHarmony device!" +} + +# 清理环境 +cleanbuild() { + rm -rf ${PWD}/$builddir +} diff --git a/community/libmnl/SHA512SUM b/community/libmnl/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..a826fa3f5dc53436d615e4b99e09fd3dd0b38395 --- /dev/null +++ b/community/libmnl/SHA512SUM @@ -0,0 +1 @@ +16fa48e74c9da7724a85c655dfb0abd8369392627934639d65de951543e1447ac3e048d231248f1ce8861443c2ef62654a85a81feeedbbffaf2e5744f6cf4c9f libmnl-1.0.5.tar.bz2 diff --git a/community/libmp3lame/BUILD.gn b/community/libmp3lame/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..dcbf99d3928876f8c3515bea701c06c30751ba79 --- /dev/null +++ b/community/libmp3lame/BUILD.gn @@ -0,0 +1,107 @@ +# Copyright (C) 2022 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. + +import("//build/ohos.gni") + +declare_args() { + enable_mp3lame_test = false +} + +config("lame_config") { + defines = [ "HAVE_CONFIG_H=1" ] + cflags = [ + "-O3", + "-Wall", + "-Wno-unused-variable", + "-Wno-absolute-value", + "-Wno-unused-function", + "-Wno-unused-const-variable", + "-Wno-shift-negative-value", + "-Wno-tautological-pointer-compare", + "-MT", + "-MP", + "-pipe", + "-ffast-math", + ] + include_dirs = [ + "//third_party/libmp3lame/libmp3lame", + "//third_party/libmp3lame/libmp3lame/libmp3lame/vector", + "//third_party/libmp3lame/libmp3lame/mpglib/", + "//third_party/libmp3lame/libmp3lame/libmp3lame", + "//third_party/libmp3lame/libmp3lame/include", + "adapted", + ] +} + +LIBMP3LAME_SOURCES = [ + "//third_party/libmp3lame/libmp3lame/libmp3lame/bitstream.c", + "//third_party/libmp3lame/libmp3lame/libmp3lame/encoder.c", + "//third_party/libmp3lame/libmp3lame/frontend/amiga_mpega.c", + "//third_party/libmp3lame/libmp3lame/libmp3lame/fft.c", + "//third_party/libmp3lame/libmp3lame/libmp3lame/gain_analysis.c", + "//third_party/libmp3lame/libmp3lame/libmp3lame/id3tag.c", + "//third_party/libmp3lame/libmp3lame/libmp3lame/lame.c", + "//third_party/libmp3lame/libmp3lame/libmp3lame/newmdct.c", + "//third_party/libmp3lame/libmp3lame/libmp3lame/psymodel.c", + "//third_party/libmp3lame/libmp3lame/libmp3lame/quantize.c", + "//third_party/libmp3lame/libmp3lame/libmp3lame/quantize_pvt.c", + "//third_party/libmp3lame/libmp3lame/libmp3lame/set_get.c", + "//third_party/libmp3lame/libmp3lame/libmp3lame/vbrquantize.c", + "//third_party/libmp3lame/libmp3lame/libmp3lame/reservoir.c", + "//third_party/libmp3lame/libmp3lame/libmp3lame/tables.c", + "//third_party/libmp3lame/libmp3lame/libmp3lame/takehiro.c", + "//third_party/libmp3lame/libmp3lame/libmp3lame/util.c", + "//third_party/libmp3lame/libmp3lame/libmp3lame/mpglib_interface.c", + "//third_party/libmp3lame/libmp3lame/libmp3lame/VbrTag.c", + "//third_party/libmp3lame/libmp3lame/libmp3lame/version.c", + "//third_party/libmp3lame/libmp3lame/libmp3lame/presets.c", + "//third_party/libmp3lame/libmp3lame/mpglib/common.c", + "//third_party/libmp3lame/libmp3lame/mpglib/dct64_i386.c", + "//third_party/libmp3lame/libmp3lame/mpglib/decode_i386.c", + "//third_party/libmp3lame/libmp3lame/mpglib/layer1.c", + "//third_party/libmp3lame/libmp3lame/mpglib/layer2.c", + "//third_party/libmp3lame/libmp3lame/mpglib/layer3.c", + "//third_party/libmp3lame/libmp3lame/mpglib/tabinit.c", + "//third_party/libmp3lame/libmp3lame/mpglib/interface.c", +] + +ohos_static_library("libmp3lame") { + sources = LIBMP3LAME_SOURCES + configs = [ ":lame_config" ] + subsystem_name = "thirdparty" + part_name = "libmp3lame" +} + +ohos_executable("lame") { + sources = [ + "//third_party/libmp3lame/libmp3lame/frontend/brhist.c", + "//third_party/libmp3lame/libmp3lame/frontend/console.c", + "//third_party/libmp3lame/libmp3lame/frontend/get_audio.c", + "//third_party/libmp3lame/libmp3lame/frontend/lame_main.c", + "//third_party/libmp3lame/libmp3lame/frontend/lametime.c", + "//third_party/libmp3lame/libmp3lame/frontend/main.c", + "//third_party/libmp3lame/libmp3lame/frontend/parse.c", + "//third_party/libmp3lame/libmp3lame/frontend/timestatus.c", + ] + configs = [ ":lame_config" ] + deps = [ ":libmp3lame" ] + subsystem_name = "thirdparty" + part_name = "libmp3lame" +} + +group("mp3lame_targets") { + deps = [ ":libmp3lame" ] + if (enable_mp3lame_test) { + deps += [ ":lame" ] + } +} diff --git a/community/libmp3lame/CHANGELOG.md b/community/libmp3lame/CHANGELOG.md new file mode 100644 index 0000000000000000000000000000000000000000..ad536a34187bd35d9159b1999c9a202e65bf5663 --- /dev/null +++ b/community/libmp3lame/CHANGELOG.md @@ -0,0 +1,3 @@ +# 1.0.0 + +添加BUILD.gn,适配在ohos上的编译 \ No newline at end of file diff --git a/community/libmp3lame/README.OpenSource b/community/libmp3lame/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..8dc3e444a6eedacec0978b4fab51b601d7383e84 --- /dev/null +++ b/community/libmp3lame/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "libmp3lame", + "License": "LGPL", + "License File": "COPYING", + "Version Number": "v3.99.5", + "Owner" : "ding_chengjie@hoperun.com", + "Upstream URL": "https://github.com/gypified/libmp3lame", + "Description": "开源mp3编码库,使用MPGLIB解码引擎,专门用于编码 mp3" + } +] diff --git a/community/libmp3lame/README_zh.md b/community/libmp3lame/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..5a66ed4d847056452dc1b00513ceb9e1acc94f41 --- /dev/null +++ b/community/libmp3lame/README_zh.md @@ -0,0 +1,15 @@ +# libmp3lame 三方库说明 + +## 功能简介 + +libmp3lame是开源mp3编码库,使用MPGLIB解码引擎,专门用于编码 mp3 + +## 使用约束 + +- Rom版本:OpenHarmony3.2 beta1 +- 三方库版本:v3.99.5 +- 当前适配的功能:mp3文件编码 + +## 集成方式 + +- [系统Rom包集成](./docs/rom_integrate.md) \ No newline at end of file diff --git a/community/libmp3lame/adapted/config.h b/community/libmp3lame/adapted/config.h new file mode 100644 index 0000000000000000000000000000000000000000..0d4d132d7b07a3152d1ffe1e771259249c1ef05b --- /dev/null +++ b/community/libmp3lame/adapted/config.h @@ -0,0 +1,375 @@ +/* config.h. Generated from config.h.in by configure. */ +/* config.h.in. Generated from configure.in by autoheader. */ + +#ifndef LAME_CONFIG_H +#define LAME_CONFIG_H + +/* debug define */ +/* #undef ABORTFP */ + +/* Define if building universal (internal helper macro) */ +/* #undef AC_APPLE_UNIVERSAL_BUILD */ + +/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP + systems. This function is required for `alloca.c' support on those systems. + */ +/* #undef CRAY_STACKSEG_END */ + +/* Define to 1 if using `alloca.c'. */ +/* #undef C_ALLOCA */ + +/* alot of debug output */ +/* #undef DEBUG */ + +/* allow to compute a more accurate replaygain value */ +/* #undef DECODE_ON_THE_FLY */ + +/* double is faster than float on Alpha */ +/* #undef FLOAT */ + +/* Define to 1 if you have `alloca', as a function or macro. */ +#define HAVE_ALLOCA 1 + +/* Define to 1 if you have and it should be used (not on Ultrix). + */ +#define HAVE_ALLOCA_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* we link against libefence */ +/* #undef HAVE_EFENCE */ + +/* Define to 1 if you have the header file. */ +#define HAVE_ERRNO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if you have the `gettimeofday' function. */ +#define HAVE_GETTIMEOFDAY 1 + +/* Define if you have the iconv() function and it works. */ +#define HAVE_ICONV 1 + +/* add ieee754_float32_t type */ +/* #undef HAVE_IEEE754_FLOAT32_T */ +#ifndef HAVE_IEEE754_FLOAT32_T + typedef float ieee754_float32_t; +#endif + +/* add ieee754_float64_t type */ +/* #undef HAVE_IEEE754_FLOAT64_T */ +#ifndef HAVE_IEEE754_FLOAT64_T + typedef double ieee754_float64_t; +#endif + +/* system has 80 bit floats */ +/* #undef HAVE_IEEE854_FLOAT80 */ + +/* add ieee854_float80_t type */ +/* #undef HAVE_IEEE854_FLOAT80_T */ +#ifndef HAVE_IEEE854_FLOAT80_T + typedef long double ieee854_float80_t; +#endif + +/* add int16_t type */ +#define HAVE_INT16_T 1 +#ifndef HAVE_INT16_T + typedef short int16_t; +#endif + +/* add int32_t type */ +#define HAVE_INT32_T 1 +#ifndef HAVE_INT32_T +#define A_INT32_T int + typedef A_INT32_T int32_t; +#endif + +/* add int64_t type */ +#define HAVE_INT64_T 1 +#ifndef HAVE_INT64_T +#define A_INT64_T long long + typedef A_INT64_T int64_t; +#endif + +/* add int8_t type */ +#define HAVE_INT8_T 1 +#ifndef HAVE_INT8_T + typedef char int8_t; +#endif + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LIMITS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LINUX_SOUNDCARD_H 1 + +/* Define to 1 if the type `long double' works and has more range or precision + than `double'. */ +/* #undef HAVE_LONG_DOUBLE */ + +/* Define to 1 if the type `long double' works and has more range or precision + than `double'. */ +/* #undef HAVE_LONG_DOUBLE_WIDER */ + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* build with mpglib support */ +/* #undef HAVE_MPGLIB */ + +/* have nasm */ +/* #undef HAVE_NASM */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_NCURSES_TERMCAP_H */ + +/* Define to 1 if you have the `socket' function. */ +#define HAVE_SOCKET 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strtol' function. */ +#define HAVE_STRTOL 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SOUNDCARD_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* have termcap */ +/* #undef HAVE_TERMCAP */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_TERMCAP_H */ + +/* add uint16_t type */ +#define HAVE_UINT16_T 1 +#ifndef HAVE_UINT16_T + typedef unsigned short uint16_t; +#endif + +/* add uint32_t type */ +#define HAVE_UINT32_T 1 +#ifndef HAVE_UINT32_T +#define A_UINT32_T unsigned int + typedef A_UINT32_T uint32_t; +#endif + +/* add uint64_t type */ +#define HAVE_UINT64_T 1 +#ifndef HAVE_UINT64_T +#define A_UINT64_T unsigned long long + typedef A_UINT64_T uint64_t; +#endif + +/* add uint8_t type */ +#define HAVE_UINT8_T 1 +#ifndef HAVE_UINT8_T + typedef unsigned char uint8_t; +#endif + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_XMMINTRIN_H */ + +/* Define as const if the declaration of iconv() needs const. */ +#define ICONV_CONST + +/* requested by Frank, seems to be temporary needed for a smooth transition */ +#define LAME_LIBRARY_BUILD 1 + +/* set to 1 if you have libsndfile */ +/* #undef LIBSNDFILE */ + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#define LT_OBJDIR ".libs/" + +/* use MMX version of choose_table */ +/* #undef MMX_choose_table */ + +/* no debug build */ +#define NDEBUG 1 + +/* build without hooks for analyzer */ +/* #undef NOANALYSIS */ + +/* Name of package */ +#define PACKAGE "lame" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "lame-dev@lists.sf.net" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "lame" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "lame 3.99.5" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "lame" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "3.99.5" + +/* Define to 1 if the C compiler supports function prototypes. */ +#define PROTOTYPES 1 + +/* The size of `double', as computed by sizeof. */ +#define SIZEOF_DOUBLE 8 + +/* The size of `float', as computed by sizeof. */ +#define SIZEOF_FLOAT 4 + +/* The size of `int', as computed by sizeof. */ +#define SIZEOF_INT 4 + +/* The size of `long', as computed by sizeof. */ +#define SIZEOF_LONG 4 + +/* The size of `long double', as computed by sizeof. */ +/* #undef SIZEOF_LONG_DOUBLE */ + +/* The size of `long long', as computed by sizeof. */ +#define SIZEOF_LONG_LONG 8 + +/* The size of `short', as computed by sizeof. */ +#define SIZEOF_SHORT 2 + +/* The size of `unsigned int', as computed by sizeof. */ +#define SIZEOF_UNSIGNED_INT 4 + +/* The size of `unsigned long', as computed by sizeof. */ +#define SIZEOF_UNSIGNED_LONG 4 + +/* The size of `unsigned long long', as computed by sizeof. */ +#define SIZEOF_UNSIGNED_LONG_LONG 8 + +/* The size of `unsigned short', as computed by sizeof. */ +#define SIZEOF_UNSIGNED_SHORT 2 + +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at runtime. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ +/* #undef STACK_DIRECTION */ + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* IEEE754 compatible machine */ +/* #undef TAKEHIRO_IEEE754_HACK */ + +/* Define to 1 if you can safely include both and . */ +#define TIME_WITH_SYS_TIME 1 + +/* faster log implementation with less but enough precission */ +/* #undef USE_FAST_LOG */ + +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# define _ALL_SOURCE 1 +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# define _GNU_SOURCE 1 +#endif +/* Enable threading extensions on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# define _POSIX_PTHREAD_SEMANTICS 1 +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# define _TANDEM_SOURCE 1 +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# define __EXTENSIONS__ 1 +#endif + + +/* Version number of package */ +#define VERSION "3.99.5" + +/* Define if using the dmalloc debugging malloc package */ +/* #undef WITH_DMALLOC */ + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +/* # undef WORDS_BIGENDIAN */ +# endif +#endif + +/* Number of bits in a file offset, on hosts where this is settable. */ +#define _FILE_OFFSET_BITS 64 + +/* Define for large files, on AIX-style hosts. */ +/* #undef _LARGE_FILES */ + +/* Define to 1 if on MINIX. */ +/* #undef _MINIX */ + +/* Define to 2 if the system does not provide POSIX.1 features except with + this defined. */ +/* #undef _POSIX_1_SOURCE */ + +/* Define to 1 if you need to in order for `stat' and other things to work. */ +/* #undef _POSIX_SOURCE */ + +/* we're on DEC Alpha */ +/* #undef __DECALPHA__ */ + +/* work around a glibc bug */ +/* #undef __NO_MATH_INLINES */ + +/* Define like PROTOTYPES; this can be used by system headers. */ +#define __PROTOTYPES 1 + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +/* #undef inline */ +#endif + +/* Define to `unsigned int' if does not define. */ +/* #undef size_t */ + +#endif /* LAME_CONFIG_H */ diff --git a/community/libmp3lame/bundle.json b/community/libmp3lame/bundle.json new file mode 100644 index 0000000000000000000000000000000000000000..0b82d5402ea3a516b9c5ff2d9e5f0086362ab329 --- /dev/null +++ b/community/libmp3lame/bundle.json @@ -0,0 +1,33 @@ +{ + "name": "@ohos/libmp3lame", + "description": "gypified libmp3lame C library", + "version": "v3.99.5", + "license": "LGPL", + "publishAs": "", + "segment": { + "destPath": "third_party/libmp3lame" + }, + "dirs": {}, + "scripts": {}, + "readmePath": { + "en": "README" + }, + "component": { + "name": "libmp3lame", + "subsystem": "thirdparty", + "syscap": [], + "features": [], + "adapted_system_type": ["standard"], + "rom": "", + "ram": "", + "deps": { + "components": [], + "third_party": [] + }, + "build": { + "sub_component": ["//third_party/libmp3lame:mp3lame_targets"], + "inner_kits": [], + "test": [] + } + } +} diff --git a/community/libmp3lame/docs/image/result.png b/community/libmp3lame/docs/image/result.png new file mode 100644 index 0000000000000000000000000000000000000000..e5d24cbdc1104c9723611237842c37d8c9b34c69 Binary files /dev/null and b/community/libmp3lame/docs/image/result.png differ diff --git a/community/libmp3lame/docs/rom_integrate.md b/community/libmp3lame/docs/rom_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..0df5784d895b1e83ab4ce6f2da17c9a87cfeec9b --- /dev/null +++ b/community/libmp3lame/docs/rom_integrate.md @@ -0,0 +1,139 @@ +# libmp3lame如何集成到系统Rom + +## 准备源码工程 + +本库是基于OpenHarmony-v3.2-Beta1版本,在RK3568开发板上验证的,如果是从未使用过RK3568,可以先查看[润和RK3568开发板标准系统快速上手](https://gitee.com/openharmony-sig/knowledge_demo_temp/tree/master/docs/rk3568_helloworld)。 + +### 准备系统Rom源码 + +系统源码获取请参考:[OpenHarmony源码下载](https://gitee.com/openharmony/docs/blob/OpenHarmony-v3.2-Beta2/zh-cn/release-notes/OpenHarmony-v3.2-beta1.md) + +### 增加构建脚本及配置文件 + +- 下载本仓库代码 + + ``` + cd ~ + git clone git@gitee.com:openharmony-sig/tpc_c_cplusplus.git --depth=1 + ``` + +- 三方库目录结构 + + ``` + tpc_c_cplusplus/thirdparty/libmp3lame #三方库libmp3lame的目录结构如下 + ├── adapted #存放三方库适配需要的代码文件 + ├── docs #存放三方库相关文档的文件夹 + ├── BUILD.gn #构建脚本,支持rom包集成 + ├── bundle.json #三方库组件定义文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md + ``` + +- 将三方库拷贝到OpenHarmony源码的third_party目录下 + + ``` + cp ~/tpc_c_cplusplus/thirdparty/libmp3lame ~/openharmony/third_party -rf + ``` + +### 准备三方库源码 + +``` +cd ~/openharmony/third_party/libmp3lame #进入三方库目录 +git clone https://github.com/gypified/libmp3lame.git #下载三方库源码 +``` + +## 系统Rom中引入三方库 + +准备完三方库代码后,我们需要将三方库加入到编译构建体系中。标准系统编译构建可以参考文档[标准系统编译构建指导](https://gitee.com/openharmony/docs/blob/OpenHarmony-3.2-Beta1/zh-cn/device-dev/subsystems/subsys-build-standard-large.md) 我们默认三方库是属于OpenHarmony的thirdparty子系统,如果需要自己定义子系统参考文档[如何为三方库组件中添加一个三方库](https://gitee.com/openharmony-sig/knowledge/blob/master/docs/openharmony_getstarted/port_thirdparty/README.md) 新增需要编译的组件,在OpenHarmony源码的vendor/hihope/rk3568/config.json文件中,新增需要编译的组件,如下代码段所示,在thirdparty子系统下面新增libmp3lame组件 + +``` + { + "subsystem": "thirdparty", + "components": [ + { + "component": "musl", + "features": [] + }, + { + "component": "libmp3lame", + "features": [] + } + ] + } +``` + +## 系统Rom中引入三方库测试程序 + +libmp3lame原生库提供了测试用例,如需要引入测试程序,在OpenHarmony源码的vendor/hihope/rk3568/config.json文件,对应组件的features中打开编译选项: + +``` +{ + "subsystem": "thirdparty", + "components": [ + { + "component": "musl", + "features": [] + }, + { + "component": "libmp3lame", + "features": [ "enable_mp3lame_test=true" ] + } + ] +} +``` + +## 编译工程 + +在OpenHarmony源码根目录下 + +``` +cd ~/openharmony +``` + +- 执行编译 + + ``` + ./build.sh --product-name rk3568 --ccache + ``` + +- 生成文件的路径 + + 可执行文件生成在out/rk3568/thirdparty/libmp3lame/lame,库文件生成在out/rk3568/obj/thirdparty/libmp3lame目录下 + +## 运行效果 + +将编译生成的库和测试文件放到板子上运行,为避免每次将文件推入设备都烧录整个镜像,我们使用hdc_std工具将文件推到开发板上 + +- 首先将hdc_std工具编译出来 工具编译出来所在路径out/sdk/ohos-sdk/windows/toolchains/hdc_std.exe + + ``` + hb set #源码根目录下使用hb set 选择产品ohos-sdk + hb build #然后编译 + ``` + +- 将工具拷贝到Windows,可以为工具目录配置环境变量,也可以在工具所在目录打开windows命令行 + +- 将编译生成的lame可执行文件及原生库下的测试文件testcase.wav准备好 + +- 将准备好的文件推送到开发板,在windows命令行进行如下操作 + + ``` + hdc_std shell mount -o remount,rw / #修改系统权限为可读写 + hdc_std file send lame /data #将可执行文件推入开发板data目录 + hdc_std file send testcase.wav /data #将测试文件推入开发板data目录 + hdc_std shell #进入开发板 + ./lame testcase.wav testcase.mp3 #执行可执行文件编码生成MP3文件 + #该组件不需要将库拷贝到/system/lib 或者/system/lib64目录下,因为可执行文件已经执行了编译生成的静态库 + ``` + +- 运行测试程序 效果如下图 + +- ![result](image/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) +- [如何为三方库组件中添加一个三方库](https://gitee.com/openharmony-sig/knowledge/blob/master/docs/openharmony_getstarted/port_thirdparty/README.md) +- [标准系统编译构建指导](https://gitee.com/openharmony/docs/blob/OpenHarmony-3.2-Beta1/zh-cn/device-dev/subsystems/subsys-build-standard-large.md) \ No newline at end of file diff --git a/community/libogg/HPKBUILD b/community/libogg/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..f5fbcc208cca759f7d8569a6075cb3adda250f0b --- /dev/null +++ b/community/libogg/HPKBUILD @@ -0,0 +1,50 @@ +# Contributor: TangShaoteng +# Maintainer: TangShaoteng + +pkgname=libogg +pkgver=v1.3.5 +pkgrel=0 +pkgdesc="Reference implementation of the Ogg media container" +url="https://www.xiph.org/" +archs=("armeabi-v7a" "arm64-v8a") +license=("BSD-3-Clause") +depends=() +makedepends=() + +source="https://github.com/xiph/ogg/releases/download/$pkgver/$pkgname-${pkgver:1}.tar.gz" + +autounpack=true +downloadpackage=true +buildtools="cmake" +builddir=$pkgname-${pkgver:1} +packagename=$builddir.tar.gz + +prepare() { + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + PKG_CONFIG_LIBDIR="${pkgconfigpath}" \ +${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" \ +-DOHOS_ARCH=$ARCH -B$ARCH-build -S./ -L > $buildlog 2>&1 + $MAKE VERBOSE=1 -C $ARCH-build >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + $MAKE -C $ARCH-build install >> $buildlog 2>&1 + cd $OLDPWD +} + +check() { + echo "The test must be on an OpenHarmony device!" + # TODO +} + +cleanbuild() { + rm -rf ${PWD}/$builddir #${PWD}/$packagename +} diff --git a/community/libogg/SHA512SUM b/community/libogg/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..01b3a072912feccd6d2e2c75fc349b54d454bc2e --- /dev/null +++ b/community/libogg/SHA512SUM @@ -0,0 +1 @@ +e4d798621bb04a62dcb831e58a444357635ab3bcb9efbdffa009cb0be1cafb5e72bf71cbcad5305aa5268a92076a03a7e564a19c0c8d54b93a05d9b03ad2da6b libogg-1.3.5.tar.gz diff --git a/community/libosip2/HPKBUILD b/community/libosip2/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..81f11dd9ae827b7c51d60ef6b8ae0aa89080aca7 --- /dev/null +++ b/community/libosip2/HPKBUILD @@ -0,0 +1,65 @@ +# Contributor: shann +# Maintainer: shann +pkgname=libosip2 +pkgver=5.3.1 +pkgrel=0 +pkgdesc="libosip2 is a C language library for parsing and processing the SIP protocol. It provides a powerful set of APIs used to implement SIP clients and servers." +url="https://ftp.gnu.org/gnu/osip/" +archs=("armeabi-v7a" "arm64-v8a") +license=("LGPL") +depends=() +makedepends=() + +source="https://ftp.gnu.org/gnu/osip/$pkgname-$pkgver.tar.gz" + +autounpack=true +downloadpackage=true +buildtools="configure" + +builddir=$pkgname-${pkgver} +packagename=$builddir.tar.gz + +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 + PKG_CONFIG_LIBDIR="${pkgconfigpath}" \ +../configure "$@" --host=$host --enable-test > $buildlog 2>&1 + $MAKE >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + $MAKE -C $ARCH-build install >> $buildlog 2>&1 + cd $OLDPWD +} + +check() { + cd $builddir/$ARCH-build + sed -i '/check: check-am/c\#check: check-am' src/test/Makefile + cd $OLDPWD + echo "The test must be on an OpenHarmony device!" + #编译生成目录$ARCH-build/src/test下执行make chech +} + +# 清理环境 +cleanbuild() { + rm -rf ${PWD}/$builddir #${PWD}/$packagename +} diff --git a/community/libosip2/HPKCHECK b/community/libosip2/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..5c932120d432606f1438c2467b088ad023091f46 --- /dev/null +++ b/community/libosip2/HPKCHECK @@ -0,0 +1,15 @@ +# Contributor: shann +# Maintainer: shann + +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/src/test/ + make check > ${logfile} 2>&1 + res=$? + cd $OLDPWD + + return $res +} \ No newline at end of file diff --git a/community/libosip2/OAT.xml b/community/libosip2/OAT.xml new file mode 100644 index 0000000000000000000000000000000000000000..90978a8a397427b9aa784690e96bba986a824e3f --- /dev/null +++ b/community/libosip2/OAT.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/community/libosip2/README.OpenSource b/community/libosip2/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..fdfcd0a90bc1b3b4e898e80679b37bd17bc33eca --- /dev/null +++ b/community/libosip2/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "libosip2", + "License": "LGPL", + "License File": "http://www.gnu.org", + "Version Number": "5.3.1", + "Owner": "swkec@isoftstone.com", + "Upstream URL": "https://ftp.gnu.org/gnu/osip/libosip2-5.3.1.tar.gz", + "Description": "libosip2 is a C language library for parsing and processing the SIP protocol. It provides a powerful set of APIs used to implement SIP clients and servers." + } +] diff --git a/community/libosip2/README_zh.md b/community/libosip2/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..d72cb0baaf397787cf4603b4f5f186e5d3eb6b72 --- /dev/null +++ b/community/libosip2/README_zh.md @@ -0,0 +1,15 @@ +# libosip2三方库说明 +## 功能简介 +libosip2是一个开放源代码的sip协议栈,是开源代码中不多使用C语言写的协议栈之一,它具有短小简洁的特点,专注于sip底层解析使得它的效率比较高. + +## 三方库版本 +- 5.3.1 + +## 已适配功能 +- 支持sip消息的解析和生成、头处理和会话管理等功能 + +## 使用约束 +- [IDE和SDK版本](../../docs/constraint.md) + +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) diff --git a/community/libosip2/SHA512SUM b/community/libosip2/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..1f9555d4fbe00cb98524e31306d5148bed536824 --- /dev/null +++ b/community/libosip2/SHA512SUM @@ -0,0 +1 @@ +cd9db7a736cca90c6862b84c4941ef025f5affab8af9bbc02ce0dd3310a2c555e0922c1bfa72d8ac08791fa1441bbcc30b627d52ca8b51f3471573a10ac82a00 libosip2-5.3.1.tar.gz diff --git a/community/libosip2/docs/hap_integrate.md b/community/libosip2/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..d60d168268af326a50f1a776faf82e27db3bea37 --- /dev/null +++ b/community/libosip2/docs/hap_integrate.md @@ -0,0 +1,75 @@ +# libosip2集成到应用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) + +## 编译三方库 +- 下载本仓库 + ``` + wget https://ftp.gnu.org/gnu/osip/libosip2-5.3.1.tar.gz + ``` +- 三方库目录结构 + ``` + tpc_c_cplusplus/thirdparty/libosip2 #三方库libosip2的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md + ``` + +- 将libosip2拷贝至lycium/main目录下(没有main目录就手动创建一下) + ``` + cd tpc_c_cplusplus + cp thirdparty/libosip2 lycium/main -rf + ``` +- 在lycium目录下编译三方库 + libosip2库不需要依赖其它库,所以在build时只需要编译libosip2库即可 + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + ``` + cd lycium + ./build.sh libosip2 + ``` +- 三方库头文件及生成的库 + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + ``` + libosip2/arm64-v8a libosip2/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的库拷贝到该目录下,如下图所示 + + ![thirdparty_install_dir](pic/osip2_install_dir.jpg) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + ``` + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libosip2/${OHOS_ARCH}/lib/libosip2.a + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libosip2/${OHOS_ARCH}/lib/libosipparser2.a) + + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libosip2/${OHOS_ARCH}/include/osip2/ + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libosip2/${OHOS_ARCH}/include/osipparser2/ + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libosip2/${OHOS_ARCH}/include/osipparser2/headers) + ``` + + ![osip2_usage](pic/osip2_usage.jpg) + +## 测试三方库 +三方库的测试使用原库自带的测试用例来做测试,[准备三方库测试环境](../../../lycium/README.md#3ci环境准备) + +- 将编译生成的可执行文件及生成的动态库准备好 + +- 将准备好的文件推送到开发板,进入到构建的目录$ARCH-build/src/test下执行make chech + + ![osip2_test](pic/osip2_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/community/libosip2/docs/pic/osip2_install_dir.jpg b/community/libosip2/docs/pic/osip2_install_dir.jpg new file mode 100644 index 0000000000000000000000000000000000000000..707a6545460a8c6c46ade669289faaafd05fe853 Binary files /dev/null and b/community/libosip2/docs/pic/osip2_install_dir.jpg differ diff --git a/community/libosip2/docs/pic/osip2_test.jpg b/community/libosip2/docs/pic/osip2_test.jpg new file mode 100644 index 0000000000000000000000000000000000000000..3dd182db0099797d3232c68555d76a9d01ed958f Binary files /dev/null and b/community/libosip2/docs/pic/osip2_test.jpg differ diff --git a/community/libosip2/docs/pic/osip2_usage.jpg b/community/libosip2/docs/pic/osip2_usage.jpg new file mode 100644 index 0000000000000000000000000000000000000000..3b0f257c2df373352a5b0353e4645200e03545b3 Binary files /dev/null and b/community/libosip2/docs/pic/osip2_usage.jpg differ diff --git a/community/libpcap/HPKBUILD b/community/libpcap/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..3df122ebc2e1ff91b530e1d78e48e6f16e5563a1 --- /dev/null +++ b/community/libpcap/HPKBUILD @@ -0,0 +1,73 @@ +# Contributor: liulihong +# Maintainer: liulihong + +pkgname=libpcap +pkgver=libpcap-1.10.3 +pkgrel=0 +pkgdesc="" +url="" +archs=("armeabi-v7a" "arm64-v8a") +license=("BSD") +depends=() +makedepends=("flex" "bison") +install= +source="https://github.com/the-tcpdump-group/$pkgname/archive/refs/tags/$pkgver.tar.gz" +builddir=$pkgname-$pkgver +packagename=$builddir.tar.gz +buildtools="configure" + +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 + cd $builddir + cd $OLDPWD +} + +build() { + + cd $builddir/$ARCH-build + 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 + if [ $ARCH == "armeabi-v7a" ] + then + unsetarm32ENV + fi + if [ $ARCH == "arm64-v8a" ] + then + unsetarm64ENV + fi + unset host +} + +check() { + cd $builddir/$ARCH-build + $MAKE testprogs >> $buildlog 2>&1 + cd $OLDPWD + echo "The test must be on an OpenHarmony device!" + # 保证设备联网 + # 在构建目录的testprogs目录下,执行./capturetest 进行抓包测试即可 +} + +cleanbuild(){ + rm -rf ${PWD}/$builddir #${PWD}/packagename +} diff --git a/community/libpcap/README.OpenSource b/community/libpcap/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..a82e46d4cfcfbb62d7bcb6c6ba9d353e9b5c5a1e --- /dev/null +++ b/community/libpcap/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "libpcap", + "License": "BSD-3-Clause", + "License File": "https://github.com/the-tcpdump-group/libpcap/blob/master/LICENSE", + "Version Number": "libpcap-1.10.3", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://github.com/the-tcpdump-group/libpcap/archive/refs/tags/libpcap-1.10.3.tar.gz", + "Description": "This directory contains source code for libpcap, a system-independent interface for user-level packet capture. libpcap provides a portable framework for low-level network monitoring." + } +] diff --git a/community/libpcap/README_zh.md b/community/libpcap/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..271d71a448b31cc20c7ac139b7b3c2eba47765de --- /dev/null +++ b/community/libpcap/README_zh.md @@ -0,0 +1,12 @@ +# libpcap三方库说明 +## 功能简介 +libpcap是unix/linux平台下的网络数据包捕获函数包,大多数网络监控软件都以它为基础。 + +## 三方库版本 +- 1.10.3 + +## 使用约束 +- [IDE和SDK版本](../../docs/constraint.md) + +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) diff --git a/community/libpcap/SHA512SUM b/community/libpcap/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..60b6a958fba666ba3fde3480276c924943818f8c --- /dev/null +++ b/community/libpcap/SHA512SUM @@ -0,0 +1 @@ +3e872265d4d3d85637fa00c5851269f3b03035df7a93b9168bb49b7f3965765e000bac8e65b4c69f42c6090fd2cb7bde0304d37efb453cd71d214088dd37cd6b libpcap-libpcap-1.10.3.tar.gz diff --git a/community/libpcap/docs/hap_integrate.md b/community/libpcap/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..b187e8918484cdc91405aad2061cb6ccc8a32348 --- /dev/null +++ b/community/libpcap/docs/hap_integrate.md @@ -0,0 +1,61 @@ +# libpcap集成到应用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) +## 编译三方库 +- 下载本仓库 + ``` + git clone https://gitee.com/openharmony-sig/tpc_c_cplusplus.git --depth=1 + ``` + +- 三方库目录结构 + ``` + tpc_c_cplusplus/thirdparty/libpcap #三方库libpcap的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md + ``` + +- 在lycium目录下编译三方库 + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ``` + cd lycium + ./build.sh libpcap + ``` + +- 三方库头文件及生成的库 + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ``` + libpcap/arm64-v8a libpcap/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的库拷贝到该目录下,如下图所示 + ![thirdparty_install_dir](pic/libpcap_install_dir.png) +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + ``` + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libpcap/${OHOS_ARCH}/lib/libpcap.a) + + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libpcap/${OHOS_ARCH}/include) + ``` +## 测试三方库 +三方库的测试使用原库自带的测试用例来做测试,[准备三方库测试环境](../../../lycium/README.md#3ci环境准备) + +进入到构建目录,再去testprogs目录执行./capturetest进行抓包测试(arm64-v8a-build为构建64位的目录,armeabi-v7a-build为构建32位的目录,下图是设备联网后应用请求网络数据的抓包测试截图) + + ![tinyxpath_test](pic/libpcap_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/community/libpcap/docs/pic/libpcap_install_dir.png b/community/libpcap/docs/pic/libpcap_install_dir.png new file mode 100644 index 0000000000000000000000000000000000000000..226559cf34a432574f721332a493eb535238ddea Binary files /dev/null and b/community/libpcap/docs/pic/libpcap_install_dir.png differ diff --git a/community/libpcap/docs/pic/libpcap_test.png b/community/libpcap/docs/pic/libpcap_test.png new file mode 100644 index 0000000000000000000000000000000000000000..4acc51194583527dc6fb90505f161352ab0060a7 Binary files /dev/null and b/community/libpcap/docs/pic/libpcap_test.png differ diff --git a/community/libpcap/docs/pic/libpcap_usage.png b/community/libpcap/docs/pic/libpcap_usage.png new file mode 100644 index 0000000000000000000000000000000000000000..ae647d89969d64a129092be0a5917754d855954d Binary files /dev/null and b/community/libpcap/docs/pic/libpcap_usage.png differ diff --git a/community/libsamplerate-0.2.2/HPKBUILD b/community/libsamplerate-0.2.2/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..c0861ddba7e7beb164945825d1130705355a7be5 --- /dev/null +++ b/community/libsamplerate-0.2.2/HPKBUILD @@ -0,0 +1,61 @@ +# 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=libsamplerate-0.2.2 +pkgver=0.2.2 +pkgrel=0 +pkgdesc="libsamplerate is a library for performing sample rate conversion of audio data." +url="https://github.com/libsndfile/libsamplerate/tree/0.2.2" +archs=("armeabi-v7a" "arm64-v8a") +license=("BSD-2-Clause license") +depends=() +makedepends=() +source="https://github.com/libsndfile/libsamplerate/archive/refs/tags/0.2.2.zip" + +downloadpackage=true +autounpack=true +buildtools=cmake + +builddir=libsamplerate-0.2.2 +packagename=libsamplerate-0.2.2.zip + +# 为编译设置环境,如设置环境变量,创建编译目录等 +prepare() { + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" -DCMAKE_C_FLAGS="-Wno-unused-command-line-argument" \ + -DCMAKE_CXX_FLAGS="-Wno-unused-command-line-argument" -B$ARCH-build -S./ > $buildlog 2>&1 + $MAKE VERBOSE=1 -C $ARCH-build >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} +package() { + cd $builddir + $MAKE -C $ARCH-build install >> $buildlog 2>&1 + cd $OLDPWD +} + +check() { + echo "The test must be on an OpenHarmony device!" +} + +cleanbuild() { + rm -rf ${PWD}/$builddir +} \ No newline at end of file diff --git a/community/libsamplerate-0.2.2/HPKCHECK b/community/libsamplerate-0.2.2/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..45087f23bbfe1b9cac2c3352e606b765ef4a975f --- /dev/null +++ b/community/libsamplerate-0.2.2/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: 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}_${OHOS_SDK_VER}_test.log + + +# 在OH环境执行测试的接口 +openharmonycheck() { + res=0 + cd ${builddir}/${ARCH}-build # 进入到测试目录 + ctest > $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/community/libsamplerate-0.2.2/README.OpenSource b/community/libsamplerate-0.2.2/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..ecd238a107317aa25db98470131f0c2a4ceecd75 --- /dev/null +++ b/community/libsamplerate-0.2.2/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "libsamplerate-0.2.2", + "License": "BSD-2-Clause license", + "License File": "https://github.com/libsndfile/libsamplerate/blob/master/COPYING", + "Version Number": "0.2.2", + "Owner": "2942375747@qq.com", + "Upstream URL": "https://github.com/libsndfile/libsamplerate", + "Description": "libsamplerate is a library for performing sample rate conversion of audio data." + } +] \ No newline at end of file diff --git a/community/libsamplerate-0.2.2/README_zh.md b/community/libsamplerate-0.2.2/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..1ec445a46d9a38e8b610e339291668d69d112675 --- /dev/null +++ b/community/libsamplerate-0.2.2/README_zh.md @@ -0,0 +1,9 @@ +# libsamplerate-0.2.2三方库说明 +## 功能简介 +libsamplerate是一个用于执行音频数据采样率转换的库。 +## 三方库版本: +- 0.2.2 +## 使用约束: +- [IDE和SDK版本](../../docs/constraint.md) +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) \ No newline at end of file diff --git a/community/libsamplerate-0.2.2/SHA512SUM b/community/libsamplerate-0.2.2/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..23457d286985fd591288ba02a4d78ab48d1b0528 --- /dev/null +++ b/community/libsamplerate-0.2.2/SHA512SUM @@ -0,0 +1 @@ +dedd072bc83ccebfe1a33e8a3fb3f72559bfd36282b958b1d5463b786f2325f684137580db38d91f0f4f5345a1da3e9e1c4a1695e303182e57d542c085db829f libsamplerate-0.2.2.zip \ No newline at end of file diff --git a/community/libsamplerate-0.2.2/docs/hap_integrate.md b/community/libsamplerate-0.2.2/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..ef939c2b5e813d9b554e70c42425c90bc5063a48 --- /dev/null +++ b/community/libsamplerate-0.2.2/docs/hap_integrate.md @@ -0,0 +1,79 @@ +# libsamplerate集成到应用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/libsamplerate-0.2.2 #三方库libsamplerate-0.2.2的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── HPKCHECK #测试脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md #三方库简介 + ``` + +- 在lycium目录下编译三方库 + + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ```shell + cd lycium + ./build.sh libsamplerate-0.2.2 + ``` + +- 三方库头文件及生成的库 + + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ```shell + libsamplerate-0.2.2/arm64-v8a libsamplerate-0.2.2/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的头文件和静态库文件拷贝到该目录下,如下图所示: +   + +  ![thirdparty_install_dir](pic/libsamplerate_install_dir.png) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + + ```shell + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libsamplerate/${OHOS_ARCH}/lib/libsamplerate.a) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libsamplerate/${OHOS_ARCH}/include) + ``` + +## 测试三方库 +- 编译出可执行的文件,使用原库自带的测试用例来做测试 [准备三方库测试环境](../../../lycium/README.md#3ci环境准备) +进入到构建目录运行测试用例(注意arm64-v8a为构建64位的目录,armeabi-v7a为构建32位的目录)。执行结果如图所示 + +```shell + cd /data/tpc_c_cplusplus/thirdparty/libsamplerate-0.2.2/libsamplerate-0.2.2/arm64-v8a-build/ + ctest +``` + ![libsamplerate_test](pic/libsamplerate_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/community/libsamplerate-0.2.2/docs/pic/libsamplerate_install_dir.png b/community/libsamplerate-0.2.2/docs/pic/libsamplerate_install_dir.png new file mode 100644 index 0000000000000000000000000000000000000000..aa39736eb36390daefe9f938ff1bbc0d526e4484 Binary files /dev/null and b/community/libsamplerate-0.2.2/docs/pic/libsamplerate_install_dir.png differ diff --git a/community/libsamplerate-0.2.2/docs/pic/libsamplerate_test.png b/community/libsamplerate-0.2.2/docs/pic/libsamplerate_test.png new file mode 100644 index 0000000000000000000000000000000000000000..3c29444a23a0c788f294192c54c2051c72c62b35 Binary files /dev/null and b/community/libsamplerate-0.2.2/docs/pic/libsamplerate_test.png differ diff --git a/community/libsndfile/HPKBUILD b/community/libsndfile/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..879193015b1de8aea299774fc85c264d77fdb673 --- /dev/null +++ b/community/libsndfile/HPKBUILD @@ -0,0 +1,52 @@ +# Contributor: xuzhao +# Maintainer: xuzhao +pkgname=libsndfile +pkgver=1.2.0 +pkgrel=0 +pkgdesc="libsndfile is a C library for reading and writing files containing sampled audio data." +url="https://github.com/libsndfile/libsndfile" +archs=("armeabi-v7a" "arm64-v8a") +license=("LGPLv2.1") +depends=() +makedepends=() + +# 官方下载地址https://github.com/libsndfile/$pkgname/archive/refs/tags/$pkgver.tar.gz受网络影响可能存在下载失败的情况,现使用gitee镜像可以与官方仓库保持同步 +source="https://gitee.com/mirrors/$pkgname/repository/archive/$pkgver.zip" +autounpack=true +downloadpackage=true +buildtools="cmake" +builddir=$pkgname-${pkgver} +packagename=$builddir.zip + +prepare() { + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + PKG_CONFIG_LIBDIR="${pkgconfigpath}" \ + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" \ + -DOHOS_ARCH=$ARCH -B$ARCH-build -S./ -L > $buildlog 2>&1 + $MAKE VERBOSE=1 -C $ARCH-build >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + $MAKE -C $ARCH-build install >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +check() { + echo "The test must be on an OpenHarmony device!" + # TODO +} + +cleanbuild(){ + rm -rf ${PWD}/$builddir #${PWD}/$packagename +} + diff --git a/community/libsndfile/SHA512SUM b/community/libsndfile/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..e4ec9ceaf5253c99e9ee2f9157e3daed31018a0e --- /dev/null +++ b/community/libsndfile/SHA512SUM @@ -0,0 +1 @@ +f5bc4c58c4240118ebe4fca140277d4caad78097c733c68f0275bf6c55898693bb3e0b1b26669aa36f493150aad550ef6af2482ddfb4d23f33f0036fde269b0d libsndfile-1.2.0.zip diff --git a/community/libtiff/HPKBUILD b/community/libtiff/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..ee95e1e6e54d80bee3b2fdbba15b4a551c3b6f2a --- /dev/null +++ b/community/libtiff/HPKBUILD @@ -0,0 +1,81 @@ +# 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: Jeff Han , wen fan +# Maintainer: Jeff Han + +pkgname=libtiff +pkgver=51558511bdbbcffdce534db21dbaf5d54b31638a +pkgrel= +pkgdesc="a small collection of tools for doingsimple manipulations of TIFF images, and documentation on the library and tools." +url=https://gitlab.com/libtiff/libtiff +archs=(armeabi-v7a arm64-v8a) +license=libtiff +depends=(zstd_1_5_6 libjpeg-turbo xz libwebp libdeflate jbigkit) +makedepends=() + +source= +autounpack=false +downloadpackage=false +buildtools=cmake +clonesrcflag=true + +builddir=${pkgname}-${pkgver} +packagename= + +prepare() { + if ${clonesrcflag} + then + git clone ${url}.git ${builddir} > ${publicbuildlog} 2>&1 || return -1 + cd ${builddir} + git reset --hard ${pkgver} >> ${publicbuildlog} 2>&1 || return -1 + cd ${OLDPWD} + clonesrcflag=false + fi + + mkdir -p ${builddir}/${ARCH}-build + return 0 +} + +build() { + cd ${builddir} + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" -B${ARCH}-build -S./ > ${buildlog} 2>&1 || return -1 + ${MAKE} -C${ARCH}-build >> ${buildlog} 2>&1 || return -1 + cd ${OLDPWD} + return 0 +} + +package() { + cd ${builddir}/${ARCH}-build + ${MAKE} install >> ${buildlog} 2>&1 || return -1 + cd ${OLDPWD} + return 0 +} + +check() { + cd ${builddir}/${ARCH}-build + + # 使用单板cmake程序进行测试 + find . -name "CTestTestfile.cmake" | xargs sed -i.bak 's#".*/cmake"#"/bin/cmake"#g' || return -1 + + # 将测试用例使用的cmake改为CI工具的cmake + sed -i.bak "s/\".*\/cmake\"/\"cmake\"/g" test/CTestTestfile.cmake || return -1 + cd ${OLDPWD} + echo "The test must be on an OpenHarmony device!" + return 0 +} + +cleanbuild() { + rm -rf ${PWD}/${builddir} + return 0 +} diff --git a/community/libtiff/HPKCHECK b/community/libtiff/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..4b27802c8b97145df735ea91d8b8e96810c88342 --- /dev/null +++ b/community/libtiff/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: Jeff Han , wen fan +# Maintainer: Jeff Han + +source HPKBUILD > /dev/null 2>&1 +logfile=${LYCIUM_THIRDPARTY_ROOT}/${pkgname}/${pkgname}_${ARCH}_${OHOS_SDK_VER}_test.log + +checkprepare() { + return 0 +} + +openharmonycheck() { + cd ${builddir}/${ARCH}-build + ctest > ${logfile} 2>&1 + ret=$? + if [ ${ret} -ne 0 ] + then + mkdir ${LYCIUM_FAULT_PATH}/${pkgname} + cp Testing/Temporary/LastTest.log ${LYCIUM_FAULT_PATH}/${pkgname}/ + fi + + cd ${OLDPWD} + return ${ret} +} diff --git a/community/libtiff/OAT.xml b/community/libtiff/OAT.xml new file mode 100644 index 0000000000000000000000000000000000000000..8c1f4a4604b0605aff883a046d2397e0016221b5 --- /dev/null +++ b/community/libtiff/OAT.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/community/libtiff/README.OpenSource b/community/libtiff/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..41aa8815ec28b97308eaf269bb5398e294ff8e35 --- /dev/null +++ b/community/libtiff/README.OpenSource @@ -0,0 +1,66 @@ +[ + { + "Name": "libtiff", + "License": "libtiff", + "License File": "https://gitlab.com/libtiff/libtiff/-/blob/master/LICENSE.md", + "Version Number": "51558511bdbbcffdce534db21dbaf5d54b31638a", + "Owner": "huangminzhong2@huawei.com", + "Upstream URL": "https://gitlab.com/libtiff/libtiff", + "Description": "a small collection of tools for doingsimple manipulations of TIFF images, and documentation on the library and tools." + }, + { + "Name": "zstd", + "License": "BSD-3-Clause or GPL-2.0-only", + "License File": ["https://github.com/facebook/zstd/blob/dev/LICENSE","https://github.com/facebook/zstd/blob/dev/COPYING"], + "Version Number": "v1.5.4", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://github.com/facebook/zstd/releases/download/v1.5.4/zstd-1.5.4.tar.gz", + "Description": "Zstandard, or zstd as short version, is a fast lossless compression algorithm, targeting real-time compression scenarios at zlib-level and better compression ratios." + }, + { + "Name": "libjpeg-turbo", + "License": "IJG and BSD-3-clause", + "License File": ["https://github.com/libjpeg-turbo/libjpeg-turbo/blob/main/README.ijg","https://github.com/libjpeg-turbo/libjpeg-turbo/blob/main/LICENSE.md"], + "Version Number": "2.1.91", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://github.com/libjpeg-turbo/libjpeg-turbo/archive/refs/tags/2.1.91.tar.gz", + "Description": "libjpeg-turbo is a JPEG image codec that uses SIMD instructions to accelerate baseline JPEG compression and decompression" + }, + { + "Name": "xz", + "License": "Public Domain and LGPL-2.1 and GPL-2.0 and GPL-3.0", + "License File": ["https://github.com/tukaani-project/xz/blob/v5.4/COPYING","https://github.com/tukaani-project/xz/blob/v5.4/COPYING.GPLv2", + "https://github.com/tukaani-project/xz/blob/v5.4/COPYING.GPLv3","https://github.com/tukaani-project/xz/blob/v5.4/COPYING.LGPLv2.1"], + "Version Number": "5.4.1", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://github.com/tukaani-project/xz/releases/download/v5.4.1/xz-5.4.1.tar.gz", + "Description": "XZ Utils is free general-purpose data compression software with a high compression ratio. " + }, + { + "Name": "libwebp", + "License": "BSD-3-Clause", + "License File": "https://github.com/webmproject/libwebp/blob/main/COPYING", + "Version Number": "1.3.0", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://github.com/webmproject/libwebp/archive/refs/tags/v1.3.0.tar.gz", + "Description": "WebP codec is a library to encode and decode images in WebP format. This package contains the library that can be used in other programs to add WebP support, as well as the command line tools 'cwebp' and 'dwebp' to compress and decompress images respectively." + }, + { + "Name": "libdeflate", + "License": "MIT", + "License File": "https://github.com/ebiggers/libdeflate/blob/master/COPYING", + "Version Number": "v1.17", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://github.com/ebiggers/libdeflate/archive/refs/tags/v1.17.tar.gz", + "Description": "libdeflate is a library for fast, whole-buffer DEFLATE-based compression and decompression." + }, + { + "Name": "jbigkit", + "License": "GPL-2.0-only", + "License File": "COPYING", + "Version Number": "2.1", + "Owner": "xiafeng@huawei.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/community/libtiff/README_zh.md b/community/libtiff/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..58cf3140bac5a031673b937e14767b89975dc24a --- /dev/null +++ b/community/libtiff/README_zh.md @@ -0,0 +1,25 @@ +# libtiff三方库说明 +## 功能简介 +libtiff是一个用来读写标签图片(tiff)的库。该库还支持如下文件格式的转化。 + +## 三方库版本 +- 51558511bdbbcffdce534db21dbaf5d54b31638a + +## 已适配功能 +- 支持如下格式转换 + + | 源文件格式 | 转化后格式 | + | :--------: | :--------: | + | tiff | tiff | + | pgm | tiff | + | g3 | tiff | + | pbm | tiff | + | ppm | tiff | + | tiff | pdf | + | tiff | ps | + +## 使用约束 +- [IDE和SDK版本](../../docs/constraint.md) + +## 集成方式 ++ [系统hap包集成](docs/hap_integrate.md) diff --git a/community/libtiff/docs/hap_integrate.md b/community/libtiff/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..661b28d6f07f52ea7991f1b43031511acc3cf021 --- /dev/null +++ b/community/libtiff/docs/hap_integrate.md @@ -0,0 +1,109 @@ +# libtiff集成到应用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 + ``` + +- 三方库目录结构 + ``` + tpc_c_cplusplus/thirdparty/libtiff #三方库的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── HPKCHECK #测试脚本 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md #三方库简介 + ├── OAT.xml #扫描结果文件 + ``` + +- 编译三方库 + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ```shell + cd lycium + ./build.sh libtiff + ``` + +- 三方库头文件及生成的库 + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ```te + libtiff/arm64-v8a libtiff/armeabi-v7a libpng/arm64-v8a libpng/armeabi-v7a + libjpeg-turbo/arm64-v8a libjpeg-turbo/armeabi-v7a libwebp/arm64-v8a libwebp/armeabi-v7a + zstd/arm64-v8a zstd/armeabi-v7a xz/arm64-v8a xz/armeabi-v7a + libdeflate/arm64-v8a libdeflate/armeabi-v7a jbigkit/arm64-v8a jbigkit/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 +- 拷贝动态库到`\\entry\libs\${OHOS_ARCH}\`目录: + 动态库需要在`\\entry\libs\${OHOS_ARCH}\`目录,才能集成到hap包中,所以需要将编译生成的所有库的so文件拷贝到对应的目录 +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的库拷贝到该目录下,如下图所示 + ![tiff_install](pic/tiff_install.png) +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + ```cmake + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/libtiff.so.6 + ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/libdeflate.so.0 + ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/libjpeg.so.62 + ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/liblzma.so.5 + ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/libzstd.so.1 + ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/libwebp.so.7) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libtiff/${OHOS_ARCH}/include + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/jbigkit/${OHOS_ARCH}/include + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libdeflate/${OHOS_ARCH}/include + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libjpeg-turbo/${OHOS_ARCH}/include + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libpng/${OHOS_ARCH}/include + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libwebp/${OHOS_ARCH}/include + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/xz/${OHOS_ARCH}/include + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/zstd/${OHOS_ARCH}/include) + ``` +## 测试三方库 +三方库的测试使用原库自带的测试用例来做测试,[准备三方库测试环境](../../../lycium/README.md#3ci环境准备) + + +- 设置MAKE执行程序路径 + ```shell + mkdir -p /data/local/tmp/ohos-sdk/linux/native/build-lycium/cmake + ln -s /usr/bin /data/local/tmp/ohos-sdk/linux/native/build-lycium/cmake/bin + ``` +- 拷贝CMAKE安装路径到单板 + ```shell + # 将编译机的/usr/share 目录下面cmake-3.26.X 进行压缩并传送到单板 + hdc.exe file send Z:\code\cmake-3.26.3.tar.gz /data/ + mv /data/cmake-3.26.3.tar.gz /usr/share + tar zxvf cmake-3.26.3.tar.gz + mv cmake-3.26.3 cmake-3.26 + ``` +- 将测试资源导入到开发板 +- 设置依赖库路径 +```shell +# 32位系统 +export LD_LIBRARY_PATH=/data/local/tmp/lycium/usr/libjpeg-turbo/armeabi-v7a/lib:/data/local/tmp/lycium/usr/libdeflate/armeabi-v7a/lib:/data/local/tmp/lycium/usr/xz/armeabi-v7a/lib:/data/local/tmp/lycium/usr/zstd/armeabi-v7a/lib:/data/local/tmp/lycium/usr/libpng/armeabi-v7a/lib:/data/local/tmp/lycium/usr/libtiff/armeabi-v7a/lib:/data/local/tmp/lycium/usr/libwebp/armeabi-v7a/lib:/data/local/tmp/lycium/usr/jbigkit/armeabi-v7a/lib + +# 64位系统 +export LD_LIBRARY_PATH=/data/local/tmp/lycium/usr/libjpeg-turbo/arm64-v8a/lib:/data/local/tmp/lycium/usr/libdeflate/arm64-v8a/lib:/data/local/tmp/lycium/usr/xz/arm64-v8a/lib:/data/local/tmp/lycium/usr/zstd/arm64-v8a/lib:/data/local/tmp/lycium/usr/libpng/arm64-v8a/lib:/data/local/tmp/lycium/usr/libtiff/arm64-v8a/lib:/data/local/tmp/lycium/usr/libwebp/arm64-v8a/lib:/data/local/tmp/lycium/usr/jbigkit/arm64-v8a/lib +``` +- 进入到构建目录输入以下指令 +```shell +find . -name "CTestTestfile.cmake" | xargs sed -i 's#".*/cmake"#"/usr/bin/cmake"#g' +``` +- 进入到构建目录执行 ctest 运行测试用例,如下截图(arm64-v8a-build为构建64位的目录,armeabi-v7a-build为构建32位的目录) + +```shell +ctest +``` + + ![tiff_test](pic/tiff_ohos_test2.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/community/libtiff/docs/pic/tiff_install.png b/community/libtiff/docs/pic/tiff_install.png new file mode 100644 index 0000000000000000000000000000000000000000..a9c2f8616fb9539112d4182d5a1c1347bf2a17a5 Binary files /dev/null and b/community/libtiff/docs/pic/tiff_install.png differ diff --git a/community/libtiff/docs/pic/tiff_ohos_test2.png b/community/libtiff/docs/pic/tiff_ohos_test2.png new file mode 100644 index 0000000000000000000000000000000000000000..491875ea13b8fdc74ffa3d871f41163ae7f2e273 Binary files /dev/null and b/community/libtiff/docs/pic/tiff_ohos_test2.png differ diff --git a/community/libtool/HPKBUILD b/community/libtool/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..637ba0d983268a11cf1ac664afb5f1844cf34323 --- /dev/null +++ b/community/libtool/HPKBUILD @@ -0,0 +1,76 @@ +# Contributor: xuzhao +# Maintainer: xuzhao +pkgname=libtool +pkgver=2.4.6 +pkgrel=0 +pkgdesc="GNU Libtool is a generic library support script that hides the complexity of using shared libraries behind a consistent, portable interface." +url="https://www.gnu.org" +archs=("armeabi-v7a" "arm64-v8a") +license=("GPLv2") +depends=() +makedepends=() + +source="https://ftpmirror.gnu.org/$pkgname/$pkgname-${pkgver}.tar.gz" +autounpack=true +downloadpackage=true +buildtools="configure" + +builddir=$pkgname-${pkgver} +packagename=$builddir.tar.gz + +source envset.sh +host= + +prepare() { + mkdir -p $builddir/$ARCH-build + + if [ $ARCH == "armeabi-v7a" ] + then + setarm32ENV + host=arm-linux + elif [ $ARCH == "arm64-v8a" ] + then + setarm64ENV + host=aarch64-linux + else + echo "${ARCH} not support" + return -1 + fi +} + +build() { + cd $builddir/$ARCH-build + PKG_CONFIG_LIBDIR="${pkgconfigpath}" \ + ../configure "$@" --host=$host > $buildlog 2>&1 + $MAKE V=1 >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir/$ARCH-build + $MAKE install >> $buildlog 2>&1 + cd $OLDPWD + unset host + if [ $ARCH == "armeabi-v7a" ] + then + unsetarm32ENV + elif [ $ARCH == "arm64-v8a" ] + then + unsetarm64ENV + else + echo "${ARCH} not support" + return -1 + fi +} + +check() { + echo "The test must be on an OpenHarmony device!" + # TODO +} + +cleanbuild(){ + rm -rf ${PWD}/$builddir #${PWD}/$packagename +} + diff --git a/community/libtool/README.OpenSource b/community/libtool/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..00c266483b38110fba92f1f245f10da50ce9406c --- /dev/null +++ b/community/libtool/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "libtool", + "License": "GPL-2.0", + "License File": "https://www.gnu.org/licenses/old-licenses/gpl-2.0.html", + "Version Number": "2.4.6", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://ftpmirror.gnu.org/libtool/libtool-2.4.6.tar.gz", + "Description": "GNU Libtool is a generic library support script that hides the complexity of using shared libraries behind a consistent, portable interface." + } +] \ No newline at end of file diff --git a/community/libtool/SHA512SUM b/community/libtool/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..8008994551f71a870347364e55bb3afd01965473 --- /dev/null +++ b/community/libtool/SHA512SUM @@ -0,0 +1 @@ +3233d81cb2739a54b840a0a82064eebbfaa4fb442fb993a35d6bd41d8395c51f038c90ae048b9252f172d0a5bbfb4b36e2b13d4477001f9ff7d4124237819a18 libtool-2.4.6.tar.gz diff --git a/community/libucl/HPKBUILD b/community/libucl/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..927a16bd1e5fa644f8242fc753754e29d9c39235 --- /dev/null +++ b/community/libucl/HPKBUILD @@ -0,0 +1,67 @@ +# 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<2942375747@qq.com>, wangying +# Maintainer: wangyihao<2471389@stu.neu.edu.cn>, wangjialun<2271411@stu.neu.edu.cn>, zhangqian<2371418@stu.neu.edu.cn>, wangying + +pkgname=libucl +pkgver=0.8.2 +pkgrel=0 +pkgdesc="UCL is an universal configuration library parser,it is compatible with JSON language and therefore can be used as a simple JSON parser." +url="https://github.com/vstakhov/libucl/tree/0.8.2" +archs=("armeabi-v7a" "arm64-v8a") +license=("BSD 2-Clause License") +depends=() +makedepends=() +source="https://github.com/vstakhov/libucl/archive/refs/tags/0.8.2.zip" + +downloadpackage=true +autounpack=true +buildtools=cmake + +builddir=$pkgname-${pkgver} +packagename=$builddir.zip + +# 为编译设置环境,如设置环境变量,创建编译目录等 +prepare() { + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + PKG_CONFIG_LIBDIR="${pkgconfigpath}" \ + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" \ + -DCMAKE_C_FLAGS="-Wno-unused-command-line-argument" \ + -DCMAKE_CXX_FLAGS="-Wno-unused-command-line-argument" \ + -B$ARCH-build -S./ > $buildlog 2>&1 + $MAKE VERBOSE=1 -C $ARCH-build >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + $MAKE -C $ARCH-build install >> $buildlog 2>&1 + cd $OLDPWD +} + + +check() { + echo "The test must be on an OpenHarmony device!" +} + + +cleanbuild() { + rm -rf ${PWD}/$builddir +} diff --git a/community/libucl/HPKCHECK b/community/libucl/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..bf95de7c03daefcd029bdb515396ad016cb9b19a --- /dev/null +++ b/community/libucl/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: 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 + +checkprepare(){ + return 0 +} + +# 在OH环境执行测试的接口 +openharmonycheck() { + res=0 # 记录返回值 + cd ${builddir}/${ARCH}-build # 进入到测试目录 + ctest > ${logfile} 2>&1 # 执行测试命令并将测试结果导出到${logfile},测试命令根据每个库的真实情况填写 + res=$? # 记录测试结果返回值 + cd $OLDPWD # 返回上一次目录 + + return $res # 返回测试值 +} \ No newline at end of file diff --git a/community/libucl/OAT.xml b/community/libucl/OAT.xml new file mode 100644 index 0000000000000000000000000000000000000000..eeb1f946d683c0b81976cd06522096062a6901b9 --- /dev/null +++ b/community/libucl/OAT.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/community/libucl/README.OpenSource b/community/libucl/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..930e57edf4b2c743fd527120b86be806f25f23eb --- /dev/null +++ b/community/libucl/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "libucl", + "License": "BSD 2-Clause License", + "License File": "https://github.com/vstakhov/libucl/blob/master/COPYING", + "Version Number": "0.8.2", + "Owner": "2942375747@qq.com", + "Upstream URL": "https://github.com/vstakhov/libucl", + "Description": "UCL is an universal configuration library parser,it is compatible with JSON language and therefore can be used as a simple JSON parser." + } +] \ No newline at end of file diff --git a/community/libucl/README_zh.md b/community/libucl/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..261f6a5649dbc01b16a1a24e0cb6bb4cb33a1938 --- /dev/null +++ b/community/libucl/README_zh.md @@ -0,0 +1,12 @@ +# libucl三方库说明 +## 功能简介 +libucl是一种通用的配置库解析器,它与JSON语言兼容,因此可以用作简单的JSON解析器。 + +## 三方库版本 +- 0.8.2 + +## 使用约束 +- [IDE和SDK版本](../../docs/constraint.md) + +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) diff --git a/community/libucl/SHA512SUM b/community/libucl/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..0baae4d641fe142924bc39b633200797add49b13 --- /dev/null +++ b/community/libucl/SHA512SUM @@ -0,0 +1 @@ +a9d0104b6457bd4659507d4cf980921ccc42967ce5231126c2f6b556affcbee11eb9d4a33dbe489d8362a416f897b9d3214144688131bd00ff5851fc60978ddc libucl-0.8.2.zip \ No newline at end of file diff --git a/community/libucl/docs/hap_integrate.md b/community/libucl/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..1cd578b3e057bdd30a87b2cb3d3b1589d9f2914f --- /dev/null +++ b/community/libucl/docs/hap_integrate.md @@ -0,0 +1,79 @@ +# libucl 集成到应用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/libucl #三方库libucl的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── HPKCHECK #测试脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md #三方库简介 + ``` + +- 在lycium目录下编译三方库 + + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ```shell + cd lycium + ./build.sh libucl-0.8.2 + ``` + +- 三方库头文件及生成的库 + + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ```shell + libucl-0.8.2/arm64-v8a libucl-0.8.2/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +- 编译出可执行的文件进行测试,[准备三方库测试环境](../../../lycium/README.md#3ci环境准备) +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的头文件拷贝到该目录下,将编译生成的三方库以及依赖库全部(动态库名字带版本号和不带版本号的都需要)拷贝到工程的libs目录下,如下图所示: +   + +  ![thirdparty_install_dir](pic/libucl_install_dir.png) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + + ```shell + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libucl/${OHOS_ARCH}/lib/libucl.a) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libucl/${OHOS_ARCH}/include) + ``` + +## 测试三方库 +在lycium目录下执行脚本./test.sh,自动检测thridparty目录下已编译的三方库, + + +```shell + cd lycium + ./test.sh libucl-0.8.2 +``` + ![libucl_test](pic/libucl_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/community/libucl/docs/pic/libucl_install_dir.png b/community/libucl/docs/pic/libucl_install_dir.png new file mode 100644 index 0000000000000000000000000000000000000000..436ef8566348a51abd7f764778f866a062e3f674 Binary files /dev/null and b/community/libucl/docs/pic/libucl_install_dir.png differ diff --git a/community/libucl/docs/pic/libucl_test.png b/community/libucl/docs/pic/libucl_test.png new file mode 100644 index 0000000000000000000000000000000000000000..0243389ef0d5c47276fb7f33c1a34d2280473107 Binary files /dev/null and b/community/libucl/docs/pic/libucl_test.png differ diff --git a/community/libuv/HPKBUILD b/community/libuv/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..cce65e8a67975d878804ace8825738c41fc4a0b8 --- /dev/null +++ b/community/libuv/HPKBUILD @@ -0,0 +1,61 @@ +# Contributor: Jeff Han +# Maintainer: Jeff Han +pkgname=libuv +pkgver=v1.44.2 +pkgrel=0 +pkgdesc="" +url="" +archs=("armeabi-v7a" "arm64-v8a") +license=("MIT") +depends=() +makedepends=() + +source="https://github.com/libuv/$pkgname/archive/refs/tags/$pkgver.tar.gz" + +autounpack=true +downloadpackage=true +patchflag=true + +builddir=$pkgname-${pkgver:1} +packagename=$builddir.tar.gz + +prepare() { + if $patchflag + then + cd $builddir + patch -p1 < `pwd`/../libuv_oh_pkg.patch + # patch只需要打一次,关闭打patch + patchflag=false + cd $OLDPWD + fi + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + PKG_CONFIG_LIBDIR="${pkgconfigpath}" \ + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" \ + -DOHOS_ARCH=$ARCH -B$ARCH-build -S./ -L > $buildlog 2>&1 + $MAKE VERBOSE=1 -C $ARCH-build >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd "$builddir" + $MAKE -C $ARCH-build install >> $buildlog 2>&1 + cd $OLDPWD +} + +check() { + echo "The test must be on an OpenHarmony device!" + # test method + # 设置环境变量 export UV_RUN_AS_ROOT=1 + # 进入编译目录运行 ctest +} + +# 清理环境 +cleanbuild() { + rm -rf ${PWD}/$builddir #${PWD}/$packagename +} diff --git a/community/libuv/SHA512SUM b/community/libuv/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..9db07b29fa171a8830721a0c14546464fcc1b601 --- /dev/null +++ b/community/libuv/SHA512SUM @@ -0,0 +1,2 @@ +d21c890787b0b364fafa5fc0cbbff296bc2ca269e1991d2f7f35fcb37b8634da377466f5af5a4245425fcf876ae6870d100ab32b12bce64f8e0b01fd25a1bc83 libuv-1.44.2.tar.gz +771b298b973e569a4edd1184f52e0449e625814516196f08b5f4edb56ade33d9de79a43aba0218bdb75f328f52f7c2b76baeeefb20017d8d08a7215fee6d0598 libuv_oh_pkg.patch diff --git a/community/libuv/libuv_oh_pkg.patch b/community/libuv/libuv_oh_pkg.patch new file mode 100644 index 0000000000000000000000000000000000000000..257d85e5a9f9d9e3898c3f3883431791e0b8d74e --- /dev/null +++ b/community/libuv/libuv_oh_pkg.patch @@ -0,0 +1,30 @@ +diff -rupN libuv-1.44.2/CMakeLists.txt libuv-1.44.2-patched/CMakeLists.txt +--- libuv-1.44.2/CMakeLists.txt 2022-07-12 16:16:33.000000000 +0000 ++++ libuv-1.44.2-patched/CMakeLists.txt 2023-04-19 08:14:47.240275531 +0000 +@@ -227,7 +227,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Android") + src/unix/epoll.c) + endif() + +-if(APPLE OR CMAKE_SYSTEM_NAME MATCHES "Android|Linux") ++if(APPLE OR CMAKE_SYSTEM_NAME MATCHES "Android|Linux|OHOS") + list(APPEND uv_sources src/unix/proctitle.c) + endif() + +@@ -275,7 +275,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "kFreeBSD" + list(APPEND uv_libraries dl freebsd-glue) + endif() + +-if(CMAKE_SYSTEM_NAME STREQUAL "Linux") ++if(CMAKE_SYSTEM_NAME MATCHES "Linux|OHOS") + list(APPEND uv_defines _GNU_SOURCE _POSIX_C_SOURCE=200112) + list(APPEND uv_libraries dl rt) + list(APPEND uv_sources +@@ -384,7 +384,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "QNX") + list(APPEND uv_libraries socket) + endif() + +-if(APPLE OR CMAKE_SYSTEM_NAME MATCHES "DragonFly|FreeBSD|Linux|NetBSD|OpenBSD") ++if(APPLE OR CMAKE_SYSTEM_NAME MATCHES "DragonFly|FreeBSD|Linux|NetBSD|OpenBSD|OHOS") + list(APPEND uv_test_libraries util) + endif() + diff --git a/community/libvorbis/HPKBUILD b/community/libvorbis/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..f0fa982b54af9f52f34a18a568293c4362ee18a7 --- /dev/null +++ b/community/libvorbis/HPKBUILD @@ -0,0 +1,48 @@ +# Contributor: TangShaoteng +# Maintainer: TangShaoteng + +pkgname=libvorbis +pkgver=v1.3.7 +pkgrel=0 +pkgdesc="Reference implementation of the Ogg Vorbis audio format." +url="https://www.xiph.org/" +archs=("armeabi-v7a" "arm64-v8a") +license=("BSD-3-Clause") +depends=("libogg") +makedepends=() + +source="https://github.com/xiph/vorbis/releases/download/$pkgver/$pkgname-${pkgver:1}.tar.gz" + +autounpack=true +downloadpackage=true +buildtools="cmake" +builddir=$pkgname-${pkgver:1} +packagename=$builddir.tar.gz + +prepare() { + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" -DOHOS_ARCH=$ARCH -B$ARCH-build -S./ -L > `pwd`/$ARCH-build/build.log 2>&1 + make VERBOSE=1 -j4 -C $ARCH-build >> `pwd`/$ARCH-build/build.log 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + make -C $ARCH-build install >> `pwd`/$ARCH-build/build.log 2>&1 + cd $OLDPWD +} + +check() { + echo "The test must be on an OpenHarmony device!" + # TODO +} + +cleanbuild() { + rm -rf ${PWD}/$builddir #${PWD}/$packagename +} diff --git a/community/libvorbis/SHA512SUM b/community/libvorbis/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..4be2811b3a8244dc8e76fda88992163bcc57e0df --- /dev/null +++ b/community/libvorbis/SHA512SUM @@ -0,0 +1 @@ +8a83ac9e9197f32fad4430946dba3927921320492f9e96cda546e8eb3981e2664da97f77e43cb197577ec056437785168ca7c4138f8bf7f2ba93899846932eb2 libvorbis-1.3.7.tar.gz diff --git a/community/libwebsockets/HPKBUILD b/community/libwebsockets/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..8dcb2d25935aff38d1114279e9f0ebc4442f50d5 --- /dev/null +++ b/community/libwebsockets/HPKBUILD @@ -0,0 +1,130 @@ +# 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: jiajiawei <2968675576@qq.com> +# Maintainer: jiajiawei <2968675576@qq.com> + +pkgname=libwebsockets +pkgver=v4.3.3 +pkgrel=0 +pkgdesc="Libwebsockets (LWS) is a lightweight and pure C library that allows you to implement various network protocols easily with a nonblocking event loop. " +url="https://libwebsockets.org/" +archs=("armeabi-v7a" "arm64-v8a") +license=("MIT License" "BSD2" "BSD3" "ZLIB" "APACHE2" "CC0") +depends=("openssl_1_0_2u" "zlib" "sqlite" "libuv" "libevent") +makedepends=() + +# 官方下载地址https://github.com/libwebsockets/$pkgname/archive/refs/tags/$pkgver.zip受网络影响可能存在下载失败的情况,现使用gitee镜像可以与官方仓库保持同步 +source="https://gitee.com/mirrors/${pkgname}source/repository/archive/$pkgver.zip" + +downloadpackage=true +autounpack=true +builddir=${pkgname}source-${pkgver} +packagename=$builddir.zip + +prepare() { + mkdir -p $builddir/$ARCH-build +} + +# 编译armeabi-v7a添加openssl_1_0_2u依赖,编译arm64-v8a关闭openssl_1_0_2u依赖 +# -DLWS_OPENSSL_SUPPORT=1 支持openssl +# -DLWS_WITH_ZLIB=ON 添加zlib依赖 +# -DLWS_WITH_SQLITE3=ON 添加sqlite依赖 +# -DLWS_WITH_LIBUV=ON 添加libuv依赖 +# -DLWS_WITH_LIBEVENT=ON 添加libevent依赖 +# -DLWS_ROLE_MQTT=ON 添加MQTT client注释 +# -DLWS_IPV6=ON 添加IPV6的支持 +# -DLWS_WITH_LWSWS=ON 添加Libwebsockets Webserve的支持 +# -DLWS_WITH_HTTP_PROXY=ON 添加active HTTP proxying的支持 +# -DLWS_WITH_ZIP_FOPS=ON 添加serving pre-zipped files的支持 +# -DLWS_WITH_SOCKS5=ON 允许在客户端连接中使用SOCKS5代理 +# -DLWS_ROLE_RAW_PROXY=ON 添加Raw packet proxy的支持 +# -DLWS_WITH_PEER_LIMITS=ON 追踪对等方并限制单个对等方可以分配的资源 +# -DLWS_WITH_RANGES=ON 支持http ranges (RFC7233) +# -DLWS_WITH_THREADPOOL=ON 支持受控的工作线程池(依赖于pthread) +# -DLWS_WITH_HTTP_STREAM_COMPRESSION=ON 支持HTTP流压缩 +# -DLWS_WITH_ALSA=ON 启用alsa音频示例 +# -DLWS_WITH_GTK=ON 启用gtk示例 +# -DLWS_WITH_FTS=ON 支持全文搜索 +# -DLWS_WITH_SYS_ASYNC_DNS=ON 支持非阻塞的内部IPv4 + IPv6 DNS解析器 +# -DLWS_WITH_SYS_DHCP_CLIENT=ON 内置的小型ntp客户端适用于TLS日期验证并通过lws_system运行 +# -DLWS_WITH_SYS_FAULT_INJECTION=ON 支持内置的小型DHCP客户端 +# -DLWS_WITH_SYS_METRICS=ON 启用故障注入支持 +# -DLWS_WITH_SECURE_STREAMS=ON 支持Lws Metrics AP +# -DLWS_WITH_SECURE_STREAMS_PROXY_API=ON 支持 Secure Streams protocol-agnostic API +# -DLWS_WITH_SECURE_STREAMS_AUTH_SIGV4=ON 将 Secure Streams 支持扩展到跨进程工作 +# -DLWS_WITH_SECURE_STREAMS_BUFFER_DUMP=ON 将 Secure Streams Auth 支持扩展到 AWS Sigv4 +build() { + cd $builddir + if [ $ARCH == "armeabi-v7a" ] + then + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" \ + -DLWS_OPENSSL_SUPPORT=1 \ + -DLWS_OPENSSL_INCLUDE_DIRS="$LYCIUM_ROOT/usr/openssl_1_0_2u/$ARCH/include" \ + -DLWS_OPENSSL_LIBRARIES="$LYCIUM_ROOT/usr/openssl_1_0_2u/$ARCH/lib/libssl.a;$LYCIUM_ROOT/usr/openssl_1_0_2u/$ARCH/lib/libcrypto.a" \ + -DLWS_WITH_ZLIB=ON \ + -DLWS_ZLIB_LIBRARIES="$LYCIUM_ROOT/usr/zlib/$ARCH/lib/libz.a" \ + -DLWS_ZLIB_INCLUDE_DIRS="$LYCIUM_ROOT/usr/zlib/$ARCH/include" \ + -DLWS_WITH_SQLITE3=ON \ + -DLWS_SQLITE3_LIBRARIES="$LYCIUM_ROOT/usr/sqlite/$ARCH/lib/libsqlite3.a" \ + -DLWS_SQLITE3_INCLUDE_DIRS="$LYCIUM_ROOT/usr/sqlite/$ARCH/include" \ + -DLWS_WITH_LIBUV=ON \ + -DLWS_LIBUV_LIBRARIES="$LYCIUM_ROOT/usr/libuv/$ARCH/lib/libuv_a.a" \ + -DLWS_LIBUV_INCLUDE_DIRS="$LYCIUM_ROOT/libuv/$ARCH/include" \ + -DLWS_WITH_LIBEVENT=ON \ + -DLIBEVENT_LIBRARIES="$LYCIUM_ROOT/usr/libevent/$ARCH/lib/libevent_core.a;$LYCIUM_ROOT/usr/libevent/$ARCH/lib/libevent_extra.a;$LYCIUM_ROOT/usr/libevent/$ARCH/lib/libevent_openssl.a;$LYCIUM_ROOT/usr/libevent/$ARCH/lib/libevent_pthreads.a;$LYCIUM_ROOT/usr/libevent/$ARCH/lib/libevent.a" \ + -DLIBEVENT_INCLUDE_DIRS="$LYCIUM_ROOT/usr/libevent/$ARCH/include" \ + -DLWS_ROLE_MQTT=ON -DLWS_IPV6=ON -DLWS_WITH_LWSWS=ON -DLWS_WITH_HTTP_PROXY=ON -DLWS_WITH_ZIP_FOPS=ON -DLWS_WITH_SOCKS5=ON -DLWS_ROLE_RAW_PROXY=ON -DLWS_WITH_PEER_LIMITS=ON -DLWS_WITH_RANGES=ON -DLWS_WITH_THREADPOOL=ON -DLWS_WITH_HTTP_STREAM_COMPRESSION=ON -DLWS_WITH_ALSA=ON -DLWS_WITH_GTK=ON -DLWS_WITH_FTS=ON -DLWS_WITH_SYS_ASYNC_DNS=ON -DLWS_WITH_SYS_DHCP_CLIENT=ON -DLWS_WITH_SYS_FAULT_INJECTION=ON -DLWS_WITH_SYS_METRICS=ON -DLWS_WITH_SECURE_STREAMS=ON -DLWS_WITH_SECURE_STREAMS_PROXY_API=ON -DLWS_WITH_SECURE_STREAMS_AUTH_SIGV4=ON -DLWS_WITH_SECURE_STREAMS_BUFFER_DUMP=ON \ + -DCMAKE_C_FLAGS="-Wno-unused-variable -Wno-unused-but-set-variable -Wno-unused-command-line-argument" \ + -B$ARCH-build -S./ > $buildlog 2>&1 + elif [ $ARCH == "arm64-v8a" ] + then + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" \ + -DLWS_WITH_SSL=OFF \ + -DLWS_WITH_ZLIB=ON \ + -DLWS_ZLIB_LIBRARIES="$LYCIUM_ROOT/usr/zlib/$ARCH/lib/libz.a" \ + -DLWS_ZLIB_INCLUDE_DIRS="$LYCIUM_ROOT/usr/zlib/$ARCH/include" \ + -DLWS_WITH_SQLITE3=ON \ + -DLWS_SQLITE3_LIBRARIES="$LYCIUM_ROOT/usr/sqlite/$ARCH/lib/libsqlite3.a" \ + -DLWS_SQLITE3_INCLUDE_DIRS="$LYCIUM_ROOT/usr/sqlite/$ARCH/include" \ + -DLWS_WITH_LIBUV=ON \ + -DLWS_LIBUV_LIBRARIES="$LYCIUM_ROOT/usr/libuv/$ARCH/lib/libuv_a.a" \ + -DLWS_LIBUV_INCLUDE_DIRS="$LYCIUM_ROOT/libuv/$ARCH/include" \ + -DLWS_WITH_LIBEVENT=ON \ + -DLIBEVENT_LIBRARIES="$LYCIUM_ROOT/usr/libevent/$ARCH/lib/libevent_core.a;$LYCIUM_ROOT/usr/libevent/$ARCH/lib/libevent_extra.a;$LYCIUM_ROOT/usr/libevent/$ARCH/lib/libevent_openssl.a;$LYCIUM_ROOT/usr/libevent/$ARCH/lib/libevent_pthreads.a;$LYCIUM_ROOT/usr/libevent/$ARCH/lib/libevent.a" \ + -DLIBEVENT_INCLUDE_DIRS="$LYCIUM_ROOT/usr/libevent/$ARCH/include" \ + -B$ARCH-build -S./ > $buildlog 2>&1 + else + echo "${ARCH} not support" + fi + $MAKE VERBOSE=1 -C $ARCH-build >> $buildlog 2>&1 # 此处使用$MAKE,在lycium/build.sh中定义,变量值为make -j32。日志路径使用变量build.log + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + make -C $ARCH-build install >> $buildlog 2>&1 # 日志路径使用变量build.log + cd $OLDPWD +} + +check() { + echo "The test must be on an OpenHarmony device!" + # TODO +} + +# 清理环境 +cleanbuild() { + rm -rf ${PWD}/$builddir #${PWD}/$packagename +} \ No newline at end of file diff --git a/community/libwebsockets/HPKCHECK b/community/libwebsockets/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..54e70fbd28a83dec2c93b63683d4e2d49b047b11 --- /dev/null +++ b/community/libwebsockets/HPKCHECK @@ -0,0 +1,31 @@ +# 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: jiajiawei <2968675576@qq.com> +# Maintainer: jiajiawei <2968675576@qq.com> + +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/bin + ./libwebsockets-test-server > ${logfile} 2>&1 + res=$? + if [ $res -ne 0 ]; then + cd $OLDPWD + return $res + fi + cd $OLDPWD + return $res +} \ No newline at end of file diff --git a/community/libwebsockets/README.OpenSource b/community/libwebsockets/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..84bed58bed7b7086aa9de4aec8f4ec2963a51d0e --- /dev/null +++ b/community/libwebsockets/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "libwebsockets", + "License": "MIT License", + "License File": "https://github.com/warmcat/libwebsockets/blob/main/LICENSE", + "Version Number": "v4.3.3", + "Owner": "jia_jiahao@runkaihong.com.cn", + "Upstream URL": "https://libwebsockets.org/", + "Description": "Libwebsockets (LWS) is a lightweight and pure C library that allows you to implement various network protocols easily with a nonblocking event loop" + } +] \ No newline at end of file diff --git a/community/libwebsockets/README_zh.md b/community/libwebsockets/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..302b112b045467b0a5a1b34a348f9e45499e6b3a --- /dev/null +++ b/community/libwebsockets/README_zh.md @@ -0,0 +1,9 @@ +# libwebsockets 三方库说明 +## 功能简介 +libwebsockets是一款轻量级用来开发服务器和客户端的C库。 +## 三方库版本 +- v4.3.3 +## 使用约束 +- [IDE和SDK版本](../../docs/constraint.md) +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) \ No newline at end of file diff --git a/community/libwebsockets/SHA512SUM b/community/libwebsockets/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..9189fd8e361523b3a1075721ca8e8d05303d2fb8 --- /dev/null +++ b/community/libwebsockets/SHA512SUM @@ -0,0 +1 @@ +fb9e8c139c8b32532fac8b36ef43b0a6cca64709d5653b427de04979c459e4261c7ec92780359a77c15d72db31b393d8f8e08ad2913f91e0ada5ebe30ae736fb libwebsocketssource-v4.3.3.zip \ No newline at end of file diff --git a/community/libwebsockets/docs/hap_integrate.md b/community/libwebsockets/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..f4f95ac17a575c26f16fe7ed285c7664f7b212c9 --- /dev/null +++ b/community/libwebsockets/docs/hap_integrate.md @@ -0,0 +1,80 @@ +# libwebsockets在OpenHarHarmony上运行 + +本库是在RK3568开发板上基于OpenHarmony4.1 Release版本的镜像验证的,如果是从未使用过RK3568,可以先查看[润和RK3568开发板标准系统快速上手](https://gitee.com/openharmony-sig/knowledge_demo_temp/tree/master/docs/rk3568_helloworld)。 + +## 开发环境 + +- [开发环境准备](../../../docs/hap_integrate_environment.md) + +## 编译三方库 + +- 下载本仓库 + + ``` + git clone https://gitee.com/openharmony-sig/tpc_c_cplusplus.git --depth=1 + ``` + +- 三方库目录结构 + + ```shell + tpc_c_cplusplus/thirdparty/libwebsockets #三方库libwebsockets的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── README_zh.md #libwebsockets说明文档 + ├── SHA512SUM #三方库校验文件 + ├── OAT.xml #OAT开源审查文本 + ``` + +- 在lycium目录下编译三方库 + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ``` + cd lycium + ./build.sh libwebsockets + ``` + +- 三方库头文件及生成的库 + + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库和头文件 + + ```shell + libwebsockets/arm64-v8a + libwebsockets/armeabi-v7a + ``` +- [测试三方库](#测试三方库) + + +## 应用中使用三方库 +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的库拷贝到该目录下 +   + +![alt text](./pic/thirdparty.png) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + +```shell +#将三方库加入工程中 +target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libwebsockets/${OHOS_ARCH}/lib/libwebsockets.a) +#将三方库的头文件加入工程中 +target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libwebsockets/${OHOS_ARCH}/include) +``` + +![alt text](./pic/target_link_libraries.png) + +## 测试三方库 + +- 编译出可执行的文件进行测试,[准备三方库测试环境](../../../lycium/README.md#3ci环境准备) + +- 将tpc_c_cplusplus发送至rk3568开发板data目录,进入到构建目录运行测试用例(注意arm64-v8a-build为构建64位的目录,armeabi-v7a-build为构建32位的目录),执行结果如图所示 +``` +cd data/tpc_c_cplusplus/thirdparty/libwebsockets/libwebsocketssource-v4.3.3/arm64-v8a-build/bin +./libwebsockets-test-server +``` +![alt text](./pic/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/community/libwebsockets/docs/pic/target_link_libraries.png b/community/libwebsockets/docs/pic/target_link_libraries.png new file mode 100644 index 0000000000000000000000000000000000000000..045ffd0ba3b8d012aa810d5393d1dc8336bae1a9 Binary files /dev/null and b/community/libwebsockets/docs/pic/target_link_libraries.png differ diff --git a/community/libwebsockets/docs/pic/test.png b/community/libwebsockets/docs/pic/test.png new file mode 100644 index 0000000000000000000000000000000000000000..9a566dc9a454089da690a54a9ead1645edd94981 Binary files /dev/null and b/community/libwebsockets/docs/pic/test.png differ diff --git a/community/libwebsockets/docs/pic/thirdparty.png b/community/libwebsockets/docs/pic/thirdparty.png new file mode 100644 index 0000000000000000000000000000000000000000..4fe56f248a3b155f2b52b696294db517b8f0fea6 Binary files /dev/null and b/community/libwebsockets/docs/pic/thirdparty.png differ diff --git a/community/libzmq/HPKBUILD b/community/libzmq/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..d07a6f89d506c412ee2373fa459994902ffd6726 --- /dev/null +++ b/community/libzmq/HPKBUILD @@ -0,0 +1,97 @@ +# 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: huangminzhong2 +# Maintainer: huangminzhong2 + +pkgname=libzmq +pkgver=v4.1.8 +pkgrel=0 +pkgdesc="A library which extends the standard socket interfaces with features traditionally provided by specialised messaging middleware products." +url="https://github.com/zeromq/libzmq" +archs=("armeabi-v7a" "arm64-v8a") +license=("MPL-2.0") +depends=() +makedepends=() +install= +source="https://github.com/zeromq/$pkgname/archive/refs/tags/$pkgver.tar.gz" +downloadpackage=true +autounpack=true +patchflag=true +buildtools="cmake" +builddir=${pkgname}-${pkgver:1} +packagename=$builddir.tar.gz + +prepare() { + if $patchflag + then + cd $builddir + # libzmq_oh_pkg.patch文件的作用如下 + # 1. test_many_sockets用例测试时会不停的创建文件描述符,直到达到系统上限,当系统资源不足时,源代码未判断errno == ENOMEM这个条件,在鸿蒙系统有的版本会直接报out of memory的错误并结束测试程序 + # 2. test_pair_ipc和test_reqrep_ipc测试用例需修改/tmp目录为/data/local/tmp目录 + #3. test_spec_req和test_req_relaxed测试用例在鸿蒙系统,需给70ms以上的时间来完成zmq_socket的创建和连接,以保证请求的正确循环 + patch -p1 < `pwd`/../libzmq_oh_pkg.patch + patchflag=false + cd $OLDPWD + fi + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + #cmake -DZMQ_HAVE_SOCK_CLOEXEC_EXITCODE=0 -DZMQ_HAVE_SOCK_CLOEXEC_EXITCODE__TRYRUN_OUTPUT="Your_Expected_Output" ... + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" \ + -DZMQ_HAVE_TCP_KEEPINTVL_EXITCODE=FAILED_TO_RUN -DZMQ_HAVE_TCP_KEEPIDLE_EXITCODE=FAILED_TO_RUN \ + -DZMQ_HAVE_TCP_KEEPCNT_EXITCODE=FAILED_TO_RUN -DZMQ_HAVE_SO_KEEPALIVE_EXITCODE=FAILED_TO_RUN \ + -DZMQ_HAVE_SOCK_CLOEXEC_EXITCODE=FAILED_TO_RUN -DZMQ_HAVE_SOCK_CLOEXEC_EXITCODE__TRYRUN_OUTPUT="./" \ + -DZMQ_HAVE_TCP_KEEPCNT_EXITCODE__TRYRUN_OUTPUT="./" -DZMQ_HAVE_TCP_KEEPIDLE_EXITCODE__TRYRUN_OUTPUT="./" \ + -DZMQ_HAVE_TCP_KEEPINTVL_EXITCODE__TRYRUN_OUTPUT="./" -DZMQ_HAVE_SO_KEEPALIVE_EXITCODE__TRYRUN_OUTPUT="./" \ + -DOHOS_ARCH=$ARCH -B$ARCH-build -S./ -L > $buildlog 2>&1 + $MAKE VERBOSE=1 -C $ARCH-build >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + make -C $ARCH-build install >> $buildlog 2>&1 + cd $OLDPWD +} + +# 进行测试的准备和说明 +check() { + echo "The test must be on an OpenHarmony device!" + cd $builddir/$ARCH-build + + # 屏蔽用例 + # test_abstract_ipc :该用例只用于linux平台测试 + # test_filter_ipc :检查用户是否属于补充组时,没有找到,系统本身对于组成员分配无法满足测试要求 + patterns_to_delete=( + "test_abstract_ipc" + "test_filter_ipc" + ) + + # 循环遍历数组并执行sed命令 + cp tests/CTestTestfile.cmake tests/CTestTestfile.cmake.bak + for pattern in "${patterns_to_delete[@]}"; do + sed -i "/${pattern}\"/{N;d;}" tests/CTestTestfile.cmake + done + + cd $OLDPWD +} + +# 清理环境 +cleanbuild() { + rm -rf ${PWD}/$builddir #${PWD}/$packagename +} diff --git a/community/libzmq/HPKCHECK b/community/libzmq/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..aed5c4d32504f31b6a7887548617d201de613bc5 --- /dev/null +++ b/community/libzmq/HPKCHECK @@ -0,0 +1,32 @@ +# 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: huangminzhong2 ,zhuangkun +# Maintainer: huangminzhong2 + +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 + ctest >> $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 +} diff --git a/community/libzmq/OAT.xml b/community/libzmq/OAT.xml new file mode 100644 index 0000000000000000000000000000000000000000..6c910b32a0f5cab1461a8807c1f474d998359e04 --- /dev/null +++ b/community/libzmq/OAT.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/community/libzmq/README.OpenSource b/community/libzmq/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..88ec53feacc4463704f282b8e8cb822bc1bdfb4c --- /dev/null +++ b/community/libzmq/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "libzmq", + "License": "MPL-2.0", + "License File": "https://github.com/zeromq/libzmq/blob/master/LICENSE", + "Version Number": "v4.8.1", + "Owner": "huangminzhong2@huawei.com", + "Upstream URL": "https://github.com/zeromq/libzmq", + "Description": "A library which extends the standard socket interfaces with features traditionally provided by specialised messaging middleware products." + } +] diff --git a/community/libzmq/README_zh.md b/community/libzmq/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..6dfc5a9590948ea7758c6c2b51d4c23f1ecb542c --- /dev/null +++ b/community/libzmq/README_zh.md @@ -0,0 +1,12 @@ +# zeromq三方库说明 +## 功能简介 +ZeroMQ轻量级消息传递内核是一个库,它扩展了标准套接字接口,使用传统上由专门的消息传递中间件产品提供的功能。 + +## 三方库版本 +- v4.8.1 + +## 使用约束 +- [IDE和SDK版本](../../docs/constraint.md) + +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) diff --git a/community/libzmq/SHA512SUM b/community/libzmq/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..7679af77a1c04a9f2e3544b701eb747f53b7efa8 --- /dev/null +++ b/community/libzmq/SHA512SUM @@ -0,0 +1 @@ +ead6eed1c48344105468ca09c03572135fbf1ec98e9c940c4dcb7ba23fc0ddbfbfac490f3cd3445fe743a65b8ed28c2d7d323baaff3ca42e24eb0e444fac137f libzmq-4.1.8.tar.gz diff --git a/community/libzmq/docs/hap_integrate.md b/community/libzmq/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..9e3a6924bb46cb93cfa0a0f56272d14e3a8996ce --- /dev/null +++ b/community/libzmq/docs/hap_integrate.md @@ -0,0 +1,72 @@ +# libzmq集成到应用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/libzmq #三方库libzmq的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── HPKCHECK #测试脚本 + ├── OAT.xml #扫描结果文件 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md #三方库简介 + ``` +- 在lycium目录下编译三方库 + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + ```shell + cd lycium + ./build.sh libzmq + ``` +- 三方库头文件及生成的库 + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + ```shell + libzmq/arm64-v8a libzmq/armeabi-v7a + ``` +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的头文件拷贝到该目录下; +- 在IDE的entry目录下新增libs目录,将编译生成的.so文件拷贝到该目录下。如下图所示: + + ![thirdparty_install_dir](pic/libzmq-dev.png) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + + ```cmake + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libzmq/${OHOS_ARCH}/lib/libzmq.so) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libzmq/${OHOS_ARCH}/include/) + ``` + + +## 测试三方库 + +- 编译出可执行的文件进行测试,[准备三方库测试环境](../../../lycium/README.md#3ci环境准备) + +- 进入到构建目录运行测试用例(注意arm64-v8a为构建64位的目录,armeabi-v7a为构建32位的目录),执行结果如图所示 +``` + cd /data/tpc_c_cplusplus/thirdparty/libzmq/libzmq-4.8.1/armeabi-v7a-build/ + ctest +``` + + ![libzmq_test](pic/test-cmd-ret.png) + +## 参考资料 + +* [OpenHarmony三方库地址](https://gitee.com/openharmony-tpc) +* [OpenHarmony知识体系](https://gitee.com/openharmony-sig/knowledge) +* [libzmq三方库地址](https://github.com/zeromq/libzmq) \ No newline at end of file diff --git a/community/libzmq/docs/pic/libzmq-dev.png b/community/libzmq/docs/pic/libzmq-dev.png new file mode 100644 index 0000000000000000000000000000000000000000..d8ce037f13d23efd2b206ee423d2592ed51c24f2 Binary files /dev/null and b/community/libzmq/docs/pic/libzmq-dev.png differ diff --git a/community/libzmq/docs/pic/test-cmd-ret.png b/community/libzmq/docs/pic/test-cmd-ret.png new file mode 100644 index 0000000000000000000000000000000000000000..32d03e3fd0fe197b64ebba161ab83e4dfeae98d7 Binary files /dev/null and b/community/libzmq/docs/pic/test-cmd-ret.png differ diff --git a/community/libzmq/libzmq_oh_pkg.patch b/community/libzmq/libzmq_oh_pkg.patch new file mode 100644 index 0000000000000000000000000000000000000000..e2211319fb505e0ca61c2413f84486889b62ffcc --- /dev/null +++ b/community/libzmq/libzmq_oh_pkg.patch @@ -0,0 +1,72 @@ +diff -urN libzmq-4.1.8_old/src/signaler.cpp libzmq-4.1.8/src/signaler.cpp +--- libzmq-4.1.8_old/src/signaler.cpp 2020-09-02 21:49:51.000000000 +0800 ++++ libzmq-4.1.8/src/signaler.cpp 2024-08-06 16:44:10.109644074 +0800 +@@ -321,7 +321,7 @@ + #if defined ZMQ_HAVE_EVENTFD + fd_t fd = eventfd (0, 0); + if (fd == -1) { +- errno_assert (errno == ENFILE || errno == EMFILE); ++ errno_assert (errno == ENFILE || errno == EMFILE || errno == ENOMEM); + *w_ = *r_ = -1; + return -1; + } +diff -urN libzmq-4.1.8_old/tests/test_pair_ipc.cpp libzmq-4.1.8/tests/test_pair_ipc.cpp +--- libzmq-4.1.8_old/tests/test_pair_ipc.cpp 2020-09-02 21:49:51.000000000 +0800 ++++ libzmq-4.1.8/tests/test_pair_ipc.cpp 2024-08-06 16:37:20.819150745 +0800 +@@ -37,12 +37,12 @@ + + void *sb = zmq_socket (ctx, ZMQ_PAIR); + assert (sb); +- int rc = zmq_bind (sb, "ipc:///tmp/tester"); ++ int rc = zmq_bind (sb, "ipc:///data/local/tmp/tester"); + assert (rc == 0); + + void *sc = zmq_socket (ctx, ZMQ_PAIR); + assert (sc); +- rc = zmq_connect (sc, "ipc:///tmp/tester"); ++ rc = zmq_connect (sc, "ipc:///data/local/tmp/tester"); + assert (rc == 0); + + bounce (sb, sc); +diff -urN libzmq-4.1.8_old/tests/test_req_relaxed.cpp libzmq-4.1.8/tests/test_req_relaxed.cpp +--- libzmq-4.1.8_old/tests/test_req_relaxed.cpp 2020-09-02 21:49:51.000000000 +0800 ++++ libzmq-4.1.8/tests/test_req_relaxed.cpp 2024-08-06 16:21:50.245261053 +0800 +@@ -64,7 +64,7 @@ + // We have to give the connects time to finish otherwise the requests + // will not properly round-robin. We could alternatively connect the + // REQ sockets to the REP sockets. +- msleep (SETTLE_TIME); ++ msleep (SETTLE_TIME * 10); + + // Case 1: Second send() before a reply arrives in a pipe. + +diff -urN libzmq-4.1.8_old/tests/test_reqrep_ipc.cpp libzmq-4.1.8/tests/test_reqrep_ipc.cpp +--- libzmq-4.1.8_old/tests/test_reqrep_ipc.cpp 2020-09-02 21:49:51.000000000 +0800 ++++ libzmq-4.1.8/tests/test_reqrep_ipc.cpp 2024-08-06 16:37:36.814645549 +0800 +@@ -37,12 +37,12 @@ + + void *sb = zmq_socket (ctx, ZMQ_REP); + assert (sb); +- int rc = zmq_bind (sb, "ipc:///tmp/tester"); ++ int rc = zmq_bind (sb, "ipc:///data/local/tmp/tester"); + assert (rc == 0); + + void *sc = zmq_socket (ctx, ZMQ_REQ); + assert (sc); +- rc = zmq_connect (sc, "ipc:///tmp/tester"); ++ rc = zmq_connect (sc, "ipc:///data/local/tmp/tester"); + assert (rc == 0); + + bounce (sb, sc); +diff -urN libzmq-4.1.8_old/tests/test_spec_req.cpp libzmq-4.1.8/tests/test_spec_req.cpp +--- libzmq-4.1.8_old/tests/test_spec_req.cpp 2020-09-02 21:49:51.000000000 +0800 ++++ libzmq-4.1.8/tests/test_spec_req.cpp 2024-08-06 16:21:30.584823410 +0800 +@@ -56,7 +56,7 @@ + // We have to give the connects time to finish otherwise the requests + // will not properly round-robin. We could alternatively connect the + // REQ sockets to the REP sockets. +- msleep (SETTLE_TIME); ++ msleep (SETTLE_TIME * 10); + + // Send our peer-replies, and expect every REP it used once in order + for (size_t peer = 0; peer < services; peer++) { diff --git a/community/linux-pam/HPKBUILD b/community/linux-pam/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..58c1290da6dbf8a2a1df0fe21aedafab35c88113 --- /dev/null +++ b/community/linux-pam/HPKBUILD @@ -0,0 +1,144 @@ +# 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: huangminzhong2 ,zhuangkun +# Maintainer: huangminzhong2 + +pkgname=linux-pam +pkgver=8562cb1b951e7bd807af6b43d85c71cedd7b10d7 +pkgrel=0 +pkgdesc="Linux-PAM offers flexible and scalable authentication solutions for Linux, allowing admins to configure authentication policies across apps via config files." +url="https://github.com/linux-pam" +archs=("armeabi-v7a" "arm64-v8a") +license=("BSD-3-Clause") +depends=() +makedepends=() + +source=https://github.com/linux-pam/linux-pam.git + +autounpack=false +downloadpackage=false +buildtools="configure" +builddir=$pkgname-${pkgver} +packagename= + +source envset.sh +autogenflags=true +patchflag=true +cloneflag=true +host= + +prepare() { + if $cloneflag + then + mkdir -p $builddir + git clone -b master $source $builddir > $publicbuildlog 2>&1 + if [ $? -ne 0 ] + then + return -1 + fi + + cd $builddir + git reset --hard $pkgver >> $publicbuildlog 2>&1 + if [ $? -ne 0 ] + then + return -2 + fi + + cd $OLDPWD + cloneflag=false + fi + + # 注释OHOS不支持的系统函数 + if $patchflag + then + cd $builddir + patch -p1 < `pwd`/../linux-pam_oh_pkg.patch >> $publicbuildlog 2>&1 + patchflag=false + cd $OLDPWD + fi + + if [ $ARCH == "armeabi-v7a" ] + then + setarm32ENV + host=arm-linux + elif [ $ARCH == "arm64-v8a" ] + then + setarm64ENV + host=aarch64-linux + else + echo "${ARCH} not support" + return -1 + fi + + if $autogenflags + then + cd $builddir + ./autogen.sh >> $publicbuildlog 2>&1 + cd ${OLDPWD} + fi + + cp -rf $builddir $builddir-$ARCH-build +} + +build() { + cd $builddir-$ARCH-build + CPPFLAGS="-DHELPER_COMPILE_R=1" ./configure "$@" --disable-doc --host=$host > $buildlog 2>&1 + $MAKE >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir-$ARCH-build + $MAKE install >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +check() { + echo "The test must be on an OpenHarmony device!" + cd $builddir-$ARCH-build + # 注释掉测试部分 + sed -i.bak 's|$(MAKE) $(AM_MAKEFLAGS) check-TESTS|# $(MAKE) $(AM_MAKEFLAGS) check-TESTS|g' tests/Makefile + $MAKE check >> $buildlog 2>&1 + # 注释掉编译部分 + sed -i '/^all: all-am$/,/^\t@:$/s/^/#/' tests/Makefile + sed -i 's|# $(MAKE) $(AM_MAKEFLAGS) check-TESTS|$(MAKE) $(AM_MAKEFLAGS) check-TESTS|g' tests/Makefile + ret=$? + cd $OLDPWD + return $ret +} + +recoverpkgbuildenv() { + unset host + if [ $ARCH == "armeabi-v7a" ] + then + unsetarm32ENV + elif [ $ARCH == "arm64-v8a" ] + then + unsetarm64ENV + else + echo "${ARCH} not support" + return -1 + fi +} + +# 清理环境 +cleanbuild(){ + rm -rf $builddir $builddir-armeabi-v7a-build $builddir-arm64-v8a-build +} + + diff --git a/community/linux-pam/HPKCHECK b/community/linux-pam/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..f47462bf2ae79887fa56ceb3d7f922c27ba367dd --- /dev/null +++ b/community/linux-pam/HPKCHECK @@ -0,0 +1,34 @@ +# 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: huangminzhong2 ,zhuangkun +# Maintainer: huangminzhong2 + +source HPKBUILD > /dev/null 2>&1 +logfile=${LYCIUM_THIRDPARTY_ROOT}/${pkgname}/${pkgname}_${ARCH}_${OHOS_SDK_VER}_test.log + +# 在OH环境执行测试的接口 +openharmonycheck() { + # 测试需要pam.conf文件 + cd ${builddir} + cp ./conf/pam.conf /data + cd $OLDPWD + + res=0 + cd ${builddir}-${ARCH}-build/tests + make check-TESTS > ${logfile} 2>&1 + res=$? + cd $OLDPWD + rm -f /data/pam.conf + return $res +} \ No newline at end of file diff --git a/community/linux-pam/OAT.xml b/community/linux-pam/OAT.xml new file mode 100644 index 0000000000000000000000000000000000000000..eeb1f946d683c0b81976cd06522096062a6901b9 --- /dev/null +++ b/community/linux-pam/OAT.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/community/linux-pam/README.OpenSource b/community/linux-pam/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..520d8bb1399ee9831f8c4b434b373cef810b1dd5 --- /dev/null +++ b/community/linux-pam/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "linux-pam", + "License": "BSD-3-Clause", + "License File": "https://github.com/linux-pam/linux-pam/blob/master/COPYING", + "Version Number": "8562cb1b951e7bd807af6b43d85c71cedd7b10d7", + "Owner": "huangminzhong2@huawei.com", + "Upstream URL": "https://github.com/linux-pam/linux-pam", + "Description": "Linux-PAM is a set of shared libraries that allow local system administrators to choose the program authentication method at will." + } +] diff --git a/community/linux-pam/README_zh.md b/community/linux-pam/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..8beadf3f041fe3999a8b7068ba10752f366bb06c --- /dev/null +++ b/community/linux-pam/README_zh.md @@ -0,0 +1,12 @@ +# linux-pam 三方库说明 +## 功能简介 +Linux-PAM是一套允许本地系统管理员随意选择程序认证方式的共享库。它通过提供一套灵活的验证机制,使得系统管理员可以在不重新编译应用程序的情况下,轻松切换或升级认证机制。 + +## 三方库版本 +- 8562cb1b951e7bd807af6b43d85c71cedd7b10d7 + +## 使用约束 +- [IDE和SDK版本](../../docs/constraint.md) + +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) diff --git a/community/linux-pam/SHA512SUM b/community/linux-pam/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..d25d4deef31b39df6d3f84ce96f9c348b75ecc2a --- /dev/null +++ b/community/linux-pam/SHA512SUM @@ -0,0 +1 @@ +4e4caef61fbc6f310feff8dd728577702c8fb7d8bee2ff6c35a19f423495d845a55dbe3f0fa3542b114f4bd77954e0f7f8af9e35a21736ac86b1ad4b09eff785 linux-pam-1.6.1.zip diff --git a/community/linux-pam/docs/hap_integrate.md b/community/linux-pam/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..52fcce729115e6bca394e562c43ae02014db1405 --- /dev/null +++ b/community/linux-pam/docs/hap_integrate.md @@ -0,0 +1,86 @@ +# linux-pam集成到应用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/linux-pam #三方库linux-pam的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── HPKCHECK #测试脚本 + ├── OAT.xml #扫描结果文件 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md #三方库简介 + ``` + +* 在lycium目录下编译三方库 + + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ```shell + cd lycium + ./build.sh linux-pam + ``` + +* 三方库头文件及生成的库 + + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ```shell + linux-pam/arm64-v8a linux-pam/armeabi-v7a + ``` + +* [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的头文件拷贝到该目录下; +- 在IDE的entry目录下新增libs目录,将编译生成的.so文件拷贝到该目录下,若没有so文件则无需新增libs目录。如下图所示: + + ![thirdparty_install_dir](pic/linux-pam-dev.png) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + + ```cmake + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/linux-pam/${OHOS_ARCH}/lib/libpam.so) + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/linux-pam/${OHOS_ARCH}/lib/libpam_misc.so) + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/linux-pam/${OHOS_ARCH}/lib/libpamc.so) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/linux-pam/${OHOS_ARCH}/include/) + ``` + +## 测试三方库 + +- 编译出可执行的文件进行测试,[准备三方库测试环境](../../../lycium/README.md#3ci环境准备) + +- 进入到构建目录运行测试用例(注意arm64-v8a为构建64位的目录,armeabi-v7a为构建32位的目录),执行结果如图所示 + + ``` + cd /data/tpc_c_cplusplus/thirdparty/linux-pam/linux-pam-8562cb1b951e7bd807af6b43d85c71cedd7b10d7-armeabi-v7a-build/tests + cp ../conf/pam.conf /data + make check-TESTS + rm -f /data/pam.conf + ``` + + ![linux-pam_test](pic/test-cmd-ret.png) + +## 参考资料 + +* [OpenHarmony三方库地址](https://gitee.com/openharmony-tpc) +* [OpenHarmony知识体系](https://gitee.com/openharmony-sig/knowledge) +* [linux-pam三方库地址](https://github.com/linux-pam) diff --git a/community/linux-pam/docs/pic/linux-pam-dev.png b/community/linux-pam/docs/pic/linux-pam-dev.png new file mode 100644 index 0000000000000000000000000000000000000000..9dd878fe88d9745f6fb1d5fed99f033865f86d8a Binary files /dev/null and b/community/linux-pam/docs/pic/linux-pam-dev.png differ diff --git a/community/linux-pam/docs/pic/test-cmd-ret.png b/community/linux-pam/docs/pic/test-cmd-ret.png new file mode 100644 index 0000000000000000000000000000000000000000..85d08f0b09daaca492b57513d8c9f0b82c1a80c2 Binary files /dev/null and b/community/linux-pam/docs/pic/test-cmd-ret.png differ diff --git a/community/linux-pam/linux-pam_oh_pkg.patch b/community/linux-pam/linux-pam_oh_pkg.patch new file mode 100644 index 0000000000000000000000000000000000000000..3eeee546c5a0bf5bbed45cd8e81dccc3ec30e75e --- /dev/null +++ b/community/linux-pam/linux-pam_oh_pkg.patch @@ -0,0 +1,72 @@ +From 5185a858acedb087c798b0300e8e477600d1b29a Mon Sep 17 00:00:00 2001 +From: xiong-qiushi +Date: Thu, 1 Aug 2024 18:07:49 +0800 +Subject: [PATCH 1/1] patch + +--- + Makefile.am | 2 +- + configure.ac | 4 ++-- + libpam/pam_modutil_getspnam.c | 2 +- + libpam/pam_private.h | 2 +- + 4 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/Makefile.am b/Makefile.am +index 8a2e31dd..e9b7c38d 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -4,7 +4,7 @@ + + AUTOMAKE_OPTIONS = 1.9 gnu dist-xz no-dist-gzip check-news + +-SUBDIRS = libpam_internal libpam tests libpamc libpam_misc modules po conf \ ++SUBDIRS = libpam_internal libpam tests libpamc libpam_misc po conf \ + xtests + + if HAVE_DOC +diff --git a/configure.ac b/configure.ac +index fc5cc085..bb28e03f 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -313,11 +313,11 @@ if test x"$enable_pamlocking" = "xyes"; then + fi + + AC_ARG_ENABLE(read-both-confs, +- AS_HELP_STRING([--enable-read-both-confs],[read both /etc/pam.d and /etc/pam.conf files])) ++ AS_HELP_STRING([--enable-read-both-confs],[read both /etc/pam.d and /data/tpc_c_cplusplus/thirdparty/linux-pam/pam.conf files])) + + if test x"$enable_read_both_confs" = "xyes"; then + AC_DEFINE([PAM_READ_BOTH_CONFS],, +- [read both /etc/pam.d and /etc/pam.conf files]) ++ [read both /etc/pam.d and /data/tpc_c_cplusplus/thirdparty/linux-pam/pam.conf files]) + fi + + AC_ARG_ENABLE([lckpwdf], +diff --git a/libpam/pam_modutil_getspnam.c b/libpam/pam_modutil_getspnam.c +index 8b48db90..c6756b06 100644 +--- a/libpam/pam_modutil_getspnam.c ++++ b/libpam/pam_modutil_getspnam.c +@@ -119,7 +119,7 @@ pam_modutil_getspnam(pam_handle_t *pamh, const char *user) + * getspnam(). So, we use the standard libc function. + */ + +- return getspnam(user); ++// return getspnam(user); + + #endif /* def HAVE_GETSPNAM_R */ + } +diff --git a/libpam/pam_private.h b/libpam/pam_private.h +index 77dc5a69..0880bf9c 100644 +--- a/libpam/pam_private.h ++++ b/libpam/pam_private.h +@@ -25,7 +25,7 @@ + + /* the Linux-PAM configuration file */ + +-#define PAM_CONFIG "/etc/pam.conf" ++#define PAM_CONFIG "/data/pam.conf" + #define PAM_CONFIG_D "/etc/pam.d" + #define PAM_CONFIG_DF "/etc/pam.d/%s" + #define PAM_CONFIG_DIST_D "/usr/lib/pam.d" +-- +2.34.1 + diff --git a/community/live555/HPKBUILD b/community/live555/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..5924aa8333a45ecbd57522f102ab8238e9311c97 --- /dev/null +++ b/community/live555/HPKBUILD @@ -0,0 +1,109 @@ +# Copyright (c) 2024 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: zhanghanyong +# Maintainer: zhanghanyong + +pkgname=live555 +pkgver=master +pkgrel=0 +pkgdesc="Skype Silk Codec SDK]Decode silk v3 audio files (like wechat amr, aud files, qq slk files) and convert to other format (like mp3). Batch conversion support." +url="https://github.com/rgaufman/live555" +archs=("arm64-v8a" "armeabi-v7a") # cpu 架构 +license=("LGPL-3.0, GPL-3.0 licenses found") +source="https://github.com/rgaufman/${pkgname}.git" +commitid=2c92a57ca04b83b2038ab2ab701d05a54be06a85 +autounpack=false +downloadpackage=false +buildtools="make" +depends=("openssl") + +builddir=$pkgname-${commitid} +packagename= +cloneflag=true + +prepare() { + if [ $cloneflag == true ] + then + mkdir $builddir + git clone -b $pkgver $source $builddir + if [ $? -ne 0 ] + then + return -1 + fi + cd $builddir + git reset --hard $commitid + if [ $? -ne 0 ] + then + return -2 + fi + cd $OLDPWD + cloneflag=false + fi + + mkdir -p $ARCH-build + cp $builddir/* $ARCH-build -rf + + if [ $ARCH == "armeabi-v7a" ]; then + cp -f config.armeabi-v7a $ARCH-build + elif [ $ARCH == "arm64-v8a" ]; then + cp -f config.arm64-v8a $ARCH-build + else + echo "Not support ${ARCH} yet" + return -1 + fi +} + +build() { + cd $ARCH-build/ + if [ $ARCH == "armeabi-v7a" ]; then + ./genMakefiles armeabi-v7a + elif [ $ARCH == "arm64-v8a" ]; then + ./genMakefiles arm64-v8a + else + echo "Not support ${ARCH} yet" + return -1 + fi + + $MAKE VERBOSE=1 >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +# 安装打包 +package() { + cd $ARCH-build/ + make DESTDIR=${LYCIUM_ROOT} PREFIX=/usr/${pkgname}/${ARCH} LIBDIR=/usr/${pkgname}/${ARCH}/lib install >> $buildlog 2>&1 + cd $OLDPWD +} + +# 测试,需要在 ohos 设备上进行 +check() { + echo "The test must be on an OpenHarmony device!" + if [ $ARCH == "armeabi-v7a" ] + then + cp ${OHOS_SDK}/native/llvm/lib/arm-linux-ohos/libc++_shared.so $LYCIUM_ROOT/usr/$pkgname/$ARCH/lib/ + elif [ $ARCH == "arm64-v8a" ] + then + cp ${OHOS_SDK}/native/llvm/lib/aarch64-linux-ohos/libc++_shared.so $LYCIUM_ROOT/usr/$pkgname/$ARCH/lib/ + else + echo "${ARCH} not support" + return -1 + fi +} + +# 清理环境 +cleanbuild() { + rm -rf ${PWD}/${ARCH}-build ${PWD}/${ARCH}-build ${PWD}/$builddir +} \ No newline at end of file diff --git a/community/live555/OAT.xml b/community/live555/OAT.xml new file mode 100644 index 0000000000000000000000000000000000000000..3c1a257f8889f16bd3c91a6d9c6090225a58e631 --- /dev/null +++ b/community/live555/OAT.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/community/live555/README.OpenSource b/community/live555/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..3c6c09ce3abb888968eee597e710907e5afda1d2 --- /dev/null +++ b/community/live555/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "live555", + "License": "LGPL-3.0, GPL-3.0 licenses found", + "License File": "LICENSES", + "Version Number": "", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://github.com/rgaufman/live555", + "Description": "Internet Streaming Media, Wireless, and Multicast technology, services, standards" + } +] diff --git a/community/live555/README_zh.md b/community/live555/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..a981fbf1b3b60e34c991d670151c570e6849796e --- /dev/null +++ b/community/live555/README_zh.md @@ -0,0 +1,14 @@ +# live555三方库说明 + +## 功能简介 + +互联网流媒体、无线和组播技术、服务和标准 + +## 三方库版本 +- 2c92a57ca04b83b2038ab2ab701d05a54be06a85 + +## 使用约束 +- [IDE和SDK版本](../../docs/constraint.md) + +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) diff --git a/community/live555/config.arm64-v8a b/community/live555/config.arm64-v8a new file mode 100644 index 0000000000000000000000000000000000000000..8ac1b43a73981198734dbb6f0cd7f926acc05cce --- /dev/null +++ b/community/live555/config.arm64-v8a @@ -0,0 +1,18 @@ +CROSS_COMPILE?= ${OHOS_SDK}/native/llvm/bin/ +COMPILE_OPTS = $(INCLUDES) -I${LYCIUM_ROOT}/usr/openssl/arm64-v8a/include -I. -O2 -DSOCKLEN_T=socklen_t -DNO_SSTREAM=1 -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64 -fPIC +C = c +C_COMPILER = $(CROSS_COMPILE)aarch64-linux-ohos-clang +C_FLAGS = $(COMPILE_OPTS) +CPP = cpp +CPLUSPLUS_COMPILER = $(CROSS_COMPILE)aarch64-linux-ohos-clang++ +CPLUSPLUS_FLAGS = $(COMPILE_OPTS) -Wall -DBSD=1 +OBJ = o +LINK = $(CROSS_COMPILE)aarch64-linux-ohos-clang++ -o +LINK_OPTS = +CONSOLE_LINK_OPTS = $(LINK_OPTS) +LIBRARY_LINK = $(CROSS_COMPILE)llvm-ar cr +LIBRARY_LINK_OPTS = $(LINK_OPTS) +LIB_SUFFIX = a +LIBS_FOR_CONSOLE_APPLICATION = ${LYCIUM_ROOT}/usr/openssl/arm64-v8a/lib/libssl.a ${LYCIUM_ROOT}/usr/openssl/arm64-v8a/lib/libcrypto.a +LIBS_FOR_GUI_APPLICATION = +EXE = diff --git a/community/live555/config.armeabi-v7a b/community/live555/config.armeabi-v7a new file mode 100644 index 0000000000000000000000000000000000000000..0a939b9e7b64b21a36a2963a90801326aab346e3 --- /dev/null +++ b/community/live555/config.armeabi-v7a @@ -0,0 +1,19 @@ +CROSS_COMPILE?= ${OHOS_SDK}/native/llvm/bin/ +COMPILE_OPTS = $(INCLUDES) -I${LYCIUM_ROOT}/usr/openssl/armeabi-v7a/include -I. -O2 -DSOCKLEN_T=socklen_t -DNO_SSTREAM=1 -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64 -fPIC +C = c +C_COMPILER = $(CROSS_COMPILE)arm-linux-ohos-clang +C_FLAGS = $(COMPILE_OPTS) +CPP = cpp +CPLUSPLUS_COMPILER = $(CROSS_COMPILE)arm-linux-ohos-clang++ +CPLUSPLUS_FLAGS = $(COMPILE_OPTS) -Wall -DBSD=1 +OBJ = o +LINK = $(CROSS_COMPILE)arm-linux-ohos-clang++ -o +LINK_OPTS = +CONSOLE_LINK_OPTS = $(LINK_OPTS) +LIBRARY_LINK = $(CROSS_COMPILE)llvm-ar cr +LIBRARY_LINK_OPTS = $(LINK_OPTS) +LIB_SUFFIX = a +LIBS_FOR_CONSOLE_APPLICATION = ${LYCIUM_ROOT}/usr/openssl/armeabi-v7a/lib/libssl.a ${LYCIUM_ROOT}/usr/openssl/armeabi-v7a/lib/libcrypto.a +LIBS_FOR_GUI_APPLICATION = +EXE = + diff --git a/community/live555/docs/hap_integrate.md b/community/live555/docs/hap_integrate.md new file mode 100755 index 0000000000000000000000000000000000000000..6bbe6112d741e6f77761c274a813c6c79090ac88 --- /dev/null +++ b/community/live555/docs/hap_integrate.md @@ -0,0 +1,98 @@ +# live555 集成到应用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/live555 #三方库live555的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── HPKCHECK #测试脚本 + ├── OAT.xml #OAT开源审查文本文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md #三方库简介 + ├── test.mp3 #测试用mp3文件 + ``` + +- 在lycium目录下编译三方库 + + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ```shell + cd lycium + ./build.sh live555 + ``` + +- 三方库头文件及生成的库 + + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ```shell + live555/arm64-v8a live555/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译live555和openssl生成的头文件和三方库静态库拷贝到该目录下,如下图所示: +  ![thirdparty_install_dir](pic/live555_install_dir.png) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + + ```shell + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/live555/${OHOS_ARCH}/lib/libliveMedia.a) + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/live555/${OHOS_ARCH}/lib/libBasicUsageEnvironment.a) + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/live555/${OHOS_ARCH}/lib/libgroupsock.a) + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/live555/${OHOS_ARCH}/lib/libUsageEnvironment.a) + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/live555/${OHOS_ARCH}/include/BasicUsageEnvironment) + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/live555/${OHOS_ARCH}/include/groupsock) + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/live555/${OHOS_ARCH}/include/liveMedia) + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/live555/${OHOS_ARCH}/include/UsageEnvironment) + + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/openssl/${OHOS_ARCH}/lib/libssl.a) + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/openssl/${OHOS_ARCH}/lib/libcrypto.a) + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/openssl/${OHOS_ARCH}/include) + ``` + +## 测试三方库 + +三方库无自动化测试,需手动执行服务端与客户端 + +将test.mp3放到mediaServer目录,进入mediaServer目录,将设备连接wifi或网络,执行以下命令启动服务端,并记录服务端打印的rtsp://信息 +```shell + # /data/tpc_c_cplusplus/thirdparty/live555/arm64-v8a-build/mediaServer + ./live555MediaServer +``` +输出如下 + ![live555_test_service](pic/live555_test_service.png) + +进入testProgs目录 + +然后执行testRTSPClient +```shell + # /data/tpc_c_cplusplus/thirdparty/live555/arm64-v8a-build/testProgs + ./testRTSPClient rtsp:///test.mp3 +``` +可以看到客户端开始接收数据。 + ![live555_test_client](pic/live555_test_client.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/community/live555/docs/pic/live555_install_dir.png b/community/live555/docs/pic/live555_install_dir.png new file mode 100644 index 0000000000000000000000000000000000000000..d34c9aa544fa2198fbc20d49b4e2c2a9aaef60ac Binary files /dev/null and b/community/live555/docs/pic/live555_install_dir.png differ diff --git a/community/live555/docs/pic/live555_test_client.png b/community/live555/docs/pic/live555_test_client.png new file mode 100644 index 0000000000000000000000000000000000000000..9235bf445de52f869471292af8fb993463efdae9 Binary files /dev/null and b/community/live555/docs/pic/live555_test_client.png differ diff --git a/community/live555/docs/pic/live555_test_service.png b/community/live555/docs/pic/live555_test_service.png new file mode 100644 index 0000000000000000000000000000000000000000..1818d5a8c1c6d2cdf22ea9f880501860def29dd8 Binary files /dev/null and b/community/live555/docs/pic/live555_test_service.png differ diff --git a/community/live555/test.mp3 b/community/live555/test.mp3 new file mode 100755 index 0000000000000000000000000000000000000000..85573aabb4945760a979388540f9374db46a968c Binary files /dev/null and b/community/live555/test.mp3 differ diff --git a/community/log4z-3.4.0/HPKBUILD b/community/log4z-3.4.0/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..12d31f1741f5da3a1a12881607e31c7109f67104 --- /dev/null +++ b/community/log4z-3.4.0/HPKBUILD @@ -0,0 +1,73 @@ +# 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<2942375747@qq.com>, wangying +# Maintainer: wangyihao<2471389@stu.neu.edu.cn>, wangjialun<2271411@stu.neu.edu.cn>, zhangqian<2371418@stu.neu.edu.cn>, wangying + +pkgname=log4z-3.4.0 +pkgver=v3.4.0 +pkgrel=0 +pkgdesc="Log4z is an open source C++ lightweight & cross platform log library." +url="https://github.com/zsummer/log4z/tree/v3.4.0" +archs=("armeabi-v7a" "arm64-v8a") +license=("MIT license") +depends=() +makedepends=() +source="https://github.com/zsummer/log4z/archive/refs/tags/v3.4.0.zip" + +downloadpackage=true +autounpack=true +buildtools=cmake +patchflag=true + +builddir=log4z-3.4.0 +packagename=log4z-v3.4.0.zip + +# 为编译设置环境,如设置环境变量,创建编译目录等 +prepare() { + if $patchflag + then + cd $builddir + patch -p1 < `pwd`/../log4z-3.4.0_oh_pkg.patch + # patch只需要打一次,关闭打patch + patchflag=false + cd $OLDPWD + fi + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" -DCMAKE_C_FLAGS="-Wno-unused-command-line-argument" \ + -DCMAKE_CXX_FLAGS="-Wno-unused-command-line-argument" -B$ARCH-build -S./ > $buildlog 2>&1 + $MAKE VERBOSE=1 -C $ARCH-build >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + $MAKE -C $ARCH-build install >> $buildlog 2>&1 + cd $OLDPWD +} + + +check() { + echo "The test must be on an OpenHarmony device!" +} + + +cleanbuild() { + rm -rf ${PWD}/$builddir +} \ No newline at end of file diff --git a/community/log4z-3.4.0/HPKCHECK b/community/log4z-3.4.0/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..b0543c6c7a83a67acb4e42d48d789a6ce984f66a --- /dev/null +++ b/community/log4z-3.4.0/HPKCHECK @@ -0,0 +1,49 @@ +# 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<2942375747@qq.com>, 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=/data/tpc_c_cplusplus/thirdparty/log4z-3.4.0/test/bin/${OHOS_SDK_VER}_test.log + +# 在OH环境执行测试的接口 +openharmonycheck() { + res=0 + cd /data/tpc_c_cplusplus/thirdparty/log4z-3.4.0/test/bin + + ./advanced_test >> ${logfile} 2>&1 + if [ $? -ne 0 ]; then + res=1 + # 保存测试失败日志 + mkdir ${LYCIUM_FAULT_PATH}/${pkgname} + cp Testing/Temporary/LastTest.log ${LYCIUM_FAULT_PATH}/${pkgname}/advanced_test_failed.log + fi + + ./fast_test >> ${logfile} 2>&1 + if [ $? -ne 0 ]; then + res=1 + mkdir ${LYCIUM_FAULT_PATH}/${pkgname} + cp Testing/Temporary/LastTest.log ${LYCIUM_FAULT_PATH}/${pkgname}/fast_test_failed.log + fi + + ./stress_test >> ${logfile} 2>&1 + if [ $? -ne 0 ]; then + res=1 + mkdir ${LYCIUM_FAULT_PATH}/${pkgname} + cp Testing/Temporary/LastTest.log ${LYCIUM_FAULT_PATH}/${pkgname}/stress_test_failed.log + fi + + cd $OLDPWD + return $res +} \ No newline at end of file diff --git a/community/log4z-3.4.0/README.OpenSource b/community/log4z-3.4.0/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..f932cab0f4fb8f29aa9dbc03d3b2dbf51393aa9e --- /dev/null +++ b/community/log4z-3.4.0/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "log4z-3.4.0", + "License": "MIT license", + "License File": "https://github.com/zsummer/log4z/blob/v3.4.0/COPYRIGHT", + "Version Number": "v3.4.0", + "Owner": "2942375747@qq.com", + "Upstream URL": "https://github.com/zsummer/log4z/tree/v3.4.0", + "Description": "Log4z is an open source C++ lightweight & cross platform log library." + } +] \ No newline at end of file diff --git a/community/log4z-3.4.0/README_zh.md b/community/log4z-3.4.0/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..e77e9105d533584cb01a74a4ce5de8836d678141 --- /dev/null +++ b/community/log4z-3.4.0/README_zh.md @@ -0,0 +1,9 @@ +# lpg4z三方库说明 +## 功能简介 +Log4z是一个开源的c++轻量级跨平台日志库。 +## 三方库版本: +- v3.4.0 +## 使用约束: +- [IDE和SDK版本](../../docs/constraint.md) +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) diff --git a/community/log4z-3.4.0/SHA512SUM b/community/log4z-3.4.0/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..40dba3bbb247b304c5f4d8257c9cd9bc84e5a769 --- /dev/null +++ b/community/log4z-3.4.0/SHA512SUM @@ -0,0 +1 @@ +f18147b53fc812174528037877f08988c4599706e0241c2cac6a75aa52088f30f4cdcc31c14417fc8950a886d03e94f5a409b7421ab2a81c428242448db2ae87 log4z-v3.4.0.zip \ No newline at end of file diff --git a/community/log4z-3.4.0/docs/hap_integrate.md b/community/log4z-3.4.0/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..2a05a2bf373d1fc765400ba8c18f9386d8d5915c --- /dev/null +++ b/community/log4z-3.4.0/docs/hap_integrate.md @@ -0,0 +1,80 @@ +# log4z集成到应用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/log4z-3.4.0 #三方库log4z-3.4.0的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── HPKCHECK #测试脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md #三方库简介 + ``` + +- 在lycium目录下编译三方库 + + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ```shell + cd lycium + ./build.sh log4z-3.4.0 + ``` + +- 三方库头文件及生成的库 + + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ```shell + log4z-3.4.0/arm64-v8a log4z-3.4.0/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +- 编译出可执行的文件进行测试,[准备三方库测试环境](../../../lycium/README.md#3ci环境准备) +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的头文件拷贝到该目录下,将编译生成的三方库以及依赖库全部(动态库名字带版本号和不带版本号的都需要)拷贝到工程的libs目录下,如下图所示: +   + +  ![thirdparty_install_dir](pic/log4z_install_dir.png) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + + ```shell + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/log4z/${OHOS_ARCH}/lib/liblog4z.a) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/log4z/${OHOS_ARCH}/include) + ``` + +## 测试三方库 +在测试用例所在目录下执行所有测试用例。 + +```shell + cd /data/tpc_c_cplusplus/thirdparty/log4z-3.4.0/test/bin + ./advanced_test & + ./fast_test & + ./stress_test & +``` + ![log4z_test](pic/log4z_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/community/log4z-3.4.0/docs/pic/log4z_install_dir.png b/community/log4z-3.4.0/docs/pic/log4z_install_dir.png new file mode 100644 index 0000000000000000000000000000000000000000..ad4941bbed92c448a5598fa775ec5e7ae021bdbd Binary files /dev/null and b/community/log4z-3.4.0/docs/pic/log4z_install_dir.png differ diff --git a/community/log4z-3.4.0/docs/pic/log4z_test.png b/community/log4z-3.4.0/docs/pic/log4z_test.png new file mode 100644 index 0000000000000000000000000000000000000000..0c935b739c758fbe78979ba0d50e6b110e66ea53 Binary files /dev/null and b/community/log4z-3.4.0/docs/pic/log4z_test.png differ diff --git a/community/log4z-3.4.0/log4z-3.4.0_oh_pkg.patch b/community/log4z-3.4.0/log4z-3.4.0_oh_pkg.patch new file mode 100644 index 0000000000000000000000000000000000000000..d1ffea5f5ba016febe6d59e0a28a99014d8d9a19 --- /dev/null +++ b/community/log4z-3.4.0/log4z-3.4.0_oh_pkg.patch @@ -0,0 +1,11 @@ +--- log4z-3.4.0_old/log4z.h 2017-09-28 01:37:48.000000000 +0800 ++++ log4z-3.4.0/log4z.h 2024-08-15 23:42:44.000000000 +0800 +@@ -826,7 +826,7 @@ + { + if ( fabst < 0.0001 || (!isSimple && fabst > 4503599627370495ULL) || (isSimple && fabst > 8388607)) + { +- gcvt(t, isSimple ? 7 : 16, _cur); ++ //gcvt(t, isSimple ? 7 : 16, _cur); + size_t len = strlen(_cur); + if (len > count) len = count; + _cur += len; diff --git a/community/lua/HPKBUILD b/community/lua/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..0a908286f86184b7a5b6365044a17c00e5f5b23b --- /dev/null +++ b/community/lua/HPKBUILD @@ -0,0 +1,88 @@ +# Copyright (c) 2024 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: xuxingguo +# Maintainer: xuxingguo + +pkgname=lua +pkgver=v5.4.6 +pkgrel=0 +pkgdesc="Lua is a powerful, efficient, lightweight, embeddable scripting language." +url="https://www.lua.org" +archs=("armeabi-v7a" "arm64-v8a") +license=("MIT License") +depends=() +makedepends=() +source="https://github.com/lua/$pkgname/archive/refs/tags/$pkgver.tar.gz" + +downloadpackage=true +autounpack=true +buildtools="make" + +builddir=$pkgname-${pkgver:1} +packagename=$builddir.tar.gz + +source envset.sh + +cc= +ar= +ld= +prepare() { + cp -rf $builddir $builddir-$ARCH-build/ + if [ $ARCH == "armeabi-v7a" ];then + setarm32ENV + cc=${OHOS_SDK}/native/llvm/bin/arm-linux-ohos-clang + elif [ $ARCH == "arm64-v8a" ];then + setarm64ENV + cc=${OHOS_SDK}/native/llvm/bin/aarch64-linux-ohos-clang + else + echo "$ARCH not support" + return -1 + fi + + ld=${OHOS_SDK}/native/llvm/bin/ld.lld + ar=${OHOS_SDK}/native/llvm/bin/llvm-ar +} + +build() { + $MAKE CC=${cc} LD=${ld} CFLAGS=-DLUA_USE_LINUX MYLIBS=-ldl -C $builddir-$ARCH-build VERBOSE=1 > \ + $buildlog 2>&1 + ret=$? + return $ret +} + +package() { + # lua 5.4.6不支持make install,故需要copy文件 + mkdir -p $LYCIUM_ROOT/usr/$pkgname/$ARCH/include + mkdir -p $LYCIUM_ROOT/usr/$pkgname/$ARCH/lib + mkdir -p $LYCIUM_ROOT/usr/$pkgname/$ARCH/bin + find ./$builddir-$ARCH-build -name '*.so' -exec cp -af {} $LYCIUM_ROOT/usr/$pkgname/$ARCH/lib/ \; + find ./$builddir-$ARCH-build -name 'liblua.a' -exec cp -af {} $LYCIUM_ROOT/usr/$pkgname/$ARCH/lib/ \; + find ./$builddir-$ARCH-build -name 'lua' -exec cp -af {} $LYCIUM_ROOT/usr/$pkgname/$ARCH/bin/ \; + find ./$builddir-$ARCH-build -name 'luac' -exec cp -af {} $LYCIUM_ROOT/usr/$pkgname/$ARCH/bin/ \; + find ./$builddir-$ARCH-build -name '*.h' -exec cp -af {} $LYCIUM_ROOT/usr/$pkgname/$ARCH/include/ \; +} + +recoverpkgbuildenv() { + unset cc ar ld +} + +check() { + echo "The test must be on an OpenHarmony device!" +} + +# 清理环境 +cleanbuild() { + rm -rf $builddir-$ARCH-build + rm -rf $builddir # $packagename +} diff --git a/community/lua/HPKCHECK b/community/lua/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..af55fa159adf96146536a553699a234e8beea66e --- /dev/null +++ b/community/lua/HPKCHECK @@ -0,0 +1,30 @@ +# Copyright (c) 2024 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: xuxingguo +# Maintainer: xuxingguo + +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 + + ${LYCIUM_ROOT}/../lycium/usr/lua/${ARCH}/bin/lua -v > ${logfile} 2>&1 + res=$? + rm -rf /usr/local/lib + cd $OLDPWD + return $res +} \ No newline at end of file diff --git a/community/lua/OAT.xml b/community/lua/OAT.xml new file mode 100644 index 0000000000000000000000000000000000000000..eeb1f946d683c0b81976cd06522096062a6901b9 --- /dev/null +++ b/community/lua/OAT.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/community/lua/README.OpenSource b/community/lua/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..62517444119f9bdc006f09c1ddb6b58c4cd906e9 --- /dev/null +++ b/community/lua/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "lua", + "License": "MIT", + "License File": "https://www.lua.org/license.html", + "Version Number": "v5.4.6", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://www.lua.org/ftp/lua-5.4.6.tar.gz", + "Description": "Lua is a powerful, efficient, lightweight, embeddable scripting language." + } +] \ No newline at end of file diff --git a/community/lua/README_zh.md b/community/lua/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..a3c104edc8cc22991f557915e6abeea7d8cd2edb --- /dev/null +++ b/community/lua/README_zh.md @@ -0,0 +1,12 @@ +# lua三方库说明 +## 功能简介 +Lua是一种强大、高效、轻量级、可嵌入的脚本语言。它支持过程编程、面向对象编程、函数式编程、数据驱动编程和数据描述 + +## 三方库版本 +- v5.4.6 + +## 使用约束 +- [IDE和SDK版本](../../docs/constraint.md) + +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) diff --git a/community/lua/SHA512SUM b/community/lua/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..f41a70257c4026acef3e95b2a65d8f25f67b24e0 --- /dev/null +++ b/community/lua/SHA512SUM @@ -0,0 +1 @@ +6582711740695500cf291a4e32061d74b046839a4128f2c135ceb27929a840ab85429342ef9b5f0221dffa3e7e4955c42fccdfd501822d42291bc9728cb4b4ae lua-5.4.6.tar.gz \ No newline at end of file diff --git a/community/lua/docs/hap_integrate.md b/community/lua/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..6ea65874c826983bbee416dc304b2a6f088cab1b --- /dev/null +++ b/community/lua/docs/hap_integrate.md @@ -0,0 +1,71 @@ +# lua 集成到应用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/lua #三方库lua的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── HPKCHECK #测试脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md #三方库简介 + ``` + +- 在lycium目录下编译三方库 + + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ```shell + cd lycium + ./build.sh lua + ``` + +- 三方库头文件及生成的库 + + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ```shell + lua/arm64-v8a lua/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +lua最终生成的是lua可执行文件,无需引入测试编译,引用原生库的测试逻辑即可。 + +## 测试三方库 + +- 将busybox推送到开发板 ,具体步骤如下: + + ```sh + hdc_std.exe file send lua /data/ ## 将测试资源推送到板子 + hdc_std.exe shell ## 进入设备系统 + cd /data + chmod a+x lua ## 设置busybox可执行权限 + ``` + +将lua推送开发板后,可以直接运行lua -v指令并可看到其执行结果,如下图所示: + ![lua_test](pic/lua_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) \ No newline at end of file diff --git a/community/lua/docs/pic/lua_test.png b/community/lua/docs/pic/lua_test.png new file mode 100644 index 0000000000000000000000000000000000000000..ec4601e4dc92bfe6f453cf9a40727ab4aed97a00 Binary files /dev/null and b/community/lua/docs/pic/lua_test.png differ diff --git a/community/lzma/BUILD.gn b/community/lzma/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..c60230fbc253183ca416d6642b14f13af705f0b8 --- /dev/null +++ b/community/lzma/BUILD.gn @@ -0,0 +1,208 @@ +# Copyright (c) 2021 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. + +import("//build/ohos.gni") + +declare_args() { + enable_lzma_test = false +} + +config("liblzma_config") { + include_dirs = [ + "./adapted", + "./lzma", + "./lzma/src", + "./lzma/src/liblzmadec", + ] + + cflags = [ + "-fPIC", + "-Wall", + "-Wextra", + "-fexceptions", + "-DHAVE_CONFIG_H", + "-DCOMPRESS_MF_BT", + "-DCOMPRESS_MF_BT4", + "-DCOMPRESS_MF_HC", + "-D_LZMA_IN_CB", + "-D_LZMA_OUT_READ", + "-D_LZMA_SYSTEM_SIZE_T", + "-D_LZMA_PROB32", + "-Wno-error=unused-parameter", + "-Wno-error=int-conversion", + "-Wno-error=format", + ] +} + +ohos_shared_library("lzma_shared") { + sources = [ + "./lzma/src/liblzmadec/main.c", + "./lzma/src/liblzmadec/buffer.c", + "./lzma/src/liblzmadec/io.c", + ] + + configs = [ + ":liblzma_config" + ] + + deps = [ + ] + + part_name = "lzma" +} + +config ("lzma_config") { + include_dirs = [ + "./adapted", + "./lzma/", + "./lzma/src", + "./lzma/src/liblzmadec", + "./lzma/src/lzma", + "./lzma/src/lzmadec", + "./lzma/src/lzmainfo", + "./lzma/src/sdk", + "./lzma/src/sdk/7zip", + "./lzma/src/sdk/7zip/Common", + "./lzma/src/sdk/Common", + "./lzma/src/sdk/7zip/Compress/LZMA/", + "./lzma/src/sdk/7zip/Compress/LZ/", + "./lzma/src/sdk/7zip/Compress/RangeCoder/", + ] + + cflags_cc = [ + "-fPIC", + "-Wall", + "-Wextra", + "-fexceptions", + "-DHAVE_CONFIG_H", + "-DHAVE_ERRNO_H", + "-DCOMPRESS_MF_BT", + "-DCOMPRESS_MF_BT4", + "-DCOMPRESS_MF_HC", + "-D_LZMA_IN_CB", + "-D_LZMA_OUT_READ", + "-D_LZMA_SYSTEM_SIZE_T", + "-D_LZMA_PROB32", + "-Wno-error=unused-parameter", + "-Wno-error=unused-variable", + "-Wno-error=sign-compare", + "-Wno-error=undef", + "-Wno-error=macro-redefined", + "-Wno-error=int-conversion", + "-Wno-error=format", + "-Wno-error=logical-op-parentheses", + "-Wno-error=parentheses", + ] + + cflags = [ + "-fPIC", + "-Wall", + "-Wextra", + "-fexceptions", + "-DHAVE_CONFIG_H", + "-DHAVE_ERRNO_H", + "-DCOMPRESS_MF_BT", + "-DCOMPRESS_MF_BT4", + "-DCOMPRESS_MF_HC", + "-D_LZMA_IN_CB", + "-D_LZMA_OUT_READ", + "-D_LZMA_SYSTEM_SIZE_T", + "-D_LZMA_PROB32", + "-Wno-error=unused-parameter", + "-Wno-error=unused-variable", + "-Wno-error=sign-compare", + "-Wno-error=undef", + "-Wno-error=macro-redefined", + "-Wno-error=int-conversion", + "-Wno-error=format", + ] +} + +ohos_executable("lzma") { + sources = [ + "./lzma/src/lzma/lzmp.cpp", + "./lzma/src/sdk/Common/C_FileIO.cpp", + "./lzma/src/sdk/Common/CRC.cpp", + "./lzma/src/sdk/Common/Alloc.cpp", + "./lzma/src/sdk/7zip/Common/FileStreams.cpp", + "./lzma/src/sdk/7zip/Common/InBuffer.cpp", + "./lzma/src/sdk/7zip/Common/OutBuffer.cpp", + "./lzma/src/sdk/7zip/Compress/LZMA/LZMAEncoder.cpp", + "./lzma/src/sdk/7zip/Compress/LZMA/LZMADecoder.h", + "./lzma/src/sdk/7zip/Compress/LZMA/LZMADecoder.cpp", + "./lzma/src/sdk/7zip/Compress/LZ/LZInWindow.cpp", + "./lzma/src/sdk/7zip/Compress/RangeCoder/RangeCoderBit.cpp", + "./lzma/src/sdk/7zip/Common/StreamUtils.cpp", + "./lzma/src/sdk/7zip/Compress/LZ/LZOutWindow.cpp", + ] + + public_configs = [ ":lzma_config" ] + + deps = [ + "//third_party/lzma:lzma_shared", + ] + + defines = [ + "PACKAGE_VERSION", + ] + + part_name = "lzma" +} + +ohos_executable("lzmadec") { + sources = [ + "./lzma/src/lzmadec/lzmadec.c" + ] + + public_configs = [ ":lzma_config" ] + + deps = [ + "//third_party/lzma:lzma_shared", + ] + + defines = [ + "PACKAGE_VERSION", + ] + + part_name = "lzma" +} + +ohos_executable("lzmainfo") { + sources = [ + "./lzma/src/lzmainfo/lzmainfo.c" + ] + + public_configs = [ ":lzma_config" ] + + deps = [ + "//third_party/lzma:lzma_shared", + ] + + defines = [ + "PACKAGE_VERSION", + ] + + part_name = "lzma" +} + +group("samples") { + if (enable_lzma_test) { + deps = [ + ":lzma", + ":lzmadec", + ":lzmainfo", + ] + } else { + deps = [] + } +} diff --git a/community/lzma/README.OpenSource b/community/lzma/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..a1d320edf91febaf0bf70fb8791e5ff7221f87a3 --- /dev/null +++ b/community/lzma/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "lzma", + "License": "GNU LGPLv2+", + "License File": "COPYRIGHT", + "Version Number": "4.32.7", + "Owner": "caiqi14@huawei.com", + "Upstream URL": "https://tukaani.org/lzma/", + "Description": "LZMA utils is a traditional data compression software with high compression ratio. LZMA utils uses the LZMA format." + } +] \ No newline at end of file diff --git a/community/lzma/README_zh.md b/community/lzma/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..06c67c31f81d07b4dd2263c9e96818c292256f25 --- /dev/null +++ b/community/lzma/README_zh.md @@ -0,0 +1,9 @@ +# lzma 三方库说明 +## 功能简介 +LZMA(Lempel-Ziv-Markov chain-Algorithm的缩写)是2001年以来得到发展的一个数据压缩算法,它是一种高压缩比的传统数据压缩软件。 +## 使用约束 +- ROM版本:OpenHarmony3.2 Beta1 +- 三方库版本:4.32.7 +- 当前适配的功能:完成了 .lzma 格式文件的压缩、解压缩 +## 集成方式 ++ [系统Rom包集成](docs/rom_integrate.md) \ No newline at end of file diff --git a/community/lzma/adapted/config.h b/community/lzma/adapted/config.h new file mode 100644 index 0000000000000000000000000000000000000000..74e8fa1b58f6281259b81292f0684d060a3595c0 --- /dev/null +++ b/community/lzma/adapted/config.h @@ -0,0 +1,192 @@ +/* config.h. Generated from config.h.in by configure. */ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if you have the declaration of `getenv', and to 0 if you don't. + */ +#define HAVE_DECL_GETENV 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ERRNO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if you have the `futimes' function. */ +#define HAVE_FUTIMES 1 + +/* Define to 1 if you have the `futimesat' function. */ +#define HAVE_FUTIMESAT 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_GETOPT_H 1 + +/* Define to 1 if you have the `getopt_long_only' function. */ +#define HAVE_GETOPT_LONG_ONLY 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LIMITS_H 1 + +/* Define to 1 if you have the `memmove' function. */ +#define HAVE_MEMMOVE 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the `memset' function. */ +#define HAVE_MEMSET 1 + +/* Define to 1 if you have the `snprintf' function. */ +#define HAVE_SNPRINTF 1 + +/* Define to 1 if stdbool.h conforms to C99. */ +#define HAVE_STDBOOL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDDEF_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the `strdup' function. */ +#define HAVE_STRDUP 1 + +/* Define to 1 if you have the `strerror' function. */ +#define HAVE_STRERROR 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strrchr' function. */ +#define HAVE_STRRCHR 1 + +/* Define to 1 if you have the `strtol' function. */ +#define HAVE_STRTOL 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the `utime' function. */ +#define HAVE_UTIME 1 + +/* Define to 1 if you have the `utimes' function. */ +#define HAVE_UTIMES 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UTIME_H 1 + +/* Define to 1 if the system has the type `_Bool'. */ +#define HAVE__BOOL 1 + +/* Define to the sub-directory where libtool stores uninstalled libraries. */ +#define LT_OBJDIR ".libs/" + +/* Define to disable debugging code. */ +#define NDEBUG 1 + +/* Name of package */ +#define PACKAGE "lzma" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "lasse.collin@tukaani.org" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "LZMA" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "LZMA 4.32.7" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "lzma" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "4.32.7" + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define to 1 if you can safely include both and . */ +#define TIME_WITH_SYS_TIME 1 + +/* Version number of package */ +#define VERSION "4.32.7" + +/* Enable large inode numbers on Mac OS X 10.5. */ +#ifndef _DARWIN_USE_64_BIT_INODE +# define _DARWIN_USE_64_BIT_INODE 1 +#endif + +/* Number of bits in a file offset, on hosts where this is settable. */ +/* #undef _FILE_OFFSET_BITS */ + +/* Define for large files, on AIX-style hosts. */ +/* #undef _LARGE_FILES */ + +/* Define to rpl_ if the getopt replacement functions and variables should be + used. */ +/* #undef __GETOPT_PREFIX */ + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +/* #undef inline */ +#endif + +/* Define to `int16_t' if or does not define it. */ +/* #undef int_fast16_t */ + +/* Define to `int32_t' if or does not define it. */ +/* #undef int_fast32_t */ + +/* Define to `int64_t' if or does not define it. */ +/* #undef int_fast64_t */ + +/* Define to `int8_t' if or does not define it. */ +/* #undef int_fast8_t */ + +/* Define to `int' if does not define. */ +/* #undef mode_t */ + +/* Define to `long int' if does not define. */ +/* #undef off_t */ + +/* Define to `unsigned int' if does not define. */ +/* #undef size_t */ + +/* Define to `uint16_t' if or does not define it. */ +/* #undef uint_fast16_t */ + +/* Define to `uint32_t' if or does not define it. */ +/* #undef uint_fast32_t */ + +/* Define to `uint64_t' if or does not define it. */ +/* #undef uint_fast64_t */ + +/* Define to `uint8_t' if or does not define it. */ +/* #undef uint_fast8_t */ diff --git a/community/lzma/bundle.json b/community/lzma/bundle.json new file mode 100644 index 0000000000000000000000000000000000000000..0c1bf6b7660976a00d15ada5d3e87f9d5d9261b8 --- /dev/null +++ b/community/lzma/bundle.json @@ -0,0 +1,33 @@ +{ + "name": "@ohos/lzma", + "description": "LZMA utils is a traditional data compression software with high compression ratio. LZMA utils uses the LZMA format.", + "version": "3.2", + "license": "GNU LGPLv2+", + "publishAs": "code-segment", + "segment": { + "destPath": "third_party/lzma" + }, + "dirs": {}, + "scripts": {}, + "readmePath": { + "en": "README" + }, + "component": { + "name": "lzma", + "subsystem": "thirdparty", + "syscap": [], + "features": [], + "adapted_system_type": [], + "rom": "", + "ram": "", + "deps": { + "components": [], + "third_party": [] + }, + "build": { + "sub_component": ["//third_party/lzma:lzma_shared","//third_party/lzma:samples"], + "inner_kits": [], + "test": [] + } + } +} \ No newline at end of file diff --git a/community/lzma/docs/pic/results.png b/community/lzma/docs/pic/results.png new file mode 100644 index 0000000000000000000000000000000000000000..3daf46bbe228d0e38ffc2dd4690b838ad21c7b8d Binary files /dev/null and b/community/lzma/docs/pic/results.png differ diff --git a/community/lzma/docs/rom_integrate.md b/community/lzma/docs/rom_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..06e44120f7f29f72d090672e03d9dc2898d667af --- /dev/null +++ b/community/lzma/docs/rom_integrate.md @@ -0,0 +1,112 @@ +# lzma如何集成到系统Rom +## 准备源码工程 +本库是基于OpenHarmony-v3.2-Beta1版本,在润和RK3568开发板上验证的。如果是从未使用过RK3568,可以先查看[润和RK3568开发板标准系统快速上手](https://gitee.com/openharmony-sig/knowledge_demo_temp/tree/master/docs/rk3568_helloworld)。 +## 准备系统Rom源码 +源码获取方法请参照:[OpenHarmony源码下载](https://gitee.com/openharmony/docs/blob/OpenHarmony-v3.2-Beta1/zh-cn/release-notes/OpenHarmony-v3.2-beta1.md#%E6%BA%90%E7%A0%81%E8%8E%B7%E5%8F%96) +## 增加构建脚本及配置文件 +- 下载本仓库代码 + ``` + cd ~/ + git clone git@gitee.com:openharmony-sig/tpc_c_cplusplus.git --depth=1 + ``` +- 三方库目录结构 + ``` + tpc_c_cplusplus/thirdparty/lzma + |-- adapted # 存放三方库适配需要的代码文件 + |-- docs # 存放三方库相关文档的文件夹 + |-- BUILD.gn # 构建脚本,支持rom包集成 + |-- bundle.json # 三方库组件定义文件 + ├── README.OpenSource # 说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md + ``` +- 将本仓库文件夹拷贝到third_party下 + ``` + cp ~/tpc_c_cplusplus/thirdparty/lzma ~/openharmony/third_party/ -rf + ``` +## 准备三方库源码 +- 将源码下载到lzma目录并将其解压出来。 +``` +cd ~/openharmony/third_party/lzma # 进入到lzma目录 +wget https://tukaani.org/lzma/lzma-4.32.7.tar.gz # 下载三方库 +tar -zxf lzma-4.32.7.tar.gz # 解压三方库 +mv lzma-4.32.7 lzma # 修改库外层文件夹名称 +``` +## 系统Rom中引入三方库 +准备完三方库代码后,我们需要将三方库加入到编译构建体系中。标准系统编译构建可以参考文档[标准系统编译构建指导](https://gitee.com/openharmony/docs/blob/OpenHarmony-3.2-Beta1/zh-cn/device-dev/subsystems/subsys-build-standard-large.md)。 +我们默认三方库是属于OpenHarmony的thirdparty子系统,如果需要自己定义子系统参考文档[如何为三方库组件中添加一个三方库](https://gitee.com/openharmony-sig/knowledge/blob/master/docs/openharmony_getstarted/port_thirdparty/README.md) +在OpenHarmony源码的vendor/hihope/rk3568/config.json文件中,新增需要编译的组件,如下: +``` +{ + "subsystem": "thirdparty", + "components": [ + { + "component": "musl", + "features": [] + }, + { + "component": "lzma", + "features": [] + } + ] +} +``` +## 系统Rom中引入三方库测试程序 +在OpenHarmony源码的vendor/hihope/rk3568/config.json文件,对应组件的features中打开编译选项,如下: +``` + { + "subsystem": "thirdparty", + "components": [ + { + "component": "musl", + "features": [] + }, + { + "component": "lzma", + "features": ["enable_lzma_test=true"] + } + ] + } +``` +## 编译工程 +在OpenHarmony源码根目录下 +``` +cd ~/openharmony +``` +- 选择产品 +``` +hb set # 该命令会列出所有可选平台,这里我们选择rk3568 +``` +- 运行编译 +``` +hb build --target-cpu arm64 # 编译64位系统使用:arm64, 编译32位系统使用:arm +``` +- 生成文件的路径,可执行文件和库文件都在out/rk3568/thirdparty/lzma目录下,同时也打包到了镜像中 +## 安装应用程序 +将编译生成的库和测试文件放到板子上运行,为避免每次将文件推入设备都烧录整个镜像,我们使用hdc_std工具将文件推到开发板上 +- 首先将hdc_std工具编译出来 + ``` + hb set # 源码根目录下使用hb set 选择产品ohos-sdk + hb build # 然后编译,编译出来在out/sdk/ohos-sdk/windows/toolchains/hdc_std.exe + ``` +- 将工具拷贝到Windows,可以为工具目录配置环境变量,也可以在工具所在目录打开windows命令行 +- 将原生库测试需要的所有文件打包成lzma.tar,并拷贝到windows下 +- 将文件推送到开发板,在windows命令行进行如下操作 + ``` + hdc_std shell mount -o remount,rw / # 修改系统权限为可读写 + hdc_std file send lzma.tar / # 将文件包推入开发板 + hdc_std shell # 进入开发板 + tar xvf lzma.tar # 解压 + cd lzma # 进入lzma目录 + mv liblzma_shared.z.so /system/lib64/ # 64位系统需要将库文件拷贝到系统lib64目录, 32位系统则是lib目录 + ``` +## 运行效果 +程序安装完后,我们通过运行如下命令测试了该库常用的.lzma文件压缩和解压缩功能,并和期望结果做对比,内容一致,总体运行结果如图: + + ![results](pic/results.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) +- [OpenHarmony源码下载](https://gitee.com/openharmony/docs/blob/OpenHarmony-v3.2-Beta1/zh-cn/release-notes/OpenHarmony-v3.2-beta1.md#%E6%BA%90%E7%A0%81%E8%8E%B7%E5%8F%96) +- [标准系统编译构建指导](https://gitee.com/openharmony/docs/blob/OpenHarmony-3.2-Beta1/zh-cn/device-dev/subsystems/subsys-build-standard-large.md) +- [如何为三方库组件中添加一个三方库](https://gitee.com/openharmony-sig/knowledge/blob/master/docs/openharmony_getstarted/port_thirdparty/README.md) diff --git a/community/mbedtls-polarssl-1.1.3/HPKBUILD b/community/mbedtls-polarssl-1.1.3/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..df2d569b3d91868dd141309fcdbfab004ef6634e --- /dev/null +++ b/community/mbedtls-polarssl-1.1.3/HPKBUILD @@ -0,0 +1,65 @@ +# 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<2942375747@qq.com> , wangying +# Maintainer: wangyihao<2942375747@qq.com>, wangjialun <2271411@stu.neu.edu.cn>, zhangqian<2371418@stu.neu.edu.cn>, wangying + +pkgname=mbedtls-polarssl-1.1.3 +pkgver=polarssl-1.1.3 +pkgrel=0 +pkgdesc="An open source, portable, easy to use, readable and flexible TLS library, and reference implementation of the PSA Cryptography API." +url="https://github.com/ARMmbed/mbedtls/tree/polarssl-1.1.3" +archs=("armeabi-v7a" "arm64-v8a") +license=("Apache-2.0 or GPL-2.0") +depends=() +makedepends=() +source="https://github.com/ARMmbed/mbedtls/archive/refs/tags/polarssl-1.1.3.zip" + +downloadpackage=true +autounpack=true +buildtools="cmake" + +builddir=mbedtls-polarssl-1.1.3 +packagename=mbedtls-polarssl-1.1.3.zip + +prepare() { + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + PKG_CONFIG_LIBDIR="${pkgconfigpath}" \ + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" \ + -DCMAKE_C_FLAGS="-Wno-unused-command-line-argument" \ + -DCMAKE_CXX_FLAGS="-Wno-unused-command-line-argument" -B$ARCH-build -S./ > $buildlog 2>&1 + $MAKE VERBOSE=1 -C $ARCH-build >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + $MAKE -C $ARCH-build install >> $buildlog 2>&1 + cd $OLDPWD +} + + +check() { + echo "The test must be on an OpenHarmony device!" +} + + +cleanbuild() { + rm -rf ${PWD}/$builddir +} diff --git a/community/mbedtls-polarssl-1.1.3/HPKCHECK b/community/mbedtls-polarssl-1.1.3/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..1ef2c9c92c12f723ca448ccccdd3dbfba4bf457a --- /dev/null +++ b/community/mbedtls-polarssl-1.1.3/HPKCHECK @@ -0,0 +1,34 @@ +# 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<2942375747@qq.com> , wangying +# Maintainer: wangyihao<2942375747@qq.com>, 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 + +# 测试前的准备, 如果不需要可以不写。 +checkprepare(){ + return 0 +} + +# 在OH环境执行测试的接口 +openharmonycheck() { + res=0 + cd ${builddir}/${ARCH}-build + ctest > ${logfile} 2>&1 + res=$? + cd $OLDPWD + + return $res +} \ No newline at end of file diff --git a/community/mbedtls-polarssl-1.1.3/OAT.xml b/community/mbedtls-polarssl-1.1.3/OAT.xml new file mode 100644 index 0000000000000000000000000000000000000000..eeb1f946d683c0b81976cd06522096062a6901b9 --- /dev/null +++ b/community/mbedtls-polarssl-1.1.3/OAT.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/community/mbedtls-polarssl-1.1.3/README.OpenSource b/community/mbedtls-polarssl-1.1.3/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..5578fbcb096c93b67e2853e73f955caa855cf228 --- /dev/null +++ b/community/mbedtls-polarssl-1.1.3/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "mbedtls-polarssl-1.1.3", + "License": "Apache-2.0 or GPL-2.0", + "License File": "https://github.com/Mbed-TLS/mbedtls/blob/development/LICENSE", + "Version Number": "polarssl-1.1.3", + "Owner": "2942375747@qq.com", + "Upstream URL": "https://github.com/Mbed-TLS/mbedtls", + "Description": "An open source, portable, easy to use, readable and flexible TLS library, and reference implementation of the PSA Cryptography API." + } +] \ No newline at end of file diff --git a/community/mbedtls-polarssl-1.1.3/README_zh.md b/community/mbedtls-polarssl-1.1.3/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..0bc3ad2fa9f55a6469ef97f67ebc8d72c287ea42 --- /dev/null +++ b/community/mbedtls-polarssl-1.1.3/README_zh.md @@ -0,0 +1,12 @@ +# mbedtls-polarssl 三方库说明 +## 功能简介 +它是一个开源的、可移植的、易于使用的、可读的和灵活的TLS库,以及PSA加密API的参考实现。 + +## 三方库版本 +- 1.1.3 + +## 使用约束 +- [IDE和SDK版本](../../docs/constraint.md) + +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) diff --git a/community/mbedtls-polarssl-1.1.3/SHA512SUM b/community/mbedtls-polarssl-1.1.3/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..0b29af612be3dbf628535cbe198da6120c7c549d --- /dev/null +++ b/community/mbedtls-polarssl-1.1.3/SHA512SUM @@ -0,0 +1 @@ +c0f0089ea2b6e07aa35ae0d26091361707fbac996bd44f14030e98962d889615c9a2965074cae5ee0c0eefe1397fae094d62a392780ea9aea8cddadd3c6b547c mbedtls-polarssl-1.1.3.zip \ No newline at end of file diff --git a/community/mbedtls-polarssl-1.1.3/docs/hap_integrate.md b/community/mbedtls-polarssl-1.1.3/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..e4474b05d5ba20d81c436edc9bbea2cbac6d3a47 --- /dev/null +++ b/community/mbedtls-polarssl-1.1.3/docs/hap_integrate.md @@ -0,0 +1,79 @@ +# mbedtls-polarssl-1.1.3 集成到应用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/mbedtls-polarssl-1.1.3 #三方库mbedtls-polarssl-1.1.3的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── HPKCHECK #测试脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md #三方库简介 + ``` + +- 在lycium目录下编译三方库 + + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ```shell + cd lycium + ./build.sh mbedtls-polarssl-1.1.3 + ``` + +- 三方库头文件及生成的库 + + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ```shell + mbedtls-polarssl-1.1.3/arm64-v8a mbedtls-polarssl-1.1.3/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +- 编译出可执行的文件进行测试,[准备三方库测试环境](../../../lycium/README.md#3ci环境准备) +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的头文件拷贝到该目录下,将编译生成的三方库以及依赖库全部拷贝到工程的libs目录下,如下图所示: +   + +  ![thirdparty_install_dir](pic/mbedtls-polarssl-1.1.3_install_dir.png) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + + ```shell + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/mbedtls-polarssl-1.1.3/${OHOS_ARCH}/lib/libpolarssl.a) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/mbedtls-polarssl-1.1.3/${OHOS_ARCH}/include) + ``` + +## 测试三方库 +在lycium目录下执行脚本./test.sh,自动运行thridparty目录下已编译的三方库, + + +```shell + cd lycium + ./test.sh mbedtls-polarssl-1.1.3 +``` + ![mbedtls-polarssl-1.1.3_test](pic/mbedtls-polarssl-1.1.3_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/community/mbedtls-polarssl-1.1.3/docs/pic/mbedtls-polarssl-1.1.3_install_dir.png b/community/mbedtls-polarssl-1.1.3/docs/pic/mbedtls-polarssl-1.1.3_install_dir.png new file mode 100644 index 0000000000000000000000000000000000000000..bb21b3447cb1baecbdcd9c3cdbe9427ce24aaca8 Binary files /dev/null and b/community/mbedtls-polarssl-1.1.3/docs/pic/mbedtls-polarssl-1.1.3_install_dir.png differ diff --git a/community/mbedtls-polarssl-1.1.3/docs/pic/mbedtls-polarssl-1.1.3_test.png b/community/mbedtls-polarssl-1.1.3/docs/pic/mbedtls-polarssl-1.1.3_test.png new file mode 100644 index 0000000000000000000000000000000000000000..a4abeaec4b0dcb9e78b71544aa8ffcdafd251b5e Binary files /dev/null and b/community/mbedtls-polarssl-1.1.3/docs/pic/mbedtls-polarssl-1.1.3_test.png differ diff --git a/community/mbedtls_2_4_2/HPKBUILD b/community/mbedtls_2_4_2/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..fe10208efc3d6af2c77798bad702b5978da2a544 --- /dev/null +++ b/community/mbedtls_2_4_2/HPKBUILD @@ -0,0 +1,66 @@ +# 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: 城meto +# Maintainer: 城meto + +pkgname=mbedtls_2_4_2 +pkgver=mbedtls-2.4.2 +pkgrel=0 +pkgdesc="Mbed TLS is a C library that implements cryptographic primitives, X.509 certificate manipulation and the SSL/TLS and DTLS protocols." +url="https://github.com/Mbed-TLS/mbedtls" +archs=("armeabi-v7a" "arm64-v8a") +license=("BSD-3-Clause") +depends=() +makedepends=() +source="https://codeload.github.com/Mbed-TLS/${pkgname:0:7}/zip/refs/tags/$pkgver" +buildtools="cmake" + +autounpack=true +downloadpackage=true + +builddir=${pkgname:0:7}-$pkgver +packagename=$pkgver.zip + +prepare() { + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + # 禁用注释检测、未使用的命令参数检测 + PKG_CONFIG_LIBDIR="${pkgconfigpath}" \ + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" \ + -DCMAKE_C_FLAGS="-Wno-error=documentation -Wno-error=unused-command-line-argument" \ + -DOHOS_ARCH=$ARCH -B$ARCH-build -S./ -L > $buildlog 2>&1 + $MAKE -C $ARCH-build VERBOSE=1 >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + $MAKE -C $ARCH-build install VERBOSE=1 >> $buildlog 2>&1 + cd $OLDPWD +} + +check() { + echo "The test must be on an OpenHarmony device!" + # real test + # ctest +} + +# 清理环境 +cleanbuild(){ + rm -rf ${PWD}/$builddir +} diff --git a/community/mbedtls_2_4_2/SHA512SUM b/community/mbedtls_2_4_2/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..213d5b22778d885309ea06045f2bc43f79ed9f54 --- /dev/null +++ b/community/mbedtls_2_4_2/SHA512SUM @@ -0,0 +1 @@ +28719f270ba21d623a8713112727432cc0d7612dc094783937b0cd52a6d1d52145d98838c7e58e2b3c15992dde2a3aa037e79fbdb5c68c6d405d00e7c817b4ef mbedtls-2.4.2.zip diff --git a/community/meshoptimizer-0.19/HPKBUILD b/community/meshoptimizer-0.19/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..2d57f1d5c1452f7ff28c696cb1520517cfb974b8 --- /dev/null +++ b/community/meshoptimizer-0.19/HPKBUILD @@ -0,0 +1,74 @@ +# 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=meshoptimizer-0.19 +pkgver=v0.19 +pkgrel=0 +pkgdesc="Mesh optimization library can make meshes smaller and faster to render" +url="https://github.com/zeux/meshoptimizer/tree/v0.19" +archs=("armeabi-v7a" "arm64-v8a") +license=("MIT License") +depends=() +makedepends=() +source="https://github.com/zeux/meshoptimizer/archive/refs/tags/v0.19.zip" + +downloadpackage=true +autounpack=true +buildtools=cmake +patchflag=true + +builddir=meshoptimizer-0.19 +packagename=meshoptimizer-v0.19.zip + +# 为编译设置环境,如设置环境变量,创建编译目录等 +prepare() { + if $patchflag + then + cd $builddir + # 为了可以在${builddir}/${ARCH}-build 目录下执行ctest来测试原库的测试用例 + # 需要在原库根目录下的CMakeLists.txt中打开构建单元测试的开关,并且进行链接库文件、注册测试用例等操作,将测试用例构建、编译为可执行文件 + patch -p1 < `pwd`/../meshoptimizer-0.19_oh_pkg.patch + # patch只需要打一次,关闭打patch + patchflag=false + cd $OLDPWD + fi + + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" -DCMAKE_C_FLAGS="-Wno-unused-command-line-argument" \ + -DCMAKE_CXX_FLAGS="-Wno-unused-command-line-argument" -B$ARCH-build -S./ > $buildlog 2>&1 + $MAKE VERBOSE=1 -C $ARCH-build >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + $MAKE -C $ARCH-build install >> $buildlog 2>&1 + cd $OLDPWD +} + +check() { + echo "The test must be on an OpenHarmony device!" +} + +cleanbuild() { + rm -rf ${PWD}/$builddir +} \ No newline at end of file diff --git a/community/meshoptimizer-0.19/HPKCHECK b/community/meshoptimizer-0.19/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..45087f23bbfe1b9cac2c3352e606b765ef4a975f --- /dev/null +++ b/community/meshoptimizer-0.19/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: 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}_${OHOS_SDK_VER}_test.log + + +# 在OH环境执行测试的接口 +openharmonycheck() { + res=0 + cd ${builddir}/${ARCH}-build # 进入到测试目录 + ctest > $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/community/meshoptimizer-0.19/README.OpenSource b/community/meshoptimizer-0.19/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..8e20d60cd56c44421d4b6a552d8a3db0aa7802f5 --- /dev/null +++ b/community/meshoptimizer-0.19/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "meshoptimizer-0.19", + "License": "MIT License", + "License File": "https://github.com/zeux/meshoptimizer/blob/master/LICENSE.md", + "Version Number": "0.19", + "Owner": "2942375747@qq.com", + "Upstream URL": "https://github.com/zeux/meshoptimizer", + "Description": "Mesh optimization library can make meshes smaller and faster to render" + } +] \ No newline at end of file diff --git a/community/meshoptimizer-0.19/README_zh.md b/community/meshoptimizer-0.19/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..ef5b5137e2d0ce70c4fa0a8de1b9c269c8561ca3 --- /dev/null +++ b/community/meshoptimizer-0.19/README_zh.md @@ -0,0 +1,9 @@ +# meshoptimizer三方库说明 +## 功能简介 +meshoptimizer是一个网格优化库,使网格更小,更快地渲染 +## 三方库版本: +- 0.19 +## 使用约束: +- [IDE和SDK版本](../../docs/constraint.md) +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) \ No newline at end of file diff --git a/community/meshoptimizer-0.19/SHA512SUM b/community/meshoptimizer-0.19/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..7857db6e31deddf8b4965ad56c4b8fbae91e142b --- /dev/null +++ b/community/meshoptimizer-0.19/SHA512SUM @@ -0,0 +1 @@ +42e932021466f4f3c69a000659aad65c3ae70a8217b0dc74391403f2ee9577ea850aeeaf11fbd6599358d6ba0d6d229903d9cd087f2e6f23c5af15364f39e490 meshoptimizer-v0.19.zip \ No newline at end of file diff --git a/community/meshoptimizer-0.19/docs/hap_integrate.md b/community/meshoptimizer-0.19/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..36ea474d96aeb3cd67bb23093afda6105d084aa8 --- /dev/null +++ b/community/meshoptimizer-0.19/docs/hap_integrate.md @@ -0,0 +1,80 @@ +# meshoptimizer集成到应用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/meshoptimizer-0.19 #三方库meshoptimizer-0.19的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── HPKCHECK #测试脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md #三方库简介 + ├── meshoptimizer-0.19_oh_pkg.patch #用于meshoptimizer-0.19库编译的补丁 + ``` + +- 在lycium目录下编译三方库 + + 编译环境的搭建参考 [准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ```shell + cd lycium + ./build.sh meshoptimizer-0.19 + ``` + +- 三方库头文件及生成的库 + + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ```shell + meshoptimizer-0.19/arm64-v8a meshoptimizer-0.19/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的头文件拷贝到该目录下,将编译生成的三方库以及依赖库全部(动态库名字带版本号和不带版本号的都需要)拷贝到工程的libs目录下,如下图所示: +   + +  ![thirdparty_install_dir](pic/meshoptimizer_install_dir.png) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + + ```shell + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/meshoptimizer/${OHOS_ARCH}/lib/libmeshoptimizer.a) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/meshoptimizer/${OHOS_ARCH}/include) + ``` + +## 测试三方库 +- 编译出可执行的文件,使用原库自带的测试用例来做测试 [准备三方库测试环境](../../../lycium/README.md#3ci环境准备) +进入到构建目录运行测试用例(注意arm64-v8a为构建64位的目录,armeabi-v7a为构建32位的目录),执行结果如图所示 + +```shell + cd /data/tpc_c_cplusplus/thirdparty/meshoptimizer-0.19/meshoptimizer-0.19/arm64-v8a-build/ + ./ctest +``` + ![meshoptimizer_test](pic/meshoptimizer_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/community/meshoptimizer-0.19/docs/pic/meshoptimizer_install_dir.png b/community/meshoptimizer-0.19/docs/pic/meshoptimizer_install_dir.png new file mode 100644 index 0000000000000000000000000000000000000000..a820c29c1a8a47b288ca4599b44134f68bceb0aa Binary files /dev/null and b/community/meshoptimizer-0.19/docs/pic/meshoptimizer_install_dir.png differ diff --git a/community/meshoptimizer-0.19/docs/pic/meshoptimizer_test.png b/community/meshoptimizer-0.19/docs/pic/meshoptimizer_test.png new file mode 100644 index 0000000000000000000000000000000000000000..5e211fd6b79b0f6a189fc118b77711baec61b532 Binary files /dev/null and b/community/meshoptimizer-0.19/docs/pic/meshoptimizer_test.png differ diff --git a/community/meshoptimizer-0.19/meshoptimizer-0.19_oh_pkg.patch b/community/meshoptimizer-0.19/meshoptimizer-0.19_oh_pkg.patch new file mode 100644 index 0000000000000000000000000000000000000000..d7fd5ee7582dd6bf2e7679342754b0c847788bd9 --- /dev/null +++ b/community/meshoptimizer-0.19/meshoptimizer-0.19_oh_pkg.patch @@ -0,0 +1,29 @@ +diff -urN meshoptimizer-0.19_old/CMakeLists.txt meshoptimizer-0.19/CMakeLists.txt +--- meshoptimizer-0.19_old/CMakeLists.txt 2023-04-30 02:06:54.000000000 +0800 ++++ meshoptimizer-0.19/CMakeLists.txt 2024-10-02 15:19:47.590097999 +0800 +@@ -13,7 +13,7 @@ + + project(meshoptimizer VERSION 0.19 LANGUAGES CXX) + +-option(MESHOPT_BUILD_DEMO "Build demo" OFF) ++option(MESHOPT_BUILD_DEMO "Build demo" ON) + option(MESHOPT_BUILD_GLTFPACK "Build gltfpack" OFF) + option(MESHOPT_BUILD_SHARED_LIBS "Build shared libraries" OFF) + option(MESHOPT_WERROR "Treat warnings as errors" OFF) +@@ -91,10 +91,14 @@ + + set(TARGETS meshoptimizer) + +-if(MESHOPT_BUILD_DEMO) ++ ++ # 启用 CTest 测试 ++ enable_testing() ++ # 添加测试可执行文件 + add_executable(demo demo/main.cpp demo/tests.cpp tools/meshloader.cpp) + target_link_libraries(demo meshoptimizer) +-endif() ++ # 添加测试 ++ add_test(NAME MeshOptimizerTestsDemo COMMAND demo) + + if(MESHOPT_BUILD_GLTFPACK) + add_executable(gltfpack ${GLTF_SOURCES} tools/meshloader.cpp) diff --git a/community/minizip-ng-1.2/HPKBUILD b/community/minizip-ng-1.2/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..0c74ba426fc864dff6a8bf132ed651864e03f010 --- /dev/null +++ b/community/minizip-ng-1.2/HPKBUILD @@ -0,0 +1,64 @@ +# 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: Jeff Han ,li-santian <2372581223@qq.com> +# Maintainer: Jeff Han + +pkgname=minizip-ng-1.2 +#源库依赖的是minizip-ng的1.2的分支,但是这个分支没有tag包,所以用的提交号版本 +pkgvel=8658af7e0a73d6ac4d94e81dde0e9fa95b1aff47 +pkgdesc="minizip-ng is a zip manipulation library written in C that is supported on Windows, macOS, and Linux." +url="https://github.com/zlib-ng/minizip-ng/tree/1.2" +archs=("armeabi-v7a" "arm64-v8a") +license=("zlib") +depends=("zlib") +makedepends=() + +source="https://github.com/zlib-ng/minizip-ng/archive/${pkgvel}.zip" +builddir=${pkgname:0:10}-${pkgvel} +packagename=${pkgvel}.zip +autounpack=true +downloadpackage=true +buildtools="cmake" + +prepare() { + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" -DBUILD_TEST=ON \ + -DCMAKE_CXX_FLAGS="${CMAKE_C_FLAGS} -L${LYCIUM_ROOT}/usr/zlib/${ARCH}/lib -lz" \ + -DCMAKE_C_FLAGS="${CMAKE_C_FLAGS} -L${LYCIUM_ROOT}/usr/zlib/${ARCH}/lib -lz" \ + -B$ARCH-build -S./ > $buildlog 2>&1 + $MAKE VERBOSE=1 -C $ARCH-build >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + $MAKE -C $ARCH-build install >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +check() { + echo "The test must be on an OpenHarmony device!" +} + +cleanbuild() { + rm -rf ${PWD}/${builddir} +} diff --git a/community/minizip-ng-1.2/HPKCHECK b/community/minizip-ng-1.2/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..fb978321d292261fa8c14019bc373925fe1bdbd5 --- /dev/null +++ b/community/minizip-ng-1.2/HPKCHECK @@ -0,0 +1,40 @@ +# 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: Jeff Han ,li-santian <2372581223@qq.com> +# Maintainer: Jeff Han + +source HPKBUILD > /dev/null 2>&1 +logfile=${LYCIUM_THIRDPARTY_ROOT}/${pkgname}/${pkgname}_${ARCH}_${OHOS_SDK_VER}_test.log + +# 在OH环境执行测试的接口 +openharmonycheck() { + res=0 + cd ${builddir}/${ARCH}-build + cp -rf ../README.md readme.txt + ./minizip_exec readme.zip readme.txt > ${logfile} 2>&1 + if [ $? -ne 0 ] + then + cd $OLDPWD + return -1 + fi + ./miniunz_exec -l readme.zip >> ${logfile} 2>&1 + if [ $? -ne 0 ] + then + cd $OLDPWD + return -1 + fi + res=$? + cd $OLDPWD + return $res +} diff --git a/community/minizip-ng-1.2/OAT.xml b/community/minizip-ng-1.2/OAT.xml new file mode 100644 index 0000000000000000000000000000000000000000..eeb1f946d683c0b81976cd06522096062a6901b9 --- /dev/null +++ b/community/minizip-ng-1.2/OAT.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/community/minizip-ng-1.2/README.OpenSource b/community/minizip-ng-1.2/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..3b2b0c78c0feb5274cc8973fa12cabc22b185a75 --- /dev/null +++ b/community/minizip-ng-1.2/README.OpenSource @@ -0,0 +1,20 @@ +[ + { + "Name": "minizip-ng", + "License": "zlib", + "License File": "https://github.com/zlib-ng/minizip-ng/blob/develop/LICENSE", + "Version Number": "8658af7e0a73d6ac4d94e81dde0e9fa95b1aff47", + "Owner": "huangminzhong2@huawei.com", + "Upstream URL": "https://github.com/zlib-ng/minizip-ng/tree/1.2", + "Description": "minizip-ng is a zip manipulation library written in C that is supported on Windows, macOS, and Linux." + }, + { + "Name": "zlib", + "License": "zlib License", + "License File": "https://github.com/madler/zlib/blob/master/LICENSE", + "Version Number": "v1.2.13", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://github.com/madler/zlib/releases/download/v1.2.13/zlib-1.2.13.tar.gz", + "Description": "A massively spiffy yet delicately unobtrusive compression library." + } +] diff --git a/community/minizip-ng-1.2/README_zh.md b/community/minizip-ng-1.2/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..c3e2cc922c1b692aeda3f4c3f4c0810ce6b41b71 --- /dev/null +++ b/community/minizip-ng-1.2/README_zh.md @@ -0,0 +1,15 @@ +# minizip-ng三方库说明 + +## 功能简介 + +minizip-ng是一个用C编写的zip操作库,支持Windows、macOS和Linux。。 + +## 三方库版本 +- 1.2(8658af7e0a73d6ac4d94e81dde0e9fa95b1aff47) + +## 使用约束 +- [IDE和SDK版本](../../docs/constraint.md) + +## 集成方式 + ++ [应用hap包集成](docs/hap_integrate.md) diff --git a/community/minizip-ng-1.2/SHA52SUM b/community/minizip-ng-1.2/SHA52SUM new file mode 100644 index 0000000000000000000000000000000000000000..0e0220015a48b14566c20435b0ffc739e51d57ad --- /dev/null +++ b/community/minizip-ng-1.2/SHA52SUM @@ -0,0 +1 @@ +830974933cbf20a736fc35b5a84b9ee6626886cc3af01de2f5edbdde52cd2aa35c2735917a72236f1aae4c3653804c37287b4fb3ea7e511f27408bc2b2d31e6a 8658af7e0a73d6ac4d94e81dde0e9fa95b1aff47.zip diff --git a/community/minizip-ng-1.2/docs/hap_integrate.md b/community/minizip-ng-1.2/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..3d02947267c4e4b702ecbfa69f61234d43e8b680 --- /dev/null +++ b/community/minizip-ng-1.2/docs/hap_integrate.md @@ -0,0 +1,84 @@ +# minizip-ng-1.2集成到应用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/minizip-ng-1.2 #三方库minizip-ng-1.2的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── HPKCHECK #测试脚本 + ├── OAT.xml #扫描结果文件 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md #三方库简介 + ``` + +* 在lycium目录下编译三方库 + + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ```shell + cd lycium + ./build.sh minizip-ng-1.2 + ``` + +* 三方库头文件及生成的库 + + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ```shell + minizip-ng-1.2/arm64-v8a minizip-ng-1.2/armeabi-v7a + ``` + +* [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的头文件拷贝到该目录下; + + ![thirdparty_install_dir](pic/minizip-ng-1.2-dev.png) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + + ```cmake + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/minizip-ng-1.2/${OHOS_ARCH}/lib/libaes.a) + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/minizip-ng-1.2/${OHOS_ARCH}/lib/libminizip.a) + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/zlib/${OHOS_ARCH}/lib/libz.a) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/minizip-ng-1.2/${OHOS_ARCH}/include/) + ``` + +## 测试三方库 + +- 编译出可执行的文件进行测试,[准备三方库测试环境](../../../lycium/README.md#3ci环境准备) + +- 进入到构建目录运行测试用例(注意arm64-v8a为构建64位的目录,armeabi-v7a为构建32位的目录),执行结果如图所示 + + ``` + cd /data/tpc_c_cplusplus/thirdparty/minizip-ng-1.2/minizip-ng-8658af7e0a73d6ac4d94e81dde0e9fa95b1aff47/armeabi-v7a-build + cp ../README.md readme.txt + ./minizip_exec readme.zip readme.txt + ``` + + ![minizip-ng-1.2_test](pic/test-cmd-ret.png) + +## 参考资料 + +* [OpenHarmony三方库地址](https://gitee.com/openharmony-tpc) +* [OpenHarmony知识体系](https://gitee.com/openharmony-sig/knowledge) +* [minizip-ng-1.2三方库地址](https://github.com/zlib-ng/minizip-ng/tree/1.2) diff --git a/community/minizip-ng-1.2/docs/pic/minizip-ng-1.2-dev.png b/community/minizip-ng-1.2/docs/pic/minizip-ng-1.2-dev.png new file mode 100644 index 0000000000000000000000000000000000000000..a0ad268479fc3ad3217a2ece6b9570394d667f70 Binary files /dev/null and b/community/minizip-ng-1.2/docs/pic/minizip-ng-1.2-dev.png differ diff --git a/community/minizip-ng-1.2/docs/pic/test-cmd-ret.png b/community/minizip-ng-1.2/docs/pic/test-cmd-ret.png new file mode 100644 index 0000000000000000000000000000000000000000..3ed96b1beeca3919fbf87c02b1f5923faca0813d Binary files /dev/null and b/community/minizip-ng-1.2/docs/pic/test-cmd-ret.png differ diff --git a/community/minizip-ng/BUILD.gn b/community/minizip-ng/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..a866cc9f79ba5c4b8f03f4be30102d6bd8481dc2 --- /dev/null +++ b/community/minizip-ng/BUILD.gn @@ -0,0 +1,180 @@ +# Copyright (c) 2021 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. + +import("//build/ohos.gni") + +declare_args() { + enable_minizip_test = false +} + +config("libminizip_config") { + include_dirs = [ + "//third_party/openssl/include", + "//third_party/openssl/include/openssl/", + "//third_party/minizip-ng/minizip-ng", + "//third_party/bzip2", + "//third_party/zlib", + "//third_party/iconv/", + "//third_party/iconv/libiconv", + "//third_party/xz/xz/", + "//third_party/xz/xz/src/liblzma/api/", + "//third_party/zstd/zstd", + "//third_party/zstd/zstd/lib/", + ] + + cflags = [ + "-fPIC", + "-Wall", + "-Wextra", + "-frtti", + "-fexceptions", + "-std=gnu99", + "-Wno-error=missing-braces", + "-Wno-error=visibility", + "-Wno-error=unused-function", + "-Wno-error=unused-variable", + "-Wno-error=undef", + "-Wno-error=deprecated-declarations", + "-Wno-error=sign-compare", + "-Wno-error=parentheses-equality", + "-Wno-incompatible-pointer-types", + "-Wno-error=unused-parameter", + "-Wno-error=header-hygiene", + "-Wno-error=implicit-function-declaration", + "-DHAVE_BZIP2", + "-DHAVE_INTTYPES_H", + "-DHAVE_PKCRYPT", + "-DHAVE_STDINT_H", + "-DHAVE_WZAES", + "-DHAVE_ZLIB", + "-DHAVE_ZSTD", + "-DHAVE_LZMA", + "-DMZ_ZIP_SIGNING", + "-DHAVE_ICONV", + "-DLZMA_API_STATIC", + "-D_POSIX_C_SOURCE=200112L", + ] +} + +ohos_shared_library("minizip_shared") { + sources = [ + "//third_party/minizip-ng/minizip-ng/mz_compat.c", + "//third_party/minizip-ng/minizip-ng/mz_crypt.c", + "//third_party/minizip-ng/minizip-ng/mz_crypt_openssl.c", + "//third_party/minizip-ng/minizip-ng/mz_os.c", + "//third_party/minizip-ng/minizip-ng/mz_os_posix.c", + "//third_party/minizip-ng/minizip-ng/mz_strm.c", + "//third_party/minizip-ng/minizip-ng/mz_strm_buf.c", + "//third_party/minizip-ng/minizip-ng/mz_strm_bzip.c", + "//third_party/minizip-ng/minizip-ng/mz_strm_lzma.c", + "//third_party/minizip-ng/minizip-ng/mz_strm_mem.c", + "//third_party/minizip-ng/minizip-ng/mz_strm_os_posix.c", + "//third_party/minizip-ng/minizip-ng/mz_strm_pkcrypt.c", + "//third_party/minizip-ng/minizip-ng/mz_strm_split.c", + "//third_party/minizip-ng/minizip-ng/mz_strm_wzaes.c", + "//third_party/minizip-ng/minizip-ng/mz_strm_zlib.c", + "//third_party/minizip-ng/minizip-ng/mz_strm_zstd.c", + "//third_party/minizip-ng/minizip-ng/mz_zip.c", + "//third_party/minizip-ng/minizip-ng/mz_zip_rw.c", + ] + + configs = [ ":libminizip_config" ] + + deps = [ + "//third_party/bzip2:libbz2", + "//third_party/iconv:iconv", + "//third_party/openssl:libcrypto_shared", + "//third_party/xz:libxz", + "//third_party/zlib:libz_shared", + "//third_party/zstd:zstd_shared", + ] + + part_name = "minizip" +} + +ohos_executable("minizip") { + sources = [ "./minizip-ng/minizip.c" ] + + cflags = [ + "-DHAVE_BZIP2", + "-DHAVE_ICONV", + "-DHAVE_INTTYPES_H", + "-DHAVE_LZMA", + "-DHAVE_PKCRYPT", + "-DHAVE_STDINT_H", + "-DHAVE_WZAES", + "-DHAVE_ZLIB", + "-DHAVE_ZSTD", + "-DLZMA_API_STATIC", + "-DMZ_ZIP_SIGNING", + "-D_POSIX_C_SOURCE=200112L", + ] + + deps = [ "//third_party/minizip-ng:minizip_shared" ] + + part_name = "minizip" +} + +ohos_executable("minigzip") { + sources = [ "./minizip-ng/minigzip.c" ] + + public_configs = [ ":libminizip_config" ] + + deps = [ "//third_party/minizip-ng:minizip_shared" ] + + part_name = "minizip" +} + +config("minizip_config") { + include_dirs = [ + "//third_party/minizip-ng/minizip-ng", + "//third_party/minizip-ng/minizip-ng/test", + ] + + cflags = [ + "-DHAVE_COMPAT", + "-DHAVE_BZIP2", + "-DHAVE_INTTYPES_H", + "-DHAVE_PKCRYPT", + "-DHAVE_STDINT_H", + "-DHAVE_WZAES", + "-DHAVE_ZLIB", + "-DHAVE_LZMA", + "-DHAVE_ZSTD", + "-DMZ_ZIP_SIGNING", + "-DZLIB_COMPAT", + "-D_POSIX_C_SOURCE=200112L", + ] +} + +ohos_executable("minizip_test") { + sources = [ "./minizip-ng/test/test.c" ] + + public_configs = [ ":minizip_config" ] + + deps = [ "//third_party/minizip-ng:minizip_shared" ] + + part_name = "minizip" +} + +group("samples") { + if (enable_minizip_test) { + deps = [ + ":minigzip", + ":minizip", + ":minizip_test", + ] + } else { + deps = [] + } +} diff --git a/community/minizip-ng/CMakeLists.txt b/community/minizip-ng/CMakeLists.txt new file mode 100755 index 0000000000000000000000000000000000000000..cece8309b23b8d56afe95429fee4581ee78918d6 --- /dev/null +++ b/community/minizip-ng/CMakeLists.txt @@ -0,0 +1,329 @@ + +# Copyright (c) 2022 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. + +# the minimum version of CMake. +cmake_minimum_required(VERSION 3.4.1) +project(minizip-ng) + +set(MINIZIP_DEFINITIONS + -DHAVE_INTTYPES_H + -DHAVE_STDINT_H + -DLZMA_API_STATIC + -D_POSIX_C_SOURCE=200112L + -DOPENSSL_ARM64_PLATFORM + -D_GNU_SOURCE + -DHAVE_ZLIB + -DMZ_ZIP_NO_CRYPTO + ) + +set(MINIZIP_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/minizip-ng) +set(MINIZIP_SRC "${CMAKE_CURRENT_SOURCE_DIR}/minizip-ng/mz_crypt.c" + "${CMAKE_CURRENT_SOURCE_DIR}/minizip-ng/mz_os.c" + "${CMAKE_CURRENT_SOURCE_DIR}/minizip-ng/mz_strm.c" + "${CMAKE_CURRENT_SOURCE_DIR}/minizip-ng/mz_strm_buf.c" + "${CMAKE_CURRENT_SOURCE_DIR}/minizip-ng/mz_strm_mem.c" + "${CMAKE_CURRENT_SOURCE_DIR}/minizip-ng/mz_strm_split.c" + "${CMAKE_CURRENT_SOURCE_DIR}/minizip-ng/mz_zip.c" + "${CMAKE_CURRENT_SOURCE_DIR}/minizip-ng/mz_zip_rw.c" + "${CMAKE_CURRENT_SOURCE_DIR}/minizip-ng/mz_strm_zlib.c" + "${CMAKE_CURRENT_SOURCE_DIR}/minizip-ng/mz_os_posix.c" + "${CMAKE_CURRENT_SOURCE_DIR}/minizip-ng/mz_strm_os_posix.c" + ) + +set(LinkLib libz.so) + +if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../libiconv) +option(BUILD_ICONV "enable to build iconv" ON) +endif() + +if (BUILD_ICONV) +set(ICONV_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../iconv/adapter) +set(ICONV_SRC ${CMAKE_CURRENT_SOURCE_DIR}/../iconv/libiconv/lib/iconv.c + ${CMAKE_CURRENT_SOURCE_DIR}/../iconv/libiconv/lib/relocatable.c + ${CMAKE_CURRENT_SOURCE_DIR}/../iconv/libiconv/libcharset/lib/localcharset.c + ${CMAKE_CURRENT_SOURCE_DIR}/../iconv/libiconv/libcharset/lib/relocatable-stub.c + ) +set(ICONV_LIB_DEFINITIONS + -DCVAPI_EXPORTS + -D_USE_MATH_DEFINES + -D__STDC_CONSTANT_MACROS + -D__STDC_FORMAT_MACROS + -D__STDC_LIMIT_MACROS + -DHAVE_CONFIG_H + -DENABLE_RELOCATABLE=1 + -DBUILDING_LIBICONV + -DNO_XMALLOC) + +add_library(iconv SHARED ${ICONV_SRC}) +target_compile_definitions(iconv PRIVATE ${ICONV_LIB_DEFINITIONS}) +target_include_directories(iconv PUBLIC ${ICONV_INCLUDE_DIR}) + +list(APPEND MINIZIP_DEFINITIONS -DHAVE_ICONV) +list(APPEND MINIZIP_INCLUDE_DIR ${ICONV_INCLUDE_DIR}) +list(APPEND LinkLib iconv) +endif() + +if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../bzip2) +option(BUILD_BZIP "enable to build with bzip2" ON) +endif() + +if (BUILD_BZIP) +set(BZIP2_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../bzip2") +set(BZIP2_SRC + "${CMAKE_CURRENT_SOURCE_DIR}/../bzip2/blocksort.c" + "${CMAKE_CURRENT_SOURCE_DIR}/../bzip2/bzlib.c" + "${CMAKE_CURRENT_SOURCE_DIR}/../bzip2/compress.c" + "${CMAKE_CURRENT_SOURCE_DIR}/../bzip2/crctable.c" + "${CMAKE_CURRENT_SOURCE_DIR}/../bzip2/decompress.c" + "${CMAKE_CURRENT_SOURCE_DIR}/../bzip2/huffman.c" + "${CMAKE_CURRENT_SOURCE_DIR}/../bzip2/randtable.c") + +add_library(bzip2 SHARED ${BZIP2_SRC}) +target_include_directories(bzip2 PUBLIC ${BZIP2_INCLUDE_DIR}) + +list(APPEND MINIZIP_DEFINITIONS -DBZ_NO_STDIO -DHAVE_BZIP2) +list(APPEND MINIZIP_INCLUDE_DIR ${BZIP2_INCLUDE_DIR}) +list(APPEND LinkLib bzip2) +list(APPEND MINIZIP_SRC ${CMAKE_CURRENT_SOURCE_DIR}/minizip-ng/mz_strm_bzip.c) +endif() + +if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../zstd) +option(BUILD_ZSTD "enable to build with zstd" ON) +endif() +if (BUILD_ZSTD) +set(ZSTD_DEFINITIONS + -DZSTD_BUILD_CONTRIB + -DZSTD_BUILD_STATIC + -DZSTD_BUILD_TESTS + -DZSTD_ZLIB_SUPPORT + -DZSTD_LZMA_SUPPORT + -DZSTD_LIB_COMPRESSION + -DZSTD_LIB_DECOMPRESSION + -DZSTD_LIB_DICTBUILDER + -DHAVE_LZ4 + -DZSTD_LZ4COMPRESS + -DZSTD_LZ4DECOMPRESS + -DHAVE_PTHREAD + -DHAVE_THREAD + -DZSTD_MULTITHREAD + -DHAVE_ZLIB + -DZSTD_GZCOMPRESS + -DZSTD_GZDECOMPRESS + -DHAVE_LZMA + -DZSTD_LZMACOMPRESS + -DZSTD_LZMADECOMPRESS) +set(ZSTD_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../zstd + ${CMAKE_CURRENT_SOURCE_DIR}/../zstd/lib + ${CMAKE_CURRENT_SOURCE_DIR}/../zstd/lib/common + ${CMAKE_CURRENT_SOURCE_DIR}/../zstd/lib/compress + ${CMAKE_CURRENT_SOURCE_DIR}/../zstd/lib/decompress + ${CMAKE_CURRENT_SOURCE_DIR}/../zstd/lib/deprecated + ${CMAKE_CURRENT_SOURCE_DIR}/../zstd/lib/dictBuilder + ${CMAKE_CURRENT_SOURCE_DIR}/../zstd/lib/legacy + ) + +set(zstd_link_lib libz.so) + +if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../lz4) +set(LZ4_SRC ${CMAKE_CURRENT_SOURCE_DIR}/../lz4/lib/lz4.c + ${CMAKE_CURRENT_SOURCE_DIR}/../lz4/lib/lz4frame.c + ${CMAKE_CURRENT_SOURCE_DIR}/../lz4/lib/lz4hc.c + ${CMAKE_CURRENT_SOURCE_DIR}/../lz4/lib/xxhash.c) +SET(LZ4_INC_IDR ${CMAKE_CURRENT_SOURCE_DIR}/../lz4 ${CMAKE_CURRENT_SOURCE_DIR}/../lz4/lib) + +add_library(lz4 STATIC ${LZ4_SRC}) +target_include_directories(lz4 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../lz4) +target_compile_definitions(lz4 PRIVATE HAVE_CONFIG_H) + +list(APPEND zstd_link_lib lz4) +list(APPEND ZSTD_INCLUDE_DIR ${LZ4_INC_IDR}) +endif() + +if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../xz) +set(XZ_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../xz/adapted + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/common + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/lzma + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/common + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/lz + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/rangecoder + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/check + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/api + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/api/lzma + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/delta + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/simple + ) +set(XZ_SRC + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/common/tuklib_physmem.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/common/tuklib_cpucores.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/common/common.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/common/block_util.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/common/easy_preset.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/common/filter_common.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/common/hardware_physmem.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/common/index.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/common/stream_flags_common.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/common/vli_size.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/common/hardware_cputhreads.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/common/alone_encoder.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/common/block_buffer_encoder.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/common/block_encoder.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/common/block_header_encoder.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/common/easy_buffer_encoder.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/common/easy_encoder.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/common/easy_encoder_memusage.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/common/filter_buffer_encoder.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/common/filter_encoder.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/common/filter_flags_encoder.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/common/index_encoder.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/common/stream_buffer_encoder.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/common/stream_encoder.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/common/stream_flags_encoder.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/common/stream_flags_decoder.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/common/vli_encoder.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/common/outqueue.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/common/stream_encoder_mt.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/common/alone_decoder.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/common/auto_decoder.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/common/block_buffer_decoder.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/common/block_decoder.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/common/block_header_decoder.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/common/easy_decoder_memusage.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/common/filter_buffer_decoder.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/common/filter_decoder.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/common/filter_flags_decoder.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/common/index_decoder.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/common/index_hash.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/common/stream_buffer_decoder.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/common/stream_decoder.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/common/vli_decoder.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/check/check.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/check/crc32_table.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/check/crc32_fast.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/check/crc64_table.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/check/crc64_fast.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/check/sha256.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/lz/lz_encoder.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/lz/lz_encoder_mf.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/lz/lz_decoder.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/lzma/lzma_encoder_presets.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/lzma/lzma_encoder.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/lzma/lzma_encoder_optimum_fast.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/lzma/lzma_encoder_optimum_normal.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/lzma/fastpos_table.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/lzma/lzma_decoder.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/lzma/lzma2_encoder.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/lzma/lzma2_decoder.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/rangecoder/price_table.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/delta/delta_common.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/delta/delta_encoder.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/delta/delta_decoder.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/simple/simple_coder.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/simple/simple_encoder.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/simple/simple_decoder.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/simple/x86.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/simple/powerpc.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/simple/ia64.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/simple/arm.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/simple/armthumb.c + ${CMAKE_CURRENT_SOURCE_DIR}/../xz/libxz/src/liblzma/simple/sparc.c + ) + +set(XZ_DEFINES "-DHAVE_CONFIG_H" + "-DTUKLIB_SYMBOL_PREFIX=lzma_" + "-DPIC" + "-DLZMA_H_INTERNAL") + +add_library(xz SHARED ${XZ_SRC}) +target_include_directories(xz PUBLIC ${XZ_INCLUDE_DIR}) +target_compile_definitions(xz PRIVATE ${XZ_DEFINES}) + +list(APPEND zstd_link_lib xz) +list(APPEND ZSTD_INCLUDE_DIR XZ_INCLUDE_DIR) +endif() + +aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/../zstd/lib/common zstd_source_common) +aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/../zstd/lib/compress zstd_source_compress) +aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/../zstd/lib/decompress zstd_source_decompress) +aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/../zstd/lib/deprecated zstd_source_deprecated) +aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/../zstd/lib/dictBuilder zstd_source_dictBuilder) +aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/../zstd/lib/legacy zstd_source_legacy) + +add_library(zstd SHARED ${zstd_source_common} + ${zstd_source_compress} + ${zstd_source_decompress} + ${zstd_source_deprecated} + ${zstd_source_dictBuilder} + ${zstd_source_legacy}) + +target_compile_definitions(zstd PRIVATE ${ZSTD_DEFINITIONS}) +target_include_directories(zstd PUBLIC ${ZSTD_INCLUDE_DIR}) + +target_link_libraries(zstd ${zstd_link_lib}) + +list(APPEND MINIZIP_INCLUDE_DIR ${ZSTD_INCLUDE_DIR}) +list(APPEND MINIZIP_SRC ${CMAKE_CURRENT_SOURCE_DIR}/minizip-ng/mz_strm_zstd.c) +list(APPEND MINIZIP_DEFINITIONS -DHAVE_ZSTD) +list(APPEND LinkLib zstd) +endif() + +if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../lzma) +option(BUILD_LZMA "enable to build with zstd" ON) +endif() +if (BUILD_LZMA) +set(LZMA_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../lzma/lib) +aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/../lzma/lib lzma_source) + +add_library(lzma SHARED ${lzma_source}) +target_compile_options(lzma PRIVATE -Wno-incompatible-pointer-types -Werror -Wimplicit-function-declaration -Wno-error=unused-command-line-argument) +target_include_directories(lzma PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) + +list(APPEND MINIZIP_INCLUDE_DIR ${BZIP2_INCLUDE_DIR}) +list(APPEND MINIZIP_DEFINITIONS -DHAVE_LZMA -DLZMA_API_STATIC) +list(APPEND MINIZIP_SRC {CMAKE_CURRENT_SOURCE_DIR}/minizip-ng/mz_strm_lzma.c) +endif() + +set(MINIZIP_FLAG -fPIC + -Wno-error=implicit-function-declaration + -Wall + -Wextra + -Wno-error=missing-braces + -Wno-missing-braces + -Wno-error=visibility + -Wno-visibility + -Wno-error=unused-function + -Wno-unused-function + -Wno-error=unused-variable + -Wno-unused-variable + -Wno-error=undef + -Wno-error=deprecated-declarations + -Wno-deprecated-declarations + -Wno-error=sign-compare + -Wno-error=parentheses-equality + -Wno-parentheses-equality + -Wno-incompatible-pointer-types + -Wno-unused-command-line-argument + -Wno-error=unused-parameter + -Wno-unused-parameter + -Wno-error=header-hygiene + -frtti + -fexceptions + -std=gnu99) + +add_library(minizip_shared SHARED ${MINIZIP_SRC}) +target_include_directories(minizip_shared PUBLIC ${MINIZIP_SOURCE_DIR}) +target_compile_options(minizip_shared PRIVATE ${MINIZIP_FLAG}) +target_compile_definitions(minizip_shared PRIVATE ${MINIZIP_DEFINITIONS}) + +target_link_libraries(minizip_shared ${LinkLib}) diff --git a/community/minizip-ng/HPKBUILD b/community/minizip-ng/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..8e2b94d40dc48f29325e9669acc17a72f7c90c4e --- /dev/null +++ b/community/minizip-ng/HPKBUILD @@ -0,0 +1,57 @@ +# Contributor: lpzhong <278527840@qq.com> +# Maintainer: lpzhong <278527840@qq.com> +pkgname=minizip-ng +pkgver=4.0.0 +pkgrel=0 +pkgdesc="minizip-ng is a zip manipulation library written in C that is supported on Windows, macOS, and Linux." +url="https://github.com/zlib-ng/minizip-ng" +archs=("armeabi-v7a" "arm64-v8a") +license=("zlib") +depends=("openssl" "xz" "bzip2" "zstd" "googletest") +makedepends=() +source="https://github.com/zlib-ng/${pkgname}/archive/refs/tags/${pkgver}.tar.gz" + +autounpack=true +downloadpackage=true +buildtools="cmake" +builddir=$pkgname-$pkgver +packagename=$builddir.tar.gz + +patchflag=true +prepare() { + mkdir -p $builddir/$ARCH-build + if $patchflag + then + cd $builddir + # patch只需要打一次,关闭打patch + patch -p1 < $PKGBUILD_ROOT/minizip_oh_pkg.patch + cd $OLDPWD + patchflag=false + fi +} + +build() { + cd $builddir + PKG_CONFIG_PATH="${pkgconfigpath}" cmake "$@" -DMZ_BUILD_TESTS=ON -DMZ_BUILD_UNIT_TESTS=ON -DOHOS_ARCH=$ARCH -B$ARCH-build -S./ -L > `pwd`/$ARCH-build/build.log 2>&1 + make -j4 -C $ARCH-build >> `pwd`/$ARCH-build/build.log 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd "$builddir" + make -C $ARCH-build install >> `pwd`/$ARCH-build/build.log 2>&1 + cd $OLDPWD +} + +check() { + echo "The test must be on an OpenHarmony device!" + # real test cmd + # ctest +} + +# 清理环境 +cleanbuild(){ + rm -rf ${PWD}/$builddir #${PWD}/$packagename +} diff --git a/community/minizip-ng/README.OpenSource b/community/minizip-ng/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..3412986431cff565f06d193534a129149ce8911e --- /dev/null +++ b/community/minizip-ng/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "minizip-ng", + "License": "zlib", + "License File": "COPYRIGHT", + "Version Number": "3.0.4", + "Owner": "huangminzhong2@huawei.com", + "Upstream URL": "https://github.com/zlib-ng/minizip-ng", + "Description": "minizip-ng is a zip manipulation library written in C that is supported on Windows, macOS, and Linux." + } +] diff --git a/community/minizip-ng/README_zh.md b/community/minizip-ng/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..5eb078509438759e74397256c750e140a555b709 --- /dev/null +++ b/community/minizip-ng/README_zh.md @@ -0,0 +1,28 @@ +# minizip-ng 三方库说明 + +## 功能简介 + +minizip是一个用C编写的zip文件操作库。 + +## 三方库版本 +- 3.0.4 + +## 已适配功能 +- 创建和解压缩zip存档。 +- 在zip存档中添加和删除条目。 +- 从内存中读取和写入压缩文件。 +- Zlib、BZIP2、LZMA、XZ和ZSTD压缩方法。 +- 跟踪并存储符号链接。 +- 通过UTF-8编码支持Unicode文件名。 +- 传统字符编码支持CP437、CP932、CP936、CP950。 +- 关闭压缩、解压缩或加密的编译 +- 将本地文件头信息归零。 +- 压缩/解压缩中心目录以减小大小 +- 如果中心目录损坏或丢失,则恢复该目录 + +## 使用约束 +- [IDE和SDK版本](../../docs/constraint.md) + +## 集成方式 + +- [应用hap包集成](docs/hap_integrate.md) diff --git a/community/minizip-ng/SHA512SUM b/community/minizip-ng/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..5fe2303a6c635bfeebf997ccf186ad3b1bc3fcc8 --- /dev/null +++ b/community/minizip-ng/SHA512SUM @@ -0,0 +1 @@ +be3a9e9580847d595abbd200ec89a97e38086cab5b34d3a4db1507247ed04f9209290945989b200225ea412ee0e37fb9f1947404d1631d2dfeb5c6dc55ce3d05 minizip-ng-4.0.0.tar.gz diff --git a/community/minizip-ng/bundle.json b/community/minizip-ng/bundle.json new file mode 100644 index 0000000000000000000000000000000000000000..c86c812eb9286b4d84ae17e8f537e1898c0e82d5 --- /dev/null +++ b/community/minizip-ng/bundle.json @@ -0,0 +1,33 @@ +{ + "name": "@ohos/minizip", + "description": "minizip-ng is a zip manipulation library written in C that is supported on Windows, macOS, and Linux.", + "version": "3.1", + "license": "zip", + "publishAs": "code-segment", + "segment": { + "destPath": "third_party/minizip-ng" + }, + "dirs": {}, + "scripts": {}, + "readmePath": { + "en": "README" + }, + "component": { + "name": "minizip", + "subsystem": "thirdparty", + "syscap": [], + "features": [], + "adapted_system_type": [], + "rom": "", + "ram": "", + "deps": { + "components": [], + "third_party": [] + }, + "build": { + "sub_component": ["//third_party/minizip-ng:minizip_shared","//third_party/minizip-ng:samples"], + "inner_kits": [], + "test": [] + } + } +} \ No newline at end of file diff --git a/community/minizip-ng/docs/hap_integrate.md b/community/minizip-ng/docs/hap_integrate.md new file mode 100755 index 0000000000000000000000000000000000000000..aae9db39efefeac13883277e241d78162e269e18 --- /dev/null +++ b/community/minizip-ng/docs/hap_integrate.md @@ -0,0 +1,81 @@ +# minizip 集成到应用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/minizip-ng # 三方库minizip-ng的目录结构如下 + ├── docs # 三方库相关文档的文件夹 + ├── BUILD.gn # 构建脚本,支持rom包集成 + ├── bundle.json # 三方库组件定义文件 + ├── CMakeLists.txt # 构建脚本,支持hap包集成 + ├── HPKBUILD # 构建脚本,可生成北向应用调用的so文件 + ├── SHA512SUM # 三方库校验文件 + ├── README.OpenSource # 说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md + ``` + +- 在lycium目录下编译三方库 + + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ```shell + cd lycium + ./build.sh minizip-ng googletest xz zstd bzip2 openssl + ``` + +- 三方库头文件及生成的库 + + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库及其依赖库 + + ```shell + minizip-ng/arm64-v8a minizip-ng/armeabi-v7a + # 依赖库 + openssl/arm64-v8a openssl/armeabi-v7a xz/arm64-v8a xz/armeabi-v7a zstd/arm64-v8a zstd/armeabi-v7a bzip2/arm64-v8a bzip2/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的头文件拷贝到该目录下,将编译生成的三方库以及依赖库全部(动态库名字带版本号和不带版本号的都需要)拷贝到工程的libs目录下,如下图所示: + +  ![minizip_install_dir](pic/minizip_install_dir.png) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + + ```shell + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/libminizip.so) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/minizip-ng/${OHOS_ARCH}/include) + ``` + + +## 测试三方库 + +三方库的测试使用原库自带的测试用例来做测试,[准备三方库测试环境](../../../lycium/README.md#3ci环境准备) + +进入到构建目录执行`ctest`运行测试用例(arm64-v8a-build为构建64位的目录,armeabi-v7a-build为构建32位的目录) + + ![minizip_test](pic/minizip_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/community/minizip-ng/docs/hap_integrate.old.md b/community/minizip-ng/docs/hap_integrate.old.md new file mode 100755 index 0000000000000000000000000000000000000000..a4f6b08b1ef02b5f88f69ffc4d29c742d503c97c --- /dev/null +++ b/community/minizip-ng/docs/hap_integrate.old.md @@ -0,0 +1,112 @@ +# minizip-ng 如何集成到应用hap + +## 准备应用工程 + +本库是基于OpenHarmony SDK API Version 9版本,在润和RK3568开发板上验证的。如果是从未使用过RK3568,可以先查看[润和RK3568开发板标准系统快速上手](https://gitee.com/openharmony-sig/knowledge_demo_temp/tree/master/docs/rk3568_helloworld)。 + +### 准备应用开发环境 + +- IDE版本:DevEco Studio 3.0 Release +- SDK版本:OpenHarmony SDK +- API版本:API Version 9 + +应用环境准备具体可参照文档[通过IDE开发一个Napi工程](https://gitee.com/openharmony-sig/knowledge_demo_temp/blob/master/docs/napi_study/docs/hello_napi.md) + +### 增加构建脚本及配置文件 + +- 下载本仓库代码
+ 通过[C/C++三方库TCP仓](https://gitee.com/openharmony-sig/tpc_c_cplusplus)下载本三方库代码并将其解压。 +- 仓库代码目录结构说明 + + ```shell + tpc_c_cplusplus/thirdparty/minizip-ng + ├── docs # 存放三方库相关文档的文件夹 + ├── BUILD.gn # 构建脚本,支持rom包集成 + ├── bundle.json # 三方库组件定义文件 + ├── CMakeLists.txt # 构建脚本,支持hap包集成 + ├── README.OpenSource # 说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md # 三方库说明文档 + ``` + +- 将minizip-ng目录及其下面所有文件拷贝到工程的entry\src\main\cpp\third_party目录下。 + +### 准备三方库源码 + +- 准备三方库源码 + 通过[minizip-ng的github网站](https://github.com/zlib-ng/minizip-ng)下载3.0.4版本的源码包,并将源码包解压后拷贝到entry\src\main\cpp\third_party\minizip-ng目录,如下所示: + + ```shell + minizip-ng + ├── docs # 存放三方库相关文档的文件夹 + ├── BUILD.gn # 构建脚本,支持rom包集成 + ├── bundle.json # 三方库组件定义文件 + ├── minizip-ng # 三方库minizip-ng源码目录 + ├── CMakeLists.txt # 构建脚本,支持hap包集成 + ├── README.OpenSource # 说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md + ``` + +- 准备依赖库 + minizip依赖了zstd,libiconv,lz4,xz,bzip2以及zlib等库,除了zlib是SDK中已有的,其他库都需要下载。 + - [libiconv适配文件](../../iconv/docs/rom_integrate.md): 参照文档下载适配代码,将整个iconv文件夹拷贝到/entry/src/main/cpp/third_party
+ [libiconv源码](https://ftp.gnu.org/gnu/libiconv/libiconv-1.7.tar.gz):下载解压后改名为libiconv,并将该源码目录拷贝到iconv文件夹中 + - [zstd](https://github.com/facebook/zstd):下载v1.5.2版本,解压后并改为zstd + - [lz4](https://gitee.com/openharmony/third_party_lz4/repository/archive/master.zip):下载解压后并改名为lz4 + - [bzip2](https://gitee.com/openharmony/third_party_bzip2/repository/archive/master.zip):下载解压后并改名为bzip2 + - [xz适配文件](../../xz/docs/rom_integrate.md): 参照文档下载适配代码,将整个xz文件夹拷贝到/entry/src/main/cpp/third_party
+ [xz源码](https://tukaani.org/xz/xz-5.2.6.tar.gz):下载解压后改名为libxz,并将该源码目录拷贝到xz文件夹中 + 所有依赖库都拷贝到/entry/src/main/cpp/third_party下. + +## 应用中使用三方库 + +- 应用中引入三方库,三方库目录如下: + + ```shell + third_party + ├── minizip-ng # 三方库minizip-ng构建目录 + | ├── CMakeLists.txt # 构建脚本,支持hap包集成 + ├── zstd # 三方库minizip-ng的依赖库zstd源码目录 + ├── iconv # 三方库minizip-ng 的依赖库libiconv构建目录 + | ├── libiconv # libiconv源码目录 + | ├── adapter # libiconv适配代码目录 + ├── lz4 # 三方库minizip-ng的依赖库lz4源码目录 + ├── bzip2 # 三方库minizip-ng的依赖库bzip2源码目录 + ├── xz # 三方库minizip-ng的依赖库xz源码目录 + ``` + +- 修改CMakeLists.txt文件 + 在工程的entry\src\main\cpp\CMakeLists.txt中做以下修改: + + ```cmake + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/minizip-ng) + add_library(entry SHARED minizipNapi.cpp minizip.cpp) + target_include_directories(entry PUBLIC thirdparty/minizip-ng/minizip-ng) + target_link_libraries(entry PUBLIC libace_napi.z.so minizip_shared) + ``` + +- 应用中导入对应的库文件 + + ```js + import minizip from "libentry.so" + ``` + +- 完整demo参考: + [minizip三方库测试源码](https://gitee.com/openharmony-sig/knowledge_demo_temp/tree/master/FA/thirdparty/minizip_demo) + +## 编译工程 + +- 连接上设备后,DevEco Studio就会显示被发现设备。然后,点击“运行”,即可依次完成该应用“编译”和“安装”的过程,如图: +  ![install](pic/install.png) + +## 运行效果 + +安装hap应用后,在ets界面依次完成:压缩文件、解压缩文件、生成带密码和带全路径的压缩文件、解压带密码和带全路径的压缩文件操作后的结果,如下图:
+ ![ets_results](pic/ets_results.png) + +## 参考资料 + +- [润和RK3568开发板标准系统快速上手](https://gitee.com/openharmony-sig/knowledge_demo_temp/tree/master/docs/rk3568_helloworld) +- [通过IDE开发一个Napi工程](https://gitee.com/openharmony-sig/knowledge_demo_temp/blob/master/docs/napi_study/docs/hello_napi.md) +- [minizip三方库测试源码](https://gitee.com/openharmony-sig/knowledge_demo_temp/tree/master/FA/thirdparty/minizip_demo) +- [OpenHarmony知识体系](https://gitee.com/openharmony-sig/knowledge) + diff --git a/community/minizip-ng/docs/pic/ets_results.png b/community/minizip-ng/docs/pic/ets_results.png new file mode 100755 index 0000000000000000000000000000000000000000..2b22c490bf3a513efca31d6b6433992227fceefd Binary files /dev/null and b/community/minizip-ng/docs/pic/ets_results.png differ diff --git a/community/minizip-ng/docs/pic/install.png b/community/minizip-ng/docs/pic/install.png new file mode 100755 index 0000000000000000000000000000000000000000..58ac7e732a58239c3c256f918f4cbe5dafe1601a Binary files /dev/null and b/community/minizip-ng/docs/pic/install.png differ diff --git a/community/minizip-ng/docs/pic/minizip_install_dir.png b/community/minizip-ng/docs/pic/minizip_install_dir.png new file mode 100755 index 0000000000000000000000000000000000000000..13b91036e3e31d43591182a0450b0c1768339194 Binary files /dev/null and b/community/minizip-ng/docs/pic/minizip_install_dir.png differ diff --git a/community/minizip-ng/docs/pic/minizip_install_libs.png b/community/minizip-ng/docs/pic/minizip_install_libs.png new file mode 100755 index 0000000000000000000000000000000000000000..53be7f2a9c5a7e03c663fbcfcdf5c1b59ed912dd Binary files /dev/null and b/community/minizip-ng/docs/pic/minizip_install_libs.png differ diff --git a/community/minizip-ng/docs/pic/minizip_test.png b/community/minizip-ng/docs/pic/minizip_test.png new file mode 100755 index 0000000000000000000000000000000000000000..9b76b6f7f6eb3bffdf57567d2b93b251846a28ac Binary files /dev/null and b/community/minizip-ng/docs/pic/minizip_test.png differ diff --git a/community/minizip-ng/docs/pic/minizip_usage.png b/community/minizip-ng/docs/pic/minizip_usage.png new file mode 100755 index 0000000000000000000000000000000000000000..382a32dc326cb6137f451545c36ac0e64f1f6c0c Binary files /dev/null and b/community/minizip-ng/docs/pic/minizip_usage.png differ diff --git a/community/minizip-ng/docs/pic/results.png b/community/minizip-ng/docs/pic/results.png new file mode 100644 index 0000000000000000000000000000000000000000..4ee6b6d75392e0effb99cfa512ed60873649f94a Binary files /dev/null and b/community/minizip-ng/docs/pic/results.png differ diff --git a/community/minizip-ng/docs/rom_integrate.md b/community/minizip-ng/docs/rom_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..f0e856d6341001a68d1097630a2d88129413abfe --- /dev/null +++ b/community/minizip-ng/docs/rom_integrate.md @@ -0,0 +1,108 @@ +# minizip-ng如何集成到系统Rom +## 准备源码工程 +本库是基于OpenHarmony-v3.2-Beta1版本,在润和RK3568开发板上验证的。如果是从未使用过RK3568,可以先查看[润和RK3568开发板标准系统快速上手](https://gitee.com/openharmony-sig/knowledge_demo_temp/tree/master/docs/rk3568_helloworld)。 +## 准备系统Rom源码 +源码获取方法请参照:[OpenHarmony源码下载](https://gitee.com/openharmony/docs/blob/OpenHarmony-v3.2-Beta1/zh-cn/release-notes/OpenHarmony-v3.2-beta1.md#%E6%BA%90%E7%A0%81%E8%8E%B7%E5%8F%96) +## 增加构建脚本及配置文件 +- 下载本仓库代码 + ``` + cd ~/ + git clone git@gitee.com:openharmony-sig/tpc_c_cplusplus.git --depth=1 # 将本仓库下载到本地 + ``` +- 仓库代码目录结构说明 + ``` + tpc_c_cplusplus/thirdparty/minizip-ng + |-- docs # 存放三方库相关文档的文件夹 + |-- BUILD.gn # 构建脚本,支持rom包集成 + |-- bundle.json # 三方库组件定义文件 + ├── README.OpenSource # 说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md + ``` +- 将本仓库文件夹拷贝到third_party下 + ``` + cp ~/tpc_c_cplusplus/thirdparty/minizipi-ng ~/openharmony/third_party/ -rf + ``` +## 准备三方库源码 +- 将源码下载到minizip-ng目录并将其解压出来。 +``` +cd ~/OpenHarmony/third_party/minizip-ng # 进入到minizip目录 +git clone -b 3.0.4 https://github.com/zlib-ng/minizip-ng.git # 下载三方库 +``` +## 系统Rom中引入三方库测试程序 +准备完三方库代码后,我们需要将三方库加入到编译构建体系中。标准系统编译构建可以参考文档[标准系统编译构建指导](https://gitee.com/openharmony/docs/blob/OpenHarmony-3.2-Beta1/zh-cn/device-dev/subsystems/subsys-build-standard-large.md)。 +我们默认三方库是属于OpenHarmony的thirdparty子系统,如果需要自己定义子系统参考文档[如何为三方库组件中添加一个三方库](https://gitee.com/openharmony-sig/knowledge/blob/master/docs/openharmony_getstarted/port_thirdparty/README.md) +在OpenHarmony源码的vendor/hihope/rk356/config.json文件,新增需要编译的组件,如下: +``` +{ + "subsystem": "thirdparty", + "components": [ + { + "component": "musl", + "features": [] + }, + { + "component": "minizip", + "features": [] + } + ] +} +``` +## 系统Rom中引入三方库测试程序 +在OpenHarmony源码的vendor/hihope/rk356/config.json文件,对应组件的features中打开编译选项,如下: +``` +{ + "subsystem": "thirdparty", + "components": [ + { + "component": "musl", + "features": [] + }, + { + "component": "minizip", + "features": ["enable_minizip_test=true"] + } + ] +} +``` +## 编译工程 +在OpenHarmony源码根目录下 +``` +cd ~/openharmony +``` +- 选择产品 +``` +hb set # 该命令会列出所有可选平台,这里我们选择rk3568 +``` +- 运行编译 +``` +hb build --target-cpu arm64 # 编译64位系统使用:arm64, 编译32位系统使用:arm +``` +- 生成文件的路径,可执行文件和库文件都在out/rk3568/thirdparty/minizip目录下,同时也打包到了镜像中 +## 运行效果 +将编译生成的库和测试文件放到板子上运行,为避免每次将文件推入设备都烧录整个镜像,我们使用hdc_std工具将文件推到开发板上 +- 首先将hdc_std工具编译出来 + ``` + hb set # 首先,源码根目录下使用hb set 选择产品ohos-sdk + hb build # 然后,编译。最后,工具编译出来在out/sdk/ohos-sdk/windows/toolchains/hdc_std.exe + ``` +- 将工具拷贝到Windows,可以为工具目录配置环境变量,也可以在工具所在目录打开windows命令行 +- 将原生库测试需要的所有文件打包成minizip.tar,并拷贝到windows下 +- 将文件推送到开发板,在windows命令行进行如下操作 + ``` + hdc_std shell mount -o remount,rw / # 修改系统权限为可读写 + hdc_std file send minizip.tar / # 将文件包推入开发板 + hdc_std shell # 进入开发板 + tar xvf minizip.tar # 解压 + cd minizip # 进入minizip目录 + mv libminizip_shared.z.so /system/lib64/ # 64位系统需要将库文件拷贝到系统lib64目录, 32位系统则是lib目录 + ``` +- 运行测试程序 + 程序安装完后,由于测试用例较多,我们准备了1个测试文件 test.c,测试了该库常用的zip文件压缩和解压缩功能,并和期望结果做对比,内容一致,如图: +  ![results](pic/results.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) +- [OpenHarmony源码下载](https://gitee.com/openharmony/docs/blob/OpenHarmony-v3.2-Beta1/zh-cn/release-notes/OpenHarmony-v3.2-beta1.md#%E6%BA%90%E7%A0%81%E8%8E%B7%E5%8F%96) +- [标准系统编译构建指导](https://gitee.com/openharmony/docs/blob/OpenHarmony-3.2-Beta1/zh-cn/device-dev/subsystems/subsys-build-standard-large.md) +- [如何为三方库组件中添加一个三方库](https://gitee.com/openharmony-sig/knowledge/blob/master/docs/openharmony_getstarted/port_thirdparty/README.md) \ No newline at end of file diff --git a/community/minizip-ng/minizip_oh_pkg.patch b/community/minizip-ng/minizip_oh_pkg.patch new file mode 100644 index 0000000000000000000000000000000000000000..617c3096f2db32a2ef1fae4f55cb584dc4910d2f --- /dev/null +++ b/community/minizip-ng/minizip_oh_pkg.patch @@ -0,0 +1,22 @@ +--- + mz_os_posix.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/mz_os_posix.c b/mz_os_posix.c +index aefc1a4..9d95f8b 100644 +--- a/mz_os_posix.c ++++ b/mz_os_posix.c +@@ -57,7 +57,11 @@ uint8_t *mz_os_utf8_string_create(const char *string, int32_t encoding) { + else if (encoding == MZ_ENCODING_CODEPAGE_932) + from_encoding = "CP932"; + else if (encoding == MZ_ENCODING_CODEPAGE_936) ++#ifdef __OHOS__ ++ from_encoding = "GB18030"; ++#else + from_encoding = "CP936"; ++#endif + else if (encoding == MZ_ENCODING_CODEPAGE_950) + from_encoding = "CP950"; + else if (encoding == MZ_ENCODING_UTF8) +-- +2.34.1 diff --git a/community/modbus/BUILD.gn b/community/modbus/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..8573b1f4b2b79eb96c108f7bc0fe54bafbeda3c8 --- /dev/null +++ b/community/modbus/BUILD.gn @@ -0,0 +1,111 @@ +# Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd. +# +# SPDX-License-Identifier: LGPL-2.1-or-later + +import("//build/ohos.gni") + +modbus_part_name = "modbus" +modbus_subsystem_name = "thirdparty" + +modbus_includes = [ + "adapted/src", + "libmodbus", + "libmodbus/src", +] + +config("modbus_config") { + cflags = [ + "-Wall", + "-Wmissing-declarations", + "-Wmissing-prototypes", + "-Wnested-externs", + "-Wpointer-arith", + "-Wpointer-arith", + "-Wsign-compare", + "-Wchar-subscripts", + "-Wstrict-prototypes", + "-Wshadow", + "-Wformat-security", + ] +} + +ohos_shared_library("modbus") { + install_enable = true + include_dirs = modbus_includes + sources = [ + "libmodbus/src/modbus-data.c", + "libmodbus/src/modbus-rtu.c", + "libmodbus/src/modbus-tcp.c", + "libmodbus/src/modbus.c", + ] + configs = [ ":modbus_config" ] + part_name = "${modbus_part_name}" + subsystem_name = "${modbus_subsystem_name}" +} + +template("swanlink_modbus_test") { + ohos_executable(target_name) { + use_exceptions = true + include_dirs = [ + "libmodbus/tests", + "adapted/tests", + ] + include_dirs += modbus_includes + deps = [ ":modbus" ] + configs = [ ":modbus_config" ] + part_name = "${modbus_part_name}" + subsystem_name = "${modbus_subsystem_name}" + forward_variables_from(invoker, "*") + } +} + +swanlink_modbus_test("unit-test-client") { + sources = [ "libmodbus/tests/unit-test-client.c" ] +} + +swanlink_modbus_test("unit-test-server") { + sources = [ "libmodbus/tests/unit-test-server.c" ] +} + +swanlink_modbus_test("random-test-client") { + sources = [ "libmodbus/tests/random-test-client.c" ] +} + +swanlink_modbus_test("random-test-server") { + sources = [ "libmodbus/tests/random-test-server.c" ] +} + +swanlink_modbus_test("bandwidth-client") { + sources = [ "libmodbus/tests/bandwidth-client.c" ] +} + +swanlink_modbus_test("bandwidth-server-one") { + sources = [ "libmodbus/tests/bandwidth-server-one.c" ] +} + +swanlink_modbus_test("bandwidth-server-many-up") { + sources = [ "libmodbus/tests/bandwidth-server-many-up.c" ] +} + +group("modbus_tests") { + deps = [ + ":unit-test-client", + ":unit-test-server", + ":random-test-client", + ":random-test-server", + ":bandwidth-client", + ":bandwidth-server-one", + ":bandwidth-server-many-up", + ] +} + +declare_args() { + enable_modbus_test = false +} + +group("libmodbus") { + deps = [ ":modbus" ] + if (enable_modbus_test) { + deps += [ ":modbus_tests" ] + } +} \ No newline at end of file diff --git a/community/modbus/README.OpenSource b/community/modbus/README.OpenSource new file mode 100755 index 0000000000000000000000000000000000000000..50e53b21888edc89801839f67a6459cd98df9251 --- /dev/null +++ b/community/modbus/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "modbus", + "License": "LGPL v2.1 or Later", + "License File": "COPYING.LESSER", + "Version Number": "3.1.10", + "Owner": "swanlink", + "Upstream URL": "https://github.com/stephane/libmodbus", + "Description": "libmodbus is a free software library to send/receive data with a device which respects the Modbus protocol. This library can use a serial port or an Ethernet connection. The Protocol Reference Guide which can be obtained from http://www.modbus.org." + } +] \ No newline at end of file diff --git a/community/modbus/README_zh.md b/community/modbus/README_zh.md new file mode 100755 index 0000000000000000000000000000000000000000..6066d6b731dcf2367ce832434a37d43a722f9e93 --- /dev/null +++ b/community/modbus/README_zh.md @@ -0,0 +1,15 @@ +# modbus 三方库说明 + +## 功能简介 + +modbus 是用 C 语言编写的第三方Modbus库来实现modbus通讯,支持 RTU(串行)和 TCP(以太网)通信模式,可根据 Modbus 协议发送和接收数据。 + +## 使用约束 + +- ROM版本:OpenHarmony3.2 beta4 +- 三方库版本:v3.1.10 +- 当前适配的功能:完成modbus鸿蒙编译的适配 + +## 集成方式 + +- [系统Rom包集成](./docs/rom_integrate.md)。 diff --git a/community/modbus/adapted/src/config.h b/community/modbus/adapted/src/config.h new file mode 100755 index 0000000000000000000000000000000000000000..558be8210710c6a346e7b75bc8c4a241eb987faa --- /dev/null +++ b/community/modbus/adapted/src/config.h @@ -0,0 +1,233 @@ +/* config.h. Generated from config.h.in by configure. */ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if you have the `accept4' function. */ +#define HAVE_ACCEPT4 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ARPA_INET_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_BYTESWAP_H 1 + +/* Define to 1 if you have the declaration of `TIOCM_RTS', and to 0 if you + don't. */ +#define HAVE_DECL_TIOCM_RTS 1 + +/* Define to 1 if you have the declaration of `TIOCSRS485', and to 0 if you + don't. */ +#define HAVE_DECL_TIOCSRS485 1 + +/* Define to 1 if you have the declaration of `__CYGWIN__', and to 0 if you + don't. */ +#define HAVE_DECL___CYGWIN__ 0 + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ERRNO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if you have the `getaddrinfo' function. */ +#define HAVE_GETADDRINFO 1 + +/* Define to 1 if you have the `gettimeofday' function. */ +#define HAVE_GETTIMEOFDAY 1 + +/* Define to 1 if you have the `inet_ntop' function. */ +#define HAVE_INET_NTOP 1 + +/* Define to 1 if you have the `inet_pton' function. */ +#define HAVE_INET_PTON 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LIMITS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LINUX_SERIAL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_NETDB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_NETINET_IN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_NETINET_TCP_H 1 + +/* Define to 1 if you have the `select' function. */ +#define HAVE_SELECT 1 + +/* Define to 1 if you have the `socket' function. */ +#define HAVE_SOCKET 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the `strerror' function. */ +#define HAVE_STRERROR 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strlcpy' function. */ +/* #undef HAVE_STRLCPY */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_IOCTL_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_PARAMS_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SOCKET_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_TERMIOS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_WINSOCK2_H */ + +/* Define to the sub-directory where libtool stores uninstalled libraries. */ +#define LT_OBJDIR ".libs/" + +/* Name of package */ +#define PACKAGE "libmodbus" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "https://github.com/stephane/libmodbus/issues" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "libmodbus" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "libmodbus 3.1.10" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "libmodbus" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "http://libmodbus.org/" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "3.1.10" + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# define _ALL_SOURCE 1 +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# define _GNU_SOURCE 1 +#endif +/* Enable threading extensions on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# define _POSIX_PTHREAD_SEMANTICS 1 +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# define _TANDEM_SOURCE 1 +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# define __EXTENSIONS__ 1 +#endif + + +/* Version number of package */ +#define VERSION "3.1.10" + +/* _ */ +#define WINVER 0x0501 + +/* Enable large inode numbers on Mac OS X 10.5. */ +#ifndef _DARWIN_USE_64_BIT_INODE +# define _DARWIN_USE_64_BIT_INODE 1 +#endif + +/* Number of bits in a file offset, on hosts where this is settable. */ +/* #undef _FILE_OFFSET_BITS */ + +/* Define for large files, on AIX-style hosts. */ +/* #undef _LARGE_FILES */ + +/* Define to 1 if on MINIX. */ +/* #undef _MINIX */ + +/* Define to 2 if the system does not provide POSIX.1 features except with + this defined. */ +/* #undef _POSIX_1_SOURCE */ + +/* Define to 1 if you need to in order for `stat' and other things to work. */ +/* #undef _POSIX_SOURCE */ + +/* Define for Solaris 2.5.1 so the uint32_t typedef from , + , or is not used. If the typedef were allowed, the + #define below would cause a syntax error. */ +/* #undef _UINT32_T */ + +/* Define for Solaris 2.5.1 so the uint8_t typedef from , + , or is not used. If the typedef were allowed, the + #define below would cause a syntax error. */ +/* #undef _UINT8_T */ + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +/* #undef inline */ +#endif + +/* Define to the type of a signed integer type of width exactly 64 bits if + such a type exists and the standard includes do not define it. */ +/* #undef int64_t */ + +/* Define to `unsigned int' if does not define. */ +/* #undef size_t */ + +/* Define to `int' if does not define. */ +/* #undef ssize_t */ + +/* Define to the type of an unsigned integer type of width exactly 16 bits if + such a type exists and the standard includes do not define it. */ +/* #undef uint16_t */ + +/* Define to the type of an unsigned integer type of width exactly 32 bits if + such a type exists and the standard includes do not define it. */ +/* #undef uint32_t */ + +/* Define to the type of an unsigned integer type of width exactly 8 bits if + such a type exists and the standard includes do not define it. */ +/* #undef uint8_t */ diff --git a/community/modbus/adapted/src/modbus-version.h b/community/modbus/adapted/src/modbus-version.h new file mode 100755 index 0000000000000000000000000000000000000000..7f41cce25eacaf03337f865183746e76856605bf --- /dev/null +++ b/community/modbus/adapted/src/modbus-version.h @@ -0,0 +1,51 @@ +/* + * Copyright © Stéphane Raimbault + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef MODBUS_VERSION_H +#define MODBUS_VERSION_H + +/* The major version, (1, if %LIBMODBUS_VERSION is 1.2.3) */ +#define LIBMODBUS_VERSION_MAJOR (3) + +/* The minor version (2, if %LIBMODBUS_VERSION is 1.2.3) */ +#define LIBMODBUS_VERSION_MINOR (1) + +/* The micro version (3, if %LIBMODBUS_VERSION is 1.2.3) */ +#define LIBMODBUS_VERSION_MICRO (10) + +/* The full version, like 1.2.3 */ +#define LIBMODBUS_VERSION 3.1.10 + +/* The full version, in string form (suited for string concatenation) + */ +#define LIBMODBUS_VERSION_STRING "3.1.10" + +/* Numerically encoded version, eg. v1.2.3 is 0x010203 */ +#define LIBMODBUS_VERSION_HEX \ + ((LIBMODBUS_VERSION_MAJOR << 16) | (LIBMODBUS_VERSION_MINOR << 8) | \ + (LIBMODBUS_VERSION_MICRO << 0)) + +/* Evaluates to True if the version is greater than @major, @minor and @micro + */ +#define LIBMODBUS_VERSION_CHECK(major, minor, micro) \ + (LIBMODBUS_VERSION_MAJOR > (major) || \ + (LIBMODBUS_VERSION_MAJOR == (major) && LIBMODBUS_VERSION_MINOR > (minor)) || \ + (LIBMODBUS_VERSION_MAJOR == (major) && LIBMODBUS_VERSION_MINOR == (minor) && \ + LIBMODBUS_VERSION_MICRO >= (micro))) + +#endif /* MODBUS_VERSION_H */ diff --git a/community/modbus/adapted/tests/unit-test.h b/community/modbus/adapted/tests/unit-test.h new file mode 100755 index 0000000000000000000000000000000000000000..50d80703fbc77f8e5947a12a21541f44762d65e7 --- /dev/null +++ b/community/modbus/adapted/tests/unit-test.h @@ -0,0 +1,107 @@ +/* tests/unit-test.h. Generated from unit-test.h.in by configure. */ +/* + * Copyright © Stéphane Raimbault + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef _UNIT_TEST_H_ +#define _UNIT_TEST_H_ + +/* Constants defined by configure.ac */ +#define HAVE_INTTYPES_H 1 +#define HAVE_STDINT_H 1 + +// clang-format off +#ifdef HAVE_INTTYPES_H +#include +#endif +#ifdef HAVE_STDINT_H +# ifndef _MSC_VER +# include +# else +# include "stdint.h" +# endif +#endif +// clang-format on + +#define SERVER_ID 17 +#define INVALID_SERVER_ID 18 + +const uint16_t UT_BITS_ADDRESS = 0x130; +const uint16_t UT_BITS_NB = 0x25; +const uint8_t UT_BITS_TAB[] = { 0xCD, 0x6B, 0xB2, 0x0E, 0x1B }; + +const uint16_t UT_INPUT_BITS_ADDRESS = 0x1C4; +const uint16_t UT_INPUT_BITS_NB = 0x16; +const uint8_t UT_INPUT_BITS_TAB[] = { 0xAC, 0xDB, 0x35 }; + +const uint16_t UT_REGISTERS_ADDRESS = 0x160; +const uint16_t UT_REGISTERS_NB = 0x3; +const uint16_t UT_REGISTERS_NB_MAX = 0x20; +const uint16_t UT_REGISTERS_TAB[] = { 0x022B, 0x0001, 0x0064 }; + +/* Raise a manual exception when this address is used for the first byte */ +const uint16_t UT_REGISTERS_ADDRESS_SPECIAL = 0x170; +/* The response of the server will contains an invalid TID or slave */ +const uint16_t UT_REGISTERS_ADDRESS_INVALID_TID_OR_SLAVE = 0x171; +/* The server will wait for 1 second before replying to test timeout */ +const uint16_t UT_REGISTERS_ADDRESS_SLEEP_500_MS = 0x172; +/* The server will wait for 5 ms before sending each byte */ +const uint16_t UT_REGISTERS_ADDRESS_BYTE_SLEEP_5_MS = 0x173; + +/* If the following value is used, a bad response is sent. + It's better to test with a lower value than + UT_REGISTERS_NB_POINTS to try to raise a segfault. */ +const uint16_t UT_REGISTERS_NB_SPECIAL = 0x2; + +const uint16_t UT_INPUT_REGISTERS_ADDRESS = 0x108; +const uint16_t UT_INPUT_REGISTERS_NB = 0x1; +const uint16_t UT_INPUT_REGISTERS_TAB[] = { 0x000A }; + +/* + * This float value is 0x47F12000 (in big-endian format). + * In Little-endian(intel) format, it will be stored in memory as follows: + * 0x00 0x20 0xF1 0x47 + * + * You can check this with the following code: + + float fl = UT_REAL; + uint8_t *inmem = (uint8_t*)&fl; + int x; + for(x = 0; x < 4; x++){ + printf("0x%02X ", inmem[ x ]); + } + printf("\n"); + */ +const float UT_REAL = 123456.00; + +/* + * The following arrays assume that 'A' is the MSB, + * and 'D' is the LSB. + * Thus, the following is the case: + * A = 0x47 + * B = 0xF1 + * C = 0x20 + * D = 0x00 + * + * There are two sets of arrays: one to test that the setting is correct, + * the other to test that the getting is correct. + * Note that the 'get' values must be constants in processor-endianness, + * as libmodbus will convert all words to processor-endianness as they come in. + */ +const uint8_t UT_IREAL_ABCD_SET[] = {0x47, 0xF1, 0x20, 0x00}; +const uint16_t UT_IREAL_ABCD_GET[] = {0x47F1, 0x2000}; +const uint8_t UT_IREAL_DCBA_SET[] = {0x00, 0x20, 0xF1, 0x47}; +const uint16_t UT_IREAL_DCBA_GET[] = {0x0020, 0xF147}; +const uint8_t UT_IREAL_BADC_SET[] = {0xF1, 0x47, 0x00, 0x20}; +const uint16_t UT_IREAL_BADC_GET[] = {0xF147, 0x0020}; +const uint8_t UT_IREAL_CDAB_SET[] = {0x20, 0x00, 0x47, 0xF1}; +const uint16_t UT_IREAL_CDAB_GET[] = {0x2000, 0x47F1}; + +/* const uint32_t UT_IREAL_ABCD = 0x47F12000); +const uint32_t UT_IREAL_DCBA = 0x0020F147; +const uint32_t UT_IREAL_BADC = 0xF1470020; +const uint32_t UT_IREAL_CDAB = 0x200047F1;*/ + +#endif /* _UNIT_TEST_H_ */ diff --git a/community/modbus/bundle.json b/community/modbus/bundle.json new file mode 100755 index 0000000000000000000000000000000000000000..46c36a44aeb181dd5ec66c6b87696e279eb0ea22 --- /dev/null +++ b/community/modbus/bundle.json @@ -0,0 +1,32 @@ +{ + "name": "@ohos/modbus", + "description": "modbus is an Open Source library to communicate with Modbus devices: RTU (serial) and TCP (Ethernet) support, available for Linux (packaged), FreeBSD, Mac OS and Windows, written in C, great test coverage and documentation, security audits, no dependencies.", + "version": "3.1.10", + "license": "LGPL v2.1 or later", + "publishAs": "code-segment", + "segment": { + "destPath": "third_party/modbus" + }, + "dirs": {}, + "scripts": {}, + "component": { + "name": "modbus", + "subsystem": "thirdparty", + "syscap": [], + "features": [], + "adapted_system_type": [], + "rom": "", + "ram": "", + "deps": { + "components": [], + "third_party": [] + }, + "build": { + "sub_component": [ + "//third_party/modbus:libmodbus" + ], + "inner_kits": [], + "test": [] + } + } +} diff --git a/community/modbus/docs/pic/running_result.png b/community/modbus/docs/pic/running_result.png new file mode 100755 index 0000000000000000000000000000000000000000..2f3c53e859950f762eeb6b16848fb03088d97c36 Binary files /dev/null and b/community/modbus/docs/pic/running_result.png differ diff --git a/community/modbus/docs/rom_integrate.md b/community/modbus/docs/rom_integrate.md new file mode 100755 index 0000000000000000000000000000000000000000..437bdd419c17d9b6e47547961a51c6c4814a9b58 --- /dev/null +++ b/community/modbus/docs/rom_integrate.md @@ -0,0 +1,152 @@ +# modbus如何集成到系统Rom + +## 准备源码工程 + +本库是基于OpenHarmony 3.2 beta4版本,在润和RK3568开发板上验证的。如果是从未使用过RK3568,可以先查看[润和RK3568开发板标准系统快速上手](https://gitee.com/openharmony-sig/knowledge_demo_temp/tree/master/docs/rk3568_helloworld)。 + +### 准备系统Rom源码 + +系统源码获取方法请参照:[OpenHarmony3.2beta4源码下载](https://gitee.com/openharmony/docs/blob/OpenHarmony-v3.2-Beta5/zh-cn/release-notes/OpenHarmony-v3.2-beta4.md#源码获取) + +### 增加构建脚本及配置文件 + +- 下载本仓库代码 + + ```shell + cd ~/ + git clone git@gitee.com:openharmony-sig/tpc_c_cplusplus.git --depth=1 + ``` + +- 仓库代码目录结构说明 + + ```shell + cd ~/tpc_c_cplusplus/thirdparty/modbus/ # 进入到仓库代码库目录 + ``` + + ```shell + modbus + |-- adapted # 存放三方库适配需要的代码文件 + |-- docs # 存放 modbus 相关文档的文件夹 + |-- BUILD.gn # 编译构建脚本 + |-- bundle.json # 三方库组件定义文件 + |-- README_zh.md # modbus 主页说明文档 + |-- README.OpenSource # modbus 源码的下载地址,版本,license等信息 + ``` + +- 将本仓库文件夹拷贝到OpenHarmony源码的third_party目录下 + + ```shell + cp -arf ~/tpc_c_cplusplus/thirdparty/modbus ~/OpenHarmony/third_party + ``` + +### 准备三方库源码 + +- 三方库源码下载 + + modbus-3.1.10源码下载到modbus目录。 + + ```shell + cd ~/OpenHarmony/third_party/modbus + git clone https://github.com/stephane/libmodbus.git -b v3.1.10 + ``` + +## 系统Rom中引入三方库 + +准备完三方库代码后,我们需要将三方库加入到编译构建体系中。标准系统编译构建可以参考文档[编译构建指导](https://gitee.com/openharmony/docs/blob/OpenHarmony-3.2-Beta4/zh-cn/device-dev/subsystems/subsys-build-all.md)。
+我们默认三方库是属于OpenHarmony的thirdparty子系统,如果需要自己定义子系统参考文档[如何为三方库组件中添加一个三方库](https://gitee.com/openharmony-sig/knowledge/blob/master/docs/openharmony_getstarted/port_thirdparty/README.md)。
+新增需要编译的组件,在OpenHarmony源码的productdefine/common/inherit/rich.json文件中,新增需要编译的组件,如下代码段所示,在thirdparty子系统下面新增modbus组件 + +```json +{ + "subsystem": "thirdparty", + "components": [ + { + "component": "musl", + "features": [] + }, + { + "component": "modbus", + "features": [] + } + ] +} +``` + +## 系统Rom中引入三方库测试程序 + +如果需要编译测试用例,在OpenHarmony源码的productdefine/common/inherit/rich.json文件,在对应组件的features中打开编译选项,如下 + +```json +{ + "subsystem": "thirdparty", + "components": [ + { + "component": "musl", + "features": [] + }, + { + "component": "modbus", + "features": [ "enable_modbus_test=true" ] + } + ] +} +``` + +## 编译工程 + +- 进入源码根目录 + + ```shell + cd ~/openharmony + ``` + +- 选择产品 + + ```shell + hb set # 运行hb set后会出现产品列表,在此我们选择 rk3568 + ``` + +- 执行编译 + + ```shell + hb build --target-cpu arm #编译32位系统 + hb build --target-cpu arm64 #编译64位系统 + ``` + +- 生成的可执行文件和库文件都在out/rk3568/thirdparty/modbus目录下,同时也打包到了镜像中 + +## 运行效果 + +将编译生成的库和测试文件放到板子上运行,为避免每次将文件推入设备都要烧录整个镜像,我们使用hdc_std工具将文件推到开发板上 + +- 首先将hdc_std工具编译出来
+ 执行以下命令进行编译hdc_std工具(工具编译出来所在路径out/sdk/ohos-sdk/windows/toolchains/hdc_std.exe): + + ```shell + hb set #源码根目录下使用hb set 选择产品ohos-sdk + hb build #然后编译 + ``` + +- 将工具拷贝到Windows,可以为工具目录配置环境变量,也可以在工具所在目录打开windows命令行 +- 将原生库测试需要的所有文件打包成modbus.tar,并拷贝到windows下 +- 将文件推送到开发板,在windows命令行进行如下操作 + + ```shell + hdc_std shell mount -o remount,rw / #修改系统权限为可读写 + hdc_std file send modbus.tar / #将文件包推入开发板 + hdc_std shell #进入开发板 + tar xvf modbus.tar #解压 + #注意需要将库拷贝到/system/lib 或者/system/lib64目录下 + ``` + +- 运行测试程序 + 在测试目录运行测试程序unit-test-server,然后再另一个窗口运行测试程序unit-test-client,则两个窗口会同时看到数据发送和接收的打印信息,如下图所示:
+  ![image-20220922143536085](./pic/running_result.png) + +## 参考资料 + +- [润和RK3568开发板标准系统快速上手](https://gitee.com/openharmony-sig/knowledge_demo_temp/tree/master/docs/rk3568_helloworld)。 +- [OpenHarmony3.2beta4](https://gitee.com/openharmony/docs/blob/OpenHarmony-v3.2-Beta5/zh-cn/release-notes/OpenHarmony-v3.2-beta4.md)。 +- [OpenHarmony三方库组织地址](https://gitee.com/openharmony-tpc)。 +- [如何为三方库组件中添加一个三方库](https://gitee.com/openharmony-sig/knowledge/blob/master/docs/openharmony_getstarted/port_thirdparty/README.md)。 +- [知识体系](https://gitee.com/openharmony-sig/knowledge)。 diff --git a/community/mpfr/HPKBUILD b/community/mpfr/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..0fdbc693480ed6717657c8b2b8fde1df3b5af611 --- /dev/null +++ b/community/mpfr/HPKBUILD @@ -0,0 +1,88 @@ +# 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: Jeff Han , Sunjiamei<939650669@qq.com> +# Maintainer: Jeff Han + +pkgname=mpfr +pkgver=4.2.1 +pkgrel=0 +pkgdesc="The mpfr library is a C library for multiple-precision floating-point computations with correct rounding." +url="https://www.mpfr.org" +archs=("armeabi-v7a" "arm64-v8a") +license=("GPL-3.0") +depends=("gmp") +makedepends=() + +source="https://www.$pkgname.org/$pkgname-current/$pkgname-$pkgver.zip" + +autounpack=true +downloadpackage=true +buildtools="configure" + +builddir=$pkgname-${pkgver} +packagename=$builddir.zip + +source envset.sh +host= +prepare() { + cp -rf $builddir $builddir-$ARCH-build + if [ $ARCH == "armeabi-v7a" ] + then + setarm32ENV + host=arm-linux + elif [ $ARCH == "arm64-v8a" ] + then + setarm64ENV + host=aarch64-linux + else + echo "$ARCH not support!" + return -1 + fi + export CFLAGS="-I$LYCIUM_ROOT/usr/gmp/$ARCH/include -L$LYCIUM_ROOT/usr/gmp/$ARCH/lib" +} + +build() { + cd $builddir-$ARCH-build + ./configure "$@" --host=$host > $buildlog 2>&1 + $MAKE VERBOSE=1 >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir-$ARCH-build + $MAKE install VERBOSE=1 >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +check() { + echo "The test must be on an OpenHarmony device!" + cd $builddir-$ARCH-build + # 注释掉测试部分 + sed -i.bak 's|$(MAKE) $(AM_MAKEFLAGS) check-TESTS|# $(MAKE) $(AM_MAKEFLAGS) check-TESTS|g' tests/Makefile + $MAKE check >> $buildlog 2>&1 + # 注释掉编译部分 + sed -i.bak '/^all: all-am$/,/^\t@:$/s/^/#/' tests/Makefile + sed -i.bak 's|# $(MAKE) $(AM_MAKEFLAGS) check-TESTS|$(MAKE) $(AM_MAKEFLAGS) check-TESTS|g' tests/Makefile + ret=$? + cd $OLDPWD + return $ret +} + +cleanbuild() { + rm -rf ${PWD}/$builddir $builddir-armeabi-v7a-build $builddir-arm64-v8a-build +} diff --git a/community/mpfr/HPKCHECK b/community/mpfr/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..2f6d4472c93bb04baeac36c08ce5be777944f26c --- /dev/null +++ b/community/mpfr/HPKCHECK @@ -0,0 +1,40 @@ +# 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: Jeff Han , Sunjiamei<939650669@qq.com> +# Maintainer: Jeff Han + +source HPKBUILD > /dev/null 2>&1 +logfile=${LYCIUM_THIRDPARTY_ROOT}/${pkgname}/${pkgname}_${ARCH}_${OHOS_SDK_VER}_test.log + +checkprepare() { + if [ ! -f /usr/bin/sed ] + then + ln -s /bin/sed /usr/bin/sed + fi +} + +openharmonycheck() { + res=0 + cd $builddir-$ARCH-build/tests + make check-TESTS > ${logfile} 2>&1 + res=$? + if [ $res -ne 0 ]; then + echo "test failed" >> ${logfile} 2>&1 + cd $OLDPWD + return $res + fi + echo "test pass" >> ${logfile} 2>&1 + cd $OLDPWD + return $res +} diff --git a/community/mpfr/OAT.xml b/community/mpfr/OAT.xml new file mode 100644 index 0000000000000000000000000000000000000000..eeb1f946d683c0b81976cd06522096062a6901b9 --- /dev/null +++ b/community/mpfr/OAT.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/community/mpfr/README.OpenSource b/community/mpfr/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..060a8b15d9726911793551f65f97f6800e8337a0 --- /dev/null +++ b/community/mpfr/README.OpenSource @@ -0,0 +1,20 @@ +[ + { + "Name": "mpfr", + "License": "GPL-3.0", + "License File": "https://www.gnu.org/licenses/lgpl-3.0.html", + "Version Number": "4.2.1", + "Owner": "hanjinfei@foxmail.com", + "Upstream URL": "https://www.mpfr.org", + "Description": "The mpfr library is a C library for multiple-precision floating-point computations with correct rounding." + }, + { + "Name": "gmp", + "License": "gplv2 and gplv3"", + "License File": ["https://www.gnu.org/licenses/old-licenses/gpl-2.0.html","https://www.gnu.org/licenses/lgpl-3.0.html"], + "Version Number": "v1.0.12", + "Owner": "chenbaodi@huawei.com", + "Upstream URL": "https://gmplib.org/download/gmp/gmp-6.2.1.tar.xz", + "Description": "GMP is a free library for arbitrary precision arithmetic, operating on signed integers, rational numbers, and floating-point numbers." + } +] diff --git a/community/mpfr/README_zh.md b/community/mpfr/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..c8ee4c7512f3d303b331bd4b4d6a0f277a1eb69b --- /dev/null +++ b/community/mpfr/README_zh.md @@ -0,0 +1,12 @@ +# mpfr 三方库说明 +## 功能简介 +mpfr库是一个C库,用于正确舍入的多精度浮点计算。 + +## 三方库版本 +- 4.2.1 + +## 使用约束 +- [IDE和SDK版本](../../docs/constraint.md) + +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) diff --git a/community/mpfr/SHA512SUM b/community/mpfr/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..aea9bc92d58feedb525143cc4df36aa0f93f0f40 --- /dev/null +++ b/community/mpfr/SHA512SUM @@ -0,0 +1 @@ +3de08deefdf7a660a4830885446f3615f8b459a8f7521e30c486708cb1f7516b5ff4c7dbfa4d3683cd85c7446d6d9505c8dcf795fb1d8983b4bdd888cbdf33b6 mpfr-4.2.1.zip diff --git a/community/mpfr/docs/hap_integrate.md b/community/mpfr/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..341a9500545a5023f912b728c7c95cdc35282505 --- /dev/null +++ b/community/mpfr/docs/hap_integrate.md @@ -0,0 +1,84 @@ +# mpfr集成到应用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/mpfr #三方库mpfr的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── HPKCHECK #测试脚本 + ├── OAT.xml #扫描结果文件 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md #三方库简介 + ``` + +* 在lycium目录下编译三方库 + + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ```shell + cd lycium + ./build.sh mpfr + ``` + +* 三方库头文件及生成的库 + + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ```shell + mpfr/arm64-v8a mpfr/armeabi-v7a + gmp/arm64-v8a gmp/armeabi-v7a + ``` + +* [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将三方库及其依赖库编译生成的头文件拷贝到该目录下。如下图所示: + + ![mpfr_install_dir](pic/mpfr_install_dir.png) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + + ```cmake + #将三方库的头文件和库文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/mpfr/${OHOS_ARCH}/include) + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/mpfr/${OHOS_ARCH}/lib/mpfr.a) + #将三方库依赖库的头文件和库文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/gmp/${OHOS_ARCH}/include) + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/gmp/${OHOS_ARCH}/lib/gmp.a) + ``` + +## 测试三方库 + +- 编译出可执行的文件进行测试,[准备三方库测试环境](../../../lycium/README.md#3ci环境准备) + +- 进入到构建目录运行测试用例(注意arm64-v8a为构建64位的目录,armeabi-v7a为构建32位的目录),执行结果如图所示 +``` + cd /data/tpc_c_cplusplus/thirdparty/mpfr/mpfr-4.2.1-armeabi-v7a-build + make check-TESTS +``` + + ![mpfr_test](pic/mpfr-test.png) + +## 参考资料 + +* [OpenHarmony三方库地址](https://gitee.com/openharmony-tpc) +* [OpenHarmony知识体系](https://gitee.com/openharmony-sig/knowledge) +* [mpfr三方库地址](https://www.mpfr.org) + diff --git a/community/mpfr/docs/pic/mpfr-test.png b/community/mpfr/docs/pic/mpfr-test.png new file mode 100644 index 0000000000000000000000000000000000000000..0cc6a37dc5979652f5dd0df9e95238ce5f057138 Binary files /dev/null and b/community/mpfr/docs/pic/mpfr-test.png differ diff --git a/community/mpfr/docs/pic/mpfr_install_dir.png b/community/mpfr/docs/pic/mpfr_install_dir.png new file mode 100644 index 0000000000000000000000000000000000000000..90128e13b8b8ee41f73f178876a9d776fad570ce Binary files /dev/null and b/community/mpfr/docs/pic/mpfr_install_dir.png differ diff --git a/community/mqtt/BUILD.gn b/community/mqtt/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..0a7c2fe36c63674d6d764ddb7f2e9c172b8ee52b --- /dev/null +++ b/community/mqtt/BUILD.gn @@ -0,0 +1,463 @@ +# Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v2.0 +# and Eclipse Distribution License v1.0 which accompany this distribution. +# +# The Eclipse Public License is available at +# https://www.eclipse.org/legal/epl-2.0/ +# and the Eclipse Distribution License is available at +# http://www.eclipse.org/org/documents/edl-v10.php. + +import("//build/ohos.gni") + +paho_mqtt_path = "//third_party/mqtt/paho.mqtt.c" +mqtt_part_name = "mqtt" +mqtt_subsystem_name = "thirdparty" + +declare_args() { + enable_mqtt_test = false +} + +group("libmqtt") { + deps = [ + ":paho-mqtt3a", + ":paho-mqtt3as", + ":paho-mqtt3c", + ":paho-mqtt3cs", + ] + + if (enable_mqtt_test) { + deps += [ + ":mqtt_samples", + ":mqtt_test", + ] + } +} + +config("mqtt_config") { + cflags = [ + "-Wno-sign-compare", + "-Wno-unused-variable", + "-Wno-deprecated-declarations", + "-Wno-format", + "-fvisibility=hidden", + "-Wno-error", + "-Wall", + "-fPIC", + "-Os", + "-g", + ] + + defines = [ + "_GNU_SOURCE", + "PAHO_MQTT_EXPORTS", + ] + + if (use_musl) { + cflags += [ "-Wno-bool-operation" ] + } +} + +ohos_source_set("mqtt_commom_dynamic") { + sources = [ + "${paho_mqtt_path}/src/Base64.c", + "${paho_mqtt_path}/src/Clients.c", + "${paho_mqtt_path}/src/LinkedList.c", + "${paho_mqtt_path}/src/Log.c", + "${paho_mqtt_path}/src/MQTTPacket.c", + "${paho_mqtt_path}/src/MQTTPacketOut.c", + "${paho_mqtt_path}/src/MQTTPersistence.c", + "${paho_mqtt_path}/src/MQTTPersistenceDefault.c", + "${paho_mqtt_path}/src/MQTTProperties.c", + "${paho_mqtt_path}/src/MQTTProtocolClient.c", + "${paho_mqtt_path}/src/MQTTProtocolOut.c", + "${paho_mqtt_path}/src/MQTTReasonCodes.c", + "${paho_mqtt_path}/src/MQTTTime.c", + "${paho_mqtt_path}/src/Messages.c", + "${paho_mqtt_path}/src/Proxy.c", + "${paho_mqtt_path}/src/SHA1.c", + "${paho_mqtt_path}/src/Socket.c", + "${paho_mqtt_path}/src/SocketBuffer.c", + "${paho_mqtt_path}/src/Thread.c", + "${paho_mqtt_path}/src/Tree.c", + "${paho_mqtt_path}/src/WebSocket.c", + "${paho_mqtt_path}/src/utf-8.c", + ] + + if (!defined(PAHO_HIGH_PERFORMANCE)) { + sources += [ + "${paho_mqtt_path}/src/Heap.c", + "${paho_mqtt_path}/src/StackTrace.c", + ] + } + include_dirs = [ + "adapted/src", + "${paho_mqtt_path}/src", + ] + configs = [ ":mqtt_config" ] +} + +ohos_shared_library("paho-mqtt3a") { + include_dirs = [ + "adapted/src", + "${paho_mqtt_path}/src", + ] + configs = [ ":mqtt_config" ] + sources = [ + "${paho_mqtt_path}/src/MQTTAsync.c", + "${paho_mqtt_path}/src/MQTTAsyncUtils.c", + ] + deps = [ ":mqtt_commom_dynamic" ] + install_images = [ "system" ] + install_enable = true + part_name = "${mqtt_part_name}" + subsystem_name = "${mqtt_subsystem_name}" +} + +ohos_shared_library("paho-mqtt3c") { + include_dirs = [ + "adapted/src", + "${paho_mqtt_path}/src", + ] + configs = [ ":mqtt_config" ] + sources = [ "${paho_mqtt_path}/src/MQTTClient.c" ] + deps = [ ":mqtt_commom_dynamic" ] + install_images = [ "system" ] + install_enable = true + part_name = "${mqtt_part_name}" + subsystem_name = "${mqtt_subsystem_name}" +} + +ohos_shared_library("paho-mqtt3as") { + include_dirs = [ + "adapted/src", + "${paho_mqtt_path}/src", + ] + configs = [ ":mqtt_config" ] + sources = [ + "${paho_mqtt_path}/src/MQTTAsync.c", + "${paho_mqtt_path}/src/MQTTAsyncUtils.c", + "${paho_mqtt_path}/src/SSLSocket.c", + ] + deps = [ + ":mqtt_commom_dynamic", + "//third_party/openssl:libssl_shared", + ] + install_images = [ "system" ] + install_enable = true + part_name = "${mqtt_part_name}" + subsystem_name = "${mqtt_subsystem_name}" +} + +ohos_shared_library("paho-mqtt3cs") { + include_dirs = [ + "adapted/src", + "${paho_mqtt_path}/src", + ] + configs = [ ":mqtt_config" ] + sources = [ + "${paho_mqtt_path}/src/MQTTClient.c", + "${paho_mqtt_path}/src/SSLSocket.c", + ] + deps = [ + ":mqtt_commom_dynamic", + "//third_party/openssl:libssl_shared", + ] + install_images = [ "system" ] + install_enable = true + part_name = "${mqtt_part_name}" + subsystem_name = "${mqtt_subsystem_name}" +} + +group("mqtt_samples") { + deps = [ + ":MQTTAsync_publish", + ":MQTTAsync_subscribe", + ":MQTTClient_publish", + ":MQTTClient_publish_async", + ":MQTTClient_subscribe", + ":paho_c_pub", + ":paho_c_sub", + ":paho_cs_pub", + ":paho_cs_sub", + ] +} + +config("mqtt_samples_config") { + cflags = [ + "-Wno-unused-variable", + "-Wno-error", + ] + defines = [ "PAHO_MQTT_IMPORTS" ] +} + +template("swanlink_mqtt_samples") { + ohos_executable(target_name) { + include_dirs = [ "${paho_mqtt_path}/src" ] + configs = [ ":mqtt_samples_config" ] + part_name = "${mqtt_part_name}" + subsystem_name = "${mqtt_subsystem_name}" + forward_variables_from(invoker, "*") + } +} + +swanlink_mqtt_samples("MQTTAsync_publish") { + sources = [ "${paho_mqtt_path}/src/samples/MQTTAsync_publish.c" ] + deps = [ ":paho-mqtt3a" ] +} + +swanlink_mqtt_samples("MQTTAsync_subscribe") { + sources = [ "${paho_mqtt_path}/src/samples/MQTTAsync_subscribe.c" ] + deps = [ ":paho-mqtt3a" ] +} + +swanlink_mqtt_samples("MQTTClient_publish") { + sources = [ "${paho_mqtt_path}/src/samples/MQTTClient_publish.c" ] + deps = [ ":paho-mqtt3c" ] +} + +swanlink_mqtt_samples("MQTTClient_publish_async") { + sources = [ "${paho_mqtt_path}/src/samples/MQTTClient_publish_async.c" ] + deps = [ ":paho-mqtt3c" ] +} + +swanlink_mqtt_samples("MQTTClient_subscribe") { + sources = [ "${paho_mqtt_path}/src/samples/MQTTClient_subscribe.c" ] + deps = [ ":paho-mqtt3c" ] +} + +swanlink_mqtt_samples("paho_c_pub") { + sources = [ + "${paho_mqtt_path}/src/samples/paho_c_pub.c", + "${paho_mqtt_path}/src/samples/pubsub_opts.c", + ] + deps = [ + ":mqtt_commom_dynamic", + ":paho-mqtt3as", + ] +} + +swanlink_mqtt_samples("paho_c_sub") { + sources = [ + "${paho_mqtt_path}/src/samples/paho_c_sub.c", + "${paho_mqtt_path}/src/samples/pubsub_opts.c", + ] + deps = [ + ":mqtt_commom_dynamic", + ":paho-mqtt3as", + ] +} + +swanlink_mqtt_samples("paho_cs_pub") { + sources = [ + "${paho_mqtt_path}/src/samples/paho_cs_pub.c", + "${paho_mqtt_path}/src/samples/pubsub_opts.c", + ] + deps = [ + ":mqtt_commom_dynamic", + ":paho-mqtt3cs", + ] +} + +swanlink_mqtt_samples("paho_cs_sub") { + sources = [ + "${paho_mqtt_path}/src/samples/paho_cs_sub.c", + "${paho_mqtt_path}/src/samples/pubsub_opts.c", + ] + deps = [ + ":mqtt_commom_dynamic", + ":paho-mqtt3cs", + ] +} + +group("mqtt_test") { + deps = [ + ":sync_client_test", + ":test1", + ":test10", + ":test11", + ":test15", + ":test2", + ":test3", + ":test4", + ":test45", + ":test5", + ":test6", + ":test9", + ":test95", + ":test_mqtt4async", + ":test_mqtt4sync", + ] +} + +config("mqtt_test_config") { + cflags = [ + "-Wno-sign-compare", + "-Wno-unused-variable", + "-Wno-format", + "-Wno-error", + ] +} + +ohos_source_set("mqtt_test_thread") { + include_dirs = [ "${paho_mqtt_path}/src" ] + configs = [ ":mqtt_test_config" ] + defines = [ + "NOSTACKTRACE", + "NOLOG_MESSAGES", + ] + sources = [ "${paho_mqtt_path}/src/Thread.c" ] +} + +ohos_source_set("mqtt_test_dynamic") { + include_dirs = [ "${paho_mqtt_path}/src" ] + configs = [ ":mqtt_test_config" ] + sources = [ + "${paho_mqtt_path}/src/Base64.c", + "${paho_mqtt_path}/src/Clients.c", + "${paho_mqtt_path}/src/LinkedList.c", + "${paho_mqtt_path}/src/Log.c", + "${paho_mqtt_path}/src/MQTTPacket.c", + "${paho_mqtt_path}/src/MQTTPacketOut.c", + "${paho_mqtt_path}/src/MQTTPersistence.c", + "${paho_mqtt_path}/src/MQTTPersistenceDefault.c", + "${paho_mqtt_path}/src/MQTTProperties.c", + "${paho_mqtt_path}/src/MQTTProtocolClient.c", + "${paho_mqtt_path}/src/MQTTProtocolOut.c", + "${paho_mqtt_path}/src/MQTTReasonCodes.c", + "${paho_mqtt_path}/src/MQTTTime.c", + "${paho_mqtt_path}/src/Messages.c", + "${paho_mqtt_path}/src/Proxy.c", + "${paho_mqtt_path}/src/SHA1.c", + "${paho_mqtt_path}/src/Socket.c", + "${paho_mqtt_path}/src/SocketBuffer.c", + "${paho_mqtt_path}/src/Tree.c", + "${paho_mqtt_path}/src/WebSocket.c", + "${paho_mqtt_path}/src/utf-8.c", + ] + + if (!defined(PAHO_HIGH_PERFORMANCE)) { + sources += [ + "${paho_mqtt_path}/src/Heap.c", + "${paho_mqtt_path}/src/StackTrace.c", + ] + } +} + +template("swanlink_mqtt_test") { + ohos_executable(target_name) { + include_dirs = [ "${paho_mqtt_path}/src" ] + configs = [ ":mqtt_test_config" ] + part_name = "${mqtt_part_name}" + subsystem_name = "${mqtt_subsystem_name}" + forward_variables_from(invoker, "*") + } +} + +swanlink_mqtt_test("test1") { + sources = [ "${paho_mqtt_path}/test/test1.c" ] + deps = [ + ":mqtt_test_thread", + ":paho-mqtt3c", + ] +} + +swanlink_mqtt_test("test15") { + sources = [ "${paho_mqtt_path}/test/test15.c" ] + deps = [ + ":mqtt_test_dynamic", + ":mqtt_test_thread", + ":paho-mqtt3c", + ] +} + +swanlink_mqtt_test("test10") { + sources = [ "${paho_mqtt_path}/test/test10.c" ] + deps = [ + ":mqtt_test_dynamic", + ":mqtt_test_thread", + ":paho-mqtt3c", + ] +} + +swanlink_mqtt_test("test2") { + sources = [ "${paho_mqtt_path}/test/test2.c" ] + deps = [ + ":mqtt_test_thread", + ":paho-mqtt3c", + ] +} + +swanlink_mqtt_test("sync_client_test") { + sources = [ "${paho_mqtt_path}/test/sync_client_test.c" ] + deps = [ + ":mqtt_test_thread", + ":paho-mqtt3c", + ] +} + +swanlink_mqtt_test("test_mqtt4sync") { + sources = [ "${paho_mqtt_path}/test/test_mqtt4sync.c" ] + deps = [ + ":mqtt_test_thread", + ":paho-mqtt3c", + ] +} + +swanlink_mqtt_test("test3") { + sources = [ "${paho_mqtt_path}/test/test3.c" ] + deps = [ ":paho-mqtt3cs" ] +} + +swanlink_mqtt_test("test4") { + sources = [ "${paho_mqtt_path}/test/test4.c" ] + deps = [ ":paho-mqtt3a" ] +} + +swanlink_mqtt_test("test45") { + sources = [ "${paho_mqtt_path}/test/test45.c" ] + deps = [ + ":mqtt_test_dynamic", + ":mqtt_test_thread", + ":paho-mqtt3a", + ] +} + +swanlink_mqtt_test("test6") { + sources = [ "${paho_mqtt_path}/test/test6.c" ] + deps = [ ":paho-mqtt3a" ] +} + +swanlink_mqtt_test("test9") { + sources = [ "${paho_mqtt_path}/test/test9.c" ] + deps = [ ":paho-mqtt3a" ] +} + +swanlink_mqtt_test("test95") { + sources = [ "${paho_mqtt_path}/test/test95.c" ] + deps = [ + ":mqtt_test_dynamic", + ":mqtt_test_thread", + ":paho-mqtt3a", + ] +} + +swanlink_mqtt_test("test_mqtt4async") { + sources = [ "${paho_mqtt_path}/test/test_mqtt4async.c" ] + deps = [ ":paho-mqtt3a" ] +} + +swanlink_mqtt_test("test11") { + sources = [ "${paho_mqtt_path}/test/test11.c" ] + deps = [ + ":mqtt_test_dynamic", + ":mqtt_test_thread", + ":paho-mqtt3a", + ] +} + +swanlink_mqtt_test("test5") { + sources = [ "${paho_mqtt_path}/test/test5.c" ] + deps = [ ":paho-mqtt3as" ] +} diff --git a/community/mqtt/HPKBUILD b/community/mqtt/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..5569883c53142ef00c8ebbfdcc0cd3b2a7d167f5 --- /dev/null +++ b/community/mqtt/HPKBUILD @@ -0,0 +1,66 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Eclipse Public License - v 2.0 +# This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v2.0 +# and Eclipse Distribution License v1.0 which accompany this distribution. +# The Eclipse Public License is available at +# https://www.eclipse.org/legal/epl-2.0/ +# and the Eclipse Distribution License is available at +# http://www.eclipse.org/org/documents/edl-v10.php. +# For an explanation of what dual-licensing means to you, see: +# https://www.eclipse.org/legal/eplfaq.php#DUALLIC + +# Contributor: WangQing +# Maintainer: WangQing + +pkgname=mqtt +pkgpaho=paho.mqtt.c +pkgver=v1.3.12 +pkgrel=0 +pkgdesc="Eclipse Paho C Client Library for the MQTT Protocol" +url="https://github.com/eclipse/paho.mqtt.c" +archs=("armeabi-v7a" "arm64-v8a") +license=("EPL-2.0 & EDL-1.0") +depends=("openssl") +makedepends=() + +# 官方下载地址"https://github.com/eclipse/$pkgpaho/archive/refs/tags/$pkgver.zip"受网络影响可能存在下载失败的情况,现使用 gitee镜像可以与官方仓库保持同步 +source="https://gitee.com/mirrors/$pkgpaho/repository/archive/$pkgver.zip" + +autounpack=true +downloadpackage=true +buildtools="cmake" +builddir=$pkgpaho-${pkgver} +packagename=$builddir.zip + +prepare() { + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" -DMZ_BUILD_TESTS=ON -DMZ_BUILD_UNIT_TESTS=ON \ + -B$ARCH-build -S./ -L > $buildlog 2>&1 + $MAKE VERBOSE=1 -C $ARCH-build >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd "$builddir" + make -C $ARCH-build install >> $buildlog 2>&1 + cd $OLDPWD +} + +check() { + echo "The test must be on an OpenHarmony device!" + # 测试本库需要搭建一个MQTT broker,并且账号密码端口等需要和test下的用例使用的保持一致。 + # 运行ctest前,需要运行python ../test/mqttsas.py &与broker建立连接。 + # ctest +} + +# 清理环境 +cleanbuild() { + rm -rf ${PWD}/$builddir #${PWD}/$packagename +} diff --git a/community/mqtt/HPKCHECK b/community/mqtt/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..cbff399140b966de3acb85c4e6fae58a4f1a250e --- /dev/null +++ b/community/mqtt/HPKCHECK @@ -0,0 +1,31 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Eclipse Public License - v 2.0 +# This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v2.0 +# and Eclipse Distribution License v1.0 which accompany this distribution. +# The Eclipse Public License is available at +# https://www.eclipse.org/legal/epl-2.0/ +# and the Eclipse Distribution License is available at +# http://www.eclipse.org/org/documents/edl-v10.php. +# For an explanation of what dual-licensing means to you, see: +# https://www.eclipse.org/legal/eplfaq.php#DUALLIC + +# Contributor: WangQing +# Maintainer: WangQing + +source HPKBUILD > /dev/null 2>&1 +logfile=${LYCIUM_THIRDPARTY_ROOT}/${pkgname}/${pkgname}_${ARCH}_${OHOS_SDK_VER}_test.log + +openharmonycheck() { + cd $builddir/$ARCH-build + ctest > ${logfile} 2>&1 + res=$? + if [ $res -ne 0 ] + then + mkdir -p $LYCIUM_FAULT_PATH/$pkgname + cp Testing/Temporary/LastTest.log $LYCIUM_FAULT_PATH/$pkgname + fi + cd $OLDPWD + + return $res +} diff --git a/community/mqtt/OAT.xml b/community/mqtt/OAT.xml new file mode 100644 index 0000000000000000000000000000000000000000..eeb1f946d683c0b81976cd06522096062a6901b9 --- /dev/null +++ b/community/mqtt/OAT.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/community/mqtt/README.OpenSource b/community/mqtt/README.OpenSource new file mode 100755 index 0000000000000000000000000000000000000000..b3f21f9aee39c5076701fee16f801b34f7b76356 --- /dev/null +++ b/community/mqtt/README.OpenSource @@ -0,0 +1,20 @@ +[ + { + "Name": "mqtt", + "License": "EPL-2.0 and EDL-1.0", + "License File": "https://github.com/eclipse/paho.mqtt.c/blob/master/LICENSE", + "Owner": "xiafeng@huawei.com", + "Version Number": "v1.3.12", + "Upstream URL": "https://github.com/eclipse/paho.mqtt.c/archive/refs/tags/v1.3.12.zip", + "Description": "This repository contains the source code for the Eclipse Paho MQTT C client library." + }, + { + "Name": "openssl", + "License": "OpenSSL License and Original SSLeay License", + "License File": "https://www.openssl-library.org/source/license/license-openssl-ssleay.txt", + "Version Number": "1.1.1u", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://www.openssl.org/source/old/1.1.1/openssl-1.1.1u.tar.gz", + "Description": "OpenSSL is a robust, commercial-grade, full-featured Open Source Toolkit for the Transport Layer Security (TLS) protocol formerly known as the Secure Sockets Layer (SSL) protocol." + } +] diff --git a/community/mqtt/README_zh.md b/community/mqtt/README_zh.md new file mode 100755 index 0000000000000000000000000000000000000000..8a389f420f4548f0c0035e6201df588f8532c6fd --- /dev/null +++ b/community/mqtt/README_zh.md @@ -0,0 +1,15 @@ +# MQTT三方库说明 +## 功能简介 +MQTT 是用 C 语言编写的用于MQTT协议的Eclipse Paho C客户端库。 + +## 三方库版本 +- paho.mqtt.c-v1.3.12 + +## 已适配功能 +- 使用该库使应用程序能够连接到MQTT代理以发布消息,并订阅主题和接收已发布的消息。 + +## 使用约束 +- [IDE和SDK版本](../../docs/constraint.md) + +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) diff --git a/community/mqtt/SHA512SUM b/community/mqtt/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..56e87946e9b384b9df1632f9876409c034810440 --- /dev/null +++ b/community/mqtt/SHA512SUM @@ -0,0 +1 @@ +d38f97a1040a4a46803fa83529b3047a55d38b00273d9eabc649923b57ff5c384cf0328a4333df2f7ee7bb31383bd1d4bd773705eedbc86cfad23b04a0c30755 paho.mqtt.c-v1.3.12.zip diff --git a/community/mqtt/adapted/src/VersionInfo.h b/community/mqtt/adapted/src/VersionInfo.h new file mode 100755 index 0000000000000000000000000000000000000000..ae34598a203a562858b1b0a3d55ce285e98cd3a7 --- /dev/null +++ b/community/mqtt/adapted/src/VersionInfo.h @@ -0,0 +1,7 @@ +#ifndef VERSIONINFO_H +#define VERSIONINFO_H + +#define BUILD_TIMESTAMP "Tue 31 Jan 2023 10:34:16 AM UTC" +#define CLIENT_VERSION "1.3.12" + +#endif /* VERSIONINFO_H */ diff --git a/community/mqtt/bundle.json b/community/mqtt/bundle.json new file mode 100755 index 0000000000000000000000000000000000000000..cdba89b480aa589730a06669559d7ba46d44bb5a --- /dev/null +++ b/community/mqtt/bundle.json @@ -0,0 +1,33 @@ +{ + "name": "@ohos/mqtt", + "description": "This repository contains the source code for the [Eclipse Paho](http://mqtt.org) MQTT C/C++ client library for Embedded platorm.", + "version": "1.3.12", + "license": "Eclipse Public License v2.0 and Eclipse Distribution License v1.0", + "publishAs": "code-segment", + "segment": { + "destPath": "third_party/mqtt" + }, + "dirs": {}, + "scripts": {}, + "readmePath": { + "en": "README" + }, + "component": { + "name": "mqtt", + "subsystem": "thirdparty", + "syscap": [], + "features": [], + "adapted_system_type": [], + "rom": "", + "ram": "", + "deps": { + "components": [], + "third_party": [] + }, + "build": { + "sub_component": ["//third_party/mqtt:libmqtt"], + "inner_kits": [], + "test": [] + } + } +} diff --git a/community/mqtt/docs/hap_integrate.md b/community/mqtt/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..4ec55bb9d77f718fa7b9fd495019769db9ab0ca8 --- /dev/null +++ b/community/mqtt/docs/hap_integrate.md @@ -0,0 +1,90 @@ +# paho.mqtt.c 集成到应用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 + ``` + +- 三方库目录结构 + + ``` + tpc_c_cplusplus/thirdparty/mqtt #三方库libmqtt的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md + ``` + +- 在lycium目录下编译三方库 + + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ``` + cd lycium + ./build.sh mqtt + ``` + +- 三方库头文件及生成的库 + + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ``` + mqtt/arm64-v8a mqtt/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的文件都拷贝到该目录下,如下图所示: + +  ![thirdparty_install_dir](pic/libmqtt_install_dir.png) + + 将编译生成的三方动态库(动态库名字带版本号和不带版本号的都需要)拷贝到工程的libs目录下: + +  ![thirdparty_install_dir1](pic/libmqtt_install_dir1.png) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句: + + ```makefile + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/paho.mqtt.c/${OHOS_ARCH}/lib/libpaho-mqtt3a.so) + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/paho.mqtt.c/${OHOS_ARCH}/lib/libpaho-mqtt3c.so) + #将三方库及其依赖库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/paho.mqtt.c/${OHOS_ARCH}/include) + ``` + + + +## 测试三方库 + +三方库的测试使用原库自带的测试用例来做测试,[准备三方库测试环境](../../../lycium/README.md#3ci环境准备) + +进入到构建目录执行`ctest`运行测试用例(arm64-v8a-build为构建64位的目录,armeabi-v7a-build为构建32位的目录) + +需要注意的是: + +- 本三方库为mqtt client端,需要搭建mqtt broker端并与之连接才可以进行测试,[搭建mqtt服务器参考](https://blog.csdn.net/qq_40183977/article/details/127531651) +- 搭建broker端需要注意端口号以及用户名密码等与test文件下的测试文件里面写的保持一致(本库测试用例里的opts.username = "testuser"; + opts.password = "testpassword";) +- 运行python ../test/mqttsas.py后面可以带参数设置broker的地址和端口号,如:python mqttsas.py 192.168.63.102 1886 +- 如在windows下使用hdc forward rport进行端口映射的方式连接测试板子,需要注意每跑完一个test用例就会断开,不建议使用这种方式测试 + + ![libass_test](pic/libmqtt_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) \ No newline at end of file diff --git a/community/mqtt/docs/pic/libmqtt_install_dir.png b/community/mqtt/docs/pic/libmqtt_install_dir.png new file mode 100644 index 0000000000000000000000000000000000000000..3861fa6262f1a34d539315ec6cbd8b3145c47168 Binary files /dev/null and b/community/mqtt/docs/pic/libmqtt_install_dir.png differ diff --git a/community/mqtt/docs/pic/libmqtt_install_dir1.png b/community/mqtt/docs/pic/libmqtt_install_dir1.png new file mode 100644 index 0000000000000000000000000000000000000000..fd905062d4977928b5c6d4e7abf52a0490d20e60 Binary files /dev/null and b/community/mqtt/docs/pic/libmqtt_install_dir1.png differ diff --git a/community/mqtt/docs/pic/libmqtt_test.png b/community/mqtt/docs/pic/libmqtt_test.png new file mode 100644 index 0000000000000000000000000000000000000000..fe2eb87a24366f0a7f666256deebc8083633ea26 Binary files /dev/null and b/community/mqtt/docs/pic/libmqtt_test.png differ diff --git a/community/mqtt/docs/pic/running_result.png b/community/mqtt/docs/pic/running_result.png new file mode 100755 index 0000000000000000000000000000000000000000..edf029d37157b214ede7f04350d88624292af48b Binary files /dev/null and b/community/mqtt/docs/pic/running_result.png differ diff --git a/community/mqtt/docs/rom_integrate.md b/community/mqtt/docs/rom_integrate.md new file mode 100755 index 0000000000000000000000000000000000000000..04699590f57931ffb0d5c50f0aee7faead443cf2 --- /dev/null +++ b/community/mqtt/docs/rom_integrate.md @@ -0,0 +1,152 @@ +# mqtt如何集成到系统Rom + +## 准备源码工程 + +本库是基于OpenHarmony 3.2 beta4版本,在润和RK3568开发板上验证的。如果是从未使用过RK3568,可以先查看[润和RK3568开发板标准系统快速上手](https://gitee.com/openharmony-sig/knowledge_demo_temp/tree/master/docs/rk3568_helloworld)。 + +### 准备系统Rom源码 + +系统源码获取方法请参照:[OpenHarmony3.2beta4源码下载](https://gitee.com/openharmony/docs/blob/OpenHarmony-v3.2-Beta5/zh-cn/release-notes/OpenHarmony-v3.2-beta4.md#源码获取) + +### 增加构建脚本及配置文件 + +- 下载本仓库代码 + + ```shell + cd ~/ + git clone git@gitee.com:openharmony-sig/tpc_c_cplusplus.git --depth=1 + ``` + +- 仓库代码目录结构说明 + + ```shell + cd ~/tpc_c_cplusplus/thirdparty/mqtt # 进入到仓库代码库目录 + ``` + + ```shell + mqtt + |-- adapted # 存放三方库适配需要的代码文件 + |-- docs # 存放 mqtt 相关文档的文件夹 + |-- BUILD.gn # 编译构建脚本 + |-- bundle.json # 三方库组件定义文件 + |-- README_zh.md # mqtt 主页说明文档 + |-- README.OpenSource # mqtt 源码的下载地址,版本,license等信息 + ``` + +- 将本仓库文件夹拷贝到OpenHarmony源码的third_party目录下 + + ```shell + cp -arf ~/tpc_c_cplusplus/thirdparty/mqtt ~/OpenHarmony/third_party + ``` + +### 准备三方库源码 + +- 三方库源码下载 + + 将mqtt-1.3.12源码下载到mqtt目录。 + + ```shell + cd ~/OpenHarmony/third_party/mqtt + git clone https://github.com/eclipse/paho.mqtt.c.git -b v1.3.12 + ``` + +## 系统Rom中引入三方库 + +准备完三方库代码后,我们需要将三方库加入到编译构建体系中。标准系统编译构建可以参考文档[编译构建指导](https://gitee.com/openharmony/docs/blob/OpenHarmony-3.2-Beta4/zh-cn/device-dev/subsystems/subsys-build-all.md)。
+我们默认三方库是属于OpenHarmony的thirdparty子系统,如果需要自己定义子系统参考文档[如何为三方库组件中添加一个三方库](https://gitee.com/openharmony-sig/knowledge/blob/master/docs/openharmony_getstarted/port_thirdparty/README.md)。
+新增需要编译的组件,在OpenHarmony源码的vendor/hihope/rk3568/config.json文件中,新增需要编译的组件,如下代码段所示,在thirdparty子系统下面新增mqtt组件 + +```json +{ + "subsystem": "thirdparty", + "components": [ + { + "component": "musl", + "features": [] + }, + { + "component": "mqtt", + "features": [] + } + ] +} +``` + +## 系统Rom中引入三方库测试程序 + +如果需要编译测试用例,在OpenHarmony源码的vendor/hihope/rk3568/config.json文件,在对应组件的features中打开编译选项,如下 + +```json +{ + "subsystem": "thirdparty", + "components": [ + { + "component": "musl", + "features": [] + }, + { + "component": "mqtt", + "features": [ "enable_mqtt_test=true" ] + } + ] +} +``` + +## 编译工程 + +- 进入源码根目录 + + ```shell + cd ~/openharmony + ``` + +- 选择产品 + + ```shell + hb set # 运行hb set后会出现产品列表,在此我们选择 rk3568 + ``` + +- 执行编译 + + ```shell + hb build --target-cpu arm #编译32位系统 + hb build --target-cpu arm64 #编译64位系统 + ``` + +- 生成的可执行文件和库文件都在out/rk3568/thirdparty/mqtt目录下,同时也打包到了镜像中 + +## 运行效果 + +将编译生成的库和测试文件放到板子上运行,为避免每次将文件推入设备都要烧录整个镜像,我们使用hdc_std工具将文件推到开发板上 + +- 首先将hdc_std工具编译出来
+ 执行以下命令进行编译hdc_std工具(工具编译出来所在路径out/sdk/ohos-sdk/windows/toolchains/hdc_std.exe): + + ```shell + hb set #源码根目录下使用hb set 选择产品ohos-sdk + hb build #然后编译 + ``` + +- 将工具拷贝到Windows,可以为工具目录配置环境变量,也可以在工具所在目录打开windows命令行 +- 将原生库测试需要的所有文件打包成mqtt.tar,并拷贝到windows下 +- 将文件推送到开发板,在windows命令行进行如下操作 + + ```shell + hdc_std shell mount -o remount,rw / #修改系统权限为可读写 + hdc_std file send mqtt.tar / #将文件包推入开发板 + hdc_std shell #进入开发板 + tar xvf mqtt.tar #解压 + #注意需要将库拷贝到/system/lib 或者/system/lib64目录下 + ``` + +- 运行测试程序 + 在测试目录运行测试程序MQTTClient_subscribe,然后再另一个窗口运行测试程序MQTTClient_publish,则在订阅窗口会打印“Message arrived”,如下图所示:
+  ![image-20220922143536085](./pic/running_result.png) + +## 参考资料 + +- [润和RK3568开发板标准系统快速上手](https://gitee.com/openharmony-sig/knowledge_demo_temp/tree/master/docs/rk3568_helloworld)。 +- [OpenHarmony3.2beta4](https://gitee.com/openharmony/docs/blob/OpenHarmony-v3.2-Beta5/zh-cn/release-notes/OpenHarmony-v3.2-beta4.md)。 +- [OpenHarmony三方库组织地址](https://gitee.com/openharmony-tpc)。 +- [如何为三方库组件中添加一个三方库](https://gitee.com/openharmony-sig/knowledge/blob/master/docs/openharmony_getstarted/port_thirdparty/README.md)。 +- [知识体系](https://gitee.com/openharmony-sig/knowledge)。 diff --git a/community/nanodbc/HPKBUILD b/community/nanodbc/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..0ebb8b3128b3d75ad64ce39939fdb963cd8b10b6 --- /dev/null +++ b/community/nanodbc/HPKBUILD @@ -0,0 +1,90 @@ +# 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: zhuangkun +# Maintainer: huangminzhong + +pkgname=nanodbc +pkgver=v2.13.0 +pkgrel=0 +pkgdesc="nanodbc is a lightweight, headline-driven ODBC library wrapper for C++ that provides a simple and modern interface to access ODBC databases" +archs=("armeabi-v7a" "arm64-v8a") +url="https://github.com/nanodbc/nanodbc/" +license=("MIT") +depends=("unixODBC") +makedepends=() +source="https://github.com/nanodbc/${pkgname}/archive/refs/tags/${pkgver}.tar.gz" + + +downloadpackage=true +autounpack=true +patchflag=true + +builddir=$pkgname-${pkgver:1} +packagename=$builddir.tar.gz + +prepare() { + mkdir -p $builddir/$ARCH-build + # 修改SONAME版本号为主版本号.2,IDE不支持使用.2.13.0版本号 + if $patchflag + then + cd $builddir + patch -p1 < `pwd`/../nanodbc_oh_pkg.patch >> $publicbuildlog 2>&1 + patchflag=false + cd $OLDPWD + fi +} + +build() { + cd $builddir + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" -DBUILD_SHARED_LIBS=ON \ + -DCMAKE_CXX_FLAGS="-Wunused-command-line-argument -Wno-error=unused-command-line-argument \ + -I${LYCIUM_ROOT}/usr/unixODBC/${ARCH}/include" \ + -DNANODBC_DISABLE_TESTS=OFF \ + -DNANODBC_DISABLE_EXAMPLES=OFF \ + -DODBC_LINK_FLAGS="-L${LYCIUM_ROOT}/usr/unixODBC/${ARCH}/lib" \ + -DOHOS_ARCH=$ARCH \ + -B$ARCH-build -S./ > $buildlog 2>&1 + $MAKE VERBOSE=1 -C $ARCH-build >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + $MAKE -C $ARCH-build install >> $buildlog 2>&1 + cd $OLDPWD +} + +check() { + cd $builddir/$ARCH-build + sed -i.bak '9s/^/#/' ./test/CTestTestfile.cmake + sed -i '10s/^/#/' ./test/CTestTestfile.cmake + sed -i '11s/^/#/' ./test/CTestTestfile.cmake + sed -i '12s/^/#/' ./test/CTestTestfile.cmake + sed -i '13s/^/#/' ./test/CTestTestfile.cmake + sed -i '14s/^/#/' ./test/CTestTestfile.cmake + sed -i '15s/^/#/' ./test/CTestTestfile.cmake + sed -i '16s/^/#/' ./test/CTestTestfile.cmake + sed -i '17s/^/#/' ./test/CTestTestfile.cmake + sed -i '18s/^/#/' ./test/CTestTestfile.cmake + cd $OLDPWD + #将测试用例使用的cmake改为CI工具的cmake + echo "The test must be on an OpenHarmony device!" +} + +cleanbuild() { + rm -rf ${PWD}/$builddir +} + diff --git a/community/nanodbc/HPKCHECK b/community/nanodbc/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..90cefe614db94107e6eaec3686b5173ab071d03d --- /dev/null +++ b/community/nanodbc/HPKCHECK @@ -0,0 +1,32 @@ +# 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: huangminzhong2 ,zhuangkun +# Maintainer: huangminzhong2 + +source HPKBUILD > /dev/null 2>&1 +logfile=${LYCIUM_THIRDPARTY_ROOT}/${pkgname}/${pkgname}_${ARCH}_${OHOS_SDK_VER}_test.log + +# 在OH环境执行测试的接口 +openharmonycheck() { + res=0 + cd ${builddir}/${ARCH}-build + ctest > ${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 +} diff --git a/community/nanodbc/OAT.xml b/community/nanodbc/OAT.xml new file mode 100644 index 0000000000000000000000000000000000000000..eeb1f946d683c0b81976cd06522096062a6901b9 --- /dev/null +++ b/community/nanodbc/OAT.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/community/nanodbc/README.OpenSource b/community/nanodbc/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..ef1bb61de57f0db7f61c90cfdc1746e5b07f046f --- /dev/null +++ b/community/nanodbc/README.OpenSource @@ -0,0 +1,31 @@ +[ + { + "Name": "nanodbc", + "License": "MIT", + "License File": "https://github.com/nanodbc/nanodbc/blob/main/LICENSE", + "Version Number": "v2.13.0", + "Owner": "huangminzhong2@huawei.com", + "Upstream URL": "https://github.com/nanodbc/nanodbc/", + "Description": "nanodbc is a lightweight, headline-driven ODBC library wrapper for C++ that provides a simple and modern interface to access ODBC databases" + } + + { + "Name": "sqlite", + "License": "Public Domain", + "License File": "https://www.sqlite.org/copyright.html", + "Version Number": "version-3.42.0", + "Owner": "wupingyuan@huawei.com", + "Upstream URL": "https://github.com/sqlite/sqlite/archive/refs/tags/.tar.gz", + "Description": "This repository contains the complete source code for the SQLite database engine. Some test scripts are also included. However, many other test scripts and most of the documentation are managed separately." + } + + { + "Name": "unixODBC", + "License": "GNU Lesser General Public License v2.1", + "License File": "https://github.com/lurcher/unixODBC/blob/master/LICENSE", + "Version Number": "2.3.11", + "Owner": "sttangc@isoftstone.com", + "Upstream URL": "https://github.com/lurcher/unixODBC/releases/download/2.3.11/unixODBC-2.3.11.tar.gz", + "Description": "The unixODBC Project goals are to develop and promote unixODBC to be the definitive standard for ODBC on non MS Windows platforms." + } +] diff --git a/community/nanodbc/README_zh.md b/community/nanodbc/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..52cf362acf1d028eeb3e94abb3c99189a9c36c1e --- /dev/null +++ b/community/nanodbc/README_zh.md @@ -0,0 +1,12 @@ +# nanodbc 三方库说明 +## 功能简介 +nanodbc 是一个用于C++的轻量级、头文件驱动的ODBC库封装,它提供了一个简单而现代的接口来访问ODBC数据库。 + +## 三方库版本 +- v2.13.0 + +## 使用约束 +- [IDE和SDK版本](../../docs/constraint.md) + +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) diff --git a/community/nanodbc/SHA512SUM b/community/nanodbc/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..06bc90132250f04db17b58d7fa11b209f56a0731 --- /dev/null +++ b/community/nanodbc/SHA512SUM @@ -0,0 +1 @@ +65a1cf1be1f3e5cb147c21226868cf3c92cb2ac92c1a5ef5b2c555ec167f5add29d63e767c4d38957f31d4f984995c1bf4dc7120f2afdaf9d757ee3e2c0625dc nanodbc-2.13.0.tar.gz diff --git a/community/nanodbc/docs/hap_integrate.md b/community/nanodbc/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..2803f460fe6651d9548989440600bb5b5c3b40b0 --- /dev/null +++ b/community/nanodbc/docs/hap_integrate.md @@ -0,0 +1,85 @@ +# nanodbc集成到应用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/nanodbc #三方库nanodbc的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── HPKCHECK #测试脚本 + ├── OAT.xml #扫描结果文件 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md #三方库简介 + ``` + +* 在lycium目录下编译三方库 + + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ```shell + cd lycium + ./build.sh nanodbc + ``` + +* 三方库头文件及生成的库 + + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ```shell + nanodbc/arm64-v8a nanodbc/armeabi-v7a + ``` + +* [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的头文件拷贝到该目录下; +- 在IDE的entry目录下新增libs目录,将编译生成的.so文件拷贝到该目录下,若没有so文件则无需新增libs目录。如下图所示: + + ![thirdparty_install_dir](pic/nanodbc-dev.png) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + + ```cmake + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/nanodbc/${OHOS_ARCH}/lib/libnanodbc.so) + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/sqlite/${OHOS_ARCH}/lib/libsqlite3.a) + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/unixODBC/${OHOS_ARCH}/lib/libodbc.a) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/nanodbc/${OHOS_ARCH}/include/) + ``` + + +## 测试三方库 + +- 编译出可执行的文件进行测试,[准备三方库测试环境](../../../lycium/README.md#3ci环境准备) + +- 进入到构建目录运行测试用例(注意arm64-v8a为构建64位的目录,armeabi-v7a为构建32位的目录),执行结果如图所示 +``` + cd /data/tpc_c_cplusplus/thirdparty/nanodbc/nanodbc-2.13.0/armeabi-v7a-build + ctest +``` + + ![libnanodbc_test](pic/test-cmd-ret.png) + +## 参考资料 + +* [OpenHarmony三方库地址](https://gitee.com/openharmony-tpc) +* [OpenHarmony知识体系](https://gitee.com/openharmony-sig/knowledge) +* [libnanodbc三方库地址](https://github.com/nanodbc/nanodbc/) + diff --git a/community/nanodbc/docs/pic/nanodbc-dev.png b/community/nanodbc/docs/pic/nanodbc-dev.png new file mode 100644 index 0000000000000000000000000000000000000000..4e1335ad5aaa9164995060053f7d5f08b4550eaa Binary files /dev/null and b/community/nanodbc/docs/pic/nanodbc-dev.png differ diff --git a/community/nanodbc/docs/pic/test-cmd-ret.png b/community/nanodbc/docs/pic/test-cmd-ret.png new file mode 100644 index 0000000000000000000000000000000000000000..d4b62ebc8ee8bc351d1c1b046636cb19ddca7f40 Binary files /dev/null and b/community/nanodbc/docs/pic/test-cmd-ret.png differ diff --git a/community/nanodbc/nanodbc_oh_pkg.patch b/community/nanodbc/nanodbc_oh_pkg.patch new file mode 100644 index 0000000000000000000000000000000000000000..fbe328729c53a32f4dfe38ce550068bcbafd91fa --- /dev/null +++ b/community/nanodbc/nanodbc_oh_pkg.patch @@ -0,0 +1,19 @@ +diff -Nuar nanodbc-2.13.0/CMakeLists.txt nanodbc-2.13.0-new/CMakeLists.txt +--- nanodbc-2.13.0/CMakeLists.txt 2020-08-27 23:16:57.000000000 +0800 ++++ nanodbc-2.13.0-new/CMakeLists.txt 2024-07-26 15:08:01.316786010 +0800 +@@ -20,10 +20,11 @@ + ######################################## + ## nanodbc version + ######################################## +-file(STRINGS VERSION NANODBC_VERSION REGEX "[0-9]+\\.[0-9]+\\.[0-9]+") +-string(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" NANODBC_VERSION_MAJOR "${NANODBC_VERSION}") +-string(REGEX REPLACE "^[0-9]+\\.([0-9])+\\.[0-9]+" "\\1" NANODBC_VERSION_MINOR "${NANODBC_VERSION}") +-string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" NANODBC_VERSION_PATCH "${NANODBC_VERSION}") ++#file(STRINGS VERSION NANODBC_VERSION REGEX "[0-9]+\\.[0-9]+\\.[0-9]+") ++set(NANODBC_VERSION "2") ++#string(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" NANODBC_VERSION_MAJOR "${NANODBC_VERSION}") ++#string(REGEX REPLACE "^[0-9]+\\.([0-9])+\\.[0-9]+" "\\1" NANODBC_VERSION_MINOR "${NANODBC_VERSION}") ++#string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" NANODBC_VERSION_PATCH "${NANODBC_VERSION}") + message(STATUS "nanodbc version: ${NANODBC_VERSION}") + + ######################################## diff --git a/community/nghttp2/HPKBUILD b/community/nghttp2/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..1f795ead05af9b64b286d2cfdbf55c5c11491523 --- /dev/null +++ b/community/nghttp2/HPKBUILD @@ -0,0 +1,73 @@ +# 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: Jeff Han +# Maintainer: Jeff Han + +pkgname=nghttp2 +pkgver=v1.52.0 +pkgrel=0 +pkgdesc="" +url="" +archs=("armeabi-v7a" "arm64-v8a") +license=("MIT") +depends=("openssl_quic" "CUnit" "nghttp3" "libxml2") # libev/libcares/libngtcp2/libngtcp2_crypto_openssl/systemd/jansson/libevent/jemalloc/ +makedepends=() + +# 官网地址:https://github.com/nghttp2/$pkgname/archive/refs/tags/$pkgver.tar.gz,因网络原因采用gitee mirrors +source=https://gitee.com/mirrors/$pkgname/repository/archive/$pkgver.zip + +autounpack=true +downloadpackage=true + +builddir=$pkgname-${pkgver} +packagename=$builddir.zip + +prepare() { + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" -DENABLE_STATIC_CRT=ON -DENABLE_STATIC_LIB=ON -DOHOS_ARCH=$ARCH -B$ARCH-build -S./ -L > `pwd`/$ARCH-build/build.log 2>&1 + make -j4 -C $ARCH-build >> `pwd`/$ARCH-build/build.log 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + make -C $ARCH-build install >> `pwd`/$ARCH-build/build.log 2>&1 + cd $OLDPWD +} + +check() { + cd $builddir/$ARCH-build + make -f lib/CMakeFiles/nghttp2_static.dir/build.make lib/CMakeFiles/nghttp2_static.dir/depend >> `pwd`/build.log 2>&1 && \ + make -f lib/CMakeFiles/nghttp2_static.dir/build.make lib/CMakeFiles/nghttp2_static.dir/build >> `pwd`/build.log 2>&1 && \ + make -f tests/CMakeFiles/failmalloc.dir/build.make tests/CMakeFiles/failmalloc.dir/depend >> `pwd`/build.log 2>&1 && \ + make -f tests/CMakeFiles/failmalloc.dir/build.make tests/CMakeFiles/failmalloc.dir/build >> `pwd`/build.log 2>&1 && \ + make -f tests/CMakeFiles/main.dir/build.make tests/CMakeFiles/main.dir/depend >> `pwd`/build.log 2>&1 && \ + make -f tests/CMakeFiles/main.dir/build.make tests/CMakeFiles/main.dir/build >> `pwd`/build.log 2>&1 && \ + make -f CMakeFiles/check.dir/build.make CMakeFiles/check.dir/depend >> `pwd`/build.log 2>&1 + cd $OLDPWD + echo "The test must be on an OpenHarmony device!" + # real test CMD + # ctest +} + +# 清理环境 +cleanbuild(){ + rm -rf ${PWD}/$builddir #${PWD}/$packagename +} diff --git a/community/nghttp2/README.OpenSource b/community/nghttp2/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..10909064272649b64ebdbdd0a2b220df49503940 --- /dev/null +++ b/community/nghttp2/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "nghttp2", + "License": "MIT", + "License File": "LICENSE", + "Version Number": "v1.52.0", + "Owner": "hanjinfei@foxmail.com", + "Upstream URL": https://github.com/nghttp2/nghttp2/archive/refs/tags/v1.52.0.tar.gz", + "Description": "This is an implementation of the Hypertext Transfer Protocol version 2 in C." + } +] diff --git a/community/nghttp2/README_zh.md b/community/nghttp2/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..4861648330216fdf48d56f7771f67386c97df6a7 --- /dev/null +++ b/community/nghttp2/README_zh.md @@ -0,0 +1,12 @@ +# nghttp2三方库说明 +## 功能简介 +nghttp2是一个实现http2超文本传输协议的C库。 + +## 三方库版本 +- v1.52.0 + +## 使用约束 +- [IDE和SDK版本](../../docs/constraint.md) + +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) diff --git a/community/nghttp2/SHA512SUM b/community/nghttp2/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..d457a3fe54c2d12993ff2f0dc69542e33f48f3f3 --- /dev/null +++ b/community/nghttp2/SHA512SUM @@ -0,0 +1 @@ +188d9a9bcffbb1f8df013baa147c08280140b9edde4639e7d56d363747e46b18cb02fc25b158c4bac46b170eac660e5d059b9ce2814b9202d17217d9c8bd1588 nghttp2-v1.52.0.zip diff --git a/community/nghttp2/docs/hap_integrate.md b/community/nghttp2/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..68f59d39d5b8e79b777f78cbdc940c88b22beca4 --- /dev/null +++ b/community/nghttp2/docs/hap_integrate.md @@ -0,0 +1,63 @@ +# nghttp2集成到应用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) +## 编译三方库 +- 下载本仓库 + ``` + git clone https://gitee.com/openharmony-sig/tpc_c_cplusplus.git --depth=1 + ``` + +- 三方库目录结构 + ``` + tpc_c_cplusplus/thirdparty/nghttp2 #三方库nghttp2的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md + ``` + +- 在lycium目录下编译三方库 + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + ``` + cd lycium + ./build.sh openssl_quic CUnit nghttp3 libxml2 nghttp2 + ``` + +- 三方库头文件及生成的库 + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + ``` + nghttp2/arm64-v8a nghttp2/armeabi-v7a + openssl_quic/arm64-v8a openssl_quic/armeabi-v7a + CUnit/arm64-v8a CUnit/armeabi-v7a + nghttp3/arm64-v8a nghttp3/armeabi-v7a + libxml2/arm64-v8a libxml2/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的库拷贝到该目录下,如下图所示 + +  ![thirdparty_install_dir](pic/nghttp2_install_dir.jpg) +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + ``` + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/nghttp2/${OHOS_ARCH}/lib/libnghttp2.a) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/nghttp2/${OHOS_ARCH}/include) + ``` +## 测试三方库 +三方库的测试使用原库自带的测试用例来做测试,[准备三方库测试环境](../../../lycium/README.md#3ci环境准备) + +进入到构建目录执行ctest运行测试用例(arm64-v8a-build为构建64位的目录,armeabi-v7a-build为构建32位的目录) + + ![nghttp2_test](pic/nghttp2_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/community/nghttp2/docs/pic/nghttp2_install_dir.jpg b/community/nghttp2/docs/pic/nghttp2_install_dir.jpg new file mode 100644 index 0000000000000000000000000000000000000000..f2aeec03e057a5a129d2486f8d6761db8e281dfa Binary files /dev/null and b/community/nghttp2/docs/pic/nghttp2_install_dir.jpg differ diff --git a/community/nghttp2/docs/pic/nghttp2_test.jpg b/community/nghttp2/docs/pic/nghttp2_test.jpg new file mode 100644 index 0000000000000000000000000000000000000000..fe0cf6d1bbe327d4783f1edc19fefb936134db18 Binary files /dev/null and b/community/nghttp2/docs/pic/nghttp2_test.jpg differ diff --git a/community/nghttp2/docs/pic/nghttp2_usage.jpg b/community/nghttp2/docs/pic/nghttp2_usage.jpg new file mode 100644 index 0000000000000000000000000000000000000000..67f6310525fa087caae25867fc9164983b6c15dc Binary files /dev/null and b/community/nghttp2/docs/pic/nghttp2_usage.jpg differ diff --git a/community/ogg-1.3.4/HPKBUILD b/community/ogg-1.3.4/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..41258afadfbf64c48756d09f8c9f80ac5456f455 --- /dev/null +++ b/community/ogg-1.3.4/HPKBUILD @@ -0,0 +1,62 @@ +# 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=ogg-1.3.4 +pkgver=v1.3.4 +pkgrel=0 +pkgdesc="It is the reference implementation of the Ogg media container" +url="https://github.com/xiph/ogg/tree/v1.3.4" +archs=("armeabi-v7a" "arm64-v8a") +license=("BSD 3-Clause License") +depends=() +makedepends=() +source="https://github.com/xiph/ogg/archive/refs/tags/v1.3.4.zip" + +downloadpackage=true +autounpack=true +buildtools=cmake + +builddir=ogg-1.3.4 +packagename=ogg-v1.3.4.zip + +# 为编译设置环境,如设置环境变量,创建编译目录等 +prepare() { + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" -DCMAKE_C_FLAGS="-Wno-unused-command-line-argument" \ + -DCMAKE_CXX_FLAGS="-Wno-unused-command-line-argument" -B$ARCH-build -S./ > $buildlog 2>&1 + $MAKE VERBOSE=1 -C $ARCH-build >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + $MAKE -C $ARCH-build install >> $buildlog 2>&1 + cd $OLDPWD +} + +check() { + echo "The test must be on an OpenHarmony device!" +} + +cleanbuild() { + rm -rf ${PWD}/$builddir +} \ No newline at end of file diff --git a/community/ogg-1.3.4/HPKCHECK b/community/ogg-1.3.4/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..45087f23bbfe1b9cac2c3352e606b765ef4a975f --- /dev/null +++ b/community/ogg-1.3.4/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: 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}_${OHOS_SDK_VER}_test.log + + +# 在OH环境执行测试的接口 +openharmonycheck() { + res=0 + cd ${builddir}/${ARCH}-build # 进入到测试目录 + ctest > $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/community/ogg-1.3.4/README.OpenSource b/community/ogg-1.3.4/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..413fa43ae7bc4f3a0463504178fcbcee9de31a7f --- /dev/null +++ b/community/ogg-1.3.4/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "ogg-1.3.4", + "License": "BSD 3-Clause License", + "License File": "https://github.com/xiph/ogg/blob/master/COPYING", + "Version Number": "1.3.4", + "Owner": "2942375747@qq.com", + "Upstream URL": "https://github.com/xiph/ogg", + "Description": "Ogg project codecs use the Ogg bitstream format to arrange the raw, compressed bitstream into a more robust, useful form." + } +] \ No newline at end of file diff --git a/community/ogg-1.3.4/README_zh.md b/community/ogg-1.3.4/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..635c67bf6d200100dbe6dcdca041a6c5043d23ab --- /dev/null +++ b/community/ogg-1.3.4/README_zh.md @@ -0,0 +1,9 @@ +# ogg三方库说明 +## 功能简介 +Ogg项目编解码器使用Ogg比特流格式可以将原始的压缩比特流排列成更健壮、更有用的形式。 +## 三方库版本: +- 1.3.4 +## 使用约束: +- [IDE和SDK版本](../../docs/constraint.md) +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) diff --git a/community/ogg-1.3.4/SHA512SUM b/community/ogg-1.3.4/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..c596833532c3b0960765dca4b141cd772e3172a4 --- /dev/null +++ b/community/ogg-1.3.4/SHA512SUM @@ -0,0 +1 @@ +0ed6a7ea4a653167af0dd713bc6ce3623f43a103453ba037edaa451d6f74827b3859d9141ba2e7599ab01e6a94e983ff443d95724866cb2f87d444bd9f7c8891 ogg-v1.3.4.zip \ No newline at end of file diff --git a/community/ogg-1.3.4/docs/hap_integrate.md b/community/ogg-1.3.4/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..cb456df27664f069278100bfe96cac8c94deb437 --- /dev/null +++ b/community/ogg-1.3.4/docs/hap_integrate.md @@ -0,0 +1,78 @@ +# ogg集成到应用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/ogg-1.3.4 #三方库ogg-1.3.4的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── HPKCHECK #测试脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md #三方库简介 + ``` + +- 在lycium目录下编译三方库 + + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ```shell + cd lycium + ./build.sh ogg-1.3.4 + ``` + +- 三方库头文件及生成的库 + + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ```shell + ogg-1.3.4/arm64-v8a ogg-1.3.4/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的头文件拷贝到该目录下,将编译生成的三方库以及依赖库全部(动态库名字带版本号和不带版本号的都需要)拷贝到工程的libs目录下,如下图所示: +   + +  ![thirdparty_install_dir](pic/ogg_install_dir.png) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + + ```shell + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/ogg/${OHOS_ARCH}/lib/libogg.a) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/ogg/${OHOS_ARCH}/include) + ``` + +## 测试三方库 +- 编译出可执行的文件,使用原库自带的测试用例来做测试 [准备三方库测试环境](../../../lycium/README.md#3ci环境准备) +进入到构建目录运行测试用例(注意arm64-v8a为构建64位的目录,armeabi-v7a为构建32位的目录),执行结果如图所示 + +```shell + cd /data/tpc_c_cplusplus/thirdparty/ogg-1.3.4/ogg-1.3.4/arm64-v8a-build/ + ctest +``` + ![ogg_test](pic/ogg_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/community/ogg-1.3.4/docs/pic/ogg_install_dir.png b/community/ogg-1.3.4/docs/pic/ogg_install_dir.png new file mode 100644 index 0000000000000000000000000000000000000000..6c7da2d8ded9a0a41f0942767f0a8f322fa1738a Binary files /dev/null and b/community/ogg-1.3.4/docs/pic/ogg_install_dir.png differ diff --git a/community/ogg-1.3.4/docs/pic/ogg_test.png b/community/ogg-1.3.4/docs/pic/ogg_test.png new file mode 100644 index 0000000000000000000000000000000000000000..e836ea017a9411669edbea6238437d05a912277c Binary files /dev/null and b/community/ogg-1.3.4/docs/pic/ogg_test.png differ diff --git a/community/opencv_3.4.1/HPKBUILD b/community/opencv_3.4.1/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..712a75eff908865d85a1a4f1d4acd57b8e79bc46 --- /dev/null +++ b/community/opencv_3.4.1/HPKBUILD @@ -0,0 +1,62 @@ +# 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: TangShaoteng , zhaoxu <357489213@qq.com> +# Maintainer: TangShaoteng + +pkgname=opencv_3.4.1 +pkgver=3.4.1 +pkgrel=0 +pkgdesc="OpenCV (Open Source Computer Vision Library) is an open source computer vision and machine learning software library. OpenCV was built to provide a common infrastructure for computer vision applications and to accelerate the use of machine perception in the commercial products. " +url="https://github.com/opencv/opencv" +archs=("armeabi-v7a" "arm64-v8a") +license=("Apache-2.0 license") +depends=() +makedepends=() + +source="https://github.com/opencv/${pkgname:0:6}/archive/refs/tags/$pkgver.tar.gz" + +autounpack=true +downloadpackage=true + +builddir=${pkgname:0:6}-${pkgver} +packagename=$builddir.tar.gz + +prepare() { + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" -DOHOS_ARCH=$ARCH -DBUILD_SHARED_LIBS=OFF -B$ARCH-build -S./ -L > `pwd`/$ARCH-build/build.log 2>&1 + make VERBOSE=1 -j4 -C $ARCH-build >> `pwd`/$ARCH-build/build.log 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + make -C $ARCH-build install >> `pwd`/$ARCH-build/build.log 2>&1 + cd $OLDPWD +} + +check() { + echo "The test must be on an OpenHarmony device!" + # TODO +} + +# 清理环境 +cleanbuild() { + rm -rf ${PWD}/$builddir #${PWD}/$packagename +} diff --git a/community/opencv_3.4.1/SHA512SUM b/community/opencv_3.4.1/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..039f1b69a0eea9afe31a1a1286e6cf4b8a2a7d65 --- /dev/null +++ b/community/opencv_3.4.1/SHA512SUM @@ -0,0 +1 @@ +e1fc14285090c6fe9e26e721f2d67d7096650c523147e925567426ef76aa7f4c6f12035d6f6ce3ec7991a75a6828a810fd4f9b75f78ed5fcccecefbadd79944b opencv-3.4.1.tar.gz diff --git a/community/openmp/HPKBUILD b/community/openmp/HPKBUILD new file mode 100755 index 0000000000000000000000000000000000000000..abfd261ecbde85ee2370df65b50f3eef87f8a370 --- /dev/null +++ b/community/openmp/HPKBUILD @@ -0,0 +1,58 @@ +# Contributor: 城meto +# Maintainer: 城meto + +pkgname=openmp +pkgver=release_90 +pkgrel=0 +pkgdesc="openmp is a compoment of llvm-project." +url="https://github.com/llvm-mirror/openmp" +archs=("armeabi-v7a" "arm64-v8a") +license=("View license") +depends=() +makedepends=() +source="https://codeload.github.com/llvm-mirror/$pkgname/zip/refs/heads/$pkgver" + +autounpack=true +downloadpackage=true +patchflag=true + +builddir=$pkgname-$pkgver +packagename=$pkgname-$pkgver.zip + +prepare() { + # 因平台差异问题,缺少pthread_cancel需要打patch + if [ $patchflag == true ];then + cd $builddir + patch -p1 < `pwd`/../openmp_oh_pkg.patch + patchflag=false + cd $OLDPWD + fi + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + # LIBOMP_USE_VERSION_SYMBOLS 打开后需要添加-DLIBOMP_LDFLAGS="-Wl,--version-script=`pwd`/runtime/src/exports_so.txt" 才可编译通过 + PKG_CONFIG_LIBDIR="{pkgconfigpath}" ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" -DLIBOMP_USE_VERSION_SYMBOLS=OFF -DOHOS_ARCH=$ARCH -B$ARCH-build -S./ -L > `pwd`/$ARCH-build/build.log 2>&1 + $MAKE -C $ARCH-build VERBOSE=1 >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + $MAKE -C $ARCH-build install VERBOSE=1 >> $buildlog 2>&1 + cd $OLDPWD +} + +check() { + echo "The test must be on an OpenHarmony device!" + # real test + # ctest +} + +# 清理环境 +cleanbuild(){ + rm -rf ${PWD}/$builddir #${PWD}/$packagename +} \ No newline at end of file diff --git a/community/openmp/SHA512SUM b/community/openmp/SHA512SUM new file mode 100755 index 0000000000000000000000000000000000000000..5176165bafc0e852ab555634765d58a9963f7a40 --- /dev/null +++ b/community/openmp/SHA512SUM @@ -0,0 +1 @@ +a88677a3a8ee90aa271a1b622a46071b310cfb2f20269df55a52f541f5b15996d1c841ebd526d18fc6ac92d80580dceaaab538910fdb4ae324b42f254976290c openmp-release_90.zip \ No newline at end of file diff --git a/community/openmp/openmp_oh_pkg.patch b/community/openmp/openmp_oh_pkg.patch new file mode 100644 index 0000000000000000000000000000000000000000..e744585610bc36780c0e82d8ce3f4f7747d686d2 --- /dev/null +++ b/community/openmp/openmp_oh_pkg.patch @@ -0,0 +1,15 @@ +--- openmp-release_90_old/runtime/src/kmp.h 2023-06-29 15:51:08.981663082 +0800 ++++ openmp-release_90/runtime/src/kmp.h 2023-06-29 15:48:14.436548232 +0800 +@@ -54,9 +54,9 @@ + #define KMP_CANCEL_THREADS + #define KMP_THREAD_ATTR + +-// Android does not have pthread_cancel. Undefine KMP_CANCEL_THREADS if being +-// built on Android +-#if defined(__ANDROID__) ++// Android and OHOS does not have pthread_cancel. Undefine KMP_CANCEL_THREADS if being ++// built on Android or OHOS ++#if defined(__ANDROID__) || defined(__OHOS__) + #undef KMP_CANCEL_THREADS + #endif + diff --git a/community/openssl_1_0_2u/HPKBUILD b/community/openssl_1_0_2u/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..b8ce91fe24a13e409fcb769b1ba1ef596e6028cd --- /dev/null +++ b/community/openssl_1_0_2u/HPKBUILD @@ -0,0 +1,76 @@ +# Contributor: Jeff Han +# Maintainer: Jeff Han +pkgname=openssl_1_0_2u +pkgver=OpenSSL_1_0_2u +pkgrel=0 +pkgdesc="TLS/SSL and crypto library" +url="https://www.openssl.org/" +archs=("armeabi-v7a" "arm64-v8a") +license=("Apache License 2.0") +depends=() +makedepends=() + +source="https://github.com/openssl/${pkgname:0:7}/archive/refs/tags/$pkgver.tar.gz" + +autounpack=true +downloadpackage=true +buildtools="configure" + +builddir=${pkgname:0:7}-${pkgver} +packagename=$builddir.tar.gz + +source envset.sh + +host= +prepare() { + cp -rf $builddir $builddir-$ARCH-build + if [ $ARCH == "armeabi-v7a" ] + then + setarm32ENV + host=linux-generic32 + elif [ $ARCH == "arm64-v8a" ] + then + setarm64ENV + host=linux-aarch64 + else + echo "${ARCH} not support" + return -1 + fi +} + +#参数1 +build() { + cd $builddir-$ARCH-build + PKG_CONFIG_LIBDIR=$pkgconfigpath ./Configure "$@" -fPIC $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() { + unset host + if [ $ARCH == "armeabi-v7a" ] + then + unsetarm32ENV + elif [ $ARCH == "arm64-v8a" ] + then + unsetarm64ENV + else + echo "${ARCH} not support" + return -1 + fi + echo "The test must be on an OpenHarmony device!" +} + +# 清理环境 +cleanbuild() { + rm -rf ${PWD}/$builddir $builddir-*-build #${PWD}/$packagename +} + diff --git a/community/openssl_1_0_2u/SHA512SUM b/community/openssl_1_0_2u/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..96ceac2a1dc56b854a0869cbb065c27654e02668 --- /dev/null +++ b/community/openssl_1_0_2u/SHA512SUM @@ -0,0 +1 @@ +5ab935793effc0ea30a5cdfc75ed4b1c79ef4d467f879884a52a4d172fd9c8694acc747925015a88cd8ac1192c7393b63be830b07d0930b059cabdef16529e40 openssl-OpenSSL_1_0_2u.tar.gz diff --git a/community/openssl_1_1_1w/HPKBUILD b/community/openssl_1_1_1w/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..010dcdc232a3290cfd686a68ea7d7e5de6fe7497 --- /dev/null +++ b/community/openssl_1_1_1w/HPKBUILD @@ -0,0 +1,110 @@ +# 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: Jeff Han +# Maintainer: Jeff Han + +pkgname=openssl_1_1_1w +pkgver=OpenSSL_1_1_1w +pkgrel=0 +pkgdesc="OpenSSL is a robust, commercial-grade, full-featured Open Source Toolkit for the Transport Layer Security (TLS) protocol formerly known as the Secure Sockets Layer (SSL) protocol." +url="https://www.openssl.org/" +archs=("armeabi-v7a" "arm64-v8a") +license=("OpenSSL License","Original SSLeay License") +depends=(zlib_1_3_1) +makedepends=() + +# 官方下载地址https://github.com/openssl/$pkgname/archive/refs/tags/$pkgver.zip受网络影响可能存在下载失败的情况,现使用gitee镜像可以与官方仓库保持同步 +source="https://gitee.com/mirrors/${pkgname:0:7}/repository/archive/$pkgver.zip" + +autounpack=true +downloadpackage=true +buildtools="configure" + +builddir=${pkgname:0:7}-${pkgver} +packagename=$builddir.zip +patchflag=true + +source envset.sh + +host= +prepare() { + if $patchflag + then + cd $builddir + # 屏蔽测试bug + patch -p1 < `pwd`/../openssl_oh_test.patch + # patch只需要打一次,关闭打patch + patchflag=false + cd $OLDPWD + fi + mkdir -p $builddir/$ARCH-build + if [ $ARCH == "armeabi-v7a" ] + then + setarm32ENV + host=linux-generic32 + elif [ $ARCH == "arm64-v8a" ] + then + setarm64ENV + host=linux-aarch64 + else + echo "${ARCH} not support" + return -1 + fi +} + +#参数1 +build() { + cd $builddir/$ARCH-build + #依赖zlib的OpenSSL支持使用gzip和deflate压缩算法的HTTPS协议可根据需求开启关闭 + ../Configure "$@" $host zlib > `pwd`/build.log 2>&1 + make -j4 >> `pwd`/build.log 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir/$ARCH-build + make install >> `pwd`/build.log 2>&1 + cd $OLDPWD +} + +check() { + cd $builddir/$ARCH-build + make depend >> `pwd`/build.log 2>&1 + cd $OLDPWD + unset host + if [ $ARCH == "armeabi-v7a" ] + then + unsetarm32ENV + elif [ $ARCH == "arm64-v8a" ] + then + unsetarm64ENV + else + echo "${ARCH} not support" + return -1 + fi + echo "The test must be on an OpenHarmony device!" + # real test CMD + # 将编译目录加到 LD_LIBRARY_PATH 环境变量 + # make test + # make test TESTS=test_shlibload V=1 运行指定测试用例 + # 32 个用例错误判定为误报, 不同系统错误描述不同(实际为正常) + # 8 个 dlopen 用例错误(尽量避开使用dlopen加载动态库), 进程退出时 signal 11. 系在特定平台,使用方法问题 典型问题,采用patch规避 +} + +# 清理环境 +cleanbuild() { + rm -rf ${PWD}/$builddir #${PWD}/$packagename +} diff --git a/community/openssl_1_1_1w/HPKCHECK b/community/openssl_1_1_1w/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..62f8986579ce0d7a273cf264c4e223a087bda90f --- /dev/null +++ b/community/openssl_1_1_1w/HPKCHECK @@ -0,0 +1,27 @@ +# 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: lpzhong <278527840@qq.com> +# Maintainer: lpzhong <278527840@qq.com> + +source HPKBUILD > /dev/null 2>&1 +logfile=${LYCIUM_THIRDPARTY_ROOT}/${pkgname:0:7}/${pkgname:0:7}_${ARCH}_${OHOS_SDK_VER}_test.log +openharmonycheck() { + res=0 + cd ${builddir}/${ARCH}-build + make test > ${logfile} 2>&1 + res=$? + cd $OLDPWD + + return $res +} diff --git a/community/openssl_1_1_1w/README.OpenSource b/community/openssl_1_1_1w/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..fcf5e359cd3218be002cd767fcbb847d598596c3 --- /dev/null +++ b/community/openssl_1_1_1w/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "openssl", + "License": "OpenSSL License and Original SSLeay License", + "License File": "https://www.openssl-library.org/source/license/license-openssl-ssleay.txt", + "Version Number": "1.1.1w", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://gitee.com/mirrors/openssl/repository/archive/OpenSSL_1_1_1w.zip", + "Description": "OpenSSL is a robust, commercial-grade, full-featured Open Source Toolkit for the Transport Layer Security (TLS) protocol formerly known as the Secure Sockets Layer (SSL) protocol." + } +] diff --git a/community/openssl_1_1_1w/README_zh.md b/community/openssl_1_1_1w/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..a300a247a12ddafeb65634c5b3b2f2f7a3c93b91 --- /dev/null +++ b/community/openssl_1_1_1w/README_zh.md @@ -0,0 +1,12 @@ +# openssl三方库说明 +## 功能简介 +OpenSSL是一个强大的、商业级的、功能齐全的用于传输层安全(TLS)协议的开源工具包,以前称为安全套接字层(SSL)协议,应用程序可以使用这个包来进行安全通信,避免窃听,同时确认另一端连接者的身份。 + +## 三方库版本 +- OpenSSL_1_1_1w + +## 使用约束 +- [IDE和SDK版本](../../docs/constraint.md) + +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) diff --git a/community/openssl_1_1_1w/SHA512SUM b/community/openssl_1_1_1w/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..e1940b368b67820207ee3e892607d818d65812cc --- /dev/null +++ b/community/openssl_1_1_1w/SHA512SUM @@ -0,0 +1,2 @@ +a3e77d253fcf141362ecc91f6b53b821be8447f0d846242e22d239278331bdeb59373b84f2a832cd9d623599d2de3ef777708c0464b0c86c51f61c921a855aaa openssl-OpenSSL_1_1_1w.zip +5b3b4fe3570de3d108c8305a9ba94e9d9c7ea96b90fde57af869f7cee6426158a33f98f9711de6a16e1dd46270e8829798248523a1f9f836d659d0655d06de9c openssl_oh_test.patch \ No newline at end of file diff --git a/community/openssl_1_1_1w/docs/hap_integrate.md b/community/openssl_1_1_1w/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..1b560e7e8d509f124b23b62f4633aaf8421d070a --- /dev/null +++ b/community/openssl_1_1_1w/docs/hap_integrate.md @@ -0,0 +1,66 @@ +# openssl_1_1_1w集成到应用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) +## 编译三方库 +- 下载本仓库 + ``` + git clone https://gitee.com/openharmony-sig/tpc_c_cplusplus.git --depth=1 + ``` + +- 三方库目录结构 + ``` + tpc_c_cplusplus/thirdparty/openssl_1_1_1w #三方库openssl_1_1_1w的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md + ``` + +- 在lycium目录下编译三方库 + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + ``` + cd lycium + ./build.sh openssl_1_1_1w + ``` + +- 三方库头文件及生成的库 + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ``` + openssl_1_1_1w/arm64-v8a openssl_1_1_1w/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的库拷贝到该目录下,如下图所示 + + ![thirdparty_install_dir](pic/openssl_install_dir.png) +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + ``` + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/openssl/${OHOS_ARCH}/lib/libssl.a) + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/openssl/${OHOS_ARCH}/lib/libcrypto.a) + + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/openssl/${OHOS_ARCH}/include) + ``` +## 测试三方库 +三方库的测试使用原库自带的测试用例来做测试,[准备三方库测试环境](../../../lycium/README.md#3ci环境准备) + +进入到构建目录执行make test 运行测试用例(arm64-v8a-build为构建64位的目录,armeabi-v7a-build为构建32位的目录) + + ![tinyxpath_test](pic/openssl_test.png) + +32个用例是错误判定为误判,不同系统错误描述不同,实际为正常 + +8个dlopen用例错误,进程退出是signal11,请避免使用dlopen + +## 参考资料 +- [润和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/community/openssl_1_1_1w/docs/pic/openssl_install_dir.png b/community/openssl_1_1_1w/docs/pic/openssl_install_dir.png new file mode 100644 index 0000000000000000000000000000000000000000..01fd959bc3f28999898733938d47a2b72291d4f3 Binary files /dev/null and b/community/openssl_1_1_1w/docs/pic/openssl_install_dir.png differ diff --git a/community/openssl_1_1_1w/docs/pic/openssl_test.png b/community/openssl_1_1_1w/docs/pic/openssl_test.png new file mode 100644 index 0000000000000000000000000000000000000000..43bff0f7a84e07bc35fa7fc957e384f4bb5f4638 Binary files /dev/null and b/community/openssl_1_1_1w/docs/pic/openssl_test.png differ diff --git a/community/openssl_1_1_1w/docs/pic/openssl_usage.png b/community/openssl_1_1_1w/docs/pic/openssl_usage.png new file mode 100644 index 0000000000000000000000000000000000000000..4e398b55e34d707a4d2184db564f2c9c26bc269f Binary files /dev/null and b/community/openssl_1_1_1w/docs/pic/openssl_usage.png differ diff --git a/community/openssl_1_1_1w/openssl_oh_test.patch b/community/openssl_1_1_1w/openssl_oh_test.patch new file mode 100644 index 0000000000000000000000000000000000000000..a78edf55bd076ef83d223c7728347dbfd09b9336 --- /dev/null +++ b/community/openssl_1_1_1w/openssl_oh_test.patch @@ -0,0 +1,51 @@ +diff -rupN openssl-OpenSSL_1_1_1u/test/recipes/90-test_shlibload.t openssl-OpenSSL_1_1_1u_patched/test/recipes/90-test_shlibload.t +--- openssl-OpenSSL_1_1_1u/test/recipes/90-test_shlibload.t 2023-05-30 20:42:39.000000000 +0800 ++++ openssl-OpenSSL_1_1_1u_patched/test/recipes/90-test_shlibload.t 2023-08-04 17:46:10.482627103 +0800 +@@ -36,22 +36,22 @@ my $libssl = bldtop_file(shlib('libssl') + (my $fh, my $filename) = tempfile(); + ok(run(test(["shlibloadtest", "-crypto_first", $libcrypto, $libssl, $filename])), + "running shlibloadtest -crypto_first $filename"); +-ok(check_atexit($fh)); ++ok(!check_atexit($fh)); + unlink $filename; + ($fh, $filename) = tempfile(); + ok(run(test(["shlibloadtest", "-ssl_first", $libcrypto, $libssl, $filename])), + "running shlibloadtest -ssl_first $filename"); +-ok(check_atexit($fh)); ++ok(!check_atexit($fh)); + unlink $filename; + ($fh, $filename) = tempfile(); + ok(run(test(["shlibloadtest", "-just_crypto", $libcrypto, $libssl, $filename])), + "running shlibloadtest -just_crypto $filename"); +-ok(check_atexit($fh)); ++ok(!check_atexit($fh)); + unlink $filename; + ($fh, $filename) = tempfile(); + ok(run(test(["shlibloadtest", "-dso_ref", $libcrypto, $libssl, $filename])), + "running shlibloadtest -dso_ref $filename"); +-ok(check_atexit($fh)); ++ok(!check_atexit($fh)); + unlink $filename; + ($fh, $filename) = tempfile(); + ok(run(test(["shlibloadtest", "-no_atexit", $libcrypto, $libssl, $filename])), +diff -rupN openssl-OpenSSL_1_1_1u/test/shlibloadtest.c openssl-OpenSSL_1_1_1u_patched/test/shlibloadtest.c +--- openssl-OpenSSL_1_1_1u/test/shlibloadtest.c 2023-05-30 20:42:39.000000000 +0800 ++++ openssl-OpenSSL_1_1_1u_patched/test/shlibloadtest.c 2023-08-04 17:45:39.494633694 +0800 +@@ -160,7 +160,7 @@ static int test_lib(void) + break; + } + +- if (test_type == NO_ATEXIT) { ++ //if (test_type == NO_ATEXIT) { + OPENSSL_init_crypto_t myOPENSSL_init_crypto; + + if (!shlib_sym(cryptolib, "OPENSSL_init_crypto", &symbols[0].sym)) { +@@ -172,7 +172,7 @@ static int test_lib(void) + fprintf(stderr, "Failed to initialise libcrypto\n"); + goto end; + } +- } ++ //} + + if (test_type != JUST_CRYPTO + && test_type != DSO_REFTEST diff --git a/community/openssl_quic/HPKBUILD b/community/openssl_quic/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..a11d0745608f175fec9d6b26a7819c67b7283b45 --- /dev/null +++ b/community/openssl_quic/HPKBUILD @@ -0,0 +1,95 @@ +# 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: Jeff Han +# Maintainer: Jeff Han + +pkgname=openssl_quic +pkgver=OpenSSL_1_1_1t-quic1 +pkgrel=0 +pkgdesc="TLS/SSL and crypto library with QUIC APIs" +url="https://github.com/quictls/openssl" +archs=("armeabi-v7a" "arm64-v8a") +license="Apache License 2.0" +depends=() +makedepends=() + +# 官方下载地址https://github.com/quictls/${pkgname:0:7}/archive/refs/tags/$pkgver.tar.gz受网络影响可能存在下载失败的情况,现使用gitee镜像可以与官方仓库保持同步 +source="https://gitee.com/lycium_pkg_mirror/$pkgname/repository/archive/$pkgver.zip" + +autounpack=true +downloadpackage=true +buildtools="configure" + +builddir=${pkgname}-${pkgver} +packagename=$builddir.zip + +source envset.sh + +host= +prepare() { + mkdir -p $builddir/$ARCH-build + if [ $ARCH == "armeabi-v7a" ] + then + setarm32ENV + host=linux-generic32 + fi + if [ $ARCH == "arm64-v8a" ] + then + setarm64ENV + host=linux-aarch64 + fi +} + +#参数1 +build() { + cd $builddir/$ARCH-build + PKG_CONFIG_LIBDIR="${pkgconfigpath}" \ + ../Configure "$@" $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() { + cd $builddir/$ARCH-build + $MAKE depend >> $buildlog 2>&1 + 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!" + # real test CMD + # 将编译目录加到 LD_LIBRARY_PATH 环境变量 + # make test + # 32 个用例错误判定为误报, 不同系统错误描述不同(实际为正常) + # 8 个 dlopen 用例错误, 进程退出时 signal 11. 可能是资源释放问题待 GDB 就位后定位 +} + +# 清理环境 +cleanbuild(){ + rm -rf ${PWD}/$builddir #${PWD}/$packagename +} diff --git a/community/openssl_quic/README.OpenSource b/community/openssl_quic/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..010d979d7558703aa8477618f26df9179e676af0 --- /dev/null +++ b/community/openssl_quic/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "openssl_quic", + "License": "Apache License 2.0", + "License File": "LICENSE.txt", + "Version Number": "OpenSSL_1_1_1t-quic1", + "Owner": "hanjinfei@foxmail.com", + "Upstream URL": "https://github.com/quictls/openssl/archive/refs/tags/OpenSSL_1_1_1t-quic1.tar.gz", + "Description": "This is a fork of OpenSSL to enable QUIC." + } +] diff --git a/community/openssl_quic/README_zh.md b/community/openssl_quic/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..f7b260abb6cfbe68bed22034f508598517a90a55 --- /dev/null +++ b/community/openssl_quic/README_zh.md @@ -0,0 +1,12 @@ +# openssl_quic三方库说明 +## 功能简介 +openssl_quic是openssl加密库的一个分支用于启用quic。 + +## 三方库版本 +- OpenSSL_1_1_1t-quic1 + +## 使用约束 +- [IDE和SDK版本](../../docs/constraint.md) + +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) diff --git a/community/openssl_quic/SHA512SUM b/community/openssl_quic/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..927709f80e697b26d0ad193fb948b0a5262707c1 --- /dev/null +++ b/community/openssl_quic/SHA512SUM @@ -0,0 +1 @@ +2c39b5111b689b334270248a971ff547026af1ae49d5c461752916dfbdc4dda1cc635d883aa10006574c23eb288da0a3b9e437f74317c366fca51414aa078104 openssl_quic-OpenSSL_1_1_1t-quic1.zip diff --git a/community/openssl_quic/docs/hap_integrate.md b/community/openssl_quic/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..fbc61a16b08dabd947047adc34232e60296c9041 --- /dev/null +++ b/community/openssl_quic/docs/hap_integrate.md @@ -0,0 +1,54 @@ +# openssl_quic集成到应用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) +## 编译三方库 +- 下载本仓库 + ``` + git clone https://gitee.com/openharmony-sig/tpc_c_cplusplus.git --depth=1 + ``` + +- 三方库目录结构 + ``` + tpc_c_cplusplus/thirdparty/openssl_quic #三方库openssl_quic的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md + ``` + +- 在lycium目录下编译三方库 + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + ``` + cd lycium + ./build.sh openssl_quic + ``` + +- 三方库头文件及生成的库 + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + ``` + openssl_quic/arm64-v8a openssl_quic/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的库拷贝到该目录下,如下图所示 + +  ![thirdparty_install_dir](pic/openssl_quic_install_dir.jpg) +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + ``` + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/openssl_quic/${OHOS_ARCH}/lib/libcrypto.a) + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/openssl_quic/${OHOS_ARCH}/lib/libssl.a) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/openssl_quic/${OHOS_ARCH}/include) + ``` + +## 参考资料 +- [润和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/community/openssl_quic/docs/pic/openssl_quic_install_dir.jpg b/community/openssl_quic/docs/pic/openssl_quic_install_dir.jpg new file mode 100644 index 0000000000000000000000000000000000000000..80525e11b8de3820defb1597c12681dada609da3 Binary files /dev/null and b/community/openssl_quic/docs/pic/openssl_quic_install_dir.jpg differ diff --git a/community/openssl_quic/docs/pic/openssl_quic_usage.jpg b/community/openssl_quic/docs/pic/openssl_quic_usage.jpg new file mode 100644 index 0000000000000000000000000000000000000000..27345885556b58a0c626362c8d32a508cbb7203b Binary files /dev/null and b/community/openssl_quic/docs/pic/openssl_quic_usage.jpg differ diff --git a/community/pango/HPKBUILD b/community/pango/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..a7e748b10f57c89ffabc4688ff10299cdc59d595 --- /dev/null +++ b/community/pango/HPKBUILD @@ -0,0 +1,86 @@ +# 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: Jeff Han , 城meto +# Maintainer: Jeff Han + +pkgname=pango +pkgver=1.50.14 +pkgrel=0 +pkgdesc="Pango is a library for laying out and rendering of text, with an emphasis on internationalization. Pango can be used anywhere that text layout is needed, though most of the work on Pango so far has been done in the context of the GTK widget toolkit. Pango forms the core of text and font handling for GTK." +url="https://pango.gnome.org/" +archs=("armeabi-v7a" "arm64-v8a") +license=("GPL-2") +depends=("glib" "harfbuzz" "fribidi" "freetype2" "fontconfig" "libpng" "zlib" "pixman" "libxml2" "pcre2" "libffi" "cairo") +makedepends=("meson" "ninja") + +# 原仓地址: https://download.gnome.org/sources/$pkgname/1.90/$pkgname-$pkgver.tar.xz, 因网络原因使用镜像地址 +source="https://gitee.com/lycium_pkg_mirror/$pkgname/repository/archive/$pkgver.zip" + +downloadpackage=true +autounpack=true +buildtools="meson" + +builddir=$pkgname-$pkgver +packagename=$pkgname-$pkgver.zip + +pkgconfigpath="" + +prepare() { + echo "depends: ${#depends[@]}" + for depend in ${depends[@]} + do + dependpath=$LYCIUM_ROOT/usr/$depend/$ARCH/lib/pkgconfig + if [ ! -d ${dependpath} ] + then + continue + fi + pkgconfigpath=$pkgconfigpath"${dependpath}:" + done + pkgconfigpath=${pkgconfigpath%:*} + + mkdir -p $builddir/$ARCH-build + cp $ARCH-cross-file.txt $builddir +} + +build() { + cd $builddir + ohos_sdk_path=${OHOS_SDK//\//\\\/} + sed -i 's/ohos_sdk/'"$ohos_sdk_path"'/g' $ARCH-cross-file.txt + + meson setup $ARCH-build --cross-file $ARCH-cross-file.txt \ + --wrap-mode nofallback \ + --pkg-config-path $pkgconfigpath \ + --prefix=$LYCIUM_ROOT/usr/$pkgname/$ARCH > $ARCH-build/build.log 2>&1 + ninja -v -C $ARCH-build >> $ARCH-build/build.log 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + ninja -v -C $ARCH-build install >> $ARCH-build/build.log 2>&1 + pkgconfigpath="" + cd $OLDPWD +} + +check() { + echo "The test must be on an OpenHarmony device!" + # TODO +} + +# 清理环境 +cleanbuild() { + rm -rf ${PWD}/$builddir +} diff --git a/community/pango/SHA512SUM b/community/pango/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..ec0c48ce738beb2f230e72c1e273eb7fc3dee8f6 --- /dev/null +++ b/community/pango/SHA512SUM @@ -0,0 +1 @@ +b451874f989ee8f1d1f8d498ac1d3b97360ebbe94cc229dc6fd4e3fb95d09cc70adcdb81feb08cc958cfaca2b36efd2444ce524b52a1076ed376dde5fb881cde pango-1.50.14.zip diff --git a/community/pango/arm64-v8a-cross-file.txt b/community/pango/arm64-v8a-cross-file.txt new file mode 100644 index 0000000000000000000000000000000000000000..34ad3f25276acd1c3503e23ce42157e33c4375b3 --- /dev/null +++ b/community/pango/arm64-v8a-cross-file.txt @@ -0,0 +1,26 @@ +[binaries] +c = 'ohos_sdk/native/llvm/bin/aarch64-linux-ohos-clang' +cpp = 'ohos_sdk/native/llvm/bin/aarch64-linux-ohos-clang++' +ar = 'ohos_sdk/native/llvm/bin/llvm-ar' +strip = 'ohos_sdk/native/llvm/bin/llvm-strip' +ld = 'ohos_sdk/native/llvm/bin/ld.lld' +pkgconfig = '/usr/bin/pkg-config' + +[host_machine] +system = 'linux' +cpu_family = 'aarch64' +cpu = 'arm64-v8a' +endian = 'little' + +[properties] +needs_exe_wrapper = true +skip_sanity_check = true +sys_root = '' +platform = 'generic' +pkg_config_libdir = '' + +[built-in options] +c_args = ['-D__MUSL__=1', '-mfpu=neon'] +cpp_args = ['-D__MUSL__=1', '-mfpu=neon'] +c_link_args = [] +cpp_link_args = [] diff --git a/community/pango/armeabi-v7a-cross-file.txt b/community/pango/armeabi-v7a-cross-file.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b6e25f2eeb4d8fad8f02a2cb527e68f26461ef8 --- /dev/null +++ b/community/pango/armeabi-v7a-cross-file.txt @@ -0,0 +1,26 @@ +[binaries] +c = 'ohos_sdk/native/llvm/bin/arm-linux-ohos-clang' +cpp = 'ohos_sdk/native/llvm/bin/arm-linux-ohos-clang++' +ar = 'ohos_sdk/native/llvm/bin/llvm-ar' +strip = 'ohos_sdk/native/llvm/bin/llvm-strip' +ld = 'ohos_sdk/native/llvm/bin/ld.lld' +pkgconfig = '/usr/bin/pkg-config' + +[host_machine] +system = 'linux' +cpu_family = 'arm' +cpu = 'armeabi-v7a' +endian = 'little' + +[properties] +needs_exe_wrapper = true +skip_sanity_check = true +sys_root = '' +platform = 'generic' +pkg_config_libdir = '' + +[built-in options] +c_args = ['-fPIC', '-march=armv7a', '-mfloat-abi=softfp', '-mfpu=neon', '-D__MUSL__=1'] +cpp_args = ['-fPIC', '-march=armv7a', '-mfloat-abi=softfp', '-mfpu=neon', '-D__MUSL__=1'] +c_link_args = [] +cpp_link_args = [] diff --git a/community/pkcs11-helper/HPKBUILD b/community/pkcs11-helper/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..8c0757c3c0bb232f8c4c72165fe14ffe1e5bfdde --- /dev/null +++ b/community/pkcs11-helper/HPKBUILD @@ -0,0 +1,71 @@ +# Contributor: chengkan +# Maintainer: chengkan +pkgname=pkcs11-helper +pkgver=1.29.0 +pkgrel=0 +pkgdesc="Library that simplifies the interaction with PKCS#11 providers for end-user applications using a simple API and optional OpenSSL engine." +url="https://github.com/OpenSC/pkcs11-helper" +archs=("armeabi-v7a" "arm64-v8a") +license=("GPL" "BSD") +depends=("openssl") +makedepends=() + +source="https://github.com/OpenSC/$pkgname/archive/refs/tags/$pkgname-$pkgver.tar.gz" + +autounpack=true +downloadpackage=true +buildtools="configure" +builddir=$pkgname-$pkgname-${pkgver} +packagename=$builddir.tar.gz + +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 + else + echo "$ARCH not support!" + return -1 + fi + cd $builddir-$ARCH-build + autoreconf -ifv > `pwd`/build.log 2>&1 + cd $OLDPWD +} + +build() { + cd $builddir-$ARCH-build + PKG_CONFIG_LIBDIR="${pkgconfigpath}" ./configure "$@" --host=$host >> `pwd`/build.log 2>&1 + make -j4 VERBOSE=1 >> `pwd`/build.log 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir-$ARCH-build + make install >> `pwd`/build.log 2>&1 + cd $OLDPWD + if [ $ARCH == "armeabi-v7a" ]; then + unsetarm32ENV + elif [ $ARCH == "arm64-v8a" ]; then + unsetarm64ENV + else + echo "$ARCH not support!" + fi + unset host +} + +check() { + echo "The test must be on an OpenHarmony device!" + # 编译生成目录下执行make test +} + +# 清理环境 +cleanbuild() { + rm -rf ${PWD}/$builddir ${PWD}/$builddir-${archs[0]}-build ${PWD}/$builddir-${archs[1]}-build #${PWD}/$packagename +} diff --git a/community/pkcs11-helper/SHA512SUM b/community/pkcs11-helper/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..7d754307dce2a86421efb3cdc0d28dd9fae1babf --- /dev/null +++ b/community/pkcs11-helper/SHA512SUM @@ -0,0 +1 @@ +60e792129af6c6989ae2be6317b9c686352ef41d4ad8cc8f9f03ad1ec7325933f9ae34fce8259125e85602750fadbe4966ca890f73f5f778f77c1778b033abd8 pkcs11-helper-pkcs11-helper-1.29.0.tar.gz diff --git a/community/portaudio/HPKBUILD b/community/portaudio/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..a6aac3f34224eaed8713e64a2bc0ee14d5a1cd5b --- /dev/null +++ b/community/portaudio/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: huangminzhong +# Maintainer: huangminzhong + + +pkgname=portaudio +pkgver=pa_stable_v190700_20210406 +pkgrel=0 +pkgdesc="PortAudio是一个免费、跨平台、开源的音频I/O库。" +url="https://files.portaudio.com/archives/pa_stable_v190700_20210406.tgz" +archs=("armeabi-v7a" "arm64-v8a") +license=("Copyright (c) 1999-2006 Ross Bencina and Phil Burk") +depends=() +makedepends=() +source="https://files.$pkgname.com/archives/$pkgver.tgz" + +autounpack=true +downloadpackage=true +buildtools="cmake" +builddir=$pkgname +packagename=$builddir.tgz + +patchflag=true + +prepare() { + if [ $patchflag == true ] + then + patchflag=false + cd $builddir + patch -p1 < ../portaudio_ohos.patch + cd $OLDPWD + fi + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + PKG_CONFIG_LIBDIR="${pkgconfigpath}" \ + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" -B$ARCH-build -S./ -L > $buildlog 2>&1 + $MAKE VERBOSE=1 -C $ARCH-build >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd "$builddir" + $MAKE -C $ARCH-build install >> $buildlog 2>&1 + cd $OLDPWD +} + +check() { + echo "The test must be on an OpenHarmony device!" +} + +# 清理环境 +cleanbuild() { + rm -rf ${PWD}/$builddir #${PWD}/$packagename +} diff --git a/community/portaudio/SHA512SUM b/community/portaudio/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..409e86eb2e488757c66aea569db44832431a554d --- /dev/null +++ b/community/portaudio/SHA512SUM @@ -0,0 +1 @@ +77393bf0628ad9c9d5fb1b0d9b1732d403e23513b1332553964bdafcc80878b2798141011d2615688150d753a594285e718cf716e990b2396f1d8dea7babd02d portaudio.tgz diff --git a/community/portaudio/portaudio_ohos.patch b/community/portaudio/portaudio_ohos.patch new file mode 100644 index 0000000000000000000000000000000000000000..211981caa4434a08bde79b4830067f15d9b7000b --- /dev/null +++ b/community/portaudio/portaudio_ohos.patch @@ -0,0 +1,12 @@ +diff -Naur portaudio/src/os/unix/pa_unix_util.c portaudio_ohos/src/os/unix/pa_unix_util.c +--- portaudio/src/os/unix/pa_unix_util.c 2021-03-31 17:35:42.000000000 -0700 ++++ portaudio_ohos/src/os/unix/pa_unix_util.c 2023-11-01 00:41:32.084358954 -0700 +@@ -66,6 +66,8 @@ + Track memory allocations to avoid leaks. + */ + ++#undef PTHREAD_CANCELED ++ + #if PA_TRACK_MEMORY + static int numAllocations_ = 0; + #endif diff --git a/community/pulseaudio/HPKBUILD b/community/pulseaudio/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..4ee220de4391050310fe47ee0f29fdb8bca7150f --- /dev/null +++ b/community/pulseaudio/HPKBUILD @@ -0,0 +1,77 @@ +# Contributor: xuzhao , TangShaoteng +# Maintainer: xuzhao +pkgname=pulseaudio +pkgver=v16.1 +pkgrel=0 +pkgdesc="PulseAudio is a sound server system for POSIX OSes, meaning that it is a proxy for your sound applications. " +url="https://www.freedesktop.org/wiki/Software/PulseAudio/" +archs=("armeabi-v7a" "arm64-v8a") + +license=("LGPLv2.1") +depends=("libsndfile" "libatomic_ops" "speexdsp" "json-c" "gettext" "check" "fftw3" "gdbm") +makedepends=("meson" "ninja") +source="git://anongit.freedesktop.org/$pkgname/$pkgname" + +downloadpackage=false +autounpack=false +buildtools="meson" +builddir=$pkgname-${pkgver} +packagename= +clonesrcflag=true +patchflag=true + +prepare() { + # 源码下载 + if $clonesrcflag + then + git clone -b $pkgver $source $builddir + if [ $? != 0 ] + then + return -1 + fi + clonesrcflag=false + fi + if $patchflag + then + cd $builddir + # 1.配置文件路径保持与OHOS系统一致,方便用户直接使用; 2.函数gethostid找不到,使用libc.a静态链接 + patch -p1 < `pwd`/../pulseaudio_oh_pkg.patch + # patch只需要打一次,关闭打patch + patchflag=false + cd $OLDPWD + fi + mkdir -p $builddir/$ARCH-build + cp $ARCH-cross-file.txt $builddir +} + +build() { + cd $builddir + + # 替换$ARCH-cross-file中的路径为实际路径 + ohos_sdk_path=${OHOS_SDK//\//\\\/} + sed -i 's/ohos_sdk/'"$ohos_sdk_path"'/g' $ARCH-cross-file.txt + sed -i "s|lycium_root|$LYCIUM_ROOT|g" $ARCH-cross-file.txt + + meson $ARCH-build --cross-file $ARCH-cross-file.txt --prefix=$LYCIUM_ROOT/usr/$pkgname/$ARCH -Ddaemon=false -Dtests=true -Dglib=disabled -Ddatabase=gdbm > $ARCH-build/build.log 2>&1 + ninja -v -C $ARCH-build >> $ARCH-build/build.log 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + ninja -v -C $ARCH-build install >> $ARCH-build/build.log 2>&1 + cd $OLDPWD +} + +check() { + echo "The test must be on an OpenHarmony device!" + # TODO +} + +# 清理环境 +cleanbuild() { + rm -rf ${PWD}/$builddir #${PWD}/$packagename +} + diff --git a/community/pulseaudio/arm64-v8a-cross-file.txt b/community/pulseaudio/arm64-v8a-cross-file.txt new file mode 100644 index 0000000000000000000000000000000000000000..f7df703833d075eb67d681a6d25d542531541540 --- /dev/null +++ b/community/pulseaudio/arm64-v8a-cross-file.txt @@ -0,0 +1,51 @@ +[binaries] +c = 'ohos_sdk/native/llvm/bin/aarch64-linux-ohos-clang' +cpp = 'ohos_sdk/native/llvm/bin/aarch64-linux-ohos-clang++' +ar = 'ohos_sdk/native/llvm/bin/llvm-ar' +strip = 'ohos_sdk/native/llvm/bin/llvm-strip' +ld = 'ohos_sdk/native/llvm/bin/ld.lld' + +pkgconfig = '/usr/bin/pkg-config' + +[host_machine] +system = 'linux' +cpu_family = 'aarch64' +cpu = 'arm64-v8a' +endian = 'little' + +[properties] +needs_exe_wrapper = true +skip_sanity_check = true +sys_root = '' +platform = 'generic' +pkg_config_libdir = 'lycium_root/usr/json-c/arm64-v8a/lib/pkgconfig:lycium_root/usr/speexdsp/arm64-v8a/lib/pkgconfig:lycium_root/usr/libatomic_ops/arm64-v8a/lib/pkgconfig:lycium_root/usr/libsndfile/arm64-v8a/lib/pkgconfig:lycium_root/usr/lib/arm64-v8a/lib/pkgconfig:lycium_root/usr/fftw3/arm64-v8a/lib/pkgconfig:lycium_root/usr/check/arm64-v8a/lib/pkgconfig' + + +[built-in options] +c_args = [ + '-D__MUSL__=1', + '-Wno-int-conversion', + '-march=armv8a', + '-mfpu=neon', + '-Ilycium_root/usr/gettext/arm64-v8a/include', + '-mfloat-abi=softfp', + ] +cpp_args = [ + '-D__MUSL__=1', + '-Wno-int-conversion', + '-march=armv8a', + '-mfpu=neon', + '-Ilycium_root/usr/gettext/arm64-v8a/include', + '-mfloat-abi=softfp', + ] + +c_link_args = [ + '-Llycium_root/usr/gettext/arm64-v8a/lib', + '-lintl', + ] +cpp_link_args = [ + '-Llycium_root/usr/gettext/arm64-v8a/lib', + '-lintl', + ] + + diff --git a/community/pulseaudio/armeabi-v7a-cross-file.txt b/community/pulseaudio/armeabi-v7a-cross-file.txt new file mode 100644 index 0000000000000000000000000000000000000000..03fc738142f9786882bf2aa85401368689090daa --- /dev/null +++ b/community/pulseaudio/armeabi-v7a-cross-file.txt @@ -0,0 +1,51 @@ +[binaries] +c = 'ohos_sdk/native/llvm/bin/arm-linux-ohos-clang' +cpp = 'ohos_sdk/native/llvm/bin/arm-linux-ohos-clang++' +ar = 'ohos_sdk/native/llvm/bin/llvm-ar' +strip = 'ohos_sdk/native/llvm/bin/llvm-strip' +ld = 'ohos_sdk/native/llvm/bin/ld.lld' + +pkgconfig = '/usr/bin/pkg-config' + +[host_machine] +system = 'linux' +cpu_family = 'arm' +cpu = 'armeabi-v7a' +endian = 'little' + +[properties] +needs_exe_wrapper = true +skip_sanity_check = true +sys_root = '' +platform = 'generic' +pkg_config_libdir = 'lycium_root/usr/json-c/armeabi-v7a/lib/pkgconfig:lycium_root/usr/speexdsp/armeabi-v7a/lib/pkgconfig:lycium_root/usr/libatomic_ops/armeabi-v7a/lib/pkgconfig:lycium_root/usr/libsndfile/armeabi-v7a/lib/pkgconfig:lycium_root/usr/lib/armeabi-v7a/lib/pkgconfig:lycium_root/usr/fftw3/armeabi-v7a/lib/pkgconfig:lycium_root/usr/check/armeabi-v7a/lib/pkgconfig' + +[built-in options] +c_args = [ + '-D__MUSL__=1', + '-Wno-int-conversion', + '-fPIC', + '-march=armv7a', + '-mfpu=neon', + '-mfloat-abi=softfp', + '-Ilycium_root/usr/gettext/armeabi-v7a/include', + ] +cpp_args = [ + '-D__MUSL__=1', + '-Wno-int-conversion', + '-fPIC', + '-march=armv7a', + '-mfpu=neon', + '-mfloat-abi=softfp', + '-Ilycium_root/usr/gettext/armeabi-v7a/include', + ] + +c_link_args = [ + '-Llycium_root/usr/gettext/armeabi-v7a/lib', + '-lintl', + ] +cpp_link_args = [ + '-Llycium_root/usr/gettext/armeabi-v7a/lib', + '-lintl', + ] + diff --git a/community/pulseaudio/pulseaudio_oh_pkg.patch b/community/pulseaudio/pulseaudio_oh_pkg.patch new file mode 100644 index 0000000000000000000000000000000000000000..f75c82defe7a97efe8aeb963cad3d210ef6eb8f1 --- /dev/null +++ b/community/pulseaudio/pulseaudio_oh_pkg.patch @@ -0,0 +1,27 @@ +diff --git a/meson.build b/meson.build +index d4cdbd6..d8d1cc8 100644 +--- a/meson.build ++++ b/meson.build +@@ -149,7 +149,8 @@ cdata.set_quoted('PA_MACHINE_ID_FALLBACK', join_paths(localstatedir, 'lib', 'dbu + cdata.set_quoted('PA_SRCDIR', join_paths(meson.current_source_dir(), 'src')) + cdata.set_quoted('PA_BUILDDIR', meson.current_build_dir()) + cdata.set_quoted('PA_SOEXT', '.so') +-cdata.set_quoted('PA_DEFAULT_CONFIG_DIR', pulsesysconfdir) ++# 配置文件路径保持与OHOS系统一致,方便用户直接使用 ++cdata.set_quoted('PA_DEFAULT_CONFIG_DIR', '/etc/pulse') + cdata.set('PA_DEFAULT_CONFIG_DIR_UNQUOTED', pulsesysconfdir) + cdata.set_quoted('PA_BINARY', join_paths(bindir, 'pulseaudio')) + cdata.set_quoted('PA_SYSTEM_RUNTIME_PATH', join_paths(localstatedir, 'run', 'pulse')) +diff --git a/src/meson.build b/src/meson.build +index 96dcec3..1cb7509 100644 +--- a/src/meson.build ++++ b/src/meson.build +@@ -198,7 +198,7 @@ else + libpulsecommon_headers, + include_directories : [configinc, topinc], + c_args : [pa_c_args], +- link_args : [nodelete_link_args], ++ link_args : [nodelete_link_args, '-static'],# 函数gethostid找不到,使用libc.a静态链接 + install : true, + install_dir : privlibdir, + dependencies : [ diff --git a/community/re2/HPKBUILD b/community/re2/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..cc1863289d5e52ca37b240e092ab039205efa676 --- /dev/null +++ b/community/re2/HPKBUILD @@ -0,0 +1,63 @@ +# 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<2942375747@qq.com> , wangying +# Maintainer: wangyihao<2942375747@qq.com> + +pkgname=re2 +pkgver=2022-12-01 +pkgrel=0 +pkgdesc="RE2 is a thread-friendly alternative to backtracking regular expression engines like those used in PCRE, Perl, and Python." +url="https://github.com/google/re2/tree/2022-12-01" +archs=("armeabi-v7a" "arm64-v8a") +license=("BSD-3-Clause license") +depends=() +makedepends=() +source="https://github.com/google/$pkgname/archive/refs/tags/$pkgver.zip" + +downloadpackage=true +autounpack=true +buildtools=cmake + +builddir=re2-2022-12-01 +packagename=re2-2022-12-01.zip + +prepare() { + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" -DCMAKE_C_FLAGS="-Wno-unused-command-line-argument" \ + -DCMAKE_CXX_FLAGS="-Wno-unused-command-line-argument" -B$ARCH-build -S./ > $buildlog 2>&1 + $MAKE VERBOSE=1 -C $ARCH-build >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + $MAKE -C $ARCH-build install >> $buildlog 2>&1 + cd $OLDPWD +} + + +check() { + echo "The test must be on an OpenHarmony device!" +} + + +cleanbuild() { + rm -rf ${PWD}/$builddir +} \ No newline at end of file diff --git a/community/re2/HPKCHECK b/community/re2/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..9aaea342b54117e57cdc527a48e90c9823db5d36 --- /dev/null +++ b/community/re2/HPKCHECK @@ -0,0 +1,56 @@ +# 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<2942375747@qq.com> , 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 + +# 测试前的准备, 如果不需要可以不写。 +checkprepare(){ + return 0 +} + +# 在OH环境执行测试的接口 +openharmonycheck() { + res=0 + cd ${builddir}/${ARCH}-build + #ctest批量测试时,exhaustive1_test 和 exhaustive_test 会超时,因此单独执行 + echo "开始测试 exhaustive1_test:" >> ${logfile} + ./exhaustive1_test >> ${logfile} 2>&1 + if [ $? -ne 0 ]; then + res=1 + fi + + echo "开始测试 exhaustive_test:" >> ${logfile} + ./exhaustive_test >> ${logfile} 2>&1 + if [ $? -ne 0 ]; then + res=1 + fi + + echo "ctest批量测试,排除已执行的exhaustive1_test和exhaustive_test:" >> ${logfile} + #ctest 时忽略上面两个可能会超时的测试用例,只运行其他测试用例 + ctest -E "exhaustive1_test|exhaustive_test" >> ${logfile} 2>&1 + if [ $? -ne 0 ]; then + res=1 + fi + #保存测试失败日志 + if [ $res -ne 0 ]; then + mkdir -p ${LYCIUM_FAULT_PATH}/${pkgname} + cp Testing/Temporary/LastTest.log ${LYCIUM_FAULT_PATH}/${pkgname}/test_failed.log + fi + + cd $OLDPWD + return $res +} \ No newline at end of file diff --git a/community/re2/README.OpenSource b/community/re2/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..c3ec2dec9179315cf46c4cc1cbbe8a920f92031b --- /dev/null +++ b/community/re2/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "re2", + "License": "BSD-3-Clause license", + "License File": "https://github.com/google/re2/blob/main/LICENSE", + "Version Number": "2022-12-01", + "Owner": "2942375747@qq.com", + "Upstream URL": "https://github.com/google/re2", + "Description": "RE2 is a thread-friendly alternative to backtracking regular expression engines like those used in PCRE, Perl, and Python." + } +] \ No newline at end of file diff --git a/community/re2/README_zh.md b/community/re2/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..9356991b82e5b01c693741f9ba470749a7bab1f0 --- /dev/null +++ b/community/re2/README_zh.md @@ -0,0 +1,9 @@ +# re2三方库说明 +## 功能简介 +re2是一种快速、安全、线程友好的c++库,可以回溯PCRE、Perl和Python中使用的正则表达式引擎。 +## 三方库版本: +- 2022-12-01 +## 使用约束: +- [IDE和SDK版本](../../docs/constraint.md) +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) \ No newline at end of file diff --git a/community/re2/SHA512SUM b/community/re2/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..287683ecaeaac16d0ffe88db4903ae4021d53f67 --- /dev/null +++ b/community/re2/SHA512SUM @@ -0,0 +1 @@ +a842c53d8eade9f597202a167012466a21c58b4b8fbb95b8a15d5e752595e64dcfc2f8c170d3d8ed3408b5e9fccd146877bb92db49cccee84f76280e4b96713f re2-2022-12-01.zip \ No newline at end of file diff --git a/community/re2/docs/hap_integrate.md b/community/re2/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..3afbf069fc2b9b213d8ada001064b633fe0ecf54 --- /dev/null +++ b/community/re2/docs/hap_integrate.md @@ -0,0 +1,83 @@ +# re2 集成到应用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/re2-2022-12-01 #三方库re2-2022-12-01的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── HPKCHECK #测试脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md #三方库简介 + ``` + +- 在lycium目录下编译三方库 + + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ```shell + cd lycium + ./build.sh re2-2022-12-01 + ``` + +- 三方库头文件及生成的库 + + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ```shell + re2-2022-12-01/arm64-v8a re2-2022-12-01/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的头文件和静态库文件拷贝到该目录下,如下图所示: +   + +  ![thirdparty_install_dir](pic/re2_install_dir.png) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + + ```shell + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/re2/${OHOS_ARCH}/lib/libre2.a) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/re2/${OHOS_ARCH}/include) + ``` + +## 测试三方库 +- 编译出可执行的文件,使用原库自带的测试用例来做测试 [准备三方库测试环境](../../../lycium/README.md#3ci环境准备) + 进入到构建目录运行测试用例(注意arm64-v8a为构建64位的目录,armeabi-v7a为构建32位的目录)。 + ctest批量测试时,exhaustive1_test 和 exhaustive_test 这两个测试用例会超时,因此单独执行。执行结果如图所示 + +```shell + cd /data/tpc_c_cplusplus/thirdparty/re2-2022-12-01/re2-2022-12-01/arm64-v8a-build + ctest + ./exhaustive1_test + ./exhaustive_test +``` + ![re2_test](pic/re2_test1.png) + ![re2_test](pic/re2_test2.png) + ![re2_test](pic/re2_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) \ No newline at end of file diff --git a/community/re2/docs/pic/re2_install_dir.png b/community/re2/docs/pic/re2_install_dir.png new file mode 100644 index 0000000000000000000000000000000000000000..60ee12a10133efdf24af5393debc5609c6154d98 Binary files /dev/null and b/community/re2/docs/pic/re2_install_dir.png differ diff --git a/community/re2/docs/pic/re2_test1.png b/community/re2/docs/pic/re2_test1.png new file mode 100644 index 0000000000000000000000000000000000000000..98db4ba8bbdd4fd007c065655f9eee597e1d070f Binary files /dev/null and b/community/re2/docs/pic/re2_test1.png differ diff --git a/community/re2/docs/pic/re2_test2.png b/community/re2/docs/pic/re2_test2.png new file mode 100644 index 0000000000000000000000000000000000000000..b1680c2b8a03c315d5c50f94eba67c229ddb006f Binary files /dev/null and b/community/re2/docs/pic/re2_test2.png differ diff --git a/community/re2/docs/pic/re2_test3.png b/community/re2/docs/pic/re2_test3.png new file mode 100644 index 0000000000000000000000000000000000000000..c44b0f1dd85e66acd682d0a6280bc51d4991cebd Binary files /dev/null and b/community/re2/docs/pic/re2_test3.png differ diff --git a/community/reactphysics3d-0.9.0/HPKBUILD b/community/reactphysics3d-0.9.0/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..f6f1a528099062cf8c6ec2e1e190c92a6b6abae7 --- /dev/null +++ b/community/reactphysics3d-0.9.0/HPKBUILD @@ -0,0 +1,72 @@ +# 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=reactphysics3d-0.9.0 +pkgver=v0.9.0 +pkgrel=0 +pkgdesc="ReactPhysics3D is an open source C++ physics engine library that can be used in 3D simulations and games." +url="https://github.com/DanielChappuis/reactphysics3d/tree/v0.9.0" +archs=("armeabi-v7a" "arm64-v8a") +license=("Zlib License") +depends=() +makedepends=() +source="https://github.com/DanielChappuis/reactphysics3d/archive/refs/tags/v0.9.0.zip" + +downloadpackage=true +autounpack=true +buildtools=cmake +patchflag=true + +builddir=reactphysics3d-0.9.0 +packagename=reactphysics3d-v0.9.0.zip + +# 为编译设置环境,如设置环境变量,创建编译目录等 +prepare() { + if $patchflag + then + cd $builddir + #在原库根目录下的CMakeLists.txt中构建单元测试,并且进行注册测试用例、链接库文件等操作, + patch -p1 < `pwd`/../reactphysics3d-0.9.0.patch + #patch只需要打一次,关闭打patch + patchflag=false + cd $OLDPWD + fi + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" -DCMAKE_C_FLAGS="-Wno-unused-command-line-argument" \ + -DCMAKE_CXX_FLAGS="-Wno-unused-command-line-argument" -B$ARCH-build -S./ > $buildlog 2>&1 + $MAKE VERBOSE=1 -C $ARCH-build >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + $MAKE -C $ARCH-build install >> $buildlog 2>&1 + cd $OLDPWD +} + +check() { + echo "The test must be on an OpenHarmony device!" +} + +cleanbuild() { + rm -rf ${PWD}/$builddir +} \ No newline at end of file diff --git a/community/reactphysics3d-0.9.0/HPKCHECK b/community/reactphysics3d-0.9.0/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..45087f23bbfe1b9cac2c3352e606b765ef4a975f --- /dev/null +++ b/community/reactphysics3d-0.9.0/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: 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}_${OHOS_SDK_VER}_test.log + + +# 在OH环境执行测试的接口 +openharmonycheck() { + res=0 + cd ${builddir}/${ARCH}-build # 进入到测试目录 + ctest > $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/community/reactphysics3d-0.9.0/README.OpenSource b/community/reactphysics3d-0.9.0/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..569a14a9477c42f54c3f4d529cf245dee58dbd87 --- /dev/null +++ b/community/reactphysics3d-0.9.0/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "reactphysics3d-0.9.0", + "License": "Zlib License", + "License File": "https://github.com/DanielChappuis/reactphysics3d/blob/master/LICENSE", + "Version Number": "0.9.0", + "Owner": "2942375747@qq.com", + "Upstream URL": "https://github.com/DanielChappuis/reactphysics3d", + "Description": "ReactPhysics3D is an open source C++ physics engine library that can be used in 3D simulations and games." + } +] \ No newline at end of file diff --git a/community/reactphysics3d-0.9.0/README_zh.md b/community/reactphysics3d-0.9.0/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..99da9a064859442c7f22b2641ca41d0f49b3898f --- /dev/null +++ b/community/reactphysics3d-0.9.0/README_zh.md @@ -0,0 +1,9 @@ +# reactphysics3d三方库说明 +## 功能简介 +reactphysics3d是一个开源的c++物理引擎库,可以用于3D模拟和游戏。 +## 三方库版本: +- 0.9.0 +## 使用约束: +- [IDE和SDK版本](../../docs/constraint.md) +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) \ No newline at end of file diff --git a/community/reactphysics3d-0.9.0/SHA512SUM b/community/reactphysics3d-0.9.0/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..7469c04a5d16bbf4a24946692063d37d2e374ed0 --- /dev/null +++ b/community/reactphysics3d-0.9.0/SHA512SUM @@ -0,0 +1 @@ +4180421e3031d06669638052bd558f6dd66e904655d4139339ebecab3668042a01feae1deb5197c1a3b2336e354b4767ff1b34949601728be71b1b63dad6d1f3 reactphysics3d-v0.9.0.zip \ No newline at end of file diff --git a/community/reactphysics3d-0.9.0/docs/hap_integrate.md b/community/reactphysics3d-0.9.0/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..14701368a7677b3e9681113c4d7868bb1b974e2d --- /dev/null +++ b/community/reactphysics3d-0.9.0/docs/hap_integrate.md @@ -0,0 +1,80 @@ +# reactphysics3d集成到应用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/reactphysics3d-0.9.0 #三方库reactphysics3d-0.9.0的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── HPKCHECK #测试脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md #三方库简介 + ├── reactphysics3d-0.9.0_oh_pkg.patch #用于reactphysics3d-0.9.0库编译的补丁 + ``` + +- 在lycium目录下编译三方库 + + 编译环境的搭建参考 [准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ```shell + cd lycium + ./build.sh reactphysics3d-0.9.0 + ``` + +- 三方库头文件及生成的库 + + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ```shell + reactphysics3d-0.9.0/arm64-v8a reactphysics3d-0.9.0/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的头文件和静态库文件拷贝到该目录下,如下图所示: +   + +  ![thirdparty_install_dir](pic/reactphysics3d_install_dir.png) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + + ```shell + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/reactphysics3d/${OHOS_ARCH}/lib/libreactphysics3d.a) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/reactphysics3d/${OHOS_ARCH}/include) + ``` + +## 测试三方库 + +- 编译出可执行的文件,使用原库自带的测试用例来做测试 [准备三方库测试环境](../../../lycium/README.md#3ci环境准备) +进入到构建目录运行测试用例(注意arm64-v8a为构建64位的目录,armeabi-v7a为构建32位的目录),执行结果如图所示 + +```shell + cd /data/tpc_c_cplusplus/thirdparty/reactphysics3d-0.9.0/reactphysics3d-0.9.0/arm64-v8a-build/ + ctest +``` + ![reactphysics3d_test](pic/reactphysics3d_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/community/reactphysics3d-0.9.0/docs/pic/reactphysics3d_install_dir.png b/community/reactphysics3d-0.9.0/docs/pic/reactphysics3d_install_dir.png new file mode 100644 index 0000000000000000000000000000000000000000..917454eca3113c49279f0567f94b01a5da86a53f Binary files /dev/null and b/community/reactphysics3d-0.9.0/docs/pic/reactphysics3d_install_dir.png differ diff --git a/community/reactphysics3d-0.9.0/docs/pic/reactphysics3d_test.png b/community/reactphysics3d-0.9.0/docs/pic/reactphysics3d_test.png new file mode 100644 index 0000000000000000000000000000000000000000..3577db6c50d1b89bd817f3d5bd2acaaadd905062 Binary files /dev/null and b/community/reactphysics3d-0.9.0/docs/pic/reactphysics3d_test.png differ diff --git a/community/reactphysics3d-0.9.0/reactphysics3d-0.9.0.patch b/community/reactphysics3d-0.9.0/reactphysics3d-0.9.0.patch new file mode 100644 index 0000000000000000000000000000000000000000..8317582b95c81c30e03a3731b49be8d750092c4f --- /dev/null +++ b/community/reactphysics3d-0.9.0/reactphysics3d-0.9.0.patch @@ -0,0 +1,38 @@ +diff -urN reactphysics3d-0.9.0_old/CMakeLists.txt reactphysics3d-0.9.0/CMakeLists.txt +--- reactphysics3d-0.9.0_old/CMakeLists.txt 2022-01-04 06:37:55.000000000 +0800 ++++ reactphysics3d-0.9.0/CMakeLists.txt 2024-09-30 19:25:35.715126376 +0800 +@@ -26,11 +26,16 @@ + + # Options + option(RP3D_COMPILE_TESTBED "Select this if you want to build the testbed application with demos" OFF) +-option(RP3D_COMPILE_TESTS "Select this if you want to build the unit tests" OFF) ++option(RP3D_COMPILE_TESTS "Select this if you want to build the unit tests" ON) + option(RP3D_PROFILING_ENABLED "Select this if you want to compile for performanace profiling" OFF) + option(RP3D_CODE_COVERAGE_ENABLED "Select this if you need to build for code coverage calculation" OFF) + option(RP3D_DOUBLE_PRECISION_ENABLED "Select this if you want to compile using double precision floating values" OFF) + ++set(TEST_SOURCES ++ "test/Test.cpp" # 在这里列出测试源文件 ++ "test/TestSuite.cpp" ++ "test/main.cpp" ++) + # Code Coverage + if(RP3D_CODE_COVERAGE_ENABLED) + INCLUDE(CodeCoverage) +@@ -257,9 +262,14 @@ + endif() + + # If we need to compile the tests +-if(RP3D_COMPILE_TESTS) ++ ++ add_executable(reactphysics3d_tests ${TEST_SOURCES}) ++ # 链接库文件(确保链接到 reactphysics3d 库) ++ target_link_libraries(reactphysics3d_tests PRIVATE reactphysics3d) ++ # 注册测试 ++ add_test(NAME ReactPhysics3DTests COMMAND reactphysics3d_tests) + add_subdirectory(test/) +-endif() ++ + + # Enable profiling if necessary + if(RP3D_PROFILING_ENABLED) diff --git a/community/rtmpdump/HPKBUILD b/community/rtmpdump/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..73fc90a98e96807c64334fe8d574d178fcdb65ac --- /dev/null +++ b/community/rtmpdump/HPKBUILD @@ -0,0 +1,76 @@ +# Contributor: Jeff Han +# Maintainer: Jeff Han +pkgname=rtmpdump +pkgver=2.3 +pkgrel=0 +pkgdesc="rtmpdump is a toolkit for RTMP streams. All forms of RTMP are supported, including rtmp://, rtmpt://, rtmpe://, rtmpte://, and rtmps://." +url="http://rtmpdump.mplayerhq.hu/" +archs=("armeabi-v7a" "arm64-v8a") +license=("LGPL") +depends=("openssl_1_0_2u") +makedepends=() + +source="http://rtmpdump.mplayerhq.hu/download/$pkgname-$pkgver.tgz" + +autounpack=true +downloadpackage=true +buildtools="make" + +builddir=$pkgname-${pkgver} +packagename=$builddir.tgz + +cc= +ar= +ld= +# rtmpdump 采用makefile编译构建,为了保留构建环境(方便测试)。因此同一份源码在解压后分为两份,各自编译互不干扰 +prepare() { + echo $packagename + 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 + elif [ $ARCH == "arm64-v8a" ] + then + cc=${OHOS_SDK}/native/llvm/bin/aarch64-linux-ohos-clang + else + echo "${ARCH} not support" + return -1 + fi + ld=${OHOS_SDK}/native/llvm/bin/ld.lld + ar=${OHOS_SDK}/native/llvm/bin/llvm-ar + cd $OLDPWD +} + +build() { + cd $builddir-$ARCH-build + $MAKE SHARED=no CC=${cc} LD=${ld} XCFLAGS="-D__MUSL__=1 -I$LYCIUM_ROOT/usr/openssl_1_0_2u/$ARCH/include" \ + XLDFLAGS="-L$LYCIUM_ROOT/usr/openssl_1_0_2u/$ARCH/lib" > $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir-$ARCH-build + $MAKE SHARED=no CC=${cc} LD=${ld} \ + LDFLAGS="-L$LYCIUM_ROOT/usr/openssl_1_0_2u/$ARCH/lib" install prefix=$LYCIUM_ROOT/usr/$pkgname/$ARCH >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +check() { + echo "The test must be on an OpenHarmony device!" + # TODO +} + +recoverpkgbuildenv() { + unset cc ar ld +} + +# 清理环境 +cleanbuild() { + rm -rf ${PWD}/$builddir $builddir-armeabi-v7a-build $builddir-arm64-v8a-build #${PWD}/$packagename +} + diff --git a/community/rtmpdump/SHA512SUM b/community/rtmpdump/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..d324bf58bac3f8f3417dbabd6e8837f23ab3db1e --- /dev/null +++ b/community/rtmpdump/SHA512SUM @@ -0,0 +1 @@ +d8240ba372a704231286b81bbf75716d8b76874840538c4e1527f7f8b6ca66eeaba6b03167fe6fab06bf80f20f07d89ecb84cc428b3196234174a43f3328ec2a rtmpdump-2.3.tgz diff --git a/community/spdlog/HPKBUILD b/community/spdlog/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..2513fbaf698eb1c4ca791c64761eb76a76eabe60 --- /dev/null +++ b/community/spdlog/HPKBUILD @@ -0,0 +1,61 @@ +# 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: kami_coder +# Maintainer: kami_coder + +pkgname=spdlog +pkgver=v1.9.2 +pkgvel=0 +url="https://github.com/gabime/spdlog" +archs=("armeabi-v7a" "arm64-v8a") +license=("MIT") +depends=("fmt-8.1.1") +makedepends=() + +source="https://codeload.github.com/gabime/${pkgname}/tar.gz/refs/tags/${pkgver}" + +builddir=${pkgname}-${pkgver:1} +packagename=${builddir}.tar.gz +autounpack=ture +downloadpackage=ture +buildtools="cmake" + +prepare() { + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" -DSPDLOG_BUILD_TESTS=ON\ + -DSPDLOG_FMT_EXTERNAL_HO=ON -B$ARCH-build -S./ > $buildlog 2>&1 + $MAKE VERBOSE=1 -C $ARCH-build >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + $MAKE -C $ARCH-build install >> $buildlog 2>&1 + cd $OLDPWD +} + +check() { + echo "The test must be on an OpenHarmony device!" +} + +# 清理环境 +cleanbuild() { + rm -rf ${PWD}/$builddir +} diff --git a/community/spdlog/HPKCHECK b/community/spdlog/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..01c9ce60eddbb926fa90f434529588a0b141abac --- /dev/null +++ b/community/spdlog/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: kami_coder +# Maintainer: kami_coder + +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 + ctest > ${logfile} 2>&1 + res=$? + if [ $res -ne 0 ] + then + mkdir -p ${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/community/spdlog/OAT.xml b/community/spdlog/OAT.xml new file mode 100644 index 0000000000000000000000000000000000000000..96937ea08644b79312d0ced7c0b3eb1e845108ee --- /dev/null +++ b/community/spdlog/OAT.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/community/spdlog/README.OpenSource b/community/spdlog/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..17786c53e08d4e7b0ef774badf622529914ffcc3 --- /dev/null +++ b/community/spdlog/README.OpenSource @@ -0,0 +1,20 @@ +[ + { + "Name": "spdlog", + "License": "MIT", + "License File": "https://github.com/gabime/spdlog/blob/v1.x/LICENSE", + "Version Number": "v1.9.2", + "Owner": "huangminzhong2@huawei.com", + "Upstream URL": "https://github.com/gabime/spdlog", + "Description": "Very fast, header-only/compiled, C++ logging library" + }, + { + "Name": "fmt", + "License": "MIT", + "License File": "https://github.com/fmtlib/fmt/blob/master/LICENSE.rst", + "Version Number": "8.1.1", + "Owner": "CHENGLIUQ@isoftstone.com", + "Upstream URL": "https://github.com/fmtlib/fmt/archive/refs/tags/8.1.1.tar.gz", + "Description": "fmt is an open-source formatting library providing a fast and safe alternative to C stdio and C++ iostreams." + } +] diff --git a/community/spdlog/README_zh.md b/community/spdlog/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..f73373b534ff8e2a1b6306baae58269b53c0e645 --- /dev/null +++ b/community/spdlog/README_zh.md @@ -0,0 +1,12 @@ +# spdlog 三方库说明 +## 功能简介 +spdlog是一个 非常快,头文件/编译,c++日志库 + +## 三方库版本 +- v1.9.2 + +## 使用约束 +- [IDE和SDK版本](../../docs/constraint.md) + +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) diff --git a/community/spdlog/SHA512SUM b/community/spdlog/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..510ea60617870a329e517b71b8fd67ff3eaed5b3 --- /dev/null +++ b/community/spdlog/SHA512SUM @@ -0,0 +1 @@ +87b12a792cf2d740ef29db4b6055788a487b6d474662b878711b8a5534efea5f0d97b6ac357834500b66cc65e1ba8934446a695e9691fd5d4b95397b6871555c spdlog-1.9.2.tar.gz diff --git a/community/spdlog/docs/hap_integrate.md b/community/spdlog/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..65d0e61d688e935ebc1c7fb69e5e7a72d9839991 --- /dev/null +++ b/community/spdlog/docs/hap_integrate.md @@ -0,0 +1,71 @@ +# spdlog集成到应用hap +本库是在RK3568开发板上基于OpenHarmony的镜像验证的,如果是从未使用过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 + ``` + +- 三方库目录结构 + ``` + tpc_c_cplusplus/thirdparty/libmysofa #三方库的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── HPKCHECK #测试脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md #三方库简介 + ├── OAT.xml #扫描结果文件 + ├── libmysofa_oh_pkg.patch #patch文件 + ``` + +- 在lycium目录下编译三方库,编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ```shell + cd lycium + ./build.sh libmysofa + ``` + +- 三方库头文件及生成的库,在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ``` + libmysofa/libmysofa-1.3.2/armeabi-v7a-build + libmysofa/libmysofa-1.3.2/arm64-v8a-build + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 +- 在IDE的cpp目录下新增thirdparty目录,将生成的库文件以及头文件拷贝到该目录下,如下图所示 + + ![install.dir](./pic/install.dir.png) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + ```makefile + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libmysofa/${OHOS_ARCH}/lib/libmysofa.a) + + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libmysofa/${OHOS_ARCH}/include) + ``` +## 测试三方库 +三方库的测试使用原库提供的测试用例来做测试,[准备三方库测试环境](../../../lycium/README.md#3ci环境准备) + +进入到构建目录准备测试,例如目录为arm64-v8a-build,执行ctest进行测试 + +```shell +cd tpc_c_cplusplus/thirdparty/libmysofa/libmysofa-1.3.2-3.11.2/arm64-v8a-build +ctest +``` + +![test-pass](./pic/linux-pass.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) +- [libspdlog三方库地址](https://github.com/gabime/spdlog) + diff --git a/community/spdlog/docs/pic/spdlog-dev.png b/community/spdlog/docs/pic/spdlog-dev.png new file mode 100644 index 0000000000000000000000000000000000000000..9aac62935ef28d68d0bc42b2bbcbca711dd111d0 Binary files /dev/null and b/community/spdlog/docs/pic/spdlog-dev.png differ diff --git a/community/spdlog/docs/pic/test-cmd-ret.png b/community/spdlog/docs/pic/test-cmd-ret.png new file mode 100644 index 0000000000000000000000000000000000000000..e9b698599c05f74c0c59f43d186088a76f0245dd Binary files /dev/null and b/community/spdlog/docs/pic/test-cmd-ret.png differ diff --git a/community/speechd/HPKBUILD b/community/speechd/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..a7da044f58f4c643cb7d44d721a2fab33a4476f9 --- /dev/null +++ b/community/speechd/HPKBUILD @@ -0,0 +1,122 @@ +# 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: huangminzhong +# Maintainer: huangminzhong + +pkgname=speechd +pkgver=0.11.5 +pkgrel=0 +pkgdesc="This is the Speech Dispatcher project (speech-dispatcher). " +url="https://github.com/brailcom/speechd" +archs=("armeabi-v7a" "arm64-v8a") +license=("GNU LESSER GENERAL PUBLIC LICENSE") +depends=("espeak" "pulseaudio" "glib" "pcre2" "libsndfile" "dotconf") +makedepends=() +# 原仓地址:source="https://github.com/brailcom/speechd/releases/download/0.11.5/speech-dispatcher-0.11.5.tar.gz" 因网络原因shi'y使用镜像地址 +source="https://gitee.com/lycium_pkg_mirror/$pkgname/repository/archive/$pkgver.zip" + +autounpack=true +downloadpackage=true +buildtools="configure" + +patchflag=true + +builddir=${pkgname}-${pkgver} +packagename=$builddir.zip + +source envset.sh +host= +prepare() { + if $patchflag + then + cd $builddir + # pthread_cancel等函数openharmony目前不支持,将pthread_join修改成pthread_detach + # setvbuf接口导致pipe使用异常 + patch -p1 < ../speechd_ohos.patch > $buildlog 2>&1 + # patch只需要打一次,关闭打patch + patchflag=false + cd $OLDPWD + fi + + cp -rf ${builddir} $builddir-${ARCH}-build + + if [ $ARCH == "armeabi-v7a" ] + then + setarm32ENV + host=arm-linux + elif [ $ARCH == "arm64-v8a" ] + then + setarm64ENV + host=aarch64-linux + else + echo "${ARCH} not support" + return -1 + fi + + cd $builddir-$ARCH-build + autoreconf -ifv >> $buildlog 2>&1 + cd $OLDPWD + +} + +build() { + cd $builddir-$ARCH-build + PKG_CONFIG_LIBDIR=$pkgconfigpath ./configure "$@" --host=$host ac_cv_func_malloc_0_nonnull=yes \ + ac_cv_func_realloc_0_nonnull=yes gt_func_gnugettext_libintl=no --with-espeak \ + LDFLAGS="-L$LYCIUM_ROOT/usr/espeak/$ARCH/lib" \ + CFLAGS="-I$LYCIUM_ROOT/usr/libsndfile/$ARCH/include -I$LYCIUM_ROOT/usr/dotconf/$ARCH/include \ + -I$LYCIUM_ROOT/usr/espeak/$ARCH/include -Wno-int-conversion" \ + CXXFLAGS="-I$LYCIUM_ROOT/usr/libsndfile/$ARCH/include -I$LYCIUM_ROOT/usr/dotconf/$ARCH/include \ + -I$LYCIUM_ROOT/usr/espeak/$ARCH/include -Wno-int-conversion" >> $buildlog 2>&1 + sed -i '$a\ # define gettext(Msgid) ((const char *) (Msgid))' config.h + ${MAKE} V=1 >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir-$ARCH-build + ${MAKE} install >> $buildlog 2>&1 + cd $OLDPWD +} + +check() { + cd $builddir-$ARCH-build + $MAKE check >> $buildlog 2>&1 + cd $OLDPWD + echo "The test must be on an OpenHarmony device!" + # how to run test + # cd $builddir-$ARCH-build/src/tests + # ../../run-speechd && ./clibrary +} + +recoverpkgbuildenv() { + unset host + if [ $ARCH == "armeabi-v7a" ] + then + unsetarm32ENV + elif [ $ARCH == "arm64-v8a" ] + then + unsetarm64ENV + else + echo "${ARCH} not support" + return -1 + fi +} + +# 清理环境 +cleanbuild(){ + rm -rf ${PWD}/$builddir ${PWD}/$builddir-armeabi-v7a-build ${PWD}/$builddir-arm64-v8a-build #${PWD}/$packagename +} diff --git a/community/speechd/OAT.xml b/community/speechd/OAT.xml new file mode 100644 index 0000000000000000000000000000000000000000..03ee5a760a1f17e2e86907647046114696ade760 --- /dev/null +++ b/community/speechd/OAT.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/community/speechd/README.OpenSource b/community/speechd/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..8ee54ddb4de849d906f44b3ae8546fea1c9fd0e9 --- /dev/null +++ b/community/speechd/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "", + "License": "GPL2 or later", + "License File": "COPYING.LGPL COPYING.GPL-3 COPYING.GPL-2", + "Version Number": "0.11.5", + "Owner": "huangminzhong2@huawei.com", + "Upstream URL": "https://github.com/brailcom/speechd/archive/refs/tags/0.11.5.zip", + "Description": "This is the Speech Dispatcher project (speech-dispatcher). " + } +] diff --git a/community/speechd/README_zh.md b/community/speechd/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..636fd02915523655e8ead39d2c1a983f4cfb44fd --- /dev/null +++ b/community/speechd/README_zh.md @@ -0,0 +1,12 @@ +# speechd 三方库说明 +## 功能简介 +Speech Dispatcher项目提供了一个高级的独立于设备的层,用于通过一个简单、稳定且文档良好的接口访问语音合成。 + +## 三方库版本 +- 0.11.5 + +## 使用约束 +- [IDE和SDK版本](../../docs/constraint.md) + +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) diff --git a/community/speechd/SHA512SUM b/community/speechd/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..7036b4eb3413e2b6d2ad55291dacac0660ea2637 --- /dev/null +++ b/community/speechd/SHA512SUM @@ -0,0 +1 @@ +7d1902320d233515179cd47063695e0f13030a8f49219ef916db9e88d3aaf8f1c05dc8b290eaf4c9650163bf783956ccf1c1c5a06f7d845bf96c742e9a80c898 speechd-0.11.5.zip diff --git a/community/speechd/docs/hap_integrate.md b/community/speechd/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..0ddbbf09a536d81130a19be2308080e12460c079 --- /dev/null +++ b/community/speechd/docs/hap_integrate.md @@ -0,0 +1,81 @@ +# speechd集成到应用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/speechd #三方库speechd的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── HPKCHECK #测试脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md + ├── speechd_ohos.patch + ``` + +- 在lycium目录下编译三方库 + + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ```shell + cd lycium + ./build.sh speechd + ``` + +- 三方库头文件及生成的库 + + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ```shell + speechd/arm64-v8a speechd/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的头文件拷贝到该目录下,将编译生成的三方库以及依赖库全部拷贝到工程的libs目录下,如下图所示: + +  ![thirdparty_install_dir](pic/install_dir.png) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + + ```cmake + #将三方库加入工程中 + target_link_libraries(entry PUBLIC ${CMAKE_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/libspeechd.so) + target_link_libraries(entry PUBLIC ${CMAKE_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/libglib-2.0.so) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/speechd/${OHOS_ARCH}/include/speech-dispatcher) + ``` + + +## 测试三方库 + +三方库的测试由于原库没有测试用例,故编写测试demo,编译出可执行的文件进行测试,[准备三方库测试环境](../../../lycium/README.md#3ci环境准备) + +进入到构建目录下的src/tests目录,设置环境export LD_LIBRARY_PATH="/data/llh_workspace/tpc_c_cplusplus/lycium/usr/glib/arm64-v8a/lib",再执行 ../../run-speechd && ./runt_test basic.test ,运行测试用例(speechd-0.11.5-arm64-v8a-build为构建64位的目录,speechd-0.11.5-armeabi-v7a-build为构建32位的目录) + + ![test](pic/test_result1.png) + + ![test](pic/test_result2.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/community/speechd/docs/pic/install_dir.png b/community/speechd/docs/pic/install_dir.png new file mode 100644 index 0000000000000000000000000000000000000000..27ab5fec1b7ea97ea6537842f4729db7f7938ddb Binary files /dev/null and b/community/speechd/docs/pic/install_dir.png differ diff --git a/community/speechd/docs/pic/test_result1.png b/community/speechd/docs/pic/test_result1.png new file mode 100644 index 0000000000000000000000000000000000000000..104db4f4e2f653b90f80140d5dac7d502f646fde Binary files /dev/null and b/community/speechd/docs/pic/test_result1.png differ diff --git a/community/speechd/docs/pic/test_result2.png b/community/speechd/docs/pic/test_result2.png new file mode 100644 index 0000000000000000000000000000000000000000..9ee3b6df6d4b03ed0ac1a3000cdac58c6fd9b237 Binary files /dev/null and b/community/speechd/docs/pic/test_result2.png differ diff --git a/community/speechd/speechd_ohos.patch b/community/speechd/speechd_ohos.patch new file mode 100644 index 0000000000000000000000000000000000000000..25b61d2ccb7b321542a772fc67f221e63be52efc --- /dev/null +++ b/community/speechd/speechd_ohos.patch @@ -0,0 +1,189 @@ +diff -Naur speech-dispatcher-0.11.5/src/api/c/libspeechd.c speech-dispatcher-0.11.5_ohos/src/api/c/libspeechd.c +--- speech-dispatcher-0.11.5/src/api/c/libspeechd.c 2023-08-06 10:47:57.000000000 -0700 ++++ speech-dispatcher-0.11.5_ohos/src/api/c/libspeechd.c 2023-11-12 23:13:46.657859121 -0800 +@@ -542,10 +542,11 @@ + if (!connection->stream) + SPD_FATAL("Can't create a stream for socket, fdopen() failed."); + /* Switch to line buffering mode */ ++#ifndef __OHOS__ + ret = setvbuf(connection->stream, NULL, _IONBF, SPD_REPLY_BUF_SIZE); + if (ret) + SPD_FATAL("Can't set buffering, setvbuf failed."); +- ++#endif + pthread_mutex_init(&connection->ssip_mutex, NULL); + + if (mode == SPD_MODE_THREADED) { +@@ -609,12 +610,18 @@ + pthread_mutex_lock(&connection->ssip_mutex); + + if (connection->mode == SPD_MODE_THREADED) { ++#ifndef __OHOS__ + pthread_cancel(connection->td->events_thread); ++#endif + pthread_mutex_destroy(&connection->td->mutex_reply_ready); + pthread_mutex_destroy(&connection->td->mutex_reply_ack); + pthread_cond_destroy(&connection->td->cond_reply_ready); + pthread_cond_destroy(&connection->td->cond_reply_ack); ++#ifndef __OHOS__ + pthread_join(connection->td->events_thread, NULL); ++#else ++ pthread_detach(connection->td->events_thread); ++#endif + connection->mode = SPD_MODE_SINGLE; + free(connection->td); + } +diff -Naur speech-dispatcher-0.11.5/src/audio/nas.c speech-dispatcher-0.11.5_ohos/src/audio/nas.c +--- speech-dispatcher-0.11.5/src/audio/nas.c 2023-06-05 15:03:00.000000000 -0700 ++++ speech-dispatcher-0.11.5_ohos/src/audio/nas.c 2023-11-12 23:15:50.034386598 -0800 +@@ -55,8 +55,9 @@ + static void *_nas_handle_events(void *par) + { + spd_nas_id_t *nas_id = (spd_nas_id_t *) par; ++#ifndef __OHOS__ + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); +- ++#endif + while (1) + AuHandleEvents(nas_id->aud); + +@@ -213,10 +214,12 @@ + + if (nas_id == NULL) + return -2; +- ++#ifndef __OHOS__ + pthread_cancel(nas_id->nas_event_handler); + pthread_join(nas_id->nas_event_handler, NULL); +- ++#else ++ pthread_detach(nas_id->nas_event_handler); ++#endif + pthread_mutex_destroy(&nas_id->pt_mutex); + pthread_mutex_destroy(&nas_id->flow_mutex); + +diff -Naur speech-dispatcher-0.11.5/src/common/common.c speech-dispatcher-0.11.5_ohos/src/common/common.c +--- speech-dispatcher-0.11.5/src/common/common.c 2023-06-05 15:03:00.000000000 -0700 ++++ speech-dispatcher-0.11.5_ohos/src/common/common.c 2023-11-12 23:16:18.814544565 -0800 +@@ -49,6 +49,8 @@ + + void set_speaking_thread_parameters(void) + { ++#ifndef __OHOS__ + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); ++#endif + } +diff -Naur speech-dispatcher-0.11.5/src/common/i18n.c speech-dispatcher-0.11.5_ohos/src/common/i18n.c +--- speech-dispatcher-0.11.5/src/common/i18n.c 2023-06-05 15:03:00.000000000 -0700 ++++ speech-dispatcher-0.11.5_ohos/src/common/i18n.c 2023-11-12 23:19:08.151691291 -0800 +@@ -27,13 +27,22 @@ + #include + #include + ++ ++#ifdef __OHOS__ ++# undef textdomain ++# define textdomain(Domainname) ((const char *) (Domainname)) ++# undef bindtextdomain ++# define bindtextdomain(Domainname, Dirname) \ ++ ((void) (Domainname), (const char *) (Dirname)) ++#endif ++ ++ + void i18n_init(void) + { + if (setlocale(LC_ALL, "") == NULL) { + perror("setlocale"); + exit(1); + } +- + if (bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR) == NULL) { + perror("bindtextdomain"); + exit(1); +diff -Naur speech-dispatcher-0.11.5/src/modules/module_utils.c speech-dispatcher-0.11.5_ohos/src/modules/module_utils.c +--- speech-dispatcher-0.11.5/src/modules/module_utils.c 2023-06-05 15:03:00.000000000 -0700 ++++ speech-dispatcher-0.11.5_ohos/src/modules/module_utils.c 2023-11-12 23:20:37.356419452 -0800 +@@ -585,7 +585,7 @@ + int module_terminate_thread(pthread_t thread) + { + int ret; +- ++#ifndef __OHOS__ + ret = pthread_cancel(thread); + if (ret != 0) { + DBG("Cancellation of speak thread failed"); +@@ -596,7 +596,9 @@ + DBG("join failed!\n"); + return 1; + } +- ++#else ++ ret = pthread_detach(thread); ++#endif + return 0; + } + +diff -Naur speech-dispatcher-0.11.5/src/server/module.c speech-dispatcher-0.11.5_ohos/src/server/module.c +--- speech-dispatcher-0.11.5/src/server/module.c 2023-08-06 09:25:17.000000000 -0700 ++++ speech-dispatcher-0.11.5_ohos/src/server/module.c 2023-11-12 23:10:48.052505520 -0800 +@@ -499,10 +499,11 @@ + FATAL("Can't create a stream for socket, fdopen() failed."); + + /* Switch to line buffering mode */ ++#ifndef __OHOS__ + ret = setvbuf(module->stream_out, NULL, _IONBF, 4096); + if (ret) + FATAL("Can't set line buffering, setvbuf failed."); +- ++#endif + MSG(4, "Trying to initialize %s.", module->name); + if (output_send_data("INIT\n", module, 0) != 0) { + MSG(1, "ERROR: Something wrong with %s, can't initialize", +diff -Naur speech-dispatcher-0.11.5/src/server/output.c speech-dispatcher-0.11.5_ohos/src/server/output.c +--- speech-dispatcher-0.11.5/src/server/output.c 2023-08-06 09:26:22.000000000 -0700 ++++ speech-dispatcher-0.11.5_ohos/src/server/output.c 2023-11-12 23:23:20.673921097 -0800 +@@ -224,8 +224,10 @@ + void + static output_lock(void) + { ++#ifndef __OHOS__ + if (pthread_self() == speak_thread) + pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &oldstate); ++#endif + pthread_mutex_lock(&output_layer_mutex); + } + +@@ -233,8 +235,10 @@ + static output_unlock(void) + { + pthread_mutex_unlock(&output_layer_mutex); ++#ifndef __OHOS__ + if (pthread_self() == speak_thread) + pthread_setcancelstate(oldstate, NULL); ++#endif + } + + #define OL_RET(value) \ +diff -Naur speech-dispatcher-0.11.5/src/server/speechd.c speech-dispatcher-0.11.5_ohos/src/server/speechd.c +--- speech-dispatcher-0.11.5/src/server/speechd.c 2023-08-06 10:47:57.000000000 -0700 ++++ speech-dispatcher-0.11.5_ohos/src/server/speechd.c 2023-11-12 23:24:07.146381145 -0800 +@@ -1353,6 +1353,7 @@ + g_hash_table_destroy(fd_settings); + + MSG(4, "Closing speak() thread..."); ++#ifndef __OHOS__ + ret = pthread_cancel(speak_thread); + if (ret != 0) + FATAL("Speak thread failed to cancel!\n"); +@@ -1360,7 +1361,9 @@ + ret = pthread_join(speak_thread, NULL); + if (ret != 0) + FATAL("Speak thread failed to join!\n"); +- ++#else ++ ret = pthread_detach(speak_thread); ++#endif + MSG(4, "Closing play() thread..."); + module_speak_queue_terminate(); + diff --git a/community/speexdsp/HPKBUILD b/community/speexdsp/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..361fcbe3dc14a7980741eb433baac069d8ffc299 --- /dev/null +++ b/community/speexdsp/HPKBUILD @@ -0,0 +1,81 @@ +# Contributor: xuzhao +# Maintainer: xuzhao +pkgname=speexdsp +pkgver=1.2.1 +pkgrel=0 +pkgdesc="Speex is an Open Source/Free Software patent-free audio compression format designed for speech." +url="https://www.speex.org" +archs=("armeabi-v7a" "arm64-v8a") +license=("Copyright 2002-2008 Xiph.org Foundation; Copyright 2002-2008 Jean-Marc Valin" \ + "Copyright 2005-2007 Analog Devices Inc" \ + "Copyright 2005-2008 Commonwealth Scientific and Industrial Research Organisation (CSIRO)" \ + "Copyright 1993, 2002, 2006 David Rowe" \ + "Copyright 2003 EpicGames" \ + "Copyright 1992-1994 Jutta Degener, Carsten Bormann") +depends=() +makedepends=() + +source="https://downloads.xiph.org/releases/speex/$pkgname-${pkgver}.tar.gz" +autounpack=true +downloadpackage=true +buildtools="configure" + +builddir=$pkgname-${pkgver} +packagename=$builddir.tar.gz + +source envset.sh +host= + +prepare() { + mkdir -p $builddir/$ARCH-build + + if [ $ARCH == "armeabi-v7a" ] + then + setarm32ENV + host=arm-linux + elif [ $ARCH == "arm64-v8a" ] + then + setarm64ENV + host=aarch64-linux + else + echo "${ARCH} not support" + return -1 + fi +} + +build() { + cd $builddir/$ARCH-build + PKG_CONFIG_LIBDIR="${pkgconfigpath}" ../configure "$@" \ + --host=$host > $buildlog 2>&1 + $MAKE V=1 >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir/$ARCH-build + $MAKE install >> $buildlog 2>&1 + cd $OLDPWD + unset host + if [ $ARCH == "armeabi-v7a" ] + then + unsetarm32ENV + elif [ $ARCH == "arm64-v8a" ] + then + unsetarm64ENV + else + echo "${ARCH} not support" + return -1 + fi +} + +check() { + echo "The test must be on an OpenHarmony device!" + # TODO +} + +cleanbuild(){ + rm -rf ${PWD}/$builddir #${PWD}/$packagename +} + diff --git a/community/speexdsp/SHA512SUM b/community/speexdsp/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..d3085e5c346478976e2e935c136565c25da68ed8 --- /dev/null +++ b/community/speexdsp/SHA512SUM @@ -0,0 +1 @@ +41b5f37b48db5cb8c5a0f6437a4a8266d2627a5b7c1088de8549fe0bf0bb3105b7df8024fe207eef194096e0726ea73e2b53e0a4293d8db8e133baa0f8a3bad3 speexdsp-1.2.1.tar.gz diff --git a/community/spirv-reflect/HPKBUILD b/community/spirv-reflect/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..e15d3e38362ce5c0e5d205786761b3e6ca443c96 --- /dev/null +++ b/community/spirv-reflect/HPKBUILD @@ -0,0 +1,74 @@ +# 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=SPIRV-Reflect +pkgver=sdk-1.3.204.0 +pkgrel=0 +pkgdesc="SPIRV-Reflect is a lightweight library that provides a C/C++ reflection API for SPIR-V shader bytecode in Vulkan applications." +url="https://github.com/KhronosGroup/SPIRV-Reflect/tree/sdk-1.3.204.0" +archs=("armeabi-v7a" "arm64-v8a") +license=("Apache-2.0 license") +depends=() +makedepends=() +#下载镜像 +source="https://gitee.com/NEU-lab/spirv-reflect/repository/archive/sdk-1.3.204.0.zip" + +downloadpackage=true +autounpack=true +buildtools=cmake +patchflag=true + +builddir=spirv-reflect-sdk-1.3.204.0 +packagename=spirv-reflect-sdk-1.3.204.0.zip + +# 为编译设置环境,如设置环境变量,创建编译目录等 +prepare() { + if $patchflag + then + cd $builddir + #在原库根目录下的CMakeLists.txt中添加测试至ctest;安装头文件 + patch -p1 < `pwd`/../spirv-reflect-sdk-1.3.204.0_oh_pkg.patch + # patch只需要打一次,关闭打patch + patchflag=false + cd $OLDPWD + fi + + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" -DCMAKE_C_FLAGS="-Wno-unused-command-line-argument" \ + -DCMAKE_CXX_FLAGS="-Wno-unused-command-line-argument" -B$ARCH-build -S./ -DSPIRV_REFLECT_STATIC_LIB=ON -DSPIRV_REFLECT_BUILD_TESTS=ON > $buildlog 2>&1 + $MAKE VERBOSE=1 -C $ARCH-build >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + $MAKE -C $ARCH-build install >> $buildlog 2>&1 + cd $OLDPWD +} + +check() { + echo "The test must be on an OpenHarmony device!" +} + +cleanbuild() { + rm -rf ${PWD}/$builddir +} \ No newline at end of file diff --git a/community/spirv-reflect/HPKCHECK b/community/spirv-reflect/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..45087f23bbfe1b9cac2c3352e606b765ef4a975f --- /dev/null +++ b/community/spirv-reflect/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: 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}_${OHOS_SDK_VER}_test.log + + +# 在OH环境执行测试的接口 +openharmonycheck() { + res=0 + cd ${builddir}/${ARCH}-build # 进入到测试目录 + ctest > $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/community/spirv-reflect/README.OpenSource b/community/spirv-reflect/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..cfc2cf22d14689a2f3817539d34b69607111cd97 --- /dev/null +++ b/community/spirv-reflect/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "spirv-reflect", + "License": "Apache-2.0 license", + "License File": "https://github.com/KhronosGroup/SPIRV-Reflect/blob/main/LICENSE", + "Version Number": "sdk-1.3.204.0", + "Owner": "2942375747@qq.com", + "Upstream URL": "https://github.com/KhronosGroup/SPIRV-Reflect", + "Description": "SPIRV-Reflect is a lightweight library that provides a C/C++ reflection API for SPIR-V shader bytecode in Vulkan applications." + } +] \ No newline at end of file diff --git a/community/spirv-reflect/README_zh.md b/community/spirv-reflect/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..26bd300b1b9b4d4a17e96a59cd1b156388082121 --- /dev/null +++ b/community/spirv-reflect/README_zh.md @@ -0,0 +1,9 @@ +# spirv-reflect三方库说明 +## 功能简介 +SPIRV-Reflect是一个轻量级库,它为Vulkan应用程序中的spirv着色器字节码提供了C/c++反射API。 +## 三方库版本: +- sdk-1.3.204.0 +## 使用约束: +- [IDE和SDK版本](../../docs/constraint.md) +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) \ No newline at end of file diff --git a/community/spirv-reflect/SHA512SUM b/community/spirv-reflect/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..f728d28d6550aa2ae70b17567131ad36a7240586 --- /dev/null +++ b/community/spirv-reflect/SHA512SUM @@ -0,0 +1 @@ +9366fbeace44c546a220d1eed7855c3a92f780de761ddb917d05ac2b6ef775668f93ca1767b57fcf467a1d8213c2cc5c74ab053ac45102a460fa4a6c4dd9ae9c spirv-reflect-sdk-1.3.204.0.zip \ No newline at end of file diff --git a/community/spirv-reflect/docs/hap_integrate.md b/community/spirv-reflect/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..8c758e1aca22e209f2f8a62558844ffdfc288aa9 --- /dev/null +++ b/community/spirv-reflect/docs/hap_integrate.md @@ -0,0 +1,79 @@ +# spirv-reflect集成到应用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/spirv-reflect #三方库spirv-reflect的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── HPKCHECK #测试脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md #三方库简介 + ├── spirv-reflect-sdk-1.3.204.0_oh_pkg.patch #用于spirv-reflect库编译的补丁 + ``` + +- 在lycium目录下编译三方库 + + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ```shell + cd lycium + ./build.sh spirv-reflect + ``` + +- 三方库头文件及生成的库 + + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ```shell + spirv-reflect/arm64-v8a spirv-reflect/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +- 编译出可执行的文件进行测试,[准备三方库测试环境](../../../lycium/README.md#3ci环境准备) +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的头文件和库文件拷贝到该目录下,如下图所示: +   + +  ![thirdparty_install_dir](pic/spirv_reflect_install_dir.png) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + + ```shell + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/spirv_reflect/${OHOS_ARCH}/lib/libspirv-reflect-static.a) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/spirv_reflect/${OHOS_ARCH}/include) + ``` + +## 测试三方库 +进入到构建目录运行测试用例(注意arm64-v8a为构建64位的目录,armeabi-v7a为构建32位的目录)。执行结果如图所示 + +```shell + cd /data/tpc_c_cplusplus/thirdparty/spirv-reflect/spirv-reflect-sdk-1.3.204.0/arm64-v8a-build/ + ./ctest +``` + ![spirv-reflect_test](pic/spirv_reflect_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/community/spirv-reflect/docs/pic/spirv_reflect_install_dir.png b/community/spirv-reflect/docs/pic/spirv_reflect_install_dir.png new file mode 100644 index 0000000000000000000000000000000000000000..46b0a12f10dbb8e403d304d219c33006611577bb Binary files /dev/null and b/community/spirv-reflect/docs/pic/spirv_reflect_install_dir.png differ diff --git a/community/spirv-reflect/docs/pic/spirv_reflect_test.png b/community/spirv-reflect/docs/pic/spirv_reflect_test.png new file mode 100644 index 0000000000000000000000000000000000000000..9d88bbe3d9ecc6f0bdee1f4bfe28734572fd4c71 Binary files /dev/null and b/community/spirv-reflect/docs/pic/spirv_reflect_test.png differ diff --git a/community/spirv-reflect/spirv-reflect-sdk-1.3.204.0_oh_pkg.patch b/community/spirv-reflect/spirv-reflect-sdk-1.3.204.0_oh_pkg.patch new file mode 100644 index 0000000000000000000000000000000000000000..85605d4339cbace69a3ad340ba8a2913b9e1aaa3 --- /dev/null +++ b/community/spirv-reflect/spirv-reflect-sdk-1.3.204.0_oh_pkg.patch @@ -0,0 +1,28 @@ +diff -urN spirv-reflect-sdk-1.3.204.0_old/CMakeLists.txt spirv-reflect-sdk-1.3.204.0/CMakeLists.txt +--- spirv-reflect-sdk-1.3.204.0_old/CMakeLists.txt 2024-10-07 23:12:59.000000000 +0800 ++++ spirv-reflect-sdk-1.3.204.0/CMakeLists.txt 2024-10-30 23:36:30.978217836 +0800 +@@ -55,7 +55,8 @@ + SET(BUILD_GTEST ON CACHE BOOL "Builds the googletest subproject" FORCE) + SET(INSTALL_GTEST OFF CACHE BOOL "Enable installation of googletest. (Projects embedding googletest generally turn this OFF.)" FORCE) + SET(gtest_force_shared_crt ON CACHE BOOL "Enable DLL for C runtime libraries on Windows" FORCE) +- ++ # 启用测试 ++ enable_testing() + add_subdirectory(third_party/googletest) + add_executable(test-spirv-reflect ${CMAKE_CURRENT_SOURCE_DIR}/tests/test-spirv-reflect.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/spirv_reflect.h +@@ -72,12 +73,14 @@ + add_custom_command(TARGET test-spirv-reflect POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_directory + ${CMAKE_CURRENT_SOURCE_DIR}/tests ${CMAKE_CURRENT_BINARY_DIR}/tests) ++ # 添加测试到 CTest ++ add_test(NAME Spirv_Refle_ctTest COMMAND test-spirv-reflect) + endif() + + if(SPIRV_REFLECT_STATIC_LIB) + add_library(spirv-reflect-static STATIC ${CMAKE_CURRENT_SOURCE_DIR}/spirv_reflect.h + ${CMAKE_CURRENT_SOURCE_DIR}/spirv_reflect.c) +- ++ install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/spirv_reflect.h" DESTINATION include) + install(TARGETS spirv-reflect-static LIBRARY DESTINATION lib) + endif() diff --git a/community/sqlite_3_46_0/HPKBUILD b/community/sqlite_3_46_0/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..908db884aae3200106f3c5b205d479e70719c0cf --- /dev/null +++ b/community/sqlite_3_46_0/HPKBUILD @@ -0,0 +1,97 @@ +# 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: Jeff Han , wen fan +# Maintainer: Jeff Han + +pkgname=sqlite_3_46_0 +pkgver=version-3.46.0 +pkgrel= +pkgdesc="This repository contains the complete source code for the SQLite database engine. Some test scripts are also included. However, many other test scripts and most of the documentation are managed separately." +url=https://github.com/sqlite/sqlite +archs=(armeabi-v7a arm64-v8a) +license=(blessing) +depends=(tcl) +makedepends=(tclsh8.6) +source=https://github.com/sqlite/sqlite/archive/refs/tags/$pkgver.tar.gz + +autounpack=true +downloadpackage=true +buildtools=configure +patchflag=true +builddir=sqlite-${pkgver} +packagename=$builddir.tar.gz +source envset.sh +host= + +prepare() { + mkdir -p $builddir/$ARCH-build + if $patchflag + then + cd $builddir + patch -p1 < `pwd`/../sqlite-3.46.0_oh_pkg.patch + patchflag=false + cd $OLDPWD + fi + 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 + PKG_CONFIG_PATH="${pkgconfigpath}" ../configure "$@" --host=$host --with-tcl=$LYCIUM_ROOT/usr/tcl/$ARCH/lib TCLLIBDIR=$LYCIUM_ROOT/usr/tcl/$ARCH/lib > `pwd`/build.log 2>&1 + make -j4 >> `pwd`/build.log 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir/$ARCH-build + make install >> `pwd`/build.log 2>&1 + ret=$? + cd $OLDPWD + if [ $ARCH == "armeabi-v7a" ] + then + unsetarm32ENV + fi + if [ $ARCH == "arm64-v8a" ] + then + unsetarm64ENV + fi + unset host + return $ret +} + +check() { + cd $builddir/$ARCH-build + make testprogs >> `pwd`/build.log 2>&1 + ret=$? + cd $OLDPWD + echo "The test must be on an OpenHarmony device!" + # 在OpenHarmony开发板中执行用例 + # make fuzztest + return $ret +} + +cleanbuild(){ + rm -rf ${PWD}/$builddir #${PWD}/$packageName +} diff --git a/community/sqlite_3_46_0/HPKCHECK b/community/sqlite_3_46_0/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..7a1879d6c2996c5d9d422530e3bc6fbd42d5f497 --- /dev/null +++ b/community/sqlite_3_46_0/HPKCHECK @@ -0,0 +1,27 @@ +# 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: Jeff Han , wen fan +# Maintainer: Jeff Han + +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 + /bin/make fuzztest > ${logfile} 2>&1 + res=$? + cd $OLDPWD + + return $res +} diff --git a/community/sqlite_3_46_0/OAT.xml b/community/sqlite_3_46_0/OAT.xml new file mode 100644 index 0000000000000000000000000000000000000000..8c1f4a4604b0605aff883a046d2397e0016221b5 --- /dev/null +++ b/community/sqlite_3_46_0/OAT.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/community/sqlite_3_46_0/README.OpenSource b/community/sqlite_3_46_0/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..358dbda92ee35ba525538685f7c0acd4e9fb132f --- /dev/null +++ b/community/sqlite_3_46_0/README.OpenSource @@ -0,0 +1,20 @@ +[ + { + "Name": "sqlite_3_46_0", + "License": "blessing", + "License File": "https://github.com/sqlite/sqlite/blob/master/LICENSE.md", + "Version Number": "version-3.46.0", + "Owner": "huangminzhong2@huawei.com", + "Upstream URL": "https://github.com/sqlite/sqlite", + "Description": "This repository contains the complete source code for the SQLite database engine. Some test scripts are also included. However, many other test scripts and most of the documentation are managed separately." + }, + { + "Name": "tcl", + "License": "TCL/TK License", + "License File": "https://www.tcl.tk/software/tcltk/license.html", + "Version Number": "8.6.13", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://sourceforge.net/projects/tcl/files/Tcl/8.6.13/tcl8.6.13-src.tar.gz", + "Description": "Tool Command Language (Tcl) is an interpreted language and very portable interpreter for that language. Tcl is embeddable and extensible, and has been widely used since its creation in 1988 by John Ousterhout." + } +] diff --git a/community/sqlite_3_46_0/README_zh.md b/community/sqlite_3_46_0/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..8f466d49a58ac72922d560cc5edc1ba58f05d16a --- /dev/null +++ b/community/sqlite_3_46_0/README_zh.md @@ -0,0 +1,12 @@ +# sqlite 三方库说明 +## 功能简介 +sqlite 是一个提供数据库操作能力的库。 + +## 三方库版本 +- 3.46.0 + +## 使用约束 +- [IDE和SDK版本](../../docs/constraint.md) + +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) diff --git a/community/sqlite_3_46_0/SHA512SUM b/community/sqlite_3_46_0/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..fd4cda60fa60ce3708374cf6b65096e90a3b6a58 --- /dev/null +++ b/community/sqlite_3_46_0/SHA512SUM @@ -0,0 +1 @@ +a9575b5b545a0fd9261651b862e1f4649da2644492723510aeeb5cfca33a8baad98349f9626dc985b21e2d081149af2f7d8f7421a5a766fd7dae4c24ed544848 sqlite-version-3.46.0.tar.gz diff --git a/community/sqlite_3_46_0/docs/hap_integrate.md b/community/sqlite_3_46_0/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..fdffdd7e47d6f76d9a68fd2a7ff9f0801b9559e4 --- /dev/null +++ b/community/sqlite_3_46_0/docs/hap_integrate.md @@ -0,0 +1,64 @@ +# sqlite_3_46_0集成到应用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) +## 编译三方库 +- 下载本仓库 + ``` + git clone https://gitee.com/openharmony-sig/tpc_c_cplusplus.git --depth=1 + ``` + +- 三方库目录结构 + ``` + tpc_c_cplusplus/thirdparty/sqlite_3_46_0 #三方库的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── HPKCHECK #测试脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md #三方库简介 + ├── OAT.xml #扫描结果文件 + ├── sqlite-3.46.0_oh_pkg.patch #patch文件 + ``` + +- 在lycium目录下编译三方库 + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + ``` + cd lycium + ./build.sh sqlite_3_46_0 + ``` + +- 三方库头文件及生成的库 + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + ``` + sqlite_3_46_0/arm64-v8a sqlite_3_46_0/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的头文件拷贝到该目录下,将编译生成的三方库以及依赖库全部(动态库名字带版本号和不带版本号的都需要)拷贝到工程的libs目录下,如下图所示: + + + ![thirdparty_install_dir](pic/sqlite_install_dir.jpg) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + ```cmake + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/libsqlite.so) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/sqlite/${OHOS_ARCH}/include) + ``` +## 测试三方库 +三方库的测试使用原库自带的测试用例来做测试,[准备三方库测试环境](../../../lycium/README.md#3ci环境准备) + +进入到构建目录执行make fuzztest运行测试用例(arm64-v8a-build为构建64位的目录,armeabi-v7a-build为构建32位的目录) + + ![sqlite_test](pic/sqlite_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/community/sqlite_3_46_0/docs/pic/sqlite_install_dir.jpg b/community/sqlite_3_46_0/docs/pic/sqlite_install_dir.jpg new file mode 100644 index 0000000000000000000000000000000000000000..b27e3d9c44b2c87c22bd6725d2c09adcbb1b23c2 Binary files /dev/null and b/community/sqlite_3_46_0/docs/pic/sqlite_install_dir.jpg differ diff --git a/community/sqlite_3_46_0/docs/pic/sqlite_test.jpg b/community/sqlite_3_46_0/docs/pic/sqlite_test.jpg new file mode 100644 index 0000000000000000000000000000000000000000..7815bf2550565bde677aa22664eacafe30987759 Binary files /dev/null and b/community/sqlite_3_46_0/docs/pic/sqlite_test.jpg differ diff --git a/community/sqlite_3_46_0/sqlite-3.46.0_oh_pkg.patch b/community/sqlite_3_46_0/sqlite-3.46.0_oh_pkg.patch new file mode 100644 index 0000000000000000000000000000000000000000..ac05c5241d41a59e2ccec21069b46648862e4bbc --- /dev/null +++ b/community/sqlite_3_46_0/sqlite-3.46.0_oh_pkg.patch @@ -0,0 +1,12 @@ +diff -Naur sqlite-release/Makefile.in sqlite-release-patch/Makefile.in +--- sqlite-release/Makefile.in 2023-03-22 19:56:21.000000000 +0800 ++++ sqlite-release-patch/Makefile.in 2023-04-06 10:29:32.362598708 +0800 +@@ -646,7 +646,7 @@ + + libtclsqlite3.la: tclsqlite.lo libsqlite3.la + $(LTLINK) -no-undefined -o $@ tclsqlite.lo \ +- libsqlite3.la @TCL_STUB_LIB_SPEC@ $(TLIBS) \ ++ libsqlite3.la -L"$(TCLLIBDIR)" $(TLIBS) \ + -rpath "$(TCLLIBDIR)" \ + -version-info "8:6:8" \ + -avoid-version diff --git a/community/sqliteodbc/HPKBUILD b/community/sqliteodbc/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..ed21a70a8fe0edcdb5c55a8ccaa8c88d3f08ae4f --- /dev/null +++ b/community/sqliteodbc/HPKBUILD @@ -0,0 +1,92 @@ +# Contributor: TangShaoteng +# Maintainer: TangShaoteng +pkgname=sqliteodbc +pkgver=0.9998 +pkgrel=0 +pkgdesc="SQLite Database Engine provides a lightweight C library to access database files" +url="http://www.ch-werner.de/sqliteodbc" +archs=("armeabi-v7a" "arm64-v8a") +license=("BSD") +depends=("sqlite" "unixODBC" "libxml2") +makedepends=("wget") + +# 请保持网络通畅 +source="http://www.ch-werner.de/$pkgname/$pkgname-$pkgver.tar.gz" + +autounpack=true +downloadpackage=true +buildtools="configure" +downloadconfigflag=true + +builddir=$pkgname-${pkgver} +packagename=$builddir.tar.gz + +source envset.sh +host= + +prepare() { + if [ $downloadconfigflag == true ];then + # 获取最新的config.sub和config.guess以支持aarch64架构编译 + wget -O $builddir/config.sub "git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD" > $builddir/build.log 2>&1 + ret=$? + if [ $ret -ne 0 ] + then + return -1 + fi + wget -O $builddir/config.guess "git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD" >> $builddir/build.log 2>&1 + ret=$? + if [ $ret -ne 0 ] + then + return -1 + fi + downloadconfigflag=false + fi + cp -arf $builddir $builddir-$ARCH-build + if [ $ARCH == "armeabi-v7a" ] + then + setarm32ENV + host=arm-linux + fi + if [ $ARCH == "arm64-v8a" ] + then + setarm64ENV + host=aarch64-linux + fi + export CFLAGS="${CFLAGS} -L$LYCIUM_ROOT/usr/xz/$ARCH/lib" +} + +build() { + cd $builddir-$ARCH-build + ./configure "$@" --host=$host --with-sqlite3=$LYCIUM_ROOT/usr/sqlite/$ARCH --with-odbc=$LYCIUM_ROOT/usr/unixODBC/$ARCH --with-libxml2=$LYCIUM_ROOT/usr/libxml2/$ARCH/bin/xml2-config >> `pwd`/build.log 2>&1 + make -j4 >> `pwd`/build.log 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir-$ARCH-build + # 此库的安装目录需要手动创建 + mkdir -p $LYCIUM_ROOT/usr/$pkgname/$ARCH/lib + # 安装sqlite3驱动 + make install >> `pwd`/build.log 2>&1 + cd $OLDPWD + if [ $ARCH == "armeabi-v7a" ] + then + unsetarm32ENV + fi + if [ $ARCH == "arm64-v8a" ] + then + unsetarm64ENV + fi + unset host +} + +check() { + echo "The test must be on an OpenHarmony device!" +} + +# 清理环境 +cleanbuild(){ + rm -rf ${PWD}/$builddir ${PWD}/$builddir-${archs[0]}-build ${PWD}/$builddir-${archs[1]}-build +} diff --git a/community/sqliteodbc/HPKCHECK b/community/sqliteodbc/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..834e85715558860b91ebaff7f6434794efdc24c0 --- /dev/null +++ b/community/sqliteodbc/HPKCHECK @@ -0,0 +1,20 @@ +# Contributor: tangshaoteng +# Maintainer: tangshaoteng + +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 + driver_config=`${LYCIUM_ROOT}/usr/unixODBC/${ARCH}/bin/odbcinst -j | grep DRIVERS | awk '{print $2}'` + data_source_config=`${LYCIUM_ROOT}/usr/unixODBC/${ARCH}/bin/odbcinst -j | grep SYSTEM | awk '{print $4}'` + driver_lib=${LYCIUM_ROOT}/usr/sqliteodbc/${ARCH}/lib/libsqlite3odbc.so + echo -e "[SQL3]\nDescription = unixODBC for sqlite3\nDriver = $driver_lib\nSetup = $driver_lib\nFileUsage=1" > $driver_config + echo -e "[myDB]\nDriver = SQL3" > $data_source_config + echo -e "quit" | ${LYCIUM_ROOT}/usr/unixODBC/${ARCH}/bin/isql -v myDB > ${logfile} 2>&1 + res=$? + cd $OLDPWD + + return $res +} diff --git a/community/sqliteodbc/OAT.xml b/community/sqliteodbc/OAT.xml new file mode 100644 index 0000000000000000000000000000000000000000..96937ea08644b79312d0ced7c0b3eb1e845108ee --- /dev/null +++ b/community/sqliteodbc/OAT.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/community/sqliteodbc/README.OpenSource b/community/sqliteodbc/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..9efd0aa554d85a1c04a5c9d022ac869203963147 --- /dev/null +++ b/community/sqliteodbc/README.OpenSource @@ -0,0 +1,38 @@ +[ + { + "Name": "sqliteodbc", + "License": "BSD", + "License File": "http://www.ch-werner.de/sqliteodbc/license.terms", + "Version Number": "0.9998", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "http://www.ch-werner.de/sqliteodbc/sqliteodbc-0.9998.tar.gz", + "Description": "SQLite Database Engine provides a lightweight C library to access database files." + }, + { + "Name": "sqlite", + "License": "Public Domain", + "License File": "https://www.sqlite.org/copyright.html", + "Version Number": "version-3.42.0", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://github.com/sqlite/sqlite/archive/refs/tags/.tar.gz", + "Description": "This repository contains the complete source code for the SQLite database engine. Some test scripts are also included. However, many other test scripts and most of the documentation are managed separately." + }, + { + "Name": "unixODBC", + "License": "LGPL-2.1", + "License File": "https://github.com/lurcher/unixODBC/blob/master/LICENSE", + "Version Number": "2.3.11", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://github.com/lurcher/unixODBC/releases/download/2.3.11/unixODBC-2.3.11.tar.gz", + "Description": "The unixODBC Project goals are to develop and promote unixODBC to be the definitive standard for ODBC on non MS Windows platforms." + }, + { + "Name": "libxml2", + "License": " MIT", + "License File": "https://github.com/GNOME/libxml2/blob/master/Copyright", + "Version Number": "v2.11.3", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://github.com/GNOME/libxml2/archive/refs/tags/v2.11.3.tar.gz", + "Description": "libxml2 is an XML toolkit implemented in C, originally developed for the GNOME Project." + } +] diff --git a/community/sqliteodbc/README_zh.md b/community/sqliteodbc/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..ad048b3e29169f4c74812f2f501adc391c54dc94 --- /dev/null +++ b/community/sqliteodbc/README_zh.md @@ -0,0 +1,12 @@ +# sqliteodbc三方库说明 +## 功能简介 +sqliteodbc是基于SQLite数据库的ODBC驱动程序 + +## 三方库版本 +- 0.9998 + +## 使用约束 +- [IDE和SDK版本](../../docs/constraint.md) + +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) diff --git a/community/sqliteodbc/SHA512SUM b/community/sqliteodbc/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..00ddbadb4d56b9c5fab6a691879fafd74a2799bc --- /dev/null +++ b/community/sqliteodbc/SHA512SUM @@ -0,0 +1 @@ +6c36cee09a7c300dd81fd70e51e84f0e93f1178393780aae5e982e5af16af7f3abc9dd39d1bdcfa49fb2fc3db3b22331e0019eac4f383da57a21ee4d2057d71f sqliteodbc-0.9998.tar.gz diff --git a/community/sqliteodbc/docs/hap_integrate.md b/community/sqliteodbc/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..b64af934702f4d3d8aac9a18c1393c5ab7d1f453 --- /dev/null +++ b/community/sqliteodbc/docs/hap_integrate.md @@ -0,0 +1,80 @@ +# sqliteodbc集成到应用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) +## 编译三方库 +- 下载本仓库 + ``` + git clone https://gitee.com/openharmony-sig/tpc_c_cplusplus.git --depth=1 + ``` + +- 三方库目录结构 + ``` + tpc_c_cplusplus/thirdparty/sqliteodbc #三方库sqliteodbc的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md + ``` + +- 在lycium目录下编译三方库 + sqliteodbc库依赖sqlite、unixODBC、libxml2、tcl、xz、zlib这6个库,所以在build时需要将依赖库一起编译进来。 + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + ``` + cd lycium + ./build.sh sqliteodbc sqlite unixODBC libxml2 tcl xz zlib + ``` + +- 三方库头文件及生成的库 + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + ``` + sqliteodbc/arm64-v8a sqliteodbc/armeabi-v7a + sqlite/arm64-v8a sqlite/armeabi-v7a + unixODBC/arm64-v8a unixODBC/armeabi-v7a + libxml2/arm64-v8a libxml2/armeabi-v7a + tcl/arm64-v8a tcl/armeabi-v7a + xz/arm64-v8a xz/armeabi-v7a + zlib/arm64-v8a zlib/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的库拷贝到该目录下,如下图所示 + ![thirdparty_install_dir](pic/sqliteodbc_install_dir.png) +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + ``` + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/sqliteodbc/${OHOS_ARCH}/lib/libsqlite3odbc-0.9998.so) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/unixODBC/${OHOS_ARCH}/include) + ``` +## 测试三方库 +sqliteodbc三方库的测试使用unixODBC库中的isql命令来做测试,步骤如下: + +- 填写unixODBC安装目录下面的etc目录下的配置文件odbcinst.ini,其中Driver和Setup需要根据libsqlite3odbc.so实际路径填写(armeabi-v7a为安装32位的目录,arm64-v8a为安装64位的目录),以下经供参考 +```shell +[SQL3] +Description = unixODBC for sqlite3 +Driver = /data/local/tmp/lycium/usr/sqliteodbc/armeabi-v7a/lib/libsqlite3odbc.so +Setup =/data/local/tmp/lycium/usr/sqliteodbc/armeabi-v7a/lib/libsqlite3odbc.so +FileUsage = 1 +``` +- 填写unixODBC安装目录下面的etc目录下的配置文件odbc.ini +```shell +[myDB] +Driver = SQL3 +``` +- 进入到unixODBC安装目录下面的bin目录执行命令./isql -v myDB,运行测试(usr/unixODBC/arm64-v8a为安装64位的目录,usr/unixODBC/armeabi-v7a为安装32位的目录) + + ![sqliteodbc_test_result](pic/sqliteodbc_test_result.png) + +测试结果显示Connected!即表示已经连接上sqlite数据库,测试成功! + +## 参考资料 +- [润和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/community/sqliteodbc/docs/pic/sqliteodbc_install_dir.png b/community/sqliteodbc/docs/pic/sqliteodbc_install_dir.png new file mode 100644 index 0000000000000000000000000000000000000000..75c20c5e23846ca81fab1f85c323a9716716c15d Binary files /dev/null and b/community/sqliteodbc/docs/pic/sqliteodbc_install_dir.png differ diff --git a/community/sqliteodbc/docs/pic/sqliteodbc_test_result.png b/community/sqliteodbc/docs/pic/sqliteodbc_test_result.png new file mode 100644 index 0000000000000000000000000000000000000000..8066e8305c6a8d41f49e6892d1dd32c136a3b75b Binary files /dev/null and b/community/sqliteodbc/docs/pic/sqliteodbc_test_result.png differ diff --git a/community/sqliteodbc/docs/pic/sqliteodbc_usage.png b/community/sqliteodbc/docs/pic/sqliteodbc_usage.png new file mode 100644 index 0000000000000000000000000000000000000000..c77b8deb19d9e6eacdb2374c6137e0c5c39a8057 Binary files /dev/null and b/community/sqliteodbc/docs/pic/sqliteodbc_usage.png differ diff --git a/community/squirrel/HPKBUILD b/community/squirrel/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..49018ddc56d935999a9903cfa54aff31a52be797 --- /dev/null +++ b/community/squirrel/HPKBUILD @@ -0,0 +1,63 @@ +# 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<2942375747@qq.com> , wangying +# Maintainer: wangyihao<2471389@stu.neu.edu.cn>, wangjialun<2271411@stu.neu.edu.cn>, zhangqian<2371418@stu.neu.edu.cn>, wangying + +pkgname=squirrel +pkgver=v3.2 +pkgrel=0 +pkgdesc="Squirrel is a lightweight programming language commonly used for game development and application scripting,which is simpler and easier to embed into applications than C." +url="https://github.com/albertodemichelis/squirrel/tree/v3.2" +archs=("armeabi-v7a" "arm64-v8a") +license=("MIT license") +depends=() +makedepends=() +source="https://github.com/albertodemichelis/squirrel/archive/refs/tags/v3.2.zip" + +downloadpackage=true +autounpack=true +buildtools=cmake + +builddir=squirrel-3.2 +packagename=squirrel-v3.2.zip + +prepare() { + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" -DCMAKE_C_FLAGS="-Wno-unused-command-line-argument" \ + -DCMAKE_CXX_FLAGS="-Wno-unused-command-line-argument" -B$ARCH-build -S./ > $buildlog 2>&1 + $MAKE VERBOSE=1 -C $ARCH-build >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + $MAKE -C $ARCH-build install >> $buildlog 2>&1 + cd $OLDPWD +} + + +check() { + echo "The test must be on an OpenHarmony device!" +} + + +cleanbuild() { + rm -rf ${PWD}/$builddir +} \ No newline at end of file diff --git a/community/squirrel/HPKCHECK b/community/squirrel/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..812f3de83baf93ec821b74d6cd155c61c4ff2bfd --- /dev/null +++ b/community/squirrel/HPKCHECK @@ -0,0 +1,49 @@ +# 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<2942375747@qq.com> , 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/bin # 进入到对应架构目录下的/bin目录,里面放置了sq二进制文件 + # 该库没有测试用例,因此执行一个demo:该库根目录下sample文件夹里放有符合squirrel语法的.nut文件,执行一个名为hello的.nut文件,输出结果为:Hello World! + ./sq ../../samples/hello.nut > $logfile 2>&1 + res=$? + # 检查是否有输出 + if [ -s $logfile ]; then + # 检查日志文件中是否包含 "Hello World!" + if grep -q "Hello World!" $logfile; then + echo "Test passed: 'Hello World!' found in the log." >> $logfile + else + echo "Test failed: 'Hello World!' not found in the log." >> $logfile + res=1 + fi + else + # 若无输出,则测试失败 + echo "Test failed: No output from the test." >> $logfile + res=1 + fi + + #保存测试失败日志 + if [ $res -ne 0 ]; then + mkdir -p ${LYCIUM_FAULT_PATH}/${pkgname} + cp Testing/Temporary/LastTest.log ${LYCIUM_FAULT_PATH}/${pkgname}/test_failed.log + fi + cd $OLDPWD + return $res +} \ No newline at end of file diff --git a/community/squirrel/README.OpenSource b/community/squirrel/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..9cde41c5d9b29c6dc3301e41e891f6eb341ae93c --- /dev/null +++ b/community/squirrel/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "squirrel", + "License": "MIT license", + "License File": "https://github.com/albertodemichelis/squirrel/blob/master/COPYRIGHT", + "Version Number": "v3.2", + "Owner": "2942375747.com", + "Upstream URL": "https://github.com/albertodemichelis/squirrel", + "Description": "Squirrel is a lightweight programming language commonly used for game development and application scripting,which is simpler and easier to embed into applications than C." + } +] \ No newline at end of file diff --git a/community/squirrel/README_zh.md b/community/squirrel/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..39d3a765a7828c3770eca98a0fb881808eb6ad12 --- /dev/null +++ b/community/squirrel/README_zh.md @@ -0,0 +1,9 @@ +# squirrel三方库说明 +## 功能简介 +Squirrel是一种轻量级的编程语言,通常用于游戏开发和应用程序的脚本编写,比C语言更简单,更易于嵌入到应用程序中。 +## 三方库版本: +- v3.2 +## 使用约束: +- [IDE和SDK版本](../../docs/constraint.md) +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md)s \ No newline at end of file diff --git a/community/squirrel/SHA512SUM b/community/squirrel/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..73a6687f99dbafad0ad51856c250acdaf5214858 --- /dev/null +++ b/community/squirrel/SHA512SUM @@ -0,0 +1 @@ +6cd3c27e6e26e76ead3235e11afff14dec4d35cd5bad6bda5e8457ec46143e269ed598184c01cbe5058390c36cffd506caf1edceaafc421c1e4a0e4a1afde60c squirrel-v3.2.zip \ No newline at end of file diff --git a/community/squirrel/docs/hap_integrate.md b/community/squirrel/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..6797a3db134e1d3432a51ee6b1d19d35240473c0 --- /dev/null +++ b/community/squirrel/docs/hap_integrate.md @@ -0,0 +1,78 @@ +# squirrel 集成到应用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/squirrel #三方库squirrel的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── HPKCHECK #测试脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md #三方库简介 + ``` + +- 在lycium目录下编译三方库 + + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ```shell + cd lycium + ./build.sh squirrel + ``` + +- 三方库头文件及生成的库 + + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ```shell + squirrel/arm64-v8a squirrel/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的头文件和库文件拷贝到该目录下,将编译生成的动态库(动态库名字带版本号和不带版本号的都需要)拷贝到工程的libs目录下,如下图所示: +   + +  ![thirdparty_install_dir](pic/squirrel_install_dir.png) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + + ```shell + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/squirrel/${OHOS_ARCH}/lib/libsquirrel.so) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/squirrel/${OHOS_ARCH}/include) + ``` + +## 测试三方库 +- 编译出可执行的文件,使用原库自带的测试用例来做测试。但本库没有测试用例,改为执行一个demo [准备三方库测试环境](../../../lycium/README.md#3ci环境准备) +- 进入到构建目录下的bin目录,运行demo(注意arm64-v8a为构建64位的目录,armeabi-v7a为构建32位的目录)。该库根目录下sample文件夹里放有符合squirrel语法的.nut文件,执行一个名为hello的.nut文件,输出结果应为:Hello World! + 执行结果如图所示: +```shell + cd /data/tpc_c_cplusplus/thirdparty/squirrel-3.2/squirrel-3.2/arm64-v8a-build/bin + ./sq ../../samples/hello.nut +``` + ![squirrel_test](pic/squirrel_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/community/squirrel/docs/pic/squirrel_install_dir.png b/community/squirrel/docs/pic/squirrel_install_dir.png new file mode 100644 index 0000000000000000000000000000000000000000..7ac40298eb26ea00e6ca1caa90ca9d8f014d7b8e Binary files /dev/null and b/community/squirrel/docs/pic/squirrel_install_dir.png differ diff --git a/community/squirrel/docs/pic/squirrel_test.png b/community/squirrel/docs/pic/squirrel_test.png new file mode 100644 index 0000000000000000000000000000000000000000..eb68dede8d73a653cde1f4063fd377ac0916e93d Binary files /dev/null and b/community/squirrel/docs/pic/squirrel_test.png differ diff --git a/community/szip/HPKBUILD b/community/szip/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..44177d779b4218e1b464d6f4b2e147c2882c711f --- /dev/null +++ b/community/szip/HPKBUILD @@ -0,0 +1,53 @@ +# Contributor: huangminzhong +# Maintainer: huangminzhong +pkgname=szip +pkgver=2.1.1 +pkgrel=0 +pkgdesc="Szip compression software, providing lossless compression of scientific data, has been provided with HDF software products as of HDF5 Release 1.6.0 and HDF4 Release 2.0." +url="https://support.hdfgroup.org/doc_resource/SZIP" +archs=("armeabi-v7a" "arm64-v8a") +license=("szip license") +depends=() +makedepends=() +source="https://support.hdfgroup.org/ftp/lib-external/$pkgname/$pkgver/src/$pkgname-$pkgver.tar.gz" +downloadpackage=true +autounpack=true + +builddir=$pkgname-$pkgver +packagename=$builddir.tar.gz + +prepare() { + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + # 该库直接交叉编译会失败,提示部分变量必须配置成"advanced" + PKG_CONFIG_LIBDIR="${pkgconfigpath}" \ + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" \ + -DOHOS_ARCH=$ARCH -B$ARCH-build -DBUILD_TESTING=ON \ + -DHAVE_DEFAULT_SOURCE_RUN="advanced" -DHAVE_DEFAULT_SOURCE_RUN__TRYRUN_OUTPUT="advanced" \ + -DTEST_LFS_WORKS_RUN="advanced" -DTEST_LFS_WORKS_RUN__TRYRUN_OUTPUT="advanced" -S./ -L > $buildlog 2>&1 + $MAKE -C $ARCH-build VERBOSE=1 >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd "$builddir" + $MAKE -C $ARCH-build install >> $buildlog 2>&1 + cd $OLDPWD + cd $LYCIUM_ROOT/usr/$pkgname/$ARCH/lib + ln -s libszip.a libsz.a + cd $OLDPWD +} + +check() { + echo "The test must be on an OpenHarmony device!" + # ctest +} + +cleanbuild(){ + rm -rf ${PWD}/$builddir # ${PWD}/$packagename +} diff --git a/community/szip/SHA512SUM b/community/szip/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..1015e775129bbdb4364e63fe3ad7af617cf19c9a --- /dev/null +++ b/community/szip/SHA512SUM @@ -0,0 +1 @@ +ada6406efb096cd8a2daf8f9217fe9111a96dcae87e29d1c31f58ddd2ad2aa7bac03f23c7205dc9360f3b62d259461759330c7189ef0c2fe559704b1ea9d40dd szip-2.1.1.tar.gz \ No newline at end of file diff --git a/community/tcl/HPKBUILD b/community/tcl/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..d5817316bb750b71988fcd85ae5c5c971389a612 --- /dev/null +++ b/community/tcl/HPKBUILD @@ -0,0 +1,84 @@ +# Contributor: wupingyuan +# Maintainer: wupingyuan +pkgname=tcl +pkgver=8.6.13 +pkgrel=0 +pkgdesc="Tool Command Language (Tcl) is an interpreted language and very portable interpreter for that language. Tcl is embeddable and extensible, and has been widely used since its creation in 1988 by John Ousterhout." +url="https://sourceforge.net/projects/tcl/" +archs=("armeabi-v7a" "arm64-v8a") +license=("TCL/TK License") +depends=(zlib_1_3_1) +makedepends=() +source="https://sourceforge.net/projects/$pkgname/files/Tcl/$pkgver/$pkgname$pkgver-src.tar.gz" + +autounpack=true +downloadpackage=true +buildtools="configure" +builddir=$pkgname$pkgver +packagename=$builddir.src.tar.gz +source envset.sh +host= + +cv_sys_osname= +sed_flag=true + +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() { + if [ "$LYCIUM_BUILD_OS" == "Darwi" ] && [ "$sed_flag" == "true" ] + then + cd $builddir + #因编译链之间差异,禁止configure主动添加Darwin环境的编译选项 + for file in $(find . -name "configure");do + sed -i.bak 's|Darwin|ShieldDarwin|g' $file + done + cd $OLDPWD + sed_flag=false + cv_sys_osname=Linux + fi + cd $builddir/$ARCH-build + ../unix/configure "$@" --host=$host tcl_cv_sys_version=$cv_sys_osname > $buildlog 2>&1 + $MAKE >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir/$ARCH-build + $MAKE install >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + if [ $ARCH == "armeabi-v7a" ] + then + unsetarm32ENV + fi + if [ $ARCH == "arm64-v8a" ] + then + unsetarm64ENV + fi + unset host + return $ret +} + +check() { + echo "The test must be on an OpenHarmony device!" + # 在OpenHarmony开发板中执行用例 + # make test +} + +cleanbuild(){ + rm -rf ${PWD}/$builddir #${PWD}/$packageName +} diff --git a/community/tcl/README.OpenSource b/community/tcl/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..1751c36c438ab3b33ce7707f16896dda86398f08 --- /dev/null +++ b/community/tcl/README.OpenSource @@ -0,0 +1,20 @@ +[ + { + "Name": "tcl", + "License": "TCL/TK License", + "License File": "https://www.tcl.tk/software/tcltk/license.html", + "Version Number": "8.6.13", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://sourceforge.net/projects/tcl/files/Tcl/8.6.13/tcl8.6.13-src.tar.gz", + "Description": "Tool Command Language (Tcl) is an interpreted language and very portable interpreter for that language. Tcl is embeddable and extensible, and has been widely used since its creation in 1988 by John Ousterhout." + }, + { + "Name": "bzip2_1_0_8", + "License": "bzip2-1.0.6", + "License File": "https://sourceforge.net/p/bzip2/bzip2/ci/bzip2-1_0_6/tree/LICENSE", + "Version Number": "1.0.8", + "Owner": "huangminzhong2@huawei.com", + "Upstream URL": "https://sourceware.org/git/bzip2", + "Description": "bzip2 is a freely available, patent free (see below), high-quality data compressor. It typically compresses files to within 10% to 15% of the best available techniques (the PPM family of statistical compressors), whilst being around twice as fast at compression and six times faster at decompression." + } +] diff --git a/community/tcl/README_zh.md b/community/tcl/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..654f70cf0264a608b669c6ec0c920b62cea8b6bf --- /dev/null +++ b/community/tcl/README_zh.md @@ -0,0 +1,15 @@ +# tcl三方库说明 +## 功能简介 +tcl是一种解释语言,也是该语言的一种非常便携的解释器。 + +## 三方库版本 +- 8.6.13 + +## 已适配功能 +- 支持tcl解释器 + +## 使用约束 +- [IDE和SDK版本](../../docs/constraint.md) + +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) diff --git a/community/tcl/SHA512SUM b/community/tcl/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..99844322967785e3dfb2ef4b2cbcb6d4b5326cd5 --- /dev/null +++ b/community/tcl/SHA512SUM @@ -0,0 +1 @@ +b597f6b62fd71457e96445401a4f8aa662c2678de8a52127c60b0abddebf1fd4452ba5364420902a15b263c0118fc91167550fd1ad2d24fa4ab2204e372c027e tcl8.6.13.src.tar.gz \ No newline at end of file diff --git a/community/tcl/docs/hap_integrate.md b/community/tcl/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..61bdb8e2ab3a473279e793921b225ea8f61dcaed --- /dev/null +++ b/community/tcl/docs/hap_integrate.md @@ -0,0 +1,72 @@ +# tcl集成到应用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) +## 编译三方库 +- 下载本仓库 + ``` + git clone https://gitee.com/openharmony-sig/tpc_c_cplusplus.git --depth=1 + ``` + +- 三方库目录结构 + ``` + tpc_c_cplusplus/thirdparty/tcl #三方库tcl的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md + ``` + +- 编译三方库 + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ``` + ./lycium/build.sh tcl + ``` + +- 三方库头文件及生成的库 + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + ``` + tcl/arm64-v8a tcl/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 拷贝动态库到`\\entry\libs\${OHOS_ARCH}\`目录: + 动态库需要在`\\entry\libs\${OHOS_ARCH}\`目录,才能集成到hap包中,所以需要将对应的so文件拷贝到对应CPU架构的目录 + + ![thirdparty_install_dir](pic/tcl_install_dir_1.jpg) + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的库拷贝到该目录下,如下图所示 + + ![thirdparty_install_dir](pic/tcl_install_dir_2.jpg) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + ``` + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/libtcl8.6.so) + target_link_libraries(entry PRIVATE ${CMAKE_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/libsqlite3.40.0.so) + target_link_libraries(entry PRIVATE ${CMAKE_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/libitcl4.2.3.so) + target_link_libraries(entry PRIVATE ${CMAKE_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/libtdbc1.1.5.so) + target_link_libraries(entry PRIVATE ${CMAKE_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/libtdbcmysql1.1.5.so) + target_link_libraries(entry PRIVATE ${CMAKE_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/libtdbcodbc1.1.5.so) + target_link_libraries(entry PRIVATE ${CMAKE_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/libtdbcpostgres1.1.5.so) + target_link_libraries(entry PRIVATE ${CMAKE_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/libthread2.8.8.so) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/tcl/${OHOS_ARCH}/include) + ``` +## 测试三方库 +三方库的测试使用原库自带的测试用例来做测试,[准备三方库测试环境](../../../lycium/README.md#3ci环境准备) + +进入到构建目录执行make test-tcl运行测试用例(arm64-v8a-build为构建64位的目录,armeabi-v7a-build为构建32位的目录)(备注:需要联网测试,其中unixInit.test和thread.test没过,unixInit.test是因为用例需要匹配查找iso8859-15|utf-8编码,而ohos中查找到的是ascii编码因此没有通过。thread.test是因为pthread_join()接口在多次调用后,threadId在用例中会有重复的现象,ohos的多线程pthread_join()没有做校验处理,导致失败) + + ![tcl_test](pic/tcl_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/community/tcl/docs/pic/tcl_install_dir_1.jpg b/community/tcl/docs/pic/tcl_install_dir_1.jpg new file mode 100644 index 0000000000000000000000000000000000000000..c96e6b1dd91d649853677efa15a5a6c468c7e92f Binary files /dev/null and b/community/tcl/docs/pic/tcl_install_dir_1.jpg differ diff --git a/community/tcl/docs/pic/tcl_install_dir_2.jpg b/community/tcl/docs/pic/tcl_install_dir_2.jpg new file mode 100644 index 0000000000000000000000000000000000000000..5eecf9e91cea23cc354f35e39feb325e5b9ceb33 Binary files /dev/null and b/community/tcl/docs/pic/tcl_install_dir_2.jpg differ diff --git a/community/tcl/docs/pic/tcl_test.jpg b/community/tcl/docs/pic/tcl_test.jpg new file mode 100644 index 0000000000000000000000000000000000000000..cf27327d19e0ff07021fffb9c095aaa34eca5c4d Binary files /dev/null and b/community/tcl/docs/pic/tcl_test.jpg differ diff --git a/community/tcl/docs/pic/tcl_usage.jpg b/community/tcl/docs/pic/tcl_usage.jpg new file mode 100644 index 0000000000000000000000000000000000000000..eb6fa055666a64697b0d7233764655b6a7dfa15b Binary files /dev/null and b/community/tcl/docs/pic/tcl_usage.jpg differ diff --git a/community/thirdparty_template/BUILD.gn b/community/thirdparty_template/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..e4f7cd101e575314b64773c134fa3b545a6023f7 --- /dev/null +++ b/community/thirdparty_template/BUILD.gn @@ -0,0 +1,12 @@ +# Copyright (c) 2022 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. \ No newline at end of file diff --git a/community/thirdparty_template/CMakeLists.txt b/community/thirdparty_template/CMakeLists.txt new file mode 100755 index 0000000000000000000000000000000000000000..7ce9dbce4c7f1e78df6419113f3f3035f4a562fd --- /dev/null +++ b/community/thirdparty_template/CMakeLists.txt @@ -0,0 +1,13 @@ +# Copyright (c) 2022 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. + diff --git a/community/thirdparty_template/HPKBUILD b/community/thirdparty_template/HPKBUILD new file mode 100755 index 0000000000000000000000000000000000000000..27f52b9dacbf90972812c6081c932d067b159860 --- /dev/null +++ b/community/thirdparty_template/HPKBUILD @@ -0,0 +1,63 @@ +# This is an example HPKBUILD file. Use this as a start to creating your own, +# and remove these comments. +# NOTE: Please fill out the license field for your package! If it is unknown, +# then please put 'unknown'. + +# Contributor: Your Name +# Maintainer: Your Name + +pkgname=NAME # 库名 +pkgver=VERSION # 库版本 +pkgrel=0 # 发布号 +pkgdesc="" # 库描述 +url="" # 官网链接 +archs=("armeabi-v7a" "arm64-v8a") # cpu 架构 +license=() +depends=() # 依赖库的目录名 必须保证被依赖的库的archs是当前库的archs的超集 +makedepends=() # 构建库时的依赖工具 +source="https://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz" # 库源码下载链接 + +downloadpackage=true # 是否自动下载压缩包,如若不写默认 true, 一些特殊情况,代码需要代码只能 git clone (项目中依赖 submoudle ) +autounpack=true # 是否自动解压,如若不写默认 true, 如果为 false 则需要用户在 prepare 函数中自行解压 +buildtools= # 编译方法, 暂时支持cmake, configure, make等, 是什么就填写什么. 如若不写默认为cmake. + +builddir= # 源码压缩包解压后目录名 编译目录名 +packageName=$builddir.tar.gz # 压缩包名 + +# 为编译设置环境,如设置环境变量,创建编译目录等 +prepare() { + cd $builddir + cd ${OLDPWD} +} + +# ${OHOS_SDK} oh sdk安装路径 +# $ARCH 编译的架构是 archs 的遍历 +# $LYCIUM_ROOT/usr/$pkgname-$ARCH-install 安装到顶层目录的usr/$pkgname-$ARCH-install +# 执行编译构建的命令 +build() { + # 如果是cmake构建 $*=-DCMAKE_FIND_ROOT_PATH="..." -DCMAKE_TOOLCHAIN_FILE="..." -DCMAKE_INSTALL_PREFIX="..." 依赖库的搜索路径,toolchain file 路径,安装路径 + cd $builddir + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake $* -DOHOS_ARCH=$ARCH -B$ARCH-build -S./ -L + make -j4 -C $ARCH-build + # 对最关键一步的退出码进行判断 + ret=$? + cd $OLDPWD + return $ret +} + +# 打包安装 +package() { + cd $builddir + make -C $ARCH-build install + cd $OLDPWD +} + +# 进行测试的准备和说明 +check() { + echo "The test must be on an OpenHarmony device!" +} + +# 清理环境 +cleanbuild(){ + rm -rf ${PWD}/$builddir #${PWD}/$packageName +} diff --git a/community/thirdparty_template/README.OpenSource b/community/thirdparty_template/README.OpenSource new file mode 100755 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/community/thirdparty_template/README_zh.md b/community/thirdparty_template/README_zh.md new file mode 100755 index 0000000000000000000000000000000000000000..ed9c9f4bf3e426ebc7386476721ac6d016452782 --- /dev/null +++ b/community/thirdparty_template/README_zh.md @@ -0,0 +1,18 @@ +# XXX三方库说明 + +## 功能简介 + +这个是xxx, 主要功能是xxx,简单的一句话介绍 + +## 使用约束 + +- IDE版本: +- ROM版本: +- API版本: +- 三方库版本: +- 当前适配的功能:完成了xxx功能的适配 + +## 集成方式 + +- [系统rom包集成](./docs/rom_integrate.md) +- [应用hap包集成](./docs/hap_integrate.md) diff --git a/community/thirdparty_template/SHA512SUM b/community/thirdparty_template/SHA512SUM new file mode 100755 index 0000000000000000000000000000000000000000..16934b8ade854efc82ab0f345c775c159d85aa68 --- /dev/null +++ b/community/thirdparty_template/SHA512SUM @@ -0,0 +1 @@ +*************************************************************************************** xxx.tar.gz \ No newline at end of file diff --git a/community/thirdparty_template/adapted/config.h b/community/thirdparty_template/adapted/config.h new file mode 100755 index 0000000000000000000000000000000000000000..0b61b0d71df2c83ad10b63c9f3e8ef9d2c323d6f --- /dev/null +++ b/community/thirdparty_template/adapted/config.h @@ -0,0 +1,19 @@ +/* +# Copyright (c) 2022 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. +*/ +#ifndef _CONFIG_H_ +#define _CONFIG_H_ + + +#endif \ No newline at end of file diff --git a/community/thirdparty_template/bundle.json b/community/thirdparty_template/bundle.json new file mode 100755 index 0000000000000000000000000000000000000000..b10c45b9e522fd6fb74e81102ef68b72f8834720 --- /dev/null +++ b/community/thirdparty_template/bundle.json @@ -0,0 +1,30 @@ +{ + "name": "", + "description": "", + "version": "", + "license": "", + "publishAs": "", + "segment": { + "destPath": "" + }, + "dirs": {}, + "scripts": {}, + "component": { + "name": "", + "subsystem": "thirdparty", + "syscap": [], + "features": [], + "adapted_system_type": [], + "rom": "", + "ram": "", + "deps": { + "components": [], + "third_party": [] + }, + "build": { + "sub_component": [], + "inner_kits": [], + "test": [] + } + } +} diff --git a/community/thirdparty_template/docs/hap_integrate.md b/community/thirdparty_template/docs/hap_integrate.md new file mode 100755 index 0000000000000000000000000000000000000000..ef4da8377346fb1a9c44a3ca61d98bf25fd392fa --- /dev/null +++ b/community/thirdparty_template/docs/hap_integrate.md @@ -0,0 +1,35 @@ +# xxx如何集成到应用hap + +## 准备应用工程 + +简要说明开发工具SDK版本和开发板运行平台 + +### 准备应用开发环境 + +介绍应用开发环境的准备 + +### 增加构建脚本及配置文件 + +介绍如何增加构建脚本及配置文件 + +### 准备三方库源码 + +介绍三方库源码的获取 + +## 应用中使用三方库 + +介绍如何在应用中使用三方库 + +## 编译工程 + +介绍如何签名,编译成hap包 + +## 运行效果 + +展示三方库在设备上运行的效果,可以贴效果图 + +## 参考资料 + +- [本文档涉及的技术补充说明](hap_integrate.md) +- [本文档引用的相关参考](hap_integrate.md) +- [相关案例参考](hap_integrate.md) diff --git a/community/thirdparty_template/docs/hap_integrate_template.md b/community/thirdparty_template/docs/hap_integrate_template.md new file mode 100755 index 0000000000000000000000000000000000000000..53f1894b60d4c80e6b758a2634b2e15e7f0c71a0 --- /dev/null +++ b/community/thirdparty_template/docs/hap_integrate_template.md @@ -0,0 +1,124 @@ +# xxx如何集成到应用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) +- [准备三方库构建环境](../../../lycium/README.md#1编译环境准备) +- [准备三方库测试环境](../../../lycium/README.md#3ci环境准备) + +## 编译三方库 + +- 下载本仓库 + + ```shell + git clone https://gitee.com/openharmony-sig/tpc_c_cplusplus.git --depth=1 + ``` + +- 三方库目录结构 + + ```shell + tpc_c_cplusplus/thirdparty/xxx #三方库xxx的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md + ``` + +- 将xxx拷贝至lycium/main目录下 + + ```shell + cd tpc_c_cplusplus + cp thirdparty/xxx lycium/main -rf + ``` + +- 在lycium目录下编译三方库 + + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ```shell + cd lycium + ./build.sh xxx ### xxx是对应的三方库名 + ``` + +- 三方库头文件及生成的库 + + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ```shell + xxx/arm64-v8a xxx/armeabi-v7a ### xxx是对应的三方库名 + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +### 静态库的使用 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的库拷贝到该目录下,如下图所示: + +  ![thirdparty_install_dir](pic/xxx_install_dir.png) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句: + + ```shell + #将三方库加入工程中,xxx是对应的三方库名 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/xxx/${OHOS_ARCH}/lib/libxxx.a) + #将三方库的头文件加入工程中,xxx是对应的三方库名 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/xxx/${OHOS_ARCH}/include) + ``` + + ![xxx_usage](pic/xxx_usage.png) + +### 动态库的使用 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的库拷贝到该目录下,如下图所示: + +  ![thirdparty_install_dir](pic/xxx_install_dir.png) + +- 拷贝动态库到`\\entry\libs\${OHOS_ARCH}\`目录: + + 动态库需要在`\\entry\libs\${OHOS_ARCH}\`目录,才能集成到hap包中,所以需要将对应的so文件拷贝到对应CPU架构的目录: + +  ![thirdparty_install_dir](pic/xxx_install_dir1.png) + + 动态库说明:
+ 此动态库不能是带有版本号(libxxx.so.0.1),通过编译生成的就是libxxx.so,如果生成的so带版本号,可以通过命令进行修改: + + ```shell + patchelf --set-soname libxxx.so libxxx.so.0.1 ## 将原库中的soname改成不带版本号的。libxxx.so是修改后的名字,libxxx.so.0.1原带版本号的库名 + mv libxxx.so.0.1 libxxx.so ## 修改库名字 + ``` + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句: + + ```shell + #将三方库加入工程中,xxx是对应的三方库名 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/xxx/${OHOS_ARCH}/lib/libxxx.so) + #将三方库的头文件加入工程中,xxx是对应的三方库名 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/xxx/${OHOS_ARCH}/include) + ``` + + ![xxx_usage](pic/xxx_usage1.png) + +## 测试三方库 + +三方库的测试使用原库自带的测试用例来做测试,[准备三方库测试环境](../../../lycium/README.md#3ci环境准备) + +进入到构建目录执行 对应的测试命令(在[HPKBUILD](../HPKBUILD)文件中的check()函数中有说明) 运行测试用例(arm64-v8a-build为构建64位的目录,armeabi-v7a-build为构建32位的目录), +如`tinyxpath`三方库的测试结果: + + ![hunspell_test](../../tinyxpath/docs/pic/tinyxpath_test.png) + +## 参考资料 + +- [本文档涉及的技术补充说明](hap_integrate.md) +- [本文档引用的相关参考](hap_integrate.md) +- [相关案例参考](hap_integrate.md) diff --git a/community/thirdparty_template/docs/pic/xxx_install_dir.png b/community/thirdparty_template/docs/pic/xxx_install_dir.png new file mode 100755 index 0000000000000000000000000000000000000000..65761f27846076fa4c324f6b95600bd7a4025243 Binary files /dev/null and b/community/thirdparty_template/docs/pic/xxx_install_dir.png differ diff --git a/community/thirdparty_template/docs/pic/xxx_install_dir1.png b/community/thirdparty_template/docs/pic/xxx_install_dir1.png new file mode 100755 index 0000000000000000000000000000000000000000..01aa37e7934912863d451e62431fafa7f4721dd2 Binary files /dev/null and b/community/thirdparty_template/docs/pic/xxx_install_dir1.png differ diff --git a/community/thirdparty_template/docs/pic/xxx_usage.png b/community/thirdparty_template/docs/pic/xxx_usage.png new file mode 100755 index 0000000000000000000000000000000000000000..e9475f3a3b3e938196779f9ea2751d7a1fc845fe Binary files /dev/null and b/community/thirdparty_template/docs/pic/xxx_usage.png differ diff --git a/community/thirdparty_template/docs/pic/xxx_usage1.png b/community/thirdparty_template/docs/pic/xxx_usage1.png new file mode 100755 index 0000000000000000000000000000000000000000..40c2851224918fed1ae6248b038519637669f15c Binary files /dev/null and b/community/thirdparty_template/docs/pic/xxx_usage1.png differ diff --git a/community/thirdparty_template/docs/rom_integrate.md b/community/thirdparty_template/docs/rom_integrate.md new file mode 100755 index 0000000000000000000000000000000000000000..9f157fdbe8c3d15ee7f6c486ad4e8bf67c89b873 --- /dev/null +++ b/community/thirdparty_template/docs/rom_integrate.md @@ -0,0 +1,39 @@ +# xxx如何集成到系统Rom + +## 准备源码工程 + +简要说明系统源码版本和运行平台 + +### 准备系统Rom源码 + +介绍系统源码的获取 + +### 增加构建脚本及配置文件 + +介绍如何增加构建脚本及配置文件 + +### 准备三方库源码 + +介绍三方库源码的获取 + +## 系统Rom中引入三方库 + +介绍如何将三方库加入OpenHarmony中构建 + +## 系统Rom中引入三方库测试程序 + +介绍如何将三方库的测试程序加入OpenHarmony中构建 + +## 编译工程 + +介绍编译流程与结果 + +## 运行效果 + +展示三方库在设备上运行的效果,可以贴效果图 + +## 参考资料 + +- [本文档涉及的技术补充说明](rom_integrate.md) +- [本文档引用的相关参考](rom_integrate.md) +- [相关案例参考](rom_integrate.md) diff --git a/community/tinygltf-2.4.0/HPKBUILD b/community/tinygltf-2.4.0/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..914398afe1ab11adcf0f816e46e78669cf7d4155 --- /dev/null +++ b/community/tinygltf-2.4.0/HPKBUILD @@ -0,0 +1,62 @@ +# 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=tinygltf-2.4.0 +pkgver=v2.4.0 +pkgrel=0 +pkgdesc="tinygltf is a header only C++ library for processing glTF files to efficiently process and exchange 3D content between different applications and platforms." +url="https://github.com/syoyo/tinygltf/tree/v2.4.0" +archs=("armeabi-v7a" "arm64-v8a") +license=("MIT license") +depends=() +makedepends=() +source="https://github.com/syoyo/tinygltf/archive/refs/tags/v2.4.0.zip" + +downloadpackage=true +autounpack=true +buildtools=cmake + +builddir=tinygltf-2.4.0 +packagename=tinygltf-v2.4.0.zip + +# 为编译设置环境,如设置环境变量,创建编译目录等 +prepare() { + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" -DCMAKE_C_FLAGS="-Wno-unused-command-line-argument" \ + -DCMAKE_CXX_FLAGS="-Wno-unused-command-line-argument" -B$ARCH-build -S./ > $buildlog 2>&1 + $MAKE VERBOSE=1 -C $ARCH-build >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + $MAKE -C $ARCH-build install >> $buildlog 2>&1 + cd $OLDPWD +} + +check() { + echo "The test must be on an OpenHarmony device!" +} + +cleanbuild() { + rm -rf ${PWD}/$builddir +} \ No newline at end of file diff --git a/community/tinygltf-2.4.0/HPKCHECK b/community/tinygltf-2.4.0/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..ef156906473c43636762756a539682540cd7afcb --- /dev/null +++ b/community/tinygltf-2.4.0/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: 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}_${OHOS_SDK_VER}_test.log + + +# 在OH环境执行测试的接口 +openharmonycheck() { + res=0 + cd ${builddir}/${ARCH}-build # 进入到测试目录 + ./loader_example model.gltf > $logfile 2>&1 #执行一个demo,解析modle.gltf文件 + 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/community/tinygltf-2.4.0/README.OpenSource b/community/tinygltf-2.4.0/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..37e443be5c3e23bed8b009a067847daed01ae52e --- /dev/null +++ b/community/tinygltf-2.4.0/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "tinygltf-2.4.0", + "License": "MIT license", + "License File": "https://github.com/syoyo/tinygltf/blob/release/LICENSE", + "Version Number": "v2.4.0", + "Owner": "2942375747@qq.com", + "Upstream URL": "https://github.com/syoyo/tinygltf", + "Description": "tinygltf is a header only C++ library for processing glTF files to efficiently process and exchange 3D content between different applications and platforms." + } +] \ No newline at end of file diff --git a/community/tinygltf-2.4.0/README_zh.md b/community/tinygltf-2.4.0/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..0ddca99457e2a1f6aa903ebb6973f3e068bffabd --- /dev/null +++ b/community/tinygltf-2.4.0/README_zh.md @@ -0,0 +1,9 @@ +# tinygltf-2.4.0三方库说明 +## 功能简介 +tinygltf是一个用于处理glTF文件的C++头文件库,用于在不同的应用程序和平台之间高效地处理和交换3D内容。 +## 三方库版本: +- v2.4.0 +## 使用约束: +- [IDE和SDK版本](../../docs/constraint.md) +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) \ No newline at end of file diff --git a/community/tinygltf-2.4.0/SHA512SUM b/community/tinygltf-2.4.0/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..25cb6c02703e2403d5ab86469716368554915080 --- /dev/null +++ b/community/tinygltf-2.4.0/SHA512SUM @@ -0,0 +1 @@ +480455e0b0dcbd9e6e5bfd90fa24c3fde09d14ef407df30b9fe57ed190b888d8fdd894630b5ee95c420bcbf349bf0d7f342ec55bde00745844ff336ea4c0c1a0 tinygltf-v2.4.0.zip \ No newline at end of file diff --git a/community/tinygltf-2.4.0/docs/hap_integrate.md b/community/tinygltf-2.4.0/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..4ae786650af64cfae79daa45d5e67a0a25cda907 --- /dev/null +++ b/community/tinygltf-2.4.0/docs/hap_integrate.md @@ -0,0 +1,76 @@ +# tinygltf集成到应用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/tinygltf-2.4.0 #三方库tinygltf-2.4.0的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── HPKCHECK #测试脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md #三方库简介 + ``` + +- 在lycium目录下编译三方库 + + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ```shell + cd lycium + ./build.sh tinygltf-2.4.0 + ``` + +- 三方库头文件及生成的库 + + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ```shell + tinygltf-2.4.0/arm64-v8a tinygltf-2.4.0/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的头文件拷贝到该目录下,如下图所示: +   + +  ![thirdparty_install_dir](pic/tinygltf_install_dir.png) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + + ```shell + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/tinygltf/${OHOS_ARCH}/include) + ``` + +## 测试三方库 +- 编译出可执行的文件,使用原库自带的测试用例来做测试 [准备三方库测试环境](../../../lycium/README.md#3ci环境准备) +进入到构建目录运行测试用例(注意arm64-v8a为构建64位的目录,armeabi-v7a为构建32位的目录),model.gltf为自行添加的.gltf格式文件用来验证测试。执行结果如图所示 + +```shell + cd /data/tpc_c_cplusplus/thirdparty/tinygltf-2.4.0/tinygltf-2.4.0/arm64-v8a-build/ + ./loader_example model.gltf +``` + ![tinygltf_test](pic/tinygltf_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/community/tinygltf-2.4.0/docs/pic/tinygltf_install_dir.png b/community/tinygltf-2.4.0/docs/pic/tinygltf_install_dir.png new file mode 100644 index 0000000000000000000000000000000000000000..759aab7ba4d9e57ba4b5446763e6e0b8634fd146 Binary files /dev/null and b/community/tinygltf-2.4.0/docs/pic/tinygltf_install_dir.png differ diff --git a/community/tinygltf-2.4.0/docs/pic/tinygltf_test.png b/community/tinygltf-2.4.0/docs/pic/tinygltf_test.png new file mode 100644 index 0000000000000000000000000000000000000000..e5b8ef4cf358693cdf24f2a4d6d068254f3f9c78 Binary files /dev/null and b/community/tinygltf-2.4.0/docs/pic/tinygltf_test.png differ diff --git a/community/tzdb/HPKBUILD b/community/tzdb/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..dcec35695fadabd0e89e2e482f7e618368b14aef --- /dev/null +++ b/community/tzdb/HPKBUILD @@ -0,0 +1,79 @@ +# Copyright (c) 2024 Huawei Device Co., Ltd. +# Licensed under the ImageMagick License (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: chenyajie +# Maintainer: huangminzhong + +pkgname=tzdb +pkgver=2024a +pkgrel=0 +pkgdesc="tzdb(Time-Zone-Database) for accurate global date-time processing in software, updated regularly, universally adopted." +url="" +archs=("armeabi-v7a" "arm64-v8a") +license=("BSD 3-clause") +depends=() +makedepends=() + +source="https://data.iana.org/time-zones/releases/tzdb-2024a.tar.lz" + +autounpack=false +downloadpackage=true +buildtools="make" + +builddir=${pkgname}-${pkgver} +packagename=${builddir}.tar + +cc= + +prepare() { + apt-get update + apt-get install lzip + tar -xvf $packagename > $publicbuildlog 2>&1 + cp -rf $builddir $builddir-$ARCH-build + cd $builddir-$ARCH-build + if [ $ARCH == "arm64-v8a" ] + then + cc=${OHOS_SDK}/native/llvm/bin/aarch64-linux-ohos-clang + export CFLAGS="-g -O2 -DHAVE_GETTEXT=0 -DOHOS_NDK -fPIC -D__MUSL__=1" + fi + if [ $ARCH == "armeabi-v7a" ] + then + cc=${OHOS_SDK}/native/llvm/bin/arm-linux-ohos-clang + export CFLAGS="-g -O2 -DHAVE_GETTEXT=0 -DOHOS_NDK -fPIC -march=armv7a -D__MUSL__=1" + fi + cd $OLDPWD # 1> /dev/null +} + +build() { + cd $builddir-$ARCH-build + $MAKE CC="${cc}" > $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir-$ARCH-build + $MAKE install PREFIX=$LYCIUM_ROOT/usr/$pkgname/$ARCH >> $buildlog 2>&1 + cd $OLDPWD +} + +check() { + echo "The test must be on an OpenHarmony device!" + # make check +} + +# 清理环境 +cleanbuild(){ + rm -rf ${PWD}/$builddir $builddir-armeabi-v7a-build $builddir-arm64-v8a-build #${PWD}/$packagename +} diff --git a/community/tzdb/README.OpenSource b/community/tzdb/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..17b4f9ae99f34e28fc8f5afa391a0e83aa5b9f58 --- /dev/null +++ b/community/tzdb/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "tzdb", + "License": "BSD 3-clause", + "License File": "https://data.iana.org/time-zones/tzdb-2024a/LICENSE", + "Version Number": "2024a", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://data.iana.org/time-zones/releases/tzdb-2024a.tar.lz", + "Description": "tzdb(Time-Zone-Database) for accurate global date-time processing in software, updated regularly, universally adopted." + } +] \ No newline at end of file diff --git a/community/tzdb/SHA512SUM b/community/tzdb/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..30e15f03fb77c84326789a44111829400c39636f --- /dev/null +++ b/community/tzdb/SHA512SUM @@ -0,0 +1 @@ +f1a3b06ea2b28a0bf968b75f3674f3b64d8226338d42e2ed17aea33e34bff0f9a7a22f4116612e6c81b9b7b57deaee6ed01a6881000fa1042a7f4390b55a1856 tzdb-2024a.tar diff --git a/community/unrar/CMakeLists.txt b/community/unrar/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..9f6864c0c98b0b83f1ad1f399e595003149b83d2 --- /dev/null +++ b/community/unrar/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(libunrar) diff --git a/community/unrar/README.OpenSource b/community/unrar/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..4e418baf0cfd83464c5a1f01966d846d70b41a2d --- /dev/null +++ b/community/unrar/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "unrar", + "License": "Apache License 2.0", + "License File": "LICENSE", + "Version Number": "1.0.0", + "Owner" : "wangyingjun5@huawei.com" + "Upstream URL": "https://github.com/maoabc/unrar-android", + "Description": "Unrar library ported to JavaScript" + } +] diff --git a/community/unrar/README_zh.md b/community/unrar/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..a85105c42f629bf5690ae8233a3c7708a67077a5 --- /dev/null +++ b/community/unrar/README_zh.md @@ -0,0 +1,12 @@ +# unrar三方库说明 +## 功能简介 +unrar是一个解压rar文件的库。 + +## 三方库版本 +- v1.0.0 + +## 使用约束 +- [IDE和SDK版本](../../docs/constraint.md) + +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) diff --git a/community/unrar/docs/hap_integrate.md b/community/unrar/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..b7501d24a389ece81bb0569a52b9da6117fede1f --- /dev/null +++ b/community/unrar/docs/hap_integrate.md @@ -0,0 +1,48 @@ +# unrar如何集成到应用hap +## 准备应用工程 +本库是基于DevEco Studio 3.0 Release版本,在RK3568开发板上验证的,如果是从未使用过RK3568,可以先查看[润和RK3568开发板标准系统快速上手](https://gitee.com/openharmony-sig/knowledge_demo_temp/tree/master/docs/rk3568_helloworld)。 +### 准备应用开发环境 +开发环境的准备参考:[开发环境准备](../../../docs/hap_integrate_environment.md) +### 增加构建脚本及配置文件 +- 下载本仓库,并解压 +- 三方库目录结构 + ``` + tpc_c_cplusplus/thirdparty/unrar #三方库unrar的目录结构如下 + ├── docs #存放三方库相关文档的文件夹 + ├── CmakeLists.txt #构建脚本,支持hap包集成 + ├── package.json #三方库组件定义文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md + ``` +- 将unrar拷贝至工程xxxx/entry/src/main/cpp/thirdparty目录下 +### 准备三方库源码 +- 三方库下载地址:[unrar](https://github.com/maoabc/unrar-android/tree/master/src/main/cpp/libunrar), 版本:v5.6.4 + 解压后把目录下的src/main/cpp/libunrar 的文件,拷贝至工程xxxx/entry/src/main/cpp/thirdparty/unrar目录下 +## 应用中使用三方库 +- 将三方库加入工程中,目录结构如下 + ``` + demo/entry/src/main/cpp + ├── thirdparty #三方库存放目录 + │ ├── unrar #三方库unrar + ├── CMakeLists.txt #工程目录的构建脚本 + ├── ..... #工程目录的其他文件 + ``` +- 在工程顶级CMakeLists.txt中引入三方库,增加如下代码 + ``` + add_subdirectory(thirdparty/unrar) #引入子目录下的CMakeLists.txt + include_directories(thirdparty/unrar/libunrar) + add_library(unrar SHARED unrar.cpp) #工程编译三方库unrar + target_link_libraries(unrar PUBLIC libace_napi.z.so libhilog_ndk.z.so static_unrar) + ``` +- 三方库接口使用可以参考demo工程 [unrar_demo](https://gitee.com/openharmony-tpc/openharmony_tpc_samples/tree/master/unrar) +## 编译工程 +编译工程,安装应用可以参考 [应用的安装和运行](https://gitee.com/openharmony-sig/knowledge_demo_temp/blob/master/docs/napi%E7%B3%BB%E5%88%97%E5%AD%A6%E4%B9%A0/docs/hello_napi.md#%E5%AE%89%E8%A3%85%E8%B0%83%E8%AF%95) +## 运行效果 +- 在 [unrar_demo](https://gitee.com/openharmony-tpc/openharmony_tpc_samples/tree/master/unrar)中,rar解压如下图所示 +  ![content](pic/content.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%E7%B3%BB%E5%88%97%E5%AD%A6%E4%B9%A0/docs/hello_napi.md) diff --git a/community/unrar/docs/pic/content.png b/community/unrar/docs/pic/content.png new file mode 100644 index 0000000000000000000000000000000000000000..709bb62629cacece63e95b44ac8b1919c4bcea9c Binary files /dev/null and b/community/unrar/docs/pic/content.png differ diff --git a/community/unrar/docs/pic/unrar1.png b/community/unrar/docs/pic/unrar1.png new file mode 100644 index 0000000000000000000000000000000000000000..7050dae1621de96f92fa4abad9243790e4aa9a13 Binary files /dev/null and b/community/unrar/docs/pic/unrar1.png differ diff --git a/community/unrar/package.json b/community/unrar/package.json new file mode 100644 index 0000000000000000000000000000000000000000..351fb3c6afb1bb82269d257c9ba31eef9ed5ef0a --- /dev/null +++ b/community/unrar/package.json @@ -0,0 +1,17 @@ +{ + "license": "ISC", + "types": "", + "devDependencies": { + "@types/libunrar.so": "file:./src/main/cpp/types/libunrar" + }, + "name": "@ohos/unrar", + "description": "a npm package which contains arkUI2.0 page", + "ohos": { + "org": "" + }, + "main": "src/main/ets/components/MainPage/MainPage.ets", + "repository": {}, + "type": "module", + "version": "1.0.0", + "dependencies": {} +} diff --git a/community/utf8proc-2.7.0/HPKBUILD b/community/utf8proc-2.7.0/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..4403e7bc4c3d59a27ac1b629b269dce7f641c537 --- /dev/null +++ b/community/utf8proc-2.7.0/HPKBUILD @@ -0,0 +1,72 @@ +# 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=utf8proc-2.7.0 +pkgver=v2.7.0 +pkgrel=0 +pkgdesc="utf8proc is a small, clean C library that provides Unicode normalization, case-folding, and other operations for data in the UTF-8 encoding." +url="https://github.com/JuliaStrings/utf8proc/tree/v2.7.0" +archs=("armeabi-v7a" "arm64-v8a") +license=("utf8proc license") +depends=() +makedepends=() +source="https://github.com/JuliaStrings/utf8proc/archive/refs/tags/v2.7.0.zip" + +downloadpackage=true +autounpack=true +buildtools=cmake +patchflag=true + +builddir=utf8proc-2.7.0 +packagename=utf8proc-v2.7.0.zip + +# 为编译设置环境,如设置环境变量,创建编译目录等 +prepare() { + if $patchflag + then + cd $builddir + #在原库根目录下的CMakeLists.txt中打开构建单元测试的开关,以便测试 + patch -p1 < `pwd`/../utf8proc-2.7.0_oh_pkg.patch + #patch只需要打一次,关闭打patch + patchflag=false + cd $OLDPWD + fi + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" -DCMAKE_C_FLAGS="-Wno-unused-command-line-argument" \ + -DCMAKE_CXX_FLAGS="-Wno-unused-command-line-argument" -B$ARCH-build -S./ > $buildlog 2>&1 + $MAKE VERBOSE=1 -C $ARCH-build >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + $MAKE -C $ARCH-build install >> $buildlog 2>&1 + cd $OLDPWD +} + +check() { + echo "The test must be on an OpenHarmony device!" +} + +cleanbuild() { + rm -rf ${PWD}/$builddir +} \ No newline at end of file diff --git a/community/utf8proc-2.7.0/HPKCHECK b/community/utf8proc-2.7.0/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..45087f23bbfe1b9cac2c3352e606b765ef4a975f --- /dev/null +++ b/community/utf8proc-2.7.0/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: 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}_${OHOS_SDK_VER}_test.log + + +# 在OH环境执行测试的接口 +openharmonycheck() { + res=0 + cd ${builddir}/${ARCH}-build # 进入到测试目录 + ctest > $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/community/utf8proc-2.7.0/README.OpenSource b/community/utf8proc-2.7.0/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..bda9679325b15e9e01716eedc85224f67235d143 --- /dev/null +++ b/community/utf8proc-2.7.0/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "utf8proc-2.7.0", + "License": "utf8proc license", + "License File": "https://github.com/JuliaStrings/utf8proc/blob/master/LICENSE.md", + "Version Number": "v2.7.0", + "Owner": "2942375747@qq.com", + "Upstream URL": "https://github.com/JuliaStrings/utf8proc", + "Description": "utf8proc is a small, clean C library that provides Unicode normalization, case-folding, and other operations for data in the UTF-8 encoding." + } +] \ No newline at end of file diff --git a/community/utf8proc-2.7.0/README_zh.md b/community/utf8proc-2.7.0/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..a1a4b1718dffbd9e98389fb3103c7b45fe7b183d --- /dev/null +++ b/community/utf8proc-2.7.0/README_zh.md @@ -0,0 +1,9 @@ +# utf8proc-2.7.0三方库说明 +## 功能简介 +utf8proc是一个紧凑、简洁而高效的C库,它为UTF-8编码的数据提供Unicode规范化、大小写转换等操作。 +## 三方库版本: +- v2.7.0 +## 使用约束: +- [IDE和SDK版本](../../docs/constraint.md) +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) \ No newline at end of file diff --git a/community/utf8proc-2.7.0/SHA512SUM b/community/utf8proc-2.7.0/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..4aecb23d04a81bc96308936e54ed8d87058ccfde --- /dev/null +++ b/community/utf8proc-2.7.0/SHA512SUM @@ -0,0 +1 @@ +97e11120dad0e1c5bc5f79a1a5854ea48aca9784b3dc29c7f9df2cef068279dd7a0d12f1de030cca2b8865623ab3c9a0958d21948891b27136c90dd7b00fc1d0 utf8proc-v2.7.0.zip \ No newline at end of file diff --git a/community/utf8proc-2.7.0/docs/hap_integrate.md b/community/utf8proc-2.7.0/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..77cfffdd6cc0ea186d396ea8aa496e4502b6f998 --- /dev/null +++ b/community/utf8proc-2.7.0/docs/hap_integrate.md @@ -0,0 +1,80 @@ +# utf8proc集成到应用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/utf8proc-2.7.0 #三方库utf8proc-2.7.0的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── HPKCHECK #测试脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md #三方库简介 + ├── utf8proc-2.7.0_oh_pkg.patch #用于utf8proc-2.7.0库编译的补丁 + ``` + +- 在lycium目录下编译三方库 + + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ```shell + cd lycium + ./build.sh utf8proc-2.7.0 + ``` + +- 三方库头文件及生成的库 + + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ```shell + utf8proc-2.7.0/arm64-v8a utf8proc-2.7.0/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的头文件和静态库文件拷贝到该目录下,如下图所示: +   + +  ![thirdparty_install_dir](pic/utf8proc_install_dir.png) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + + ```shell + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/utf8proc/${OHOS_ARCH}/lib/libutf8proc.a) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/utf8proc/${OHOS_ARCH}/include) + ``` + +## 测试三方库 +- 编译出可执行的文件,使用原库自带的测试用例来做测试 [准备三方库测试环境](../../../lycium/README.md#3ci环境准备) +进入到构建目录运行测试用例(注意arm64-v8a为构建64位的目录,armeabi-v7a为构建32位的目录),执行结果如图所示 + +```shell + cd /data/tpc_c_cplusplus/thirdparty/utf8proc-2.7.0/utf8proc-2.7.0/arm64-v8a-build/ + ctest +``` + ![utf8proc_test](pic/utf8proc_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/community/utf8proc-2.7.0/docs/pic/utf8proc_install_dir.png b/community/utf8proc-2.7.0/docs/pic/utf8proc_install_dir.png new file mode 100644 index 0000000000000000000000000000000000000000..f5ad5515a4403906110294bb3fe3dff7be9ae45d Binary files /dev/null and b/community/utf8proc-2.7.0/docs/pic/utf8proc_install_dir.png differ diff --git a/community/utf8proc-2.7.0/docs/pic/utf8proc_test.png b/community/utf8proc-2.7.0/docs/pic/utf8proc_test.png new file mode 100644 index 0000000000000000000000000000000000000000..7df58115feac9a465eee2e3da3b1898c67b64f74 Binary files /dev/null and b/community/utf8proc-2.7.0/docs/pic/utf8proc_test.png differ diff --git a/community/utf8proc-2.7.0/utf8proc-2.7.0_oh_pkg.patch b/community/utf8proc-2.7.0/utf8proc-2.7.0_oh_pkg.patch new file mode 100644 index 0000000000000000000000000000000000000000..6b674fb242717dc273940b5504b8dd52f40cf1e1 --- /dev/null +++ b/community/utf8proc-2.7.0/utf8proc-2.7.0_oh_pkg.patch @@ -0,0 +1,12 @@ +diff -urN utf8proc-2.7.0_old/CMakeLists.txt utf8proc-2.7.0/CMakeLists.txt +--- utf8proc-2.7.0_old/CMakeLists.txt 2021-12-17 10:11:23.000000000 +0800 ++++ utf8proc-2.7.0/CMakeLists.txt 2024-10-04 19:24:58.163194537 +0800 +@@ -17,7 +17,7 @@ + set(SO_PATCH 0) + + option(UTF8PROC_INSTALL "Enable installation of utf8proc" On) +-option(UTF8PROC_ENABLE_TESTING "Enable testing of utf8proc" Off) ++option(UTF8PROC_ENABLE_TESTING "Enable testing of utf8proc" ON) + option(LIB_FUZZING_ENGINE "Fuzzing engine to link against" Off) + + add_library (utf8proc diff --git a/community/xerces-c/BUILD.gn b/community/xerces-c/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..e1950f76cf055d14c557af8e3bb59dfdc6880923 --- /dev/null +++ b/community/xerces-c/BUILD.gn @@ -0,0 +1,954 @@ +# Copyright (c) 2021 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. + +import("//build/ohos.gni") + +declare_args() { + enable_xerces_test = false +} + +config("libxerces-c_config") { + cflags_cc = [ + "-frtti", + "-fexceptions", + "-Wno-header-hygiene", + "-DHAVE_CONFIG_H=1", + "-DXERCES_BUILDING_LIBRARY=1", + "-D_FILE_OFFSET_BITS=64", + "-D_THREAD_SAFE=1", + "-DXERCES_USE_TRANSCODER_ICU=1", + "-Dxerces_c_EXPORTS", + "-Wno-long-long", + "-Woverlength-strings", + "-Woverloaded-virtual", + "-Wno-variadic-macros", + "-Wno-misleading-indentation", + "-Wno-memset-transposed-args", + "-Wno-unused-variable", + "-fstrict-aliasing", + "-fPIC", + ] + + cflags = [ + "-DHAVE_CONFIG_H=1", + "-DXERCES_BUILDING_LIBRARY=1", + "-D_FILE_OFFSET_BITS=64", + "-D_THREAD_SAFE=1", + "-Dxerces_c_EXPORTS", + "-fPIC", + ] + + include_dirs = [ + "xerces-c/src", + "xerces-c", + "adapted", + "//third_party/icu/icu4c/source/common", + ] +} + +ohos_shared_library("libxerces-c") { + sources= [ + "xerces-c/src/xercesc/util/Base64.cpp", + "xerces-c/src/xercesc/util/BinFileInputStream.cpp", + "xerces-c/src/xercesc/util/BinInputStream.cpp", + "xerces-c/src/xercesc/util/BinMemInputStream.cpp", + "xerces-c/src/xercesc/util/BitSet.cpp", + "xerces-c/src/xercesc/util/DefaultPanicHandler.cpp", + "xerces-c/src/xercesc/util/EncodingValidator.cpp", + "xerces-c/src/xercesc/util/HeaderDummy.cpp", + "xerces-c/src/xercesc/util/HexBin.cpp", + "xerces-c/src/xercesc/util/JanitorExports.cpp", + "xerces-c/src/xercesc/util/KVStringPair.cpp", + "xerces-c/src/xercesc/util/Mutexes.cpp", + "xerces-c/src/xercesc/util/PanicHandler.cpp", + "xerces-c/src/xercesc/util/PlatformUtils.cpp", + "xerces-c/src/xercesc/util/PSVIUni.cpp", + "xerces-c/src/xercesc/util/QName.cpp", + "xerces-c/src/xercesc/util/regx/ASCIIRangeFactory.cpp", + "xerces-c/src/xercesc/util/regx/BlockRangeFactory.cpp", + "xerces-c/src/xercesc/util/regx/BMPattern.cpp", + "xerces-c/src/xercesc/util/regx/CharToken.cpp", + "xerces-c/src/xercesc/util/regx/ClosureToken.cpp", + "xerces-c/src/xercesc/util/regx/ConcatToken.cpp", + "xerces-c/src/xercesc/util/regx/Match.cpp", + "xerces-c/src/xercesc/util/regx/Op.cpp", + "xerces-c/src/xercesc/util/regx/OpFactory.cpp", + "xerces-c/src/xercesc/util/regx/ParenToken.cpp", + "xerces-c/src/xercesc/util/regx/ParserForXMLSchema.cpp", + "xerces-c/src/xercesc/util/regx/RangeFactory.cpp", + "xerces-c/src/xercesc/util/regx/RangeToken.cpp", + "xerces-c/src/xercesc/util/regx/RangeTokenMap.cpp", + "xerces-c/src/xercesc/util/regx/RegularExpression.cpp", + "xerces-c/src/xercesc/util/regx/RegxParser.cpp", + "xerces-c/src/xercesc/util/regx/RegxUtil.cpp", + "xerces-c/src/xercesc/util/regx/StringToken.cpp", + "xerces-c/src/xercesc/util/regx/Token.cpp", + "xerces-c/src/xercesc/util/regx/TokenFactory.cpp", + "xerces-c/src/xercesc/util/regx/UnicodeRangeFactory.cpp", + "xerces-c/src/xercesc/util/regx/UnionToken.cpp", + "xerces-c/src/xercesc/util/regx/XMLRangeFactory.cpp", + "xerces-c/src/xercesc/util/regx/XMLUniCharacter.cpp", + "xerces-c/src/xercesc/util/StringPool.cpp", + "xerces-c/src/xercesc/util/SynchronizedStringPool.cpp", + "xerces-c/src/xercesc/util/TransService.cpp", + "xerces-c/src/xercesc/util/XMemory.cpp", + "xerces-c/src/xercesc/util/XML256TableTranscoder.cpp", + "xerces-c/src/xercesc/util/XML88591Transcoder.cpp", + "xerces-c/src/xercesc/util/XMLAbstractDoubleFloat.cpp", + "xerces-c/src/xercesc/util/XMLASCIITranscoder.cpp", + "xerces-c/src/xercesc/util/XMLBigDecimal.cpp", + "xerces-c/src/xercesc/util/XMLBigInteger.cpp", + "xerces-c/src/xercesc/util/XMLChar.cpp", + "xerces-c/src/xercesc/util/XMLChTranscoder.cpp", + "xerces-c/src/xercesc/util/XMLDateTime.cpp", + "xerces-c/src/xercesc/util/XMLDouble.cpp", + "xerces-c/src/xercesc/util/XMLEBCDICTranscoder.cpp", + "xerces-c/src/xercesc/util/XMLException.cpp", + "xerces-c/src/xercesc/util/XMLFloat.cpp", + "xerces-c/src/xercesc/util/XMLIBM1047Transcoder.cpp", + "xerces-c/src/xercesc/util/XMLIBM1140Transcoder.cpp", + "xerces-c/src/xercesc/util/XMLInitializer.cpp", + "xerces-c/src/xercesc/util/XMLMsgLoader.cpp", + "xerces-c/src/xercesc/util/XMLNumber.cpp", + "xerces-c/src/xercesc/util/XMLString.cpp", + "xerces-c/src/xercesc/util/XMLStringTokenizer.cpp", + "xerces-c/src/xercesc/util/XMLUCS4Transcoder.cpp", + "xerces-c/src/xercesc/util/XMLUni.cpp", + "xerces-c/src/xercesc/util/XMLUri.cpp", + "xerces-c/src/xercesc/util/XMLURL.cpp", + "xerces-c/src/xercesc/util/XMLUTF16Transcoder.cpp", + "xerces-c/src/xercesc/util/XMLUTF8Transcoder.cpp", + "xerces-c/src/xercesc/util/XMLWin1252Transcoder.cpp", + "xerces-c/src/xercesc/dom/DOMException.cpp", + "xerces-c/src/xercesc/dom/DOMLSException.cpp", + "xerces-c/src/xercesc/dom/DOMRangeException.cpp", + "xerces-c/src/xercesc/dom/DOMXPathException.cpp", + "xerces-c/src/xercesc/dom/impl/DOMAttrImpl.cpp", + "xerces-c/src/xercesc/dom/impl/DOMAttrMapImpl.cpp", + "xerces-c/src/xercesc/dom/impl/DOMAttrNSImpl.cpp", + "xerces-c/src/xercesc/dom/impl/DOMCDATASectionImpl.cpp", + "xerces-c/src/xercesc/dom/impl/DOMCharacterDataImpl.cpp", + "xerces-c/src/xercesc/dom/impl/DOMChildNode.cpp", + "xerces-c/src/xercesc/dom/impl/DOMCommentImpl.cpp", + "xerces-c/src/xercesc/dom/impl/DOMConfigurationImpl.cpp", + "xerces-c/src/xercesc/dom/impl/DOMDeepNodeListImpl.cpp", + "xerces-c/src/xercesc/dom/impl/DOMDocumentFragmentImpl.cpp", + "xerces-c/src/xercesc/dom/impl/DOMDocumentImpl.cpp", + "xerces-c/src/xercesc/dom/impl/DOMDocumentTypeImpl.cpp", + "xerces-c/src/xercesc/dom/impl/DOMElementImpl.cpp", + "xerces-c/src/xercesc/dom/impl/DOMElementNSImpl.cpp", + "xerces-c/src/xercesc/dom/impl/DOMEntityImpl.cpp", + "xerces-c/src/xercesc/dom/impl/DOMEntityReferenceImpl.cpp", + "xerces-c/src/xercesc/dom/impl/DOMErrorImpl.cpp", + "xerces-c/src/xercesc/dom/impl/DOMImplementationImpl.cpp", + "xerces-c/src/xercesc/dom/impl/DOMImplementationListImpl.cpp", + "xerces-c/src/xercesc/dom/impl/DOMImplementationRegistry.cpp", + "xerces-c/src/xercesc/dom/impl/DOMLocatorImpl.cpp", + "xerces-c/src/xercesc/dom/impl/DOMNamedNodeMapImpl.cpp", + "xerces-c/src/xercesc/dom/impl/DOMNodeIDMap.cpp", + "xerces-c/src/xercesc/dom/impl/DOMNodeImpl.cpp", + "xerces-c/src/xercesc/dom/impl/DOMNodeIteratorImpl.cpp", + "xerces-c/src/xercesc/dom/impl/DOMNodeListImpl.cpp", + "xerces-c/src/xercesc/dom/impl/DOMNodeVector.cpp", + "xerces-c/src/xercesc/dom/impl/DOMNormalizer.cpp", + "xerces-c/src/xercesc/dom/impl/DOMNotationImpl.cpp", + "xerces-c/src/xercesc/dom/impl/DOMParentNode.cpp", + "xerces-c/src/xercesc/dom/impl/DOMProcessingInstructionImpl.cpp", + "xerces-c/src/xercesc/dom/impl/DOMRangeImpl.cpp", + "xerces-c/src/xercesc/dom/impl/DOMStringListImpl.cpp", + "xerces-c/src/xercesc/dom/impl/DOMStringPool.cpp", + "xerces-c/src/xercesc/dom/impl/DOMTextImpl.cpp", + "xerces-c/src/xercesc/dom/impl/DOMTreeWalkerImpl.cpp", + "xerces-c/src/xercesc/dom/impl/DOMTypeInfoImpl.cpp", + "xerces-c/src/xercesc/dom/impl/DOMLSSerializerImpl.cpp", + "xerces-c/src/xercesc/dom/impl/DOMLSInputImpl.cpp", + "xerces-c/src/xercesc/dom/impl/DOMLSOutputImpl.cpp", + "xerces-c/src/xercesc/dom/impl/DOMXPathExpressionImpl.cpp", + "xerces-c/src/xercesc/dom/impl/DOMXPathNSResolverImpl.cpp", + "xerces-c/src/xercesc/dom/impl/DOMXPathResultImpl.cpp", + "xerces-c/src/xercesc/dom/impl/XSDElementNSImpl.cpp", + "xerces-c/src/xercesc/framework/BinOutputStream.cpp", + "xerces-c/src/xercesc/framework/LocalFileFormatTarget.cpp", + "xerces-c/src/xercesc/framework/LocalFileInputSource.cpp", + "xerces-c/src/xercesc/framework/MemBufFormatTarget.cpp", + "xerces-c/src/xercesc/framework/MemBufInputSource.cpp", + "xerces-c/src/xercesc/framework/psvi/PSVIAttribute.cpp", + "xerces-c/src/xercesc/framework/psvi/PSVIAttributeList.cpp", + "xerces-c/src/xercesc/framework/psvi/PSVIElement.cpp", + "xerces-c/src/xercesc/framework/psvi/PSVIItem.cpp", + "xerces-c/src/xercesc/framework/psvi/XSAnnotation.cpp", + "xerces-c/src/xercesc/framework/psvi/XSAttributeDeclaration.cpp", + "xerces-c/src/xercesc/framework/psvi/XSAttributeGroupDefinition.cpp", + "xerces-c/src/xercesc/framework/psvi/XSAttributeUse.cpp", + "xerces-c/src/xercesc/framework/psvi/XSComplexTypeDefinition.cpp", + "xerces-c/src/xercesc/framework/psvi/XSElementDeclaration.cpp", + "xerces-c/src/xercesc/framework/psvi/XSFacet.cpp", + "xerces-c/src/xercesc/framework/psvi/XSIDCDefinition.cpp", + "xerces-c/src/xercesc/framework/psvi/XSModel.cpp", + "xerces-c/src/xercesc/framework/psvi/XSModelGroup.cpp", + "xerces-c/src/xercesc/framework/psvi/XSModelGroupDefinition.cpp", + "xerces-c/src/xercesc/framework/psvi/XSMultiValueFacet.cpp", + "xerces-c/src/xercesc/framework/psvi/XSNamespaceItem.cpp", + "xerces-c/src/xercesc/framework/psvi/XSNotationDeclaration.cpp", + "xerces-c/src/xercesc/framework/psvi/XSObject.cpp", + "xerces-c/src/xercesc/framework/psvi/XSParticle.cpp", + "xerces-c/src/xercesc/framework/psvi/XSSimpleTypeDefinition.cpp", + "xerces-c/src/xercesc/framework/psvi/XSTypeDefinition.cpp", + "xerces-c/src/xercesc/framework/psvi/XSValue.cpp", + "xerces-c/src/xercesc/framework/psvi/XSWildcard.cpp", + "xerces-c/src/xercesc/framework/StdInInputSource.cpp", + "xerces-c/src/xercesc/framework/StdOutFormatTarget.cpp", + "xerces-c/src/xercesc/framework/URLInputSource.cpp", + "xerces-c/src/xercesc/framework/Wrapper4DOMLSInput.cpp", + "xerces-c/src/xercesc/framework/Wrapper4InputSource.cpp", + "xerces-c/src/xercesc/framework/XMLAttDef.cpp", + "xerces-c/src/xercesc/framework/XMLAttDefList.cpp", + "xerces-c/src/xercesc/framework/XMLAttr.cpp", + "xerces-c/src/xercesc/framework/XMLBuffer.cpp", + "xerces-c/src/xercesc/framework/XMLBufferMgr.cpp", + "xerces-c/src/xercesc/framework/XMLContentModel.cpp", + "xerces-c/src/xercesc/framework/XMLDTDDescription.cpp", + "xerces-c/src/xercesc/framework/XMLElementDecl.cpp", + "xerces-c/src/xercesc/framework/XMLEntityDecl.cpp", + "xerces-c/src/xercesc/framework/XMLFormatter.cpp", + "xerces-c/src/xercesc/framework/XMLGrammarDescription.cpp", + "xerces-c/src/xercesc/framework/XMLGrammarPoolImpl.cpp", + "xerces-c/src/xercesc/framework/XMLNotationDecl.cpp", + "xerces-c/src/xercesc/framework/XMLRecognizer.cpp", + "xerces-c/src/xercesc/framework/XMLRefInfo.cpp", + "xerces-c/src/xercesc/framework/XMLSchemaDescription.cpp", + "xerces-c/src/xercesc/framework/XMLValidator.cpp", + "xerces-c/src/xercesc/internal/BinFileOutputStream.cpp", + "xerces-c/src/xercesc/internal/BinMemOutputStream.cpp", + "xerces-c/src/xercesc/internal/DGXMLScanner.cpp", + "xerces-c/src/xercesc/internal/ElemStack.cpp", + "xerces-c/src/xercesc/internal/IGXMLScanner.cpp", + "xerces-c/src/xercesc/internal/IGXMLScanner2.cpp", + "xerces-c/src/xercesc/internal/MemoryManagerImpl.cpp", + "xerces-c/src/xercesc/internal/ReaderMgr.cpp", + "xerces-c/src/xercesc/internal/SGXMLScanner.cpp", + "xerces-c/src/xercesc/internal/ValidationContextImpl.cpp", + "xerces-c/src/xercesc/internal/VecAttributesImpl.cpp", + "xerces-c/src/xercesc/internal/VecAttrListImpl.cpp", + "xerces-c/src/xercesc/internal/WFXMLScanner.cpp", + "xerces-c/src/xercesc/internal/XMLReader.cpp", + "xerces-c/src/xercesc/internal/XMLScanner.cpp", + "xerces-c/src/xercesc/internal/XMLScannerResolver.cpp", + "xerces-c/src/xercesc/internal/XProtoType.cpp", + "xerces-c/src/xercesc/internal/XSAXMLScanner.cpp", + "xerces-c/src/xercesc/internal/XSerializeEngine.cpp", + "xerces-c/src/xercesc/internal/XSObjectFactory.cpp", + "xerces-c/src/xercesc/internal/XTemplateSerializer.cpp", + "xerces-c/src/xercesc/parsers/AbstractDOMParser.cpp", + "xerces-c/src/xercesc/parsers/DOMLSParserImpl.cpp", + "xerces-c/src/xercesc/parsers/SAX2XMLFilterImpl.cpp", + "xerces-c/src/xercesc/parsers/SAX2XMLReaderImpl.cpp", + "xerces-c/src/xercesc/parsers/SAXParser.cpp", + "xerces-c/src/xercesc/parsers/XercesDOMParser.cpp", + "xerces-c/src/xercesc/sax/Dummy.cpp", + "xerces-c/src/xercesc/sax/InputSource.cpp", + "xerces-c/src/xercesc/sax/SAXException.cpp", + "xerces-c/src/xercesc/sax/SAXParseException.cpp", + "xerces-c/src/xercesc/sax2/sax2Dummy.cpp", + "xerces-c/src/xercesc/validators/common/AllContentModel.cpp", + "xerces-c/src/xercesc/validators/common/CMAny.cpp", + "xerces-c/src/xercesc/validators/common/CMBinaryOp.cpp", + "xerces-c/src/xercesc/validators/common/CMUnaryOp.cpp", + "xerces-c/src/xercesc/validators/common/ContentLeafNameTypeVector.cpp", + "xerces-c/src/xercesc/validators/common/ContentSpecNode.cpp", + "xerces-c/src/xercesc/validators/common/DFAContentModel.cpp", + "xerces-c/src/xercesc/validators/common/Grammar.cpp", + "xerces-c/src/xercesc/validators/common/GrammarResolver.cpp", + "xerces-c/src/xercesc/validators/common/MixedContentModel.cpp", + "xerces-c/src/xercesc/validators/common/SimpleContentModel.cpp", + "xerces-c/src/xercesc/validators/datatype/AbstractNumericFacetValidator.cpp", + "xerces-c/src/xercesc/validators/datatype/AbstractNumericValidator.cpp", + "xerces-c/src/xercesc/validators/datatype/AbstractStringValidator.cpp", + "xerces-c/src/xercesc/validators/datatype/AnySimpleTypeDatatypeValidator.cpp", + "xerces-c/src/xercesc/validators/datatype/AnyURIDatatypeValidator.cpp", + "xerces-c/src/xercesc/validators/datatype/Base64BinaryDatatypeValidator.cpp", + "xerces-c/src/xercesc/validators/datatype/BooleanDatatypeValidator.cpp", + "xerces-c/src/xercesc/validators/datatype/DatatypeValidator.cpp", + "xerces-c/src/xercesc/validators/datatype/DatatypeValidatorFactory.cpp", + "xerces-c/src/xercesc/validators/datatype/DateDatatypeValidator.cpp", + "xerces-c/src/xercesc/validators/datatype/DateTimeDatatypeValidator.cpp", + "xerces-c/src/xercesc/validators/datatype/DateTimeValidator.cpp", + "xerces-c/src/xercesc/validators/datatype/DayDatatypeValidator.cpp", + "xerces-c/src/xercesc/validators/datatype/DecimalDatatypeValidator.cpp", + "xerces-c/src/xercesc/validators/datatype/DoubleDatatypeValidator.cpp", + "xerces-c/src/xercesc/validators/datatype/DurationDatatypeValidator.cpp", + "xerces-c/src/xercesc/validators/datatype/ENTITYDatatypeValidator.cpp", + "xerces-c/src/xercesc/validators/datatype/FloatDatatypeValidator.cpp", + "xerces-c/src/xercesc/validators/datatype/HexBinaryDatatypeValidator.cpp", + "xerces-c/src/xercesc/validators/datatype/IDDatatypeValidator.cpp", + "xerces-c/src/xercesc/validators/datatype/IDREFDatatypeValidator.cpp", + "xerces-c/src/xercesc/validators/datatype/ListDatatypeValidator.cpp", + "xerces-c/src/xercesc/validators/datatype/MonthDatatypeValidator.cpp", + "xerces-c/src/xercesc/validators/datatype/MonthDayDatatypeValidator.cpp", + "xerces-c/src/xercesc/validators/datatype/NameDatatypeValidator.cpp", + "xerces-c/src/xercesc/validators/datatype/NCNameDatatypeValidator.cpp", + "xerces-c/src/xercesc/validators/datatype/NOTATIONDatatypeValidator.cpp", + "xerces-c/src/xercesc/validators/datatype/QNameDatatypeValidator.cpp", + "xerces-c/src/xercesc/validators/datatype/StringDatatypeValidator.cpp", + "xerces-c/src/xercesc/validators/datatype/TimeDatatypeValidator.cpp", + "xerces-c/src/xercesc/validators/datatype/UnionDatatypeValidator.cpp", + "xerces-c/src/xercesc/validators/datatype/XMLCanRepGroup.cpp", + "xerces-c/src/xercesc/validators/datatype/YearDatatypeValidator.cpp", + "xerces-c/src/xercesc/validators/datatype/YearMonthDatatypeValidator.cpp", + "xerces-c/src/xercesc/validators/DTD/DTDAttDef.cpp", + "xerces-c/src/xercesc/validators/DTD/DTDAttDefList.cpp", + "xerces-c/src/xercesc/validators/DTD/DTDElementDecl.cpp", + "xerces-c/src/xercesc/validators/DTD/DTDEntityDecl.cpp", + "xerces-c/src/xercesc/validators/DTD/DTDGrammar.cpp", + "xerces-c/src/xercesc/validators/DTD/DTDScanner.cpp", + "xerces-c/src/xercesc/validators/DTD/DTDValidator.cpp", + "xerces-c/src/xercesc/validators/DTD/XMLDTDDescriptionImpl.cpp", + "xerces-c/src/xercesc/validators/schema/ComplexTypeInfo.cpp", + "xerces-c/src/xercesc/validators/schema/GeneralAttributeCheck.cpp", + "xerces-c/src/xercesc/validators/schema/identity/FieldActivator.cpp", + "xerces-c/src/xercesc/validators/schema/identity/FieldValueMap.cpp", + "xerces-c/src/xercesc/validators/schema/identity/IC_Field.cpp", + "xerces-c/src/xercesc/validators/schema/identity/IC_Key.cpp", + "xerces-c/src/xercesc/validators/schema/identity/IC_KeyRef.cpp", + "xerces-c/src/xercesc/validators/schema/identity/IC_Selector.cpp", + "xerces-c/src/xercesc/validators/schema/identity/IC_Unique.cpp", + "xerces-c/src/xercesc/validators/schema/identity/IdentityConstraint.cpp", + "xerces-c/src/xercesc/validators/schema/identity/IdentityConstraintHandler.cpp", + "xerces-c/src/xercesc/validators/schema/identity/ValueStore.cpp", + "xerces-c/src/xercesc/validators/schema/identity/ValueStoreCache.cpp", + "xerces-c/src/xercesc/validators/schema/identity/XercesXPath.cpp", + "xerces-c/src/xercesc/validators/schema/identity/XPathMatcher.cpp", + "xerces-c/src/xercesc/validators/schema/identity/XPathMatcherStack.cpp", + "xerces-c/src/xercesc/validators/schema/identity/XPathSymbols.cpp", + "xerces-c/src/xercesc/validators/schema/NamespaceScope.cpp", + "xerces-c/src/xercesc/validators/schema/SchemaAttDef.cpp", + "xerces-c/src/xercesc/validators/schema/SchemaAttDefList.cpp", + "xerces-c/src/xercesc/validators/schema/SchemaElementDecl.cpp", + "xerces-c/src/xercesc/validators/schema/SchemaGrammar.cpp", + "xerces-c/src/xercesc/validators/schema/SchemaInfo.cpp", + "xerces-c/src/xercesc/validators/schema/SchemaSymbols.cpp", + "xerces-c/src/xercesc/validators/schema/SchemaValidator.cpp", + "xerces-c/src/xercesc/validators/schema/SubstitutionGroupComparator.cpp", + "xerces-c/src/xercesc/validators/schema/TraverseSchema.cpp", + "xerces-c/src/xercesc/validators/schema/XercesAttGroupInfo.cpp", + "xerces-c/src/xercesc/validators/schema/XercesElementWildcard.cpp", + "xerces-c/src/xercesc/validators/schema/XercesGroupInfo.cpp", + "xerces-c/src/xercesc/validators/schema/XMLSchemaDescriptionImpl.cpp", + "xerces-c/src/xercesc/validators/schema/XSDDOMParser.cpp", + "xerces-c/src/xercesc/validators/schema/XSDErrorReporter.cpp", + "xerces-c/src/xercesc/validators/schema/XSDLocator.cpp", + "xerces-c/src/xercesc/validators/schema/XUtil.cpp", + "xerces-c/src/xercesc/xinclude/XIncludeDOMDocumentProcessor.cpp", + "xerces-c/src/xercesc/xinclude/XIncludeLocation.cpp", + "xerces-c/src/xercesc/xinclude/XIncludeUtils.cpp", + "xerces-c/src/stricmp.c", + "xerces-c/src/strnicmp.c", + "xerces-c/src/xercesc/util/NetAccessors/Socket/SocketNetAccessor.cpp", + "xerces-c/src/xercesc/util/NetAccessors/Socket/UnixHTTPURLInputStream.cpp", + "xerces-c/src/xercesc/util/NetAccessors/BinHTTPInputStreamCommon.cpp", + "xerces-c/src/xercesc/util/Transcoders/ICU/ICUTransService.cpp", + "xerces-c/src/xercesc/util/MsgLoaders/InMemory/InMemMsgLoader.cpp", + "xerces-c/src/xercesc/util/MutexManagers/StdMutexMgr.cpp", + "xerces-c/src/xercesc/util/FileManagers/PosixFileMgr.cpp", + ] + + configs = [ + ":libxerces-c_config" + ] + + deps = [ + "//third_party/icu/icu4c:shared_icuuc", + ] + + part_name = "xerces" +} + +config("samples_config") { + cflags_cc = [ + "-frtti", + "-fexceptions", + "-Wno-header-hygiene", + "-DHAVE_CONFIG_H=1", + "-D_FILE_OFFSET_BITS=64", + "-D_THREAD_SAFE=1", + "-Wno-long-long", + "-Wno-variadic-macros", + "-Wno-misleading-indentation", + "-Wno-main", + "-Wno-unused-variable", + ] + + include_dirs = [ + "xerces-c/samples", + "xerces-c/src", + "xerces-c/samples/src", + "adapted", + ] +} + +ohos_executable("StdInParse") { + sources= [ + "xerces-c/samples/src/StdInParse/StdInParse.cpp", + "xerces-c/samples/src/StdInParse/StdInParseHandlers.cpp", + ] + + configs = [ + ":samples_config" + ] + deps = [ + ":libxerces-c", + ] + + part_name = "xerces" +} + +ohos_executable("SEnumVal") { + sources= [ + "xerces-c/samples/src/SEnumVal/SEnumVal.cpp", + ] + + configs = [ + ":samples_config" + ] + deps = [ + ":libxerces-c", + ] + + part_name = "xerces" +} + +ohos_executable("CreateDOMDocument") { + sources= [ + "xerces-c/samples/src/CreateDOMDocument/CreateDOMDocument.cpp", + ] + + configs = [ + ":samples_config" + ] + deps = [ + ":libxerces-c", + ] + + part_name = "xerces" +} + +ohos_executable("SCMPrint") { + sources= [ + "xerces-c/samples/src/SCMPrint/SCMPrint.cpp", + ] + + configs = [ + ":samples_config" + ] + deps = [ + ":libxerces-c" + ] + + part_name = "xerces" +} + +ohos_executable("XInclude") { + sources= [ + "xerces-c/samples/src/XInclude/XInclude.cpp", + ] + + configs = [ + ":samples_config" + ] + deps = [ + ":libxerces-c", + ] + + part_name = "xerces" +} + +ohos_executable("DOMCount") { + sources= [ + "xerces-c/samples/src/DOMCount/DOMCount.cpp", + ] + + configs = [ + ":samples_config" + ] + deps = [ + ":libxerces-c", + ] + + part_name = "xerces" +} + +ohos_executable("EnumVal") { + sources= [ + "xerces-c/samples/src/EnumVal/EnumVal.cpp", + ] + + configs = [ + ":samples_config" + ] + deps = [ + ":libxerces-c", + ] + + part_name = "xerces" +} + +ohos_executable("PSVIWriter") { + sources= [ + "xerces-c/samples/src/PSVIWriter/PSVIWriter.cpp", + "xerces-c/samples/src/PSVIWriter/PSVIWriterHandlers.cpp", + ] + + configs = [ + ":samples_config" + ] + deps = [ + ":libxerces-c", + ] + + part_name = "xerces" +} + +ohos_executable("MemParse") { + sources= [ + "xerces-c/samples/src/MemParse/MemParse.cpp", + "xerces-c/samples/src/MemParse/MemParseHandlers.cpp", + ] + + configs = [ + ":samples_config" + ] + deps = [ + ":libxerces-c", + ] + + part_name = "xerces" +} + +ohos_executable("DOMPrint") { + sources= [ + "xerces-c/samples/src/DOMPrint/DOMPrint.cpp", + "xerces-c/samples/src/DOMPrint/DOMPrintErrorHandler.cpp", + "xerces-c/samples/src/DOMPrint/DOMPrintFilter.cpp", + "xerces-c/samples/src/DOMPrint/DOMTreeErrorReporter.cpp", + ] + + configs = [ + ":samples_config" + ] + deps = [ + ":libxerces-c", + ] + + part_name = "xerces" +} + +ohos_executable("Redirect") { + sources= [ + "xerces-c/samples/src/Redirect/Redirect.cpp", + "xerces-c/samples/src/Redirect/RedirectHandlers.cpp", + ] + + configs = [ + ":samples_config" + ] + deps = [ + ":libxerces-c", + ] + + part_name = "xerces" +} + +ohos_executable("PParse") { + sources= [ + "xerces-c/samples/src/PParse/PParse.cpp", + "xerces-c/samples/src/PParse/PParseHandlers.cpp", + ] + + configs = [ + ":samples_config" + ] + deps = [ + ":libxerces-c", + ] + + part_name = "xerces" +} + +ohos_executable("SAXCount") { + sources= [ + "xerces-c/samples/src/SAXCount/SAXCount.cpp", + "xerces-c/samples/src/SAXCount/SAXCountHandlers.cpp", + ] + + configs = [ + ":samples_config" + ] + deps = [ + ":libxerces-c", + ] + + part_name = "xerces" +} + +ohos_executable("SAX2Print") { + sources= [ + "xerces-c/samples/src/SAX2Print/SAX2FilterHandlers.cpp", + "xerces-c/samples/src/SAX2Print/SAX2Print.cpp", + "xerces-c/samples/src/SAX2Print/SAX2PrintHandlers.cpp", + ] + + configs = [ + ":samples_config" + ] + deps = [ + ":libxerces-c", + ] + + part_name = "xerces" +} + +ohos_executable("SAX2Count") { + sources= [ + "xerces-c/samples/src/SAX2Count/SAX2Count.cpp", + "xerces-c/samples/src/SAX2Count/SAX2CountHandlers.cpp", + ] + + configs = [ + ":samples_config" + ] + deps = [ + ":libxerces-c", + ] + + part_name = "xerces" +} + +ohos_executable("SAXPrint") { + sources= [ + "xerces-c/samples/src/SAXPrint/SAXPrint.cpp", + "xerces-c/samples/src/SAXPrint/SAXPrintHandlers.cpp", + ] + + configs = [ + ":samples_config" + ] + deps = [ + ":libxerces-c", + ] + + part_name = "xerces" +} + +config("tests_config") { + cflags_cc = [ + "-frtti", + "-fexceptions", + "-Wno-header-hygiene", + "-DHAVE_CONFIG_H=1", + "-D_FILE_OFFSET_BITS=64", + "-D_THREAD_SAFE=1", + "-Wno-implicitly-unsigned-literal", + "-Wno-variadic-macros", + "-fstrict-aliasing", + "-Wno-misleading-indentation", + "-Wno-main", + "-Wno-unused-variable", + ] + + include_dirs = [ + "xerces-c/tests", + "xerces-c/tests/src", + "xerces-c/src", + "xerces-c", + "adapted", + ] +} + +ohos_executable("XSValueTest") { + sources= [ + "xerces-c/tests/src/XSValueTest/XSValueTest.cpp", + ] + + configs = [ + ":tests_config" + ] + deps = [ + ":libxerces-c", + ] + + part_name = "xerces" +} + +ohos_executable("DOMTest") { + sources= [ + "xerces-c/tests/src/DOM/DOMTest/DTest.cpp", + ] + + configs = [ + ":tests_config" + ] + deps = [ + ":libxerces-c", + ] + + part_name = "xerces" +} + +ohos_executable("ThreadTest") { + sources= [ + "xerces-c/tests/src/ThreadTest/ThreadTest.cpp", + ] + + configs = [ + ":tests_config" + ] + deps = [ + ":libxerces-c", + ] + + part_name = "xerces" +} + +ohos_executable("Char16Test") { + sources= [ + "xerces-c/tests/src/Char16Test/Char16Test.cpp", + ] + + configs = [ + ":tests_config" + ] + deps = [ + ":libxerces-c", + ] + + part_name = "xerces" +} + +ohos_executable("DOMMemTest") { + sources= [ + "xerces-c/tests/src/DOM/DOMMemTest/DOMMemTest.cpp", + ] + + configs = [ + ":tests_config" + ] + deps = [ + ":libxerces-c", + ] + + part_name = "xerces" +} + +ohos_executable("DOMTraversalTest") { + sources= [ + "xerces-c/tests/src/DOM/Traversal/Traversal.cpp", + ] + + configs = [ + ":tests_config" + ] + deps = [ + ":libxerces-c", + ] + + part_name = "xerces" +} + +ohos_executable("XSerializerTest") { + sources= [ + "xerces-c/tests/src/XSerializerTest/XSerializerHandlers.cpp", + "xerces-c/tests/src/XSerializerTest/XSerializerTest.cpp", + ] + + configs = [ + ":tests_config" + ] + deps = [ + ":libxerces-c", + ] + + part_name = "xerces" +} + +ohos_executable("RangeTest") { + sources= [ + "xerces-c/tests/src/DOM/RangeTest/RangeTest.cpp", + ] + + configs = [ + ":tests_config" + ] + deps = [ + ":libxerces-c", + ] + + part_name = "xerces" +} + +ohos_executable("InitTermTest") { + sources= [ + "xerces-c/tests/src/InitTermTest/InitTermTest.cpp", + ] + + configs = [ + ":tests_config" + ] + deps = [ + ":libxerces-c", + ] + + part_name = "xerces" +} + +ohos_executable("DOMTypeInfoTest") { + sources= [ + "xerces-c/tests/src/DOM/TypeInfo/TypeInfo.cpp", + ] + + configs = [ + ":tests_config" + ] + deps = [ + ":libxerces-c", + ] + + part_name = "xerces" +} + +ohos_executable("XSTSHarness") { + sources= [ + "xerces-c/tests/src/XSTSHarness/XSTSHarness.cpp", + "xerces-c/tests/src/XSTSHarness/XSTSHarnessHandlers.cpp", + "xerces-c/tests/src/XSTSHarness/XMLHarnessHandlers.cpp", + ] + + configs = [ + ":tests_config" + ] + deps = [ + ":libxerces-c", + ] + + part_name = "xerces" +} + +ohos_executable("EncodingTest") { + sources= [ + "xerces-c/tests/src/EncodingTest/EncodingTest.cpp", + ] + + configs = [ + ":tests_config" + ] + deps = [ + ":libxerces-c", + ] + + part_name = "xerces" +} + +ohos_executable("Normalizer") { + sources= [ + "xerces-c/tests/src/DOM/Normalizer/Normalizer.cpp", + ] + + configs = [ + ":tests_config" + ] + deps = [ + ":libxerces-c", + ] + + part_name = "xerces" +} + +ohos_executable("MemHandlerTest") { + sources= [ + "xerces-c/tests/src/MemHandlerTest/MemoryMonitor.cpp", + ] + + configs = [ + ":tests_config" + ] + deps = [ + ":libxerces-c", + ] + + part_name = "xerces" +} + +ohos_executable("NetAccessorTest") { + sources= [ + "xerces-c/tests/src/NetAccessorTest/NetAccessorTest.cpp", + ] + + configs = [ + ":tests_config" + ] + deps = [ + ":libxerces-c", + ] + + part_name = "xerces" +} + +group("samples") { + +if(enable_xerces_test) { + deps = [ + ":StdInParse", + ":SEnumVal", + ":CreateDOMDocument", + ":SCMPrint", + ":XInclude", + ":DOMCount", + ":EnumVal", + ":PSVIWriter", + ":MemParse", + ":DOMPrint", + ":Redirect", + ":PParse", + ":SAXCount", + ":SAX2Print", + ":SAX2Count", + ":SAXPrint", + ] +} else { + deps = [] +} +} + +group("tests") { + +if(enable_xerces_test){ + deps = [ + ":XSValueTest", + ":DOMTest", + ":ThreadTest", + ":Char16Test", + ":DOMMemTest", + ":DOMTraversalTest", + ":XSerializerTest", + ":RangeTest", + ":InitTermTest", + ":DOMTypeInfoTest", + ":XSTSHarness", + ":EncodingTest", + ":Normalizer", + ":MemHandlerTest", + ":NetAccessorTest", + ] +}else { + deps = [] +} +} diff --git a/community/xerces-c/CMakeLists.txt b/community/xerces-c/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..af46d95cdb55e203c4000f912439ab05dca11139 --- /dev/null +++ b/community/xerces-c/CMakeLists.txt @@ -0,0 +1,345 @@ +cmake_minimum_required(VERSION 3.4.1) +set(CMAKE_CXX_STANDARD 17) +project(xerces) + +set(CMAKE_BUILD_WITH_INSTALL_RPATH true) +if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../icu") +option(ICUUC "add ICUUC library for XML transcode" ON) +endif() + +if(ICUUC) +set(LibIcuSrc "${CMAKE_CURRENT_SOURCE_DIR}/../icu/icu4c/source") +set(icustubdata "${CMAKE_CURRENT_SOURCE_DIR}/../icu/icu4c/source/stubdata/stubdata.cpp") +aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/../icu/icu4c/source/common icucommon) +add_library(icuuc SHARED ${icucommon} ${icustubdata}) +target_compile_definitions(icuuc PRIVATE -DU_ATTRIBUTE_DEPRECATED= + -DU_COMMON_IMPLEMENTATION + -DUPRV_BLOCK_MACRO_BEGIN= + -DUPRV_BLOCK_MACRO_END= + -DUCONFIG_USE_WINDOWS_LCID_MAPPING_API=0 + -D_REENTRANT) +target_include_directories(icuuc PRIVATE ${LibIcuSrc} ${LibIcuSrc}/common ${LibIcuSrc}/i18n) +endif() + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-memset-transposed-args -fPIC -std=c++17 -Wno-unused-command-line-argument -frtti -fexceptions") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -Wno-unused-command-line-argument") + +set(xerces_src "xerces-c/src/xercesc/util/Base64.cpp" + "xerces-c/src/xercesc/util/BinFileInputStream.cpp" + "xerces-c/src/xercesc/util/BinInputStream.cpp" + "xerces-c/src/xercesc/util/BinMemInputStream.cpp" + "xerces-c/src/xercesc/util/BitSet.cpp" + "xerces-c/src/xercesc/util/DefaultPanicHandler.cpp" + "xerces-c/src/xercesc/util/EncodingValidator.cpp" + "xerces-c/src/xercesc/util/HeaderDummy.cpp" + "xerces-c/src/xercesc/util/HexBin.cpp" + "xerces-c/src/xercesc/util/JanitorExports.cpp" + "xerces-c/src/xercesc/util/KVStringPair.cpp" + "xerces-c/src/xercesc/util/Mutexes.cpp" + "xerces-c/src/xercesc/util/PanicHandler.cpp" + "xerces-c/src/xercesc/util/PlatformUtils.cpp" + "xerces-c/src/xercesc/util/PSVIUni.cpp" + "xerces-c/src/xercesc/util/QName.cpp" + "xerces-c/src/xercesc/util/regx/ASCIIRangeFactory.cpp" + "xerces-c/src/xercesc/util/regx/BlockRangeFactory.cpp" + "xerces-c/src/xercesc/util/regx/BMPattern.cpp" + "xerces-c/src/xercesc/util/regx/CharToken.cpp" + "xerces-c/src/xercesc/util/regx/ClosureToken.cpp" + "xerces-c/src/xercesc/util/regx/ConcatToken.cpp" + "xerces-c/src/xercesc/util/regx/Match.cpp" + "xerces-c/src/xercesc/util/regx/Op.cpp" + "xerces-c/src/xercesc/util/regx/OpFactory.cpp" + "xerces-c/src/xercesc/util/regx/ParenToken.cpp" + "xerces-c/src/xercesc/util/regx/ParserForXMLSchema.cpp" + "xerces-c/src/xercesc/util/regx/RangeFactory.cpp" + "xerces-c/src/xercesc/util/regx/RangeToken.cpp" + "xerces-c/src/xercesc/util/regx/RangeTokenMap.cpp" + "xerces-c/src/xercesc/util/regx/RegularExpression.cpp" + "xerces-c/src/xercesc/util/regx/RegxParser.cpp" + "xerces-c/src/xercesc/util/regx/RegxUtil.cpp" + "xerces-c/src/xercesc/util/regx/StringToken.cpp" + "xerces-c/src/xercesc/util/regx/Token.cpp" + "xerces-c/src/xercesc/util/regx/TokenFactory.cpp" + "xerces-c/src/xercesc/util/regx/UnicodeRangeFactory.cpp" + "xerces-c/src/xercesc/util/regx/UnionToken.cpp" + "xerces-c/src/xercesc/util/regx/XMLRangeFactory.cpp" + "xerces-c/src/xercesc/util/regx/XMLUniCharacter.cpp" + "xerces-c/src/xercesc/util/StringPool.cpp" + "xerces-c/src/xercesc/util/SynchronizedStringPool.cpp" + "xerces-c/src/xercesc/util/TransService.cpp" + "xerces-c/src/xercesc/util/XMemory.cpp" + "xerces-c/src/xercesc/util/XML256TableTranscoder.cpp" + "xerces-c/src/xercesc/util/XML88591Transcoder.cpp" + "xerces-c/src/xercesc/util/XMLAbstractDoubleFloat.cpp" + "xerces-c/src/xercesc/util/XMLASCIITranscoder.cpp" + "xerces-c/src/xercesc/util/XMLBigDecimal.cpp" + "xerces-c/src/xercesc/util/XMLBigInteger.cpp" + "xerces-c/src/xercesc/util/XMLChar.cpp" + "xerces-c/src/xercesc/util/XMLChTranscoder.cpp" + "xerces-c/src/xercesc/util/XMLDateTime.cpp" + "xerces-c/src/xercesc/util/XMLDouble.cpp" + "xerces-c/src/xercesc/util/XMLEBCDICTranscoder.cpp" + "xerces-c/src/xercesc/util/XMLException.cpp" + "xerces-c/src/xercesc/util/XMLFloat.cpp" + "xerces-c/src/xercesc/util/XMLIBM1047Transcoder.cpp" + "xerces-c/src/xercesc/util/XMLIBM1140Transcoder.cpp" + "xerces-c/src/xercesc/util/XMLInitializer.cpp" + "xerces-c/src/xercesc/util/XMLMsgLoader.cpp" + "xerces-c/src/xercesc/util/XMLNumber.cpp" + "xerces-c/src/xercesc/util/XMLString.cpp" + "xerces-c/src/xercesc/util/XMLStringTokenizer.cpp" + "xerces-c/src/xercesc/util/XMLUCS4Transcoder.cpp" + "xerces-c/src/xercesc/util/XMLUni.cpp" + "xerces-c/src/xercesc/util/XMLUri.cpp" + "xerces-c/src/xercesc/util/XMLURL.cpp" + "xerces-c/src/xercesc/util/XMLUTF16Transcoder.cpp" + "xerces-c/src/xercesc/util/XMLUTF8Transcoder.cpp" + "xerces-c/src/xercesc/util/XMLWin1252Transcoder.cpp" + "xerces-c/src/xercesc/dom/DOMException.cpp" + "xerces-c/src/xercesc/dom/DOMLSException.cpp" + "xerces-c/src/xercesc/dom/DOMRangeException.cpp" + "xerces-c/src/xercesc/dom/DOMXPathException.cpp" + "xerces-c/src/xercesc/dom/impl/DOMAttrImpl.cpp" + "xerces-c/src/xercesc/dom/impl/DOMAttrMapImpl.cpp" + "xerces-c/src/xercesc/dom/impl/DOMAttrNSImpl.cpp" + "xerces-c/src/xercesc/dom/impl/DOMCDATASectionImpl.cpp" + "xerces-c/src/xercesc/dom/impl/DOMCharacterDataImpl.cpp" + "xerces-c/src/xercesc/dom/impl/DOMChildNode.cpp" + "xerces-c/src/xercesc/dom/impl/DOMCommentImpl.cpp" + "xerces-c/src/xercesc/dom/impl/DOMConfigurationImpl.cpp" + "xerces-c/src/xercesc/dom/impl/DOMDeepNodeListImpl.cpp" + "xerces-c/src/xercesc/dom/impl/DOMDocumentFragmentImpl.cpp" + "xerces-c/src/xercesc/dom/impl/DOMDocumentImpl.cpp" + "xerces-c/src/xercesc/dom/impl/DOMDocumentTypeImpl.cpp" + "xerces-c/src/xercesc/dom/impl/DOMElementImpl.cpp" + "xerces-c/src/xercesc/dom/impl/DOMElementNSImpl.cpp" + "xerces-c/src/xercesc/dom/impl/DOMEntityImpl.cpp" + "xerces-c/src/xercesc/dom/impl/DOMEntityReferenceImpl.cpp" + "xerces-c/src/xercesc/dom/impl/DOMErrorImpl.cpp" + "xerces-c/src/xercesc/dom/impl/DOMImplementationImpl.cpp" + "xerces-c/src/xercesc/dom/impl/DOMImplementationListImpl.cpp" + "xerces-c/src/xercesc/dom/impl/DOMImplementationRegistry.cpp" + "xerces-c/src/xercesc/dom/impl/DOMLocatorImpl.cpp" + "xerces-c/src/xercesc/dom/impl/DOMNamedNodeMapImpl.cpp" + "xerces-c/src/xercesc/dom/impl/DOMNodeIDMap.cpp" + "xerces-c/src/xercesc/dom/impl/DOMNodeImpl.cpp" + "xerces-c/src/xercesc/dom/impl/DOMNodeIteratorImpl.cpp" + "xerces-c/src/xercesc/dom/impl/DOMNodeListImpl.cpp" + "xerces-c/src/xercesc/dom/impl/DOMNodeVector.cpp" + "xerces-c/src/xercesc/dom/impl/DOMNormalizer.cpp" + "xerces-c/src/xercesc/dom/impl/DOMNotationImpl.cpp" + "xerces-c/src/xercesc/dom/impl/DOMParentNode.cpp" + "xerces-c/src/xercesc/dom/impl/DOMProcessingInstructionImpl.cpp" + "xerces-c/src/xercesc/dom/impl/DOMRangeImpl.cpp" + "xerces-c/src/xercesc/dom/impl/DOMStringListImpl.cpp" + "xerces-c/src/xercesc/dom/impl/DOMStringPool.cpp" + "xerces-c/src/xercesc/dom/impl/DOMTextImpl.cpp" + "xerces-c/src/xercesc/dom/impl/DOMTreeWalkerImpl.cpp" + "xerces-c/src/xercesc/dom/impl/DOMTypeInfoImpl.cpp" + "xerces-c/src/xercesc/dom/impl/DOMLSSerializerImpl.cpp" + "xerces-c/src/xercesc/dom/impl/DOMLSInputImpl.cpp" + "xerces-c/src/xercesc/dom/impl/DOMLSOutputImpl.cpp" + "xerces-c/src/xercesc/dom/impl/DOMXPathExpressionImpl.cpp" + "xerces-c/src/xercesc/dom/impl/DOMXPathNSResolverImpl.cpp" + "xerces-c/src/xercesc/dom/impl/DOMXPathResultImpl.cpp" + "xerces-c/src/xercesc/dom/impl/XSDElementNSImpl.cpp" + "xerces-c/src/xercesc/framework/BinOutputStream.cpp" + "xerces-c/src/xercesc/framework/LocalFileFormatTarget.cpp" + "xerces-c/src/xercesc/framework/LocalFileInputSource.cpp" + "xerces-c/src/xercesc/framework/MemBufFormatTarget.cpp" + "xerces-c/src/xercesc/framework/MemBufInputSource.cpp" + "xerces-c/src/xercesc/framework/psvi/PSVIAttribute.cpp" + "xerces-c/src/xercesc/framework/psvi/PSVIAttributeList.cpp" + "xerces-c/src/xercesc/framework/psvi/PSVIElement.cpp" + "xerces-c/src/xercesc/framework/psvi/PSVIItem.cpp" + "xerces-c/src/xercesc/framework/psvi/XSAnnotation.cpp" + "xerces-c/src/xercesc/framework/psvi/XSAttributeDeclaration.cpp" + "xerces-c/src/xercesc/framework/psvi/XSAttributeGroupDefinition.cpp" + "xerces-c/src/xercesc/framework/psvi/XSAttributeUse.cpp" + "xerces-c/src/xercesc/framework/psvi/XSComplexTypeDefinition.cpp" + "xerces-c/src/xercesc/framework/psvi/XSElementDeclaration.cpp" + "xerces-c/src/xercesc/framework/psvi/XSFacet.cpp" + "xerces-c/src/xercesc/framework/psvi/XSIDCDefinition.cpp" + "xerces-c/src/xercesc/framework/psvi/XSModel.cpp" + "xerces-c/src/xercesc/framework/psvi/XSModelGroup.cpp" + "xerces-c/src/xercesc/framework/psvi/XSModelGroupDefinition.cpp" + "xerces-c/src/xercesc/framework/psvi/XSMultiValueFacet.cpp" + "xerces-c/src/xercesc/framework/psvi/XSNamespaceItem.cpp" + "xerces-c/src/xercesc/framework/psvi/XSNotationDeclaration.cpp" + "xerces-c/src/xercesc/framework/psvi/XSObject.cpp" + "xerces-c/src/xercesc/framework/psvi/XSParticle.cpp" + "xerces-c/src/xercesc/framework/psvi/XSSimpleTypeDefinition.cpp" + "xerces-c/src/xercesc/framework/psvi/XSTypeDefinition.cpp" + "xerces-c/src/xercesc/framework/psvi/XSValue.cpp" + "xerces-c/src/xercesc/framework/psvi/XSWildcard.cpp" + "xerces-c/src/xercesc/framework/StdInInputSource.cpp" + "xerces-c/src/xercesc/framework/StdOutFormatTarget.cpp" + "xerces-c/src/xercesc/framework/URLInputSource.cpp" + "xerces-c/src/xercesc/framework/Wrapper4DOMLSInput.cpp" + "xerces-c/src/xercesc/framework/Wrapper4InputSource.cpp" + "xerces-c/src/xercesc/framework/XMLAttDef.cpp" + "xerces-c/src/xercesc/framework/XMLAttDefList.cpp" + "xerces-c/src/xercesc/framework/XMLAttr.cpp" + "xerces-c/src/xercesc/framework/XMLBuffer.cpp" + "xerces-c/src/xercesc/framework/XMLBufferMgr.cpp" + "xerces-c/src/xercesc/framework/XMLContentModel.cpp" + "xerces-c/src/xercesc/framework/XMLDTDDescription.cpp" + "xerces-c/src/xercesc/framework/XMLElementDecl.cpp" + "xerces-c/src/xercesc/framework/XMLEntityDecl.cpp" + "xerces-c/src/xercesc/framework/XMLFormatter.cpp" + "xerces-c/src/xercesc/framework/XMLGrammarDescription.cpp" + "xerces-c/src/xercesc/framework/XMLGrammarPoolImpl.cpp" + "xerces-c/src/xercesc/framework/XMLNotationDecl.cpp" + "xerces-c/src/xercesc/framework/XMLRecognizer.cpp" + "xerces-c/src/xercesc/framework/XMLRefInfo.cpp" + "xerces-c/src/xercesc/framework/XMLSchemaDescription.cpp" + "xerces-c/src/xercesc/framework/XMLValidator.cpp" + "xerces-c/src/xercesc/internal/BinFileOutputStream.cpp" + "xerces-c/src/xercesc/internal/BinMemOutputStream.cpp" + "xerces-c/src/xercesc/internal/DGXMLScanner.cpp" + "xerces-c/src/xercesc/internal/ElemStack.cpp" + "xerces-c/src/xercesc/internal/IGXMLScanner.cpp" + "xerces-c/src/xercesc/internal/IGXMLScanner2.cpp" + "xerces-c/src/xercesc/internal/MemoryManagerImpl.cpp" + "xerces-c/src/xercesc/internal/ReaderMgr.cpp" + "xerces-c/src/xercesc/internal/SGXMLScanner.cpp" + "xerces-c/src/xercesc/internal/ValidationContextImpl.cpp" + "xerces-c/src/xercesc/internal/VecAttributesImpl.cpp" + "xerces-c/src/xercesc/internal/VecAttrListImpl.cpp" + "xerces-c/src/xercesc/internal/WFXMLScanner.cpp" + "xerces-c/src/xercesc/internal/XMLReader.cpp" + "xerces-c/src/xercesc/internal/XMLScanner.cpp" + "xerces-c/src/xercesc/internal/XMLScannerResolver.cpp" + "xerces-c/src/xercesc/internal/XProtoType.cpp" + "xerces-c/src/xercesc/internal/XSAXMLScanner.cpp" + "xerces-c/src/xercesc/internal/XSerializeEngine.cpp" + "xerces-c/src/xercesc/internal/XSObjectFactory.cpp" + "xerces-c/src/xercesc/internal/XTemplateSerializer.cpp" + "xerces-c/src/xercesc/parsers/AbstractDOMParser.cpp" + "xerces-c/src/xercesc/parsers/DOMLSParserImpl.cpp" + "xerces-c/src/xercesc/parsers/SAX2XMLFilterImpl.cpp" + "xerces-c/src/xercesc/parsers/SAX2XMLReaderImpl.cpp" + "xerces-c/src/xercesc/parsers/SAXParser.cpp" + "xerces-c/src/xercesc/parsers/XercesDOMParser.cpp" + "xerces-c/src/xercesc/sax/Dummy.cpp" + "xerces-c/src/xercesc/sax/InputSource.cpp" + "xerces-c/src/xercesc/sax/SAXException.cpp" + "xerces-c/src/xercesc/sax/SAXParseException.cpp" + "xerces-c/src/xercesc/sax2/sax2Dummy.cpp" + "xerces-c/src/xercesc/validators/common/AllContentModel.cpp" + "xerces-c/src/xercesc/validators/common/CMAny.cpp" + "xerces-c/src/xercesc/validators/common/CMBinaryOp.cpp" + "xerces-c/src/xercesc/validators/common/CMUnaryOp.cpp" + "xerces-c/src/xercesc/validators/common/ContentLeafNameTypeVector.cpp" + "xerces-c/src/xercesc/validators/common/ContentSpecNode.cpp" + "xerces-c/src/xercesc/validators/common/DFAContentModel.cpp" + "xerces-c/src/xercesc/validators/common/Grammar.cpp" + "xerces-c/src/xercesc/validators/common/GrammarResolver.cpp" + "xerces-c/src/xercesc/validators/common/MixedContentModel.cpp" + "xerces-c/src/xercesc/validators/common/SimpleContentModel.cpp" + "xerces-c/src/xercesc/validators/datatype/AbstractNumericFacetValidator.cpp" + "xerces-c/src/xercesc/validators/datatype/AbstractNumericValidator.cpp" + "xerces-c/src/xercesc/validators/datatype/AbstractStringValidator.cpp" + "xerces-c/src/xercesc/validators/datatype/AnySimpleTypeDatatypeValidator.cpp" + "xerces-c/src/xercesc/validators/datatype/AnyURIDatatypeValidator.cpp" + "xerces-c/src/xercesc/validators/datatype/Base64BinaryDatatypeValidator.cpp" + "xerces-c/src/xercesc/validators/datatype/BooleanDatatypeValidator.cpp" + "xerces-c/src/xercesc/validators/datatype/DatatypeValidator.cpp" + "xerces-c/src/xercesc/validators/datatype/DatatypeValidatorFactory.cpp" + "xerces-c/src/xercesc/validators/datatype/DateDatatypeValidator.cpp" + "xerces-c/src/xercesc/validators/datatype/DateTimeDatatypeValidator.cpp" + "xerces-c/src/xercesc/validators/datatype/DateTimeValidator.cpp" + "xerces-c/src/xercesc/validators/datatype/DayDatatypeValidator.cpp" + "xerces-c/src/xercesc/validators/datatype/DecimalDatatypeValidator.cpp" + "xerces-c/src/xercesc/validators/datatype/DoubleDatatypeValidator.cpp" + "xerces-c/src/xercesc/validators/datatype/DurationDatatypeValidator.cpp" + "xerces-c/src/xercesc/validators/datatype/ENTITYDatatypeValidator.cpp" + "xerces-c/src/xercesc/validators/datatype/FloatDatatypeValidator.cpp" + "xerces-c/src/xercesc/validators/datatype/HexBinaryDatatypeValidator.cpp" + "xerces-c/src/xercesc/validators/datatype/IDDatatypeValidator.cpp" + "xerces-c/src/xercesc/validators/datatype/IDREFDatatypeValidator.cpp" + "xerces-c/src/xercesc/validators/datatype/ListDatatypeValidator.cpp" + "xerces-c/src/xercesc/validators/datatype/MonthDatatypeValidator.cpp" + "xerces-c/src/xercesc/validators/datatype/MonthDayDatatypeValidator.cpp" + "xerces-c/src/xercesc/validators/datatype/NameDatatypeValidator.cpp" + "xerces-c/src/xercesc/validators/datatype/NCNameDatatypeValidator.cpp" + "xerces-c/src/xercesc/validators/datatype/NOTATIONDatatypeValidator.cpp" + "xerces-c/src/xercesc/validators/datatype/QNameDatatypeValidator.cpp" + "xerces-c/src/xercesc/validators/datatype/StringDatatypeValidator.cpp" + "xerces-c/src/xercesc/validators/datatype/TimeDatatypeValidator.cpp" + "xerces-c/src/xercesc/validators/datatype/UnionDatatypeValidator.cpp" + "xerces-c/src/xercesc/validators/datatype/XMLCanRepGroup.cpp" + "xerces-c/src/xercesc/validators/datatype/YearDatatypeValidator.cpp" + "xerces-c/src/xercesc/validators/datatype/YearMonthDatatypeValidator.cpp" + "xerces-c/src/xercesc/validators/DTD/DTDAttDef.cpp" + "xerces-c/src/xercesc/validators/DTD/DTDAttDefList.cpp" + "xerces-c/src/xercesc/validators/DTD/DTDElementDecl.cpp" + "xerces-c/src/xercesc/validators/DTD/DTDEntityDecl.cpp" + "xerces-c/src/xercesc/validators/DTD/DTDGrammar.cpp" + "xerces-c/src/xercesc/validators/DTD/DTDScanner.cpp" + "xerces-c/src/xercesc/validators/DTD/DTDValidator.cpp" + "xerces-c/src/xercesc/validators/DTD/XMLDTDDescriptionImpl.cpp" + "xerces-c/src/xercesc/validators/schema/ComplexTypeInfo.cpp" + "xerces-c/src/xercesc/validators/schema/GeneralAttributeCheck.cpp" + "xerces-c/src/xercesc/validators/schema/identity/FieldActivator.cpp" + "xerces-c/src/xercesc/validators/schema/identity/FieldValueMap.cpp" + "xerces-c/src/xercesc/validators/schema/identity/IC_Field.cpp" + "xerces-c/src/xercesc/validators/schema/identity/IC_Key.cpp" + "xerces-c/src/xercesc/validators/schema/identity/IC_KeyRef.cpp" + "xerces-c/src/xercesc/validators/schema/identity/IC_Selector.cpp" + "xerces-c/src/xercesc/validators/schema/identity/IC_Unique.cpp" + "xerces-c/src/xercesc/validators/schema/identity/IdentityConstraint.cpp" + "xerces-c/src/xercesc/validators/schema/identity/IdentityConstraintHandler.cpp" + "xerces-c/src/xercesc/validators/schema/identity/ValueStore.cpp" + "xerces-c/src/xercesc/validators/schema/identity/ValueStoreCache.cpp" + "xerces-c/src/xercesc/validators/schema/identity/XercesXPath.cpp" + "xerces-c/src/xercesc/validators/schema/identity/XPathMatcher.cpp" + "xerces-c/src/xercesc/validators/schema/identity/XPathMatcherStack.cpp" + "xerces-c/src/xercesc/validators/schema/identity/XPathSymbols.cpp" + "xerces-c/src/xercesc/validators/schema/NamespaceScope.cpp" + "xerces-c/src/xercesc/validators/schema/SchemaAttDef.cpp" + "xerces-c/src/xercesc/validators/schema/SchemaAttDefList.cpp" + "xerces-c/src/xercesc/validators/schema/SchemaElementDecl.cpp" + "xerces-c/src/xercesc/validators/schema/SchemaGrammar.cpp" + "xerces-c/src/xercesc/validators/schema/SchemaInfo.cpp" + "xerces-c/src/xercesc/validators/schema/SchemaSymbols.cpp" + "xerces-c/src/xercesc/validators/schema/SchemaValidator.cpp" + "xerces-c/src/xercesc/validators/schema/SubstitutionGroupComparator.cpp" + "xerces-c/src/xercesc/validators/schema/TraverseSchema.cpp" + "xerces-c/src/xercesc/validators/schema/XercesAttGroupInfo.cpp" + "xerces-c/src/xercesc/validators/schema/XercesElementWildcard.cpp" + "xerces-c/src/xercesc/validators/schema/XercesGroupInfo.cpp" + "xerces-c/src/xercesc/validators/schema/XMLSchemaDescriptionImpl.cpp" + "xerces-c/src/xercesc/validators/schema/XSDDOMParser.cpp" + "xerces-c/src/xercesc/validators/schema/XSDErrorReporter.cpp" + "xerces-c/src/xercesc/validators/schema/XSDLocator.cpp" + "xerces-c/src/xercesc/validators/schema/XUtil.cpp" + "xerces-c/src/xercesc/xinclude/XIncludeDOMDocumentProcessor.cpp" + "xerces-c/src/xercesc/xinclude/XIncludeLocation.cpp" + "xerces-c/src/xercesc/xinclude/XIncludeUtils.cpp" + "xerces-c/src/stricmp.c" + "xerces-c/src/strnicmp.c" + "xerces-c/src/xercesc/util/NetAccessors/Socket/SocketNetAccessor.cpp" + "xerces-c/src/xercesc/util/NetAccessors/Socket/UnixHTTPURLInputStream.cpp" + "xerces-c/src/xercesc/util/NetAccessors/BinHTTPInputStreamCommon.cpp" + "xerces-c/src/xercesc/util/Transcoders/ICU/ICUTransService.cpp" + "xerces-c/src/xercesc/util/MsgLoaders/InMemory/InMemMsgLoader.cpp" + "xerces-c/src/xercesc/util/MutexManagers/StdMutexMgr.cpp" + "xerces-c/src/xercesc/util/FileManagers/PosixFileMgr.cpp") +add_library(xerces-c SHARED ${xerces_src}) +target_include_directories(xerces-c PRIVATE + xerces-c + xerces-c/src + adapted) +target_compile_definitions(xerces-c PRIVATE + -DHAVE_CONFIG_H=1 + -DXERCES_BUILDING_LIBRARY=1 + -D_FILE_OFFSET_BITS=64 + -D_THREAD_SAFE=1 + -Dxerces_c_EXPORTS) + +if(ICUUC) +target_link_libraries(xerces-c PRIVATE icuuc) +target_include_directories(xerces-c PRIVATE ${LibIcuSrc}/common) +target_compile_definitions(xerces-c PRIVATE -DXERCES_USE_TRANSCODER_ICU=1) +endif() \ No newline at end of file diff --git a/community/xerces-c/HPKBUILD b/community/xerces-c/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..8311a65f6207a2318da026435a71aa3360f8e67e --- /dev/null +++ b/community/xerces-c/HPKBUILD @@ -0,0 +1,53 @@ +# Contributor: liulihong +# Maintainer: liulihong +pkgname=xerces-c +pkgver=v3.2.4 +pkgrel=0 +pkgdesc="Apache Xerces-C validating XML parser" +url="https://github.com/apache/xerces-c" +archs=("armeabi-v7a" "arm64-v8a") +license=("Apache-2.0 license") +depends=() +makedepends=() + +# 原仓位置:source="https://github.com/apache/$pkgname/archive/refs/tags/$pkgver.tar.gz",因网络原因使用镜像 +source="https://gitee.com/lycium_pkg_mirror/$pkgname/repository/archive/$pkgver.tar.gz" + +autounpack=true +downloadpackage=true + +builddir=$pkgname-$pkgver +packagename=$builddir.tar.gz + +prepare() { + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + PKG_CONFIG_LIBDIR="${pkgconfigpath}" \ + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" \ + -DOHOS_ARCH=$ARCH -B$ARCH-build -S./ -L > $buildlog 2>&1 + $MAKE -C $ARCH-build VERBOSE=1 >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + $MAKE -C $ARCH-build install >> $buildlog 2>&1 + cd $OLDPWD +} + +check() { + echo "The test must be on an OpenHarmony device!" + # real test CMD + # 将安装目录加到 LD_LIBRARY_PATH 环境变量 + # ctest +} + +# 清理环境 +cleanbuild(){ + rm -rf ${PWD}/$builddir #${PWD}/$packagename +} diff --git a/community/xerces-c/README.OpenSource b/community/xerces-c/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..91bb18c7c1cca27c29d6184ea332ebaf5fcf7b35 --- /dev/null +++ b/community/xerces-c/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "xerces-c", + "License": "Apache License V2.0", + "License File": "LICENSE", + "Version Number": "v3.2.4", + "Owner": "huangminzhong2@huawei.com", + "Upstream URL": "https://github.com/apache/xerces-c.git", + "Description": "Apache Xerces-C validating XML parser" + } +] diff --git a/community/xerces-c/README_zh.md b/community/xerces-c/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..12434934baf23f8ae39e2bd3c355482d2c60bdfa --- /dev/null +++ b/community/xerces-c/README_zh.md @@ -0,0 +1,15 @@ +# xerces-c三方库说明 +## 功能简介 +xerces是一个开放源代码的XML语法分析器,它提供了SAX和DOM API。 + +## 三方库版本 +- v3.2.4 + +## 已适配功能 +- 支持sax解析和dom解析 + +## 使用约束 +- [IDE和SDK版本](../../docs/constraint.md) + +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) diff --git a/community/xerces-c/SHA512SUM b/community/xerces-c/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..bfeae7bcbc583a5cf4c85365aeffc2a453767544 --- /dev/null +++ b/community/xerces-c/SHA512SUM @@ -0,0 +1 @@ +6bd4d78a8706c4117023f6cbfa471dbc4b6773311045334fd724f4b3e390c4106e03e9f2a5960c2cf9c971ee653e484039e43472aaa7d58582d504b7eb95861e xerces-c-v3.2.4.tar.gz diff --git a/community/xerces-c/adapted/config.h b/community/xerces-c/adapted/config.h new file mode 100755 index 0000000000000000000000000000000000000000..93ff1a6b4562b25bde04765647aaaf53bbfc054f --- /dev/null +++ b/community/xerces-c/adapted/config.h @@ -0,0 +1,490 @@ +/* config.h.cmake.in. Not generated, but originated from autoheader. */ +/* This file must be kept up-to-date with needed substitutions from config.h.in. */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_CSTDINT */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +#if defined(__cplusplus) && defined(HAVE_CSTDINT) +#include +#elif HAVE_STDINT_H +#include +#elif HAVE_INTTYPES_H +#include +#endif + +/* Define to specify no threading is used */ +/* #undef APP_NO_THREADS */ + +/* Define to 1 if you have the header file. */ +#define HAVE_ARPA_INET_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ARPA_NAMESER_COMPAT_H 1 + +/* define if bool is a built-in type */ +#define HAVE_BOOL 1 + +/* Define to 1 if you have the `catclose' function. */ +#define HAVE_CATCLOSE 1 + +/* Define to 1 if you have the `catgets' function. */ +#define HAVE_CATGETS 1 + +/* Define to 1 if you have the `catopen' function. */ +#define HAVE_CATOPEN 1 + +/* Define to 1 if you have the `clock_gettime' function. */ +#define HAVE_CLOCK_GETTIME 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_CORESERVICES_CORESERVICES_H */ + +/* Define to 1 if you have cpuid.h */ +/* #undef HAVE_CPUID_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_CTYPE_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ENDIAN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ERRNO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_FLOAT_H 1 + +/* Define to 1 if you have the `ftime' function. */ +#define HAVE_FTIME 1 + +/* Define to 1 if you have the `getaddrinfo' function. */ +#define HAVE_GETADDRINFO 1 + +/* Define to 1 if you have the `getcwd' function. */ +#define HAVE_GETCWD 1 + +/* Define to 1 if you have the `gethostbyaddr' function. */ +#define HAVE_GETHOSTBYADDR 1 + +/* Define to 1 if you have the `gethostbyname' function. */ +#define HAVE_GETHOSTBYNAME 1 + +/* Define to 1 if you have the `gettimeofday' function. */ +#define HAVE_GETTIMEOFDAY 1 + +/* Define to 1 if you have the `gmtime_r' function. */ +#define HAVE_GMTIME_R 1 + +/* Define to 1 if you have the `iconv' function. */ +#define HAVE_ICONV 1 + +/* Define to 1 if you have the `iconv_close' function. */ +#define HAVE_ICONV_CLOSE 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ICONV_H 1 + +/* Define to 1 if you have the `iconv_open' function. */ +#define HAVE_ICONV_OPEN 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LANGINFO_H 1 + +/* Define to 1 if you have the `nsl' library (-lnsl). */ +#define HAVE_LIBNSL 1 + +/* Define to 1 if you have the `socket' library (-lsocket). */ +/* #undef HAVE_LIBSOCKET */ + +/* Define to 1 if you have the header file. */ +#define HAVE_LIMITS_H 1 + +/* Define to 1 if you have the `localeconv' function. */ +#define HAVE_LOCALECONV 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LOCALE_H 1 + +/* define if the compiler implements L"widestring" */ +#define HAVE_LSTRING 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_MACHINE_ENDIAN_H */ + +/* Define to 1 if you have the `mblen' function. */ +#define HAVE_MBLEN 1 + +/* Define to 1 if you have the `mbrlen' function. */ +#define HAVE_MBRLEN 1 + +/* Define to 1 if you have the `mbsrtowcs' function. */ +#define HAVE_MBSRTOWCS 1 + +/* Define to 1 if you have the `mbstowcs' function. */ +#define HAVE_MBSTOWCS 1 + +/* Define to 1 if you have the `memmove' function. */ +#define HAVE_MEMMOVE 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the `memset' function. */ +#define HAVE_MEMSET 1 + +/* define if the compiler implements namespaces */ +#define HAVE_NAMESPACES 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_NETDB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_NETINET_IN_H 1 + +/* Define to 1 if you have the `nl_langinfo' function. */ +#define HAVE_NL_LANGINFO 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_NL_TYPES_H 1 + +/* Define to 1 if you have the `pathconf' function. */ +#define HAVE_PATHCONF 1 + +/* Define to 1 if you have the PATH_MAX macro. */ +#define HAVE_PATH_MAX 1 + +/* Define if you have POSIX threads libraries and header files. */ +#define HAVE_PTHREAD 1 + +/* Define to 1 if you have the `realpath' function. */ +#define HAVE_REALPATH 1 + +/* Define to 1 if you have the `setlocale' function. */ +#define HAVE_SETLOCALE 1 + +/* Define to 1 if you have the `snprintf' function. */ +#define HAVE_SNPRINTF 1 + +/* Define to 1 if you have the `socket' function. */ +#define HAVE_SOCKET 1 + +/* Define to 1 if stdbool.h conforms to C99. */ +/* #undef HAVE_STDBOOL_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STDDEF_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDIO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* define if the compiler supports ISO C++ standard library */ +#define HAVE_STD_LIBS 1 + +/* define if the compiler supports the std namespace */ +#define HAVE_STD_NAMESPACE 1 + +/* Define to 1 if you have the `strcasecmp' function. */ +#define HAVE_STRCASECMP 1 + +/* Define to 1 if you have the `strchr' function. */ +#define HAVE_STRCHR 1 + +/* Define to 1 if you have the `strdup' function. */ +#define HAVE_STRDUP 1 + +/* Define to 1 if you have the `stricmp' function. */ +/* #undef HAVE_STRICMP */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strncasecmp' function. */ +#define HAVE_STRNCASECMP 1 + +/* Define to 1 if you have the `strnicmp' function. */ +/* #undef HAVE_STRNICMP */ + +/* Define to 1 if you have the `strrchr' function. */ +#define HAVE_STRRCHR 1 + +/* Define to 1 if you have the `strstr' function. */ +#define HAVE_STRSTR 1 + +/* Define to 1 if you have the `strtol' function. */ +#define HAVE_STRTOL 1 + +/* Define to 1 if you have the `strtoul' function. */ +#define HAVE_STRTOUL 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_PARAM_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SOCKET_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIMEB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the `timegm' function. */ +#define HAVE_TIMEGM 1 + +/* Define to 1 if you have the `towlower' function. */ +#define HAVE_TOWLOWER 1 + +/* Define to 1 if you have the `towupper' function. */ +#define HAVE_TOWUPPER 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_WCHAR_H 1 + +/* Define to 1 if you have the `wcsicmp' function. */ +/* #undef HAVE_WCSICMP */ + +/* Define to 1 if you have the `wcslwr' function. */ +/* #undef HAVE_WCSLWR */ + +/* Define to 1 if you have the `wcsnicmp' function. */ +/* #undef HAVE_WCSNICMP */ + +/* Define to 1 if you have the `wcsrtombs' function. */ +#define HAVE_WCSRTOMBS 1 + +/* Define to 1 if you have the `wcstombs' function. */ +#define HAVE_WCSTOMBS 1 + +/* Define to 1 if you have the `wcsupr' function. */ +/* #undef HAVE_WCSUPR */ + +/* Define to 1 if you have the header file. */ +#define HAVE_WCTYPE_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_WINSOCK2_H */ + +/* Define to 1 if you have to use const char* with iconv, to 0 if you must use + char*. */ +#define ICONV_USES_CONST_POINTER 0 + +/* Define to 1 if your C compiler doesn't accept -c and -o together. */ +/* #undef NO_MINUS_C_MINUS_O */ + +/* Name of package */ +#define PACKAGE "xerces-c" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "xerces-c" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "xerces-c 3.2.3" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "xerces-c" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "3.2.3" + +/* The size of `int', as computed by sizeof. */ +#define SIZEOF_INT 4 + +/* The size of `long', as computed by sizeof. */ +#define SIZEOF_LONG 8 + +/* The size of `long long', as computed by sizeof. */ +#define SIZEOF_LONG_LONG 8 + +/* The size of `short', as computed by sizeof. */ +#define SIZEOF_SHORT 2 + +/* The size of `wchar_t', as computed by sizeof. */ +#define SIZEOF_WCHAR_T 4 + +/* The size of `__int64', as computed by sizeof. */ +#define SIZEOF___INT64 0 + +/* Version number of package */ +#define VERSION "3.2.3" + +/* Define if DLL symbols should be exported */ +/* #undef XERCES_DLL_EXPORT */ + +/* Define if namespaces is supported by the compiler */ +#define XERCES_HAS_CPP_NAMESPACE 1 + +/* Define to have SSE2 instruction support detected at runtime using __cpuid + */ +/* #undef XERCES_HAVE_CPUID_INTRINSIC */ + +/* Define to 1 if you have emmintrin.h */ +/* #undef XERCES_HAVE_EMMINTRIN_H */ + +/* Define to have SSE2 instruction support detected at runtime using + __get_cpuid */ +/* #undef XERCES_HAVE_GETCPUID */ + +/* Define to 1 if you have intrin.h */ +/* #undef XERCES_HAVE_INTRIN_H */ + +/* Define to 1 if we have inttypes.h */ +#define XERCES_HAVE_INTTYPES_H 1 + +/* Define to have SSE2 instruction used at runtime */ +/* #undef XERCES_HAVE_SSE2_INTRINSIC */ + +/* Define to 1 if we have sys/types.h */ +#define XERCES_HAVE_SYS_TYPES_H 1 + +/* Define to have Xerces_autoconf_config.hpp include wchar.h */ +/* #undef XERCES_INCLUDE_WCHAR_H */ + +/* Define if there is support for L"widestring" */ +#define XERCES_LSTRSUPPORT 1 + +/* Define if the isstream library can be included as */ +#define XERCES_NEW_IOSTREAMS 1 + +/* Define to have XMemory.hpp avoid declaring a matching operator delete for + the placement operator new */ +/* #undef XERCES_NO_MATCHING_DELETE_OPERATOR */ + +/* Define if there is no native bool support in this environment */ +/* #undef XERCES_NO_NATIVE_BOOL */ + +/* Define to use backslash as an extra path delimiter character */ +/* #undef XERCES_PATH_DELIMITER_BACKSLASH */ + +/* Define as the platform's export attribute */ +#define XERCES_PLATFORM_EXPORT + +/* Define as the platform's import attribute */ +#define XERCES_PLATFORM_IMPORT + +/* An appropriate signed 16 bit integer type */ +#define XERCES_S16BIT_INT int16_t + +/* An appropriate signed 32 bit integer type */ +#define XERCES_S32BIT_INT int32_t + +/* An appropriate signed 64 bit integer type */ +#define XERCES_S64BIT_INT int64_t + +/* Define as the appropriate SIZE_MAX macro */ +#define XERCES_SIZE_MAX SIZE_MAX + +/* Define as the appropriate size_t type */ +#define XERCES_SIZE_T size_t + +/* Define as the appropriate SSIZE_MAX macro */ +#define XERCES_SSIZE_MAX SSIZE_MAX + +/* Define as the appropriate ssize_t type */ +#define XERCES_SSIZE_T ssize_t + +/* Define if building a static library */ +/* #undef XERCES_STATIC_LIBRARY */ + +/* Define if the std namespace is supported */ +#define XERCES_STD_NAMESPACE 1 + +/* An appropriate unsigned 16 bit integer type */ +#define XERCES_U16BIT_INT uint16_t + +/* An appropriate unsigned 32 bit integer type */ +#define XERCES_U32BIT_INT uint32_t + +/* An appropriate unsigned 64 bit integer type */ +#define XERCES_U64BIT_INT uint64_t + +/* Define to use the POSIX file mgr */ +#define XERCES_USE_FILEMGR_POSIX 1 + +/* Define to use the Windows file mgr */ +/* #undef XERCES_USE_FILEMGR_WINDOWS */ + +/* Define to use the iconv-based MsgLoader */ +/* #undef XERCES_USE_MSGLOADER_ICONV */ + +/* Define to use the ICU-based MsgLoader */ +/* #undef XERCES_USE_MSGLOADER_ICU */ + +/* Define to use the InMemory MsgLoader */ +#define XERCES_USE_MSGLOADER_INMEMORY 1 + +/* Define to use the NoThread mutex mgr */ +/* #undef XERCES_USE_MUTEXMGR_NOTHREAD */ + +/* Define to use the C++11 standard mutex mgr */ +#define XERCES_USE_MUTEXMGR_STD 1 + +/* Define to use the POSIX mutex mgr */ +/* #undef XERCES_USE_MUTEXMGR_POSIX */ + +/* Define to use the Windows mutex mgr */ +/* #undef XERCES_USE_MUTEXMGR_WINDOWS */ + +/* Define to use the Mac OS X CFURL NetAccessor */ +/* #undef XERCES_USE_NETACCESSOR_CFURL */ + +/* Define to use the CURL NetAccessor */ +/* #undef XERCES_USE_NETACCESSOR_CURL */ + +/* Define to use the Sockets-based NetAccessor */ +#define XERCES_USE_NETACCESSOR_SOCKET 1 + +/* Define to use the WinSock NetAccessor */ +/* #undef XERCES_USE_NETACCESSOR_WINSOCK */ + +/* Define to use the GNU iconv transcoder */ +/* #undef XERCES_USE_TRANSCODER_GNUICONV */ + +/* Define to use the iconv transcoder */ +/* #undef XERCES_USE_TRANSCODER_ICONV */ + +/* Define to use the ICU-based transcoder */ +/*#define XERCES_USE_TRANSCODER_ICU 1*/ + +/* Define to use the Mac OS UnicodeConverter-based transcoder */ +/* #undef XERCES_USE_TRANSCODER_MACOSUNICODECONVERTER */ + +/* Define to use the Windows transcoder */ +/* #undef XERCES_USE_TRANSCODER_WINDOWS */ + +/* Define to the 16 bit type used to represent Xerces UTF-16 characters */ +#define XERCES_XMLCH_T char16_t + + diff --git a/community/xerces-c/adapted/xercesc/util/XercesVersion.hpp b/community/xerces-c/adapted/xercesc/util/XercesVersion.hpp new file mode 100755 index 0000000000000000000000000000000000000000..7cf165b8389a1e9cd51fed22bc7714ee832d96ae --- /dev/null +++ b/community/xerces-c/adapted/xercesc/util/XercesVersion.hpp @@ -0,0 +1,219 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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. + */ + +/* + * $Id$ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XERCESVERSION_HPP) +#define XERCESC_INCLUDE_GUARD_XERCESVERSION_HPP + +// --------------------------------------------------------------------------- +// X E R C E S V E R S I O N H E A D E R D O C U M E N T A T I O N + +/** + * User Documentation for Xerces Version Values: + * + * + * + * Xerces Notes: + * + * Xerces Committers Documentation: + * + * Xerces committers normally only need to modify one or two of the + * following macros: + * + * XERCES_VERSION_MAJOR + * XERCES_VERSION_MINOR + * XERCES_VERSION_REVISION + * + * The integer values of these macros define the Xerces version number. All + * other constants and preprocessor macros are automatically generated from + * these three definitions. + * + * The macro XERCES_GRAMMAR_SERIALIZATION_LEVEL has been added so that during + * development if users are using the latest code they can use the grammar + * serialization/deserialization features. Whenever a change is made to the + * serialization code this macro should be incremented. + * + * Xerces User Documentation: + * + * The following sections in the user documentation have examples based upon + * the following three version input values: + * + * #define XERCES_VERSION_MAJOR 19 + * #define XERCES_VERSION_MINOR 3 + * #define XERCES_VERSION_REVISION 74 + * + * The minor and revision (patch level) numbers have two digits of resolution + * which means that '3' becomes '03' in this example. This policy guarantees + * that when using preprocessor macros, version 19.3.74 will be greater than + * version 1.94.74 since the first will expand to 190374 and the second to + * 19474. + * + * Preprocessor Macros: + * + * _XERCES_VERSION defines the primary preprocessor macro that users will + * introduce into their code to perform conditional compilation where the + * version of Xerces is detected in order to enable or disable version + * specific capabilities. The value of _XERCES_VERSION for the above example + * will be 190374. To use it a user would perform an operation such as the + * following: + * + * #if _XERCES_VERSION >= 190374 + * // code specific to new version of Xerces... + * #else + * // old code here... + * #endif + * + * XERCES_FULLVERSIONSTR is a preprocessor macro that expands to a string + * constant whose value, for the above example, will be "19_3_74". + * + * XERCES_FULLVERSIONDOT is a preprocessor macro that expands to a string + * constant whose value, for the above example, will be "19.3.74". + * + * XERCES_VERSIONSTR is a preprocessor macro that expands to a string + * constant whose value, for the above example, will be "19_3". This + * particular macro is very dangerous if it were to be used for comparing + * version numbers since ordering will not be guaranteed. + * + * Xerces_DLLVersionStr is a preprocessor macro that expands to a string + * constant whose value, for the above example, will be "19_3_74". This + * macro is provided for backwards compatibility to pre-1.7 versions of + * Xerces. + * + * String Constants: + * + * gXercesVersionStr is a global string constant whose value corresponds to + * the value "19_3" for the above example. + * + * gXercesFullVersionStr is a global string constant whose value corresponds + * to the value "19_3_74" for the above example. + * + * Numeric Constants: + * + * gXercesMajVersion is a global integer constant whose value corresponds to + * the major version number. For the above example its value will be 19. + * + * gXercesMinVersion is a global integer constant whose value corresponds to + * the minor version number. For the above example its value will be 3. + * + * gXercesRevision is a global integer constant whose value corresponds to + * the revision (patch) version number. For the above example its value will + * be 74. + * + */ + +// --------------------------------------------------------------------------- +// X E R C E S V E R S I O N S P E C I F I C A T I O N + +/** + * MODIFY THESE NUMERIC VALUES TO COINCIDE WITH XERCES VERSION + * AND DO NOT MODIFY ANYTHING ELSE IN THIS VERSION HEADER FILE + */ + +#define XERCES_VERSION_MAJOR 3 +#define XERCES_VERSION_MINOR 2 +#define XERCES_VERSION_REVISION 3 + +/*** + * + * XERCES_GRAMMAR_SERIALIZATION_LEVEL = 4 SchemaAttDef, SchemaElementDecl serialize fPSVIScope + * XERCES_GRAMMAR_SERIALIZATION_LEVEL = 5 XercesStep serializes the axis as an int + * XERCES_GRAMMAR_SERIALIZATION_LEVEL = 6 added fIsExternal to XMLEntityDecl + * XERCES_GRAMMAR_SERIALIZATION_LEVEL = 7 size of line/column fields has changed + * + ***/ +#define XERCES_GRAMMAR_SERIALIZATION_LEVEL 7 + +/** DO NOT MODIFY BELOW THIS LINE */ + +/** + * MAGIC THAT AUTOMATICALLY GENERATES THE FOLLOWING: + * + * Xerces_DLLVersionStr, gXercesVersionStr, gXercesFullVersionStr, + * gXercesMajVersion, gXercesMinVersion, gXercesRevision + */ + +// --------------------------------------------------------------------------- +// T W O A R G U M E N T C O N C A T E N A T I O N M A C R O S + +// two argument concatenation routines +#define CAT2_SEP_UNDERSCORE(a, b) #a "_" #b +#define CAT2_SEP_PERIOD(a, b) #a "." #b +#define CAT2_SEP_NIL(a, b) #a #b +#define CAT2_RAW_NUMERIC(a, b) a ## b + +// two argument macro invokers +#define INVK_CAT2_SEP_UNDERSCORE(a,b) CAT2_SEP_UNDERSCORE(a,b) +#define INVK_CAT2_SEP_PERIOD(a,b) CAT2_SEP_PERIOD(a,b) +#define INVK_CAT2_STR_SEP_NIL(a,b) CAT2_SEP_NIL(a,b) +#define INVK_CAT2_RAW_NUMERIC(a,b) CAT2_RAW_NUMERIC(a,b) + +// --------------------------------------------------------------------------- +// T H R E E A R G U M E N T C O N C A T E N A T I O N M A C R O S + +// three argument concatenation routines +#define CAT3_SEP_UNDERSCORE(a, b, c) #a "_" #b "_" #c +#define CAT3_SEP_PERIOD(a, b, c) #a "." #b "." #c +#define CAT3_SEP_NIL(a, b, c) #a #b #c +#define CAT3_RAW_NUMERIC(a, b, c) a ## b ## c +#define CAT3_RAW_NUMERIC_SEP_UNDERSCORE(a, b, c) a ## _ ## b ## _ ## c + +// three argument macro invokers +#define INVK_CAT3_SEP_UNDERSCORE(a,b,c) CAT3_SEP_UNDERSCORE(a,b,c) +#define INVK_CAT3_SEP_PERIOD(a,b,c) CAT3_SEP_PERIOD(a,b,c) +#define INVK_CAT3_SEP_NIL(a,b,c) CAT3_SEP_NIL(a,b,c) +#define INVK_CAT3_RAW_NUMERIC(a,b,c) CAT3_RAW_NUMERIC(a,b,c) +#define INVK_CAT3_RAW_NUMERIC_SEP_UNDERSCORE(a,b,c) CAT3_RAW_NUMERIC_SEP_UNDERSCORE(a,b,c) + +// --------------------------------------------------------------------------- +// C A L C U L A T E V E R S I O N - E X P A N D E D F O R M + +#define MULTIPLY(factor,value) factor * value +#define CALC_EXPANDED_FORM(a,b,c) ( MULTIPLY(10000,a) + MULTIPLY(100,b) + MULTIPLY(1,c) ) + +// --------------------------------------------------------------------------- +// X E R C E S V E R S I O N I N F O R M A T I O N + +// Xerces version strings; these particular macros cannot be used for +// conditional compilation as they are not numeric constants + +#define XERCES_FULLVERSIONSTR INVK_CAT3_SEP_UNDERSCORE(XERCES_VERSION_MAJOR,XERCES_VERSION_MINOR,XERCES_VERSION_REVISION) +#define XERCES_FULLVERSIONDOT INVK_CAT3_SEP_PERIOD(XERCES_VERSION_MAJOR,XERCES_VERSION_MINOR,XERCES_VERSION_REVISION) +#define XERCES_FULLVERSIONNUM INVK_CAT3_SEP_NIL(XERCES_VERSION_MAJOR,XERCES_VERSION_MINOR,XERCES_VERSION_REVISION) +#define XERCES_VERSIONSTR INVK_CAT2_SEP_UNDERSCORE(XERCES_VERSION_MAJOR,XERCES_VERSION_MINOR) + +// Xerces C++ Namespace string, concatenated with full version string +#define XERCES_PRODUCT xercesc +#define XERCES_CPP_NAMESPACE INVK_CAT3_RAW_NUMERIC_SEP_UNDERSCORE(XERCES_PRODUCT,XERCES_VERSION_MAJOR,XERCES_VERSION_MINOR) + +// original from Xerces header +#define Xerces_DLLVersionStr XERCES_FULLVERSIONSTR + +const char* const gXercesVersionStr = XERCES_VERSIONSTR; +const char* const gXercesFullVersionStr = XERCES_FULLVERSIONSTR; +const unsigned int gXercesMajVersion = XERCES_VERSION_MAJOR; +const unsigned int gXercesMinVersion = XERCES_VERSION_MINOR; +const unsigned int gXercesRevision = XERCES_VERSION_REVISION; + +// Xerces version numeric constants that can be used for conditional +// compilation purposes. + +#define _XERCES_VERSION CALC_EXPANDED_FORM (XERCES_VERSION_MAJOR,XERCES_VERSION_MINOR,XERCES_VERSION_REVISION) + +#endif // XERCESVERSION_HPP diff --git a/community/xerces-c/adapted/xercesc/util/Xerces_autoconf_config.hpp b/community/xerces-c/adapted/xercesc/util/Xerces_autoconf_config.hpp new file mode 100755 index 0000000000000000000000000000000000000000..9769f725d08637fb8f26fc20b7d736f0ab844c32 --- /dev/null +++ b/community/xerces-c/adapted/xercesc/util/Xerces_autoconf_config.hpp @@ -0,0 +1,156 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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. + */ + +/* + * $Id: Xerces_autoconf_config.hpp.in 834826 2009-11-11 10:03:53Z borisk $ + */ + +// +// There are two primary xerces configuration header files: +// +// Xerces_autoconf_config.hpp +// +// For configuration of items that must be accessable +// through public headers. This file has limited information +// and carefully works to avoid collision of macro names, etc. +// +// This file is included by XercesDefs.h. In the event +// of a non-configured platform, a similar header specific +// to the platform will be included instead. +// +// config.h +// +// Generalized cmake-generated header file, with much more +// information, used to supply configuration information +// for use in implementation files. +// +// For CMake-based builds, this header is configured by cmake from the +// .cmake.in template file of the same name. + + +#ifndef XERCES_AUTOCONFIG_CONFIG_HPP +#define XERCES_AUTOCONFIG_CONFIG_HPP + +// --------------------------------------------------------------------------- +// These defines are set by cmake as appropriate for the platform. +// --------------------------------------------------------------------------- +#define XERCES_AUTOCONF 1 +#define XERCES_HAVE_SYS_TYPES_H 1 +#define XERCES_HAVE_CSTDINT 1 +#define XERCES_HAVE_STDINT_H 1 +#define XERCES_HAVE_INTTYPES_H 1 +/* #undef XERCES_HAVE_INTRIN_H */ +/* #undef XERCES_HAVE_EMMINTRIN_H */ +/* #undef XERCES_INCLUDE_WCHAR_H */ + +#define XERCES_S16BIT_INT int16_t +#define XERCES_S32BIT_INT int32_t +#define XERCES_S64BIT_INT int64_t +#define XERCES_U16BIT_INT uint16_t +#define XERCES_U32BIT_INT uint32_t +#define XERCES_U64BIT_INT uint64_t +#define XERCES_XMLCH_T char16_t +#define XERCES_SIZE_T size_t +#define XERCES_SSIZE_T ssize_t + +#define XERCES_HAS_CPP_NAMESPACE 1 +#define XERCES_STD_NAMESPACE 1 +#define XERCES_NEW_IOSTREAMS 1 +/* #undef XERCES_NO_NATIVE_BOOL */ +#define XERCES_LSTRSUPPORT 1 +/* #undef XERCES_MFC_SUPPORT */ + +/* #undef XERCES_HAVE_CPUID_INTRINSIC */ +/* #undef XERCES_HAVE_SSE2_INTRINSIC */ +/* #undef XERCES_HAVE_GETCPUID */ + +/* #undef XERCES_NO_MATCHING_DELETE_OPERATOR */ + +/* #undef XERCES_DLL_EXPORT */ +/* #undef XERCES_STATIC_LIBRARY */ +#define XERCES_PLATFORM_EXPORT +#define XERCES_PLATFORM_IMPORT +#define XERCES_TEMPLATE_EXTERN extern +#ifdef XERCES_DLL_EXPORT +# define DLL_EXPORT +#endif + +// --------------------------------------------------------------------------- +// Include standard headers, if available, that we may rely on below. +// --------------------------------------------------------------------------- +#if defined(__cplusplus) && defined(XERCES_HAVE_CSTDINT) +# include +#endif +#if XERCES_HAVE_STDINT_H +# include +#endif +#if XERCES_HAVE_INTTYPES_H +# include +#endif +#if XERCES_HAVE_SYS_TYPES_H +# include +#endif +#if XERCES_INCLUDE_WCHAR_H +# include +#endif + +// --------------------------------------------------------------------------- +// XMLSize_t is the unsigned integral type. +// --------------------------------------------------------------------------- +typedef XERCES_SIZE_T XMLSize_t; +typedef XERCES_SSIZE_T XMLSSize_t; + +#define XERCES_SIZE_MAX SIZE_MAX +#define XERCES_SSIZE_MAX SSIZE_MAX + +// --------------------------------------------------------------------------- +// Define our version of the XML character +// --------------------------------------------------------------------------- +typedef XERCES_XMLCH_T XMLCh; + +// --------------------------------------------------------------------------- +// Define unsigned 16, 32, and 64 bit integers +// --------------------------------------------------------------------------- +typedef XERCES_U16BIT_INT XMLUInt16; +typedef XERCES_U32BIT_INT XMLUInt32; +typedef XERCES_U64BIT_INT XMLUInt64; + +// --------------------------------------------------------------------------- +// Define signed 16, 32, and 64 bit integers +// --------------------------------------------------------------------------- +typedef XERCES_S16BIT_INT XMLInt16; +typedef XERCES_S32BIT_INT XMLInt32; +typedef XERCES_S64BIT_INT XMLInt64; + +// --------------------------------------------------------------------------- +// XMLFilePos is the type used to represent a file position. +// --------------------------------------------------------------------------- +typedef XMLUInt64 XMLFilePos; + +// --------------------------------------------------------------------------- +// XMLFileLoc is the type used to represent a file location (line/column). +// --------------------------------------------------------------------------- +typedef XMLUInt64 XMLFileLoc; + +// --------------------------------------------------------------------------- +// Force on the Xerces debug token if it is on in the build environment +// --------------------------------------------------------------------------- +#if defined(_DEBUG) +#define XERCES_DEBUG +#endif + +#endif diff --git a/community/xerces-c/bundle.json b/community/xerces-c/bundle.json new file mode 100644 index 0000000000000000000000000000000000000000..0c849472fb48a9b89d8f217c8399ff0fe613cd38 --- /dev/null +++ b/community/xerces-c/bundle.json @@ -0,0 +1,33 @@ +{ + "name": "@ohos/xerces-c", + "description": "Apache Xerces-C validating XML parser", + "version": "v3.2.3", + "license": "Apache License V2.0", + "publishAs": "", + "segment": { + "destPath": "third_party/xerces-c" + }, + "dirs": {}, + "scripts": {}, + "readmePath": { + "en": "README" + }, + "component": { + "name": "xerces", + "subsystem": "thirdparty", + "syscap": [], + "features": [], + "adapted_system_type": ["standard"], + "rom": "", + "ram": "", + "deps": { + "components": [], + "third_party": [] + }, + "build": { + "sub_component": ["//third_party/xerces-c:libxerces-c","//third_party/xerces-c:samples","//third_party/xerces-c:tests"], + "inner_kits": [], + "test": [] + } + } +} diff --git a/community/xerces-c/docs/hap_integrate.md b/community/xerces-c/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..006ad8046da7eec6d32282f0adc004cff62c5fc8 --- /dev/null +++ b/community/xerces-c/docs/hap_integrate.md @@ -0,0 +1,68 @@ +# xerces-c集成到应用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) + +## 编译三方库 +- 下载本仓库 + ``` + git clone https://gitee.com/openharmony-sig/tpc_c_cplusplus.git --depth=1 + ``` + +- 三方库目录结构 + ``` + tpc_c_cplusplus/thirdparty/xerces-c #三方库xerces-c的目录结构如下 + ├── adapted #存放三方库适配需要的代码文件 + ├── BUILD.gn # 构建脚本,支持rom包集成 + ├── docs #三方库相关文档的文件夹 + ├── CmakeLists.txt #构建脚本,支持hap包集成 + ├── bundle.json #三方库组件定义文件 + ├── HPKBUILD #构建脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md + ``` + +- 编译三方库 + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ``` + cd lycium + ./build.sh xerces-c + ``` + +- 三方库头文件及生成的库 + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ``` + xerces-c/arm64-v8a xerces-c/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 +- 拷贝动态库到`\\entry\libs\${OHOS_ARCH}\`目录: + 动态库需要在`\\entry\libs\${OHOS_ARCH}\`目录,才能集成到hap包中,所以需要将对应的so文件拷贝到对应CPU架构的目录 +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的库拷贝到该目录下,如下图所示 + ![xerces-c_install](pic/xerces-c_install.png) +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + ``` + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/libxerces-c-3.2.so) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/xerces-c/${OHOS_ARCH}/include/xercesc) + ``` +## 测试三方库 +三方库的测试使用原库自带的测试用例来做测试,[准备三方库测试环境](../../../lycium/README.md#3ci环境准备) + +进入到构建目录执行ctest运行测试用例,共80个用例如下截图(arm64-v8a-build为构建64位的目录,armeabi-v7a-build为构建32位的目录) + + ![jbigkit_test](pic/xerces-c_ohos_test1.png) + + ![jbigkit_test](pic/xerces-c_ohos_test2.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/community/xerces-c/docs/hap_integrate.old.md b/community/xerces-c/docs/hap_integrate.old.md new file mode 100644 index 0000000000000000000000000000000000000000..a96939eebee877e865aee253993fd0131ff7f297 --- /dev/null +++ b/community/xerces-c/docs/hap_integrate.old.md @@ -0,0 +1,54 @@ +# xerces-c如何集成到应用hap +## 准备应用工程 +本库是基于DevEco Studio 3.0 Release版本,在RK3568开发板上验证的,如果是从未使用过RK3568,可以先查看[润和RK3568开发板标准系统快速上手](https://gitee.com/openharmony-sig/knowledge_demo_temp/tree/master/docs/rk3568_helloworld)。 +### 准备应用开发环境 +开发环境的准备参考:[开发环境准备](https://gitee.com/openharmony-sig/knowledge_demo_temp/blob/master/docs/napi_study/docs/hello_napi.md#%E5%B7%A5%E7%A8%8B%E5%87%86%E5%A4%87) +### 增加构建脚本及配置文件 +- 下载本仓库,并解压 +- 三方库目录结构 + ``` + tpc_c_cplusplus/thirdparty/xerces-c #三方库xerces-c的目录结构如下 + ├── adapted #存放三方库适配需要的代码文件 + ├── docs #存放三方库相关文档的文件夹 + ├── CmakeLists.txt #构建脚本,支持hap包集成 + ├── bundle.json #三方库组件定义文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md + ``` +- 将xerces-c拷贝至工程xxxx/entry/src/main/cpp/thirdparty目录下 +### 准备三方库源码 +- 三方库下载地址:[xerces-c](https://github.com/apache/xerces-c), 版本:v3.2.4 + 解压后修改库文件名为xerces-c,拷贝至工程xxxx/entry/src/main/cpp/thirdparty/xerces-c目录下 +- 依赖库下载地址:[ICU](https://gitee.com/openharmony/third_party_icu.git),版本:OpenHarmony-3.2-Beta3 + 解压后修改库文件名为icu,拷贝至工程xxxx/entry/src/main/cpp/thirdparty目录下 +## 应用中使用三方库 +- 将三方库加入工程中,目录结构如下 + ``` + demo/entry/src/main/cpp + ├── thirdparty #三方库存放目录 + │ ├── xerces-c #三方库xerces-c + │ ├── icu #三方库xerces-c的依赖库 + ├── CMakeLists.txt #工程目录的构建脚本 + ├── ..... #工程目录的其他文件 + ``` +- 在工程顶级CMakeLists.txt中引入三方库,增加如下代码 + ``` + add_subdirectory(thirdparty/xerces-c) #引入子目录下的CMakeLists.txt + target_link_libraries(工程库名 PUBLIC xerces-c) #工程依赖三方库xerces + target_include_directories(工程库名 PRIVATE thirdparty/xerces-c/xerces-c + thirdparty/xerces-c/xerces-c/src + thirdparty/xerces-c/adapted) #增加三方库头文件目录 + ``` +- 三方库接口使用可以参考demo工程 [xerces_demo](https://gitee.com/openharmony-sig/knowledge_demo_temp/tree/master/FA/thirdparty/xerces_demo) +## 编译工程 +编译工程,安装应用可以参考 [应用的安装和运行](https://gitee.com/openharmony-sig/knowledge_demo_temp/blob/master/docs/napi_study/docs/hello_napi.md#%E5%AE%89%E8%A3%85%E8%B0%83%E8%AF%95) +## 运行效果 +- 在 [xerces_demo](https://gitee.com/openharmony-sig/knowledge_demo_temp/tree/master/FA/thirdparty/xerces_demo)中,使用DOM和SAX解析如下图所示数据 +  ![content](pic/content.png) +- 先创建xml文件,然后分析使用两种方式解析,如下图 +  ![hap_xerces_test](pic/hap_xerces_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/community/xerces-c/docs/pic/content.png b/community/xerces-c/docs/pic/content.png new file mode 100644 index 0000000000000000000000000000000000000000..1d9c09d8a7f866fa2ae387bfa841037eb1289960 Binary files /dev/null and b/community/xerces-c/docs/pic/content.png differ diff --git a/community/xerces-c/docs/pic/hap_xerces_test.png b/community/xerces-c/docs/pic/hap_xerces_test.png new file mode 100644 index 0000000000000000000000000000000000000000..9526c5cfc091abeb866d4de6d461014ddc5e648a Binary files /dev/null and b/community/xerces-c/docs/pic/hap_xerces_test.png differ diff --git a/community/xerces-c/docs/pic/result.png b/community/xerces-c/docs/pic/result.png new file mode 100644 index 0000000000000000000000000000000000000000..f11a5572536bdc9e88de6399dd20eddc113bf692 Binary files /dev/null and b/community/xerces-c/docs/pic/result.png differ diff --git a/community/xerces-c/docs/pic/xerces-c_install.png b/community/xerces-c/docs/pic/xerces-c_install.png new file mode 100644 index 0000000000000000000000000000000000000000..81162dafc58fadab7afebb9d7e6f3ca66af36139 Binary files /dev/null and b/community/xerces-c/docs/pic/xerces-c_install.png differ diff --git a/community/xerces-c/docs/pic/xerces-c_ohos_test1.png b/community/xerces-c/docs/pic/xerces-c_ohos_test1.png new file mode 100644 index 0000000000000000000000000000000000000000..d9ae802d5dd53e6b96ba27add8ab0626a1e8a42c Binary files /dev/null and b/community/xerces-c/docs/pic/xerces-c_ohos_test1.png differ diff --git a/community/xerces-c/docs/pic/xerces-c_ohos_test2.png b/community/xerces-c/docs/pic/xerces-c_ohos_test2.png new file mode 100644 index 0000000000000000000000000000000000000000..4646d464708db6d7e00a52e2ba73b2376e8c5235 Binary files /dev/null and b/community/xerces-c/docs/pic/xerces-c_ohos_test2.png differ diff --git a/community/xerces-c/docs/pic/xerces-c_usage.png b/community/xerces-c/docs/pic/xerces-c_usage.png new file mode 100644 index 0000000000000000000000000000000000000000..9777a9e8039a719269fbe09e0c4ba10fcff3085a Binary files /dev/null and b/community/xerces-c/docs/pic/xerces-c_usage.png differ diff --git a/community/xerces-c/docs/rom_integrate.md b/community/xerces-c/docs/rom_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..27ca028956f75ae5d0d874a289020647d7a6449c --- /dev/null +++ b/community/xerces-c/docs/rom_integrate.md @@ -0,0 +1,111 @@ +# xerces-c如何集成到系统Rom +## 准备源码工程 +本库是基于OpenHarmony-v3.2-Beta1版本,在RK3568开发板上验证的,如果是从未使用过RK3568,可以先查看[润和RK3568开发板标准系统快速上手](https://gitee.com/openharmony-sig/knowledge_demo_temp/tree/master/docs/rk3568_helloworld)。 +### 准备系统Rom源码 +系统源码获取请参考:[OpenHarmony源码下载](https://gitee.com/openharmony/docs/blob/OpenHarmony-v3.2-Beta2/zh-cn/release-notes/OpenHarmony-v3.2-beta1.md) +### 增加构建脚本及配置文件 +- 下载本仓库代码 + ``` + cd ~ + git clone git@gitee.com:openharmony-sig/tpc_c_cplusplus.git --depth=1 + ``` +- 三方库目录结构 + ``` + tpc_c_cplusplus/thirdparty/xerces-c #三方库xerces-c的目录结构如下 + ├── adapted #存放三方库适配需要的代码文件 + ├── docs #存放三方库相关文档的文件夹 + ├── BUILD.gn #构建脚本,支持rom包集成 + ├── bundle.json #三方库组件定义文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md + ``` +- 将三方库拷贝到OpenHarmony源码的third_party目录下 + ``` + cp ~/tpc_c_cplusplus/thirdparty/xerces-c ~/openharmony/third_party -rf + ``` +### 准备三方库源码 +``` +cd ~/openharmony/third_party/xerces-c #进入三方库目录 +git clone https://github.com/apache/xerces-c.git -b v3.2.3 #下载三方库源码 +``` +## 系统Rom中引入三方库 +准备完三方库代码后,我们需要将三方库加入到编译构建体系中。标准系统编译构建可以参考文档[标准系统编译构建指导](https://gitee.com/openharmony/docs/blob/OpenHarmony-3.2-Beta1/zh-cn/device-dev/subsystems/subsys-build-standard-large.md) +我们默认三方库是属于OpenHarmony的thirdparty子系统,如果需要自己定义子系统参考文档[如何为三方库组件中添加一个三方库](https://gitee.com/openharmony-sig/knowledge/blob/master/docs/openharmony_getstarted/port_thirdparty/README.md) +新增需要编译的组件,在OpenHarmony源码的vendor/hihope/rk3568/config.json文件中,新增需要编译的组件,如下代码段所示,在thirdparty子系统下面新增xerces组件 + +``` + { + "subsystem": "thirdparty", + "components": [ + { + "component": "musl", + "features": [] + }, + { + "component": "xerces", + "features": [] + } + ] + } + +``` +## 系统Rom中引入三方库测试程序 +如果需要编译测试用例,在OpenHarmony源码的vendor/hihope/rk3568/config.json文件,对应组件的features中打开编译选项,如下 +``` + { + "subsystem": "thirdparty", + "components": [ + { + "component": "musl", + "features": [] + }, + { + "component": "xerces", + "features": ["enable_xerces_test=true"] + } + ] + } +``` +## 编译工程 +在OpenHarmony源码根目录下 +``` +cd ~/openharmony +``` +- 选择平台 + ``` + hb set #hb set 命令会列出所有可选平台,这里我们选择rk3568 + ``` +- 执行编译 + ``` + hb build --target-cpu arm #编译32位系统 + hb build --target-cpu arm64 #编译64位系统 + ``` +- 生成文件的路径,可执行文件和库文件都在out/rk3568/thirdparty/xerces目录下,同时也打包到了镜像中 +## 运行效果 +将编译生成的库和测试文件放到板子上运行,为避免每次将文件推入设备都烧录整个镜像,我们使用hdc_std工具将文件推到开发板上 +- 首先将hdc_std工具编译出来 + 工具编译出来所在路径out/sdk/ohos-sdk/windows/toolchains/hdc_std.exe + + ``` + hb set #源码根目录下使用hb set 选择产品ohos-sdk + hb build #然后编译 + ``` +- 将工具拷贝到Windows,可以为工具目录配置环境变量,也可以在工具所在目录打开windows命令行 +- 将原生库测试需要的所有文件打包成xerces.tar,并拷贝到windows下 +- 将文件推送到开发板,在windows命令行进行如下操作 + ``` + hdc_std shell mount -oremount,rw / #修改系统权限为可读写 + hdc_std file send xerces.tar / #将文件包推入开发板 + hdc_std shell #进入开发板 + tar xvf xerces.tar #解压 + #注意需要将库拷贝到/system/lib 或者/system/lib64目录下 + ``` +- 运行测试程序 + 测试用例非常多,这里演示其中几个用例,如下图 + ![result](pic/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) +- [如何为三方库组件中添加一个三方库](https://gitee.com/openharmony-sig/knowledge/blob/master/docs/openharmony_getstarted/port_thirdparty/README.md) +- [标准系统编译构建指导](https://gitee.com/openharmony/docs/blob/OpenHarmony-3.2-Beta1/zh-cn/device-dev/subsystems/subsys-build-standard-large.md) \ No newline at end of file diff --git a/community/xz/BUILD.gn b/community/xz/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..d46e25d54cc33973faae70fcc12ffb0687341129 --- /dev/null +++ b/community/xz/BUILD.gn @@ -0,0 +1,210 @@ +# Copyright (c) 2019-2022 Huawei Device Co., Ltd. All rights reserved. +# 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. + +import("//build/ohos.gni") +import("//build/ohos/ndk/ndk.gni") + +declare_args() { + enable_xz_test = false +} + +config("xz_config") { + cflags = [ + "-DHAVE_CONFIG_H", + "-DTUKLIB_SYMBOL_PREFIX=lzma_", + "-fvisibility=hidden", + "-fno-builtin", + "-Wall", + "-Wextra", + "-Wvla", + "-Wformat=2", + "-Winit-self", + "-Wmissing-include-dirs", + "-Wstrict-aliasing", + "-Wfloat-equal", + "-Wundef", + "-Wshadow", + "-Wpointer-arith", + "-Wbad-function-cast", + "-Wwrite-strings", + "-Waggregate-return", + "-Wstrict-prototypes", + "-Wold-style-definition", + "-Wmissing-prototypes", + "-Wmissing-declarations", + "-Wmissing-noreturn", + "-Wredundant-decls", + "-Wno-incompatible-pointer-types", + "-fPIC", + "-DPIC", + ] +} + +ohos_shared_library("xz_shared") { + sources = [ + "xz/src/common/tuklib_cpucores.c", + "xz/src/common/tuklib_physmem.c", + "xz/src/liblzma/check/check.c", + "xz/src/liblzma/check/crc32_fast.c", + "xz/src/liblzma/check/crc32_table.c", + "xz/src/liblzma/check/crc64_fast.c", + "xz/src/liblzma/check/crc64_table.c", + "xz/src/liblzma/check/sha256.c", + "xz/src/liblzma/common/alone_decoder.c", + "xz/src/liblzma/common/alone_encoder.c", + "xz/src/liblzma/common/auto_decoder.c", + "xz/src/liblzma/common/block_buffer_decoder.c", + "xz/src/liblzma/common/block_buffer_encoder.c", + "xz/src/liblzma/common/block_decoder.c", + "xz/src/liblzma/common/block_encoder.c", + "xz/src/liblzma/common/block_header_decoder.c", + "xz/src/liblzma/common/block_header_encoder.c", + "xz/src/liblzma/common/block_util.c", + "xz/src/liblzma/common/common.c", + "xz/src/liblzma/common/easy_buffer_encoder.c", + "xz/src/liblzma/common/easy_decoder_memusage.c", + "xz/src/liblzma/common/easy_encoder.c", + "xz/src/liblzma/common/easy_encoder_memusage.c", + "xz/src/liblzma/common/easy_preset.c", + "xz/src/liblzma/common/filter_buffer_decoder.c", + "xz/src/liblzma/common/filter_buffer_encoder.c", + "xz/src/liblzma/common/filter_common.c", + "xz/src/liblzma/common/filter_decoder.c", + "xz/src/liblzma/common/filter_encoder.c", + "xz/src/liblzma/common/filter_flags_decoder.c", + "xz/src/liblzma/common/filter_flags_encoder.c", + "xz/src/liblzma/common/hardware_cputhreads.c", + "xz/src/liblzma/common/hardware_physmem.c", + "xz/src/liblzma/common/index.c", + "xz/src/liblzma/common/index_decoder.c", + "xz/src/liblzma/common/index_encoder.c", + "xz/src/liblzma/common/index_hash.c", + "xz/src/liblzma/common/outqueue.c", + "xz/src/liblzma/common/stream_buffer_decoder.c", + "xz/src/liblzma/common/stream_buffer_encoder.c", + "xz/src/liblzma/common/stream_decoder.c", + "xz/src/liblzma/common/stream_encoder.c", + "xz/src/liblzma/common/stream_encoder_mt.c", + "xz/src/liblzma/common/stream_flags_common.c", + "xz/src/liblzma/common/stream_flags_decoder.c", + "xz/src/liblzma/common/stream_flags_encoder.c", + "xz/src/liblzma/common/vli_decoder.c", + "xz/src/liblzma/common/vli_encoder.c", + "xz/src/liblzma/common/vli_size.c", + "xz/src/liblzma/delta/delta_common.c", + "xz/src/liblzma/delta/delta_decoder.c", + "xz/src/liblzma/delta/delta_encoder.c", + "xz/src/liblzma/lz/lz_decoder.c", + "xz/src/liblzma/lz/lz_encoder.c", + "xz/src/liblzma/lz/lz_encoder_mf.c", + "xz/src/liblzma/lzma/fastpos_table.c", + "xz/src/liblzma/lzma/lzma2_decoder.c", + "xz/src/liblzma/lzma/lzma2_encoder.c", + "xz/src/liblzma/lzma/lzma_decoder.c", + "xz/src/liblzma/lzma/lzma_encoder.c", + "xz/src/liblzma/lzma/lzma_encoder_optimum_fast.c", + "xz/src/liblzma/lzma/lzma_encoder_optimum_normal.c", + "xz/src/liblzma/lzma/lzma_encoder_presets.c", + "xz/src/liblzma/rangecoder/price_table.c", + "xz/src/liblzma/simple/arm.c", + "xz/src/liblzma/simple/armthumb.c", + "xz/src/liblzma/simple/ia64.c", + "xz/src/liblzma/simple/powerpc.c", + "xz/src/liblzma/simple/simple_coder.c", + "xz/src/liblzma/simple/simple_decoder.c", + "xz/src/liblzma/simple/simple_encoder.c", + "xz/src/liblzma/simple/sparc.c", + "xz/src/liblzma/simple/x86.c", + ] + + include_dirs = [ + "//third_party/xz/xz", + "//third_party/xz/adapted", + "//third_party/xz/xz/src/liblzma", + "//third_party/xz/xz/src/liblzma/api", + "//third_party/xz/xz/src/liblzma/lzma", + "//third_party/xz/xz/src/liblzma/common", + "//third_party/xz/xz/src/liblzma/check", + "//third_party/xz/xz/src/liblzma/lz", + "//third_party/xz/xz/src/liblzma/rangecoder", + "//third_party/xz/xz/src/liblzma/api/lzma", + "//third_party/xz/xz/src/liblzma/delta", + "//third_party/xz/xz/src/liblzma/simple", + "//third_party/xz/xz/src/common", + ] + + configs = [ ":xz_config" ] + + part_name = "xz" + + subsystem_name = "thirdparty" +} + +ohos_executable("xz_test") { + sources = [ + "xz//src/xz/message.c", + "xz/src/common/tuklib_exit.c", + "xz/src/common/tuklib_mbstr_fw.c", + "xz/src/common/tuklib_mbstr_width.c", + "xz/src/common/tuklib_open_stdxxx.c", + "xz/src/common/tuklib_progname.c", + "xz/src/xz/args.c", + "xz/src/xz/coder.c", + "xz/src/xz/file_io.c", + "xz/src/xz/hardware.c", + "xz/src/xz/list.c", + "xz/src/xz/main.c", + "xz/src/xz/mytime.c", + "xz/src/xz/options.c", + "xz/src/xz/signals.c", + "xz/src/xz/suffix.c", + "xz/src/xz/util.c", + ] + include_dirs = [ + "xz/src/common/", + "xz/src/liblzma/api", + "//third_party/xz/adapted", + ] + configs = [ ":xz_config" ] + deps = [ ":xz_shared" ] + cflags = [ "-DLOCALEDIR=\"./\"" ] + part_name = "xz" +} + +ohos_executable("xzdec") { + sources = [ + "xz/src/common/tuklib_exit.c", + "xz/src/common/tuklib_progname.c", + "xz/src/xzdec/xzdec.c", + ] + include_dirs = [ + "xz/src/common/", + "xz/src/liblzma/api", + "//third_party/xz/adapted", + ] + configs = [ ":xz_config" ] + deps = [ ":xz_shared" ] + + part_name = "xz" +} + +group("xz") { + deps = [ ":xz_shared" ] + + if (enable_xz_test == true) { + deps += [ + ":xz_test", + ":xzdec", + ] + } +} diff --git a/community/xz/HPKBUILD b/community/xz/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..d98bf7c14eae04e3720e506ebbf33f5c047e3661 --- /dev/null +++ b/community/xz/HPKBUILD @@ -0,0 +1,103 @@ +# 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: Jeff Han +# Maintainer: Jeff Han + +pkgname=xz +pkgver=v5.4.1 +pkgrel=0 +pkgdesc="XZ Utils is free general-purpose data compression software with a high compression ratio. XZ Utils were written for POSIX-like systems, but also work on some not-so-POSIX systems. XZ Utils are the successor to LZMA Utils." +url="https://tukaani.org/xz" +archs=("armeabi-v7a" "arm64-v8a") +license=("Public Domain" "LGPL-2.1" "GPL-2.0" "GPL-3.0") +depends=() +makedepends=() + +# 官方下载地址https://tukaani.org/$pkgname/$pkgname-$pkgver.tar.gz受网络影响可能存在下载失败的情况,现使用gitee镜像可以与官方仓库保持同步 +source="https://gitee.com/lycium_pkg_mirror/$pkgname/repository/archive/$pkgver.zip" + +autounpack=true +downloadpackage=true +buildtools="configure" + +builddir=$pkgname-${pkgver} +packagename=$builddir.zip + +source envset.sh +host= +autogenflags=true + +prepare() { + mkdir -p $builddir/$ARCH-build + if [ $ARCH == "armeabi-v7a" ] + then + setarm32ENV + host=arm-linux + elif [ $ARCH == "arm64-v8a" ] + then + setarm64ENV + host=aarch64-linux + else + echo "${ARCH} not support" + return -1 + fi + if $autogenflags + then + cd $builddir + ./autogen.sh > $publicbuildlog 2>&1 + cd ${OLDPWD} + fi +} + +build() { + cd $builddir/$ARCH-build + PKG_CONFIG_LIBDIR="${pkgconfigpath}" \ + ../configure "$@" --host=$host --disable-xzdec --disable-lzmadec \ + --disable-xz --disable-lzmainfo > $buildlog 2>&1 + $MAKE VERBOSE=1 >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir/$ARCH-build + $MAKE install >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +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 + else + echo "${ARCH} not support" + return -1 + fi +} + +# 清理环境 +cleanbuild(){ + rm -rf ${PWD}/$builddir #${PWD}/$packagename +} diff --git a/community/xz/README.OpenSource b/community/xz/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..7f011841cc22d65be3cef40402e6f56a0f6b537b --- /dev/null +++ b/community/xz/README.OpenSource @@ -0,0 +1,12 @@ +[ + { + "Name": "xz", + "License": "Public Domain and LGPL-2.1 and GPL-2.0 and GPL-3.0", + "License File": ["https://github.com/tukaani-project/xz/blob/v5.4/COPYING","https://github.com/tukaani-project/xz/blob/v5.4/COPYING.GPLv2", + "https://github.com/tukaani-project/xz/blob/v5.4/COPYING.GPLv3","https://github.com/tukaani-project/xz/blob/v5.4/COPYING.LGPLv2.1"], + "Version Number": "5.4.1", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://github.com/tukaani-project/xz/releases/download/v5.4.1/xz-5.4.1.tar.gz", + "Description": "XZ Utils is free general-purpose data compression software with a high compression ratio. " + } +] diff --git a/community/xz/README_zh.md b/community/xz/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..ce58789c03c8ab9cddc1f24cd7f83bcf05b1f6f9 --- /dev/null +++ b/community/xz/README_zh.md @@ -0,0 +1,18 @@ +# xz 三方库说明 + +## 功能简介 + +XZ 是免费的通用数据压缩软件,具有较高的压缩比。 + +## 三方库版本 +- 5.2.6 + +## 已适配功能 +- 完成了 .lzma 格式文件的压缩、解压缩 + +## 使用约束 +- [IDE和SDK版本](../../docs/constraint.md) + +## 集成方式 + +- [应用hap包集成](docs/hap_integrate.md) diff --git a/community/xz/SHA512SUM b/community/xz/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..5bb2b126784d9d8bfb885ccd357fe577b1731ad1 --- /dev/null +++ b/community/xz/SHA512SUM @@ -0,0 +1 @@ +ac99b89d06e7955f506198ec85b871af4b00673c69fd99cf0c1d34341a8447550020300b3b3e077765878e2988a2e4d48b5aaea67bde39417d0e240eb04e1c28 xz-v5.4.1.zip diff --git a/community/xz/adapted/config.h b/community/xz/adapted/config.h new file mode 100644 index 0000000000000000000000000000000000000000..1dd967bf31a2b227b64199bc9c96ec382b3c9beb --- /dev/null +++ b/community/xz/adapted/config.h @@ -0,0 +1,515 @@ +/* config.h. Generated from config.h.in by configure. */ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define if building universal (internal helper macro) */ +/* #undef AC_APPLE_UNIVERSAL_BUILD */ + +/* How many MiB of RAM to assume if the real amount cannot be determined. */ +#define ASSUME_RAM 128 + +/* Define to 1 if translation of program messages to the user's native + language is requested. */ +#define ENABLE_NLS 1 + +/* Define to 1 if bswap_16 is available. */ +/* #undef HAVE_BSWAP_16 */ + +/* Define to 1 if bswap_32 is available. */ +/* #undef HAVE_BSWAP_32 */ + +/* Define to 1 if bswap_64 is available. */ +/* #undef HAVE_BSWAP_64 */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_BYTESWAP_H */ + +/* Define to 1 if Capsicum is available. */ +/* #undef HAVE_CAPSICUM */ + +/* Define to 1 if the system has the type `CC_SHA256_CTX'. */ +/* #undef HAVE_CC_SHA256_CTX */ + +/* Define to 1 if you have the `CC_SHA256_Init' function. */ +/* #undef HAVE_CC_SHA256_INIT */ + +/* Define to 1 if you have the Mac OS X function CFLocaleCopyCurrent in the + CoreFoundation framework. */ +/* #undef HAVE_CFLOCALECOPYCURRENT */ + +/* Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in + the CoreFoundation framework. */ +/* #undef HAVE_CFPREFERENCESCOPYAPPVALUE */ + +/* Define to 1 if crc32 integrity check is enabled. */ +#define HAVE_CHECK_CRC32 1 + +/* Define to 1 if crc64 integrity check is enabled. */ +#define HAVE_CHECK_CRC64 1 + +/* Define to 1 if sha256 integrity check is enabled. */ +#define HAVE_CHECK_SHA256 1 + +/* Define to 1 if you have the `clock_gettime' function. */ +#define HAVE_CLOCK_GETTIME 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_COMMONCRYPTO_COMMONDIGEST_H */ + +/* Define if the GNU dcgettext() function is already present or preinstalled. + */ +#define HAVE_DCGETTEXT 1 + +/* Define to 1 if you have the declaration of `CLOCK_MONOTONIC', and to 0 if + you don't. */ +#define HAVE_DECL_CLOCK_MONOTONIC 1 + +/* Define to 1 if you have the declaration of `program_invocation_name', and + to 0 if you don't. */ +#define HAVE_DECL_PROGRAM_INVOCATION_NAME 1 + +/* Define to 1 if any of HAVE_DECODER_foo have been defined. */ +#define HAVE_DECODERS 1 + +/* Define to 1 if arm decoder is enabled. */ +#define HAVE_DECODER_ARM 1 + +/* Define to 1 if armthumb decoder is enabled. */ +#define HAVE_DECODER_ARMTHUMB 1 + +/* Define to 1 if delta decoder is enabled. */ +#define HAVE_DECODER_DELTA 1 + +/* Define to 1 if ia64 decoder is enabled. */ +#define HAVE_DECODER_IA64 1 + +/* Define to 1 if lzma1 decoder is enabled. */ +#define HAVE_DECODER_LZMA1 1 + +/* Define to 1 if lzma2 decoder is enabled. */ +#define HAVE_DECODER_LZMA2 1 + +/* Define to 1 if powerpc decoder is enabled. */ +#define HAVE_DECODER_POWERPC 1 + +/* Define to 1 if sparc decoder is enabled. */ +#define HAVE_DECODER_SPARC 1 + +/* Define to 1 if x86 decoder is enabled. */ +#define HAVE_DECODER_X86 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if any of HAVE_ENCODER_foo have been defined. */ +#define HAVE_ENCODERS 1 + +/* Define to 1 if arm encoder is enabled. */ +#define HAVE_ENCODER_ARM 1 + +/* Define to 1 if armthumb encoder is enabled. */ +#define HAVE_ENCODER_ARMTHUMB 1 + +/* Define to 1 if delta encoder is enabled. */ +#define HAVE_ENCODER_DELTA 1 + +/* Define to 1 if ia64 encoder is enabled. */ +#define HAVE_ENCODER_IA64 1 + +/* Define to 1 if lzma1 encoder is enabled. */ +#define HAVE_ENCODER_LZMA1 1 + +/* Define to 1 if lzma2 encoder is enabled. */ +#define HAVE_ENCODER_LZMA2 1 + +/* Define to 1 if powerpc encoder is enabled. */ +#define HAVE_ENCODER_POWERPC 1 + +/* Define to 1 if sparc encoder is enabled. */ +#define HAVE_ENCODER_SPARC 1 + +/* Define to 1 if x86 encoder is enabled. */ +#define HAVE_ENCODER_X86 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if you have the `futimens' function. */ +#define HAVE_FUTIMENS 1 + +/* Define to 1 if you have the `futimes' function. */ +/* #undef HAVE_FUTIMES */ + +/* Define to 1 if you have the `futimesat' function. */ +/* #undef HAVE_FUTIMESAT */ + +/* Define to 1 if you have the header file. */ +#define HAVE_GETOPT_H 1 + +/* Define to 1 if you have the `getopt_long' function. */ +#define HAVE_GETOPT_LONG 1 + +/* Define if the GNU gettext() function is already present or preinstalled. */ +#define HAVE_GETTEXT 1 + +/* Define if you have the iconv() function and it works. */ +/* #undef HAVE_ICONV */ + +/* Define to 1 if you have the header file. */ +// #define HAVE_IMMINTRIN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LIMITS_H 1 + +/* Define to 1 if mbrtowc and mbstate_t are properly declared. */ +#define HAVE_MBRTOWC 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 to enable bt2 match finder. */ +#define HAVE_MF_BT2 1 + +/* Define to 1 to enable bt3 match finder. */ +#define HAVE_MF_BT3 1 + +/* Define to 1 to enable bt4 match finder. */ +#define HAVE_MF_BT4 1 + +/* Define to 1 to enable hc3 match finder. */ +#define HAVE_MF_HC3 1 + +/* Define to 1 to enable hc4 match finder. */ +#define HAVE_MF_HC4 1 + +/* Define to 1 if getopt.h declares extern int optreset. */ +/* #undef HAVE_OPTRESET */ + +/* Define to 1 if you have the `posix_fadvise' function. */ +#define HAVE_POSIX_FADVISE 1 + +/* Define to 1 if you have the `pthread_condattr_setclock' function. */ +#define HAVE_PTHREAD_CONDATTR_SETCLOCK 1 + +/* Have PTHREAD_PRIO_INHERIT. */ +#define HAVE_PTHREAD_PRIO_INHERIT 1 + +/* Define to 1 if you have the `SHA256Init' function. */ +/* #undef HAVE_SHA256INIT */ + +/* Define to 1 if the system has the type `SHA256_CTX'. */ +/* #undef HAVE_SHA256_CTX */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SHA256_H */ + +/* Define to 1 if you have the `SHA256_Init' function. */ +/* #undef HAVE_SHA256_INIT */ + +/* Define to 1 if the system has the type `SHA2_CTX'. */ +/* #undef HAVE_SHA2_CTX */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SHA2_H */ + +/* Define to 1 if optimizing for size. */ +/* #undef HAVE_SMALL */ + +/* Define to 1 if stdbool.h conforms to C99. */ +#define HAVE_STDBOOL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if `st_atimensec' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_ATIMENSEC */ + +/* Define to 1 if `st_atimespec.tv_nsec' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC */ + +/* Define to 1 if `st_atim.st__tim.tv_nsec' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_ATIM_ST__TIM_TV_NSEC */ + +/* Define to 1 if `st_atim.tv_nsec' is a member of `struct stat'. */ +#define HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC 1 + +/* Define to 1 if `st_uatime' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_UATIME */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_BYTEORDER_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_CAPSICUM_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_ENDIAN_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_PARAM_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if the system has the type `uintptr_t'. */ +#define HAVE_UINTPTR_T 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the `utime' function. */ +/* #undef HAVE_UTIME */ + +/* Define to 1 if you have the `utimes' function. */ +/* #undef HAVE_UTIMES */ + +/* Define to 1 or 0, depending whether the compiler supports simple visibility + declarations. */ +#define HAVE_VISIBILITY 1 + +/* Define to 1 if you have the `wcwidth' function. */ +#define HAVE_WCWIDTH 1 + +/* Define to 1 if the system has the type `_Bool'. */ +#define HAVE__BOOL 1 + +/* Define to 1 if you have the `_futime' function. */ +/* #undef HAVE__FUTIME */ + +/* Define to 1 if _mm_movemask_epi8 is available. */ +#define HAVE__MM_MOVEMASK_EPI8 1 + +/* Define to 1 if the GNU C extension __builtin_assume_aligned is supported. + */ +#define HAVE___BUILTIN_ASSUME_ALIGNED 1 + +/* Define to 1 if the GNU C extensions __builtin_bswap16/32/64 are supported. + */ +#define HAVE___BUILTIN_BSWAPXX 1 + +/* Define to the sub-directory where libtool stores uninstalled libraries. */ +#define LT_OBJDIR ".libs/" + +/* Define to 1 when using POSIX threads (pthreads). */ +#define MYTHREAD_POSIX 1 + +/* Define to 1 when using Windows Vista compatible threads. This uses features + that are not available on Windows XP. */ +/* #undef MYTHREAD_VISTA */ + +/* Define to 1 when using Windows 95 (and thus XP) compatible threads. This + avoids use of features that were added in Windows Vista. */ +/* #undef MYTHREAD_WIN95 */ + +/* Define to 1 to disable debugging code. */ +#define NDEBUG 1 + +/* Name of package */ +#define PACKAGE "xz" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "lasse.collin@tukaani.org" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "XZ Utils" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "XZ Utils 5.2.6" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "xz" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "https://tukaani.org/xz/" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "5.2.6" + +/* Define to necessary symbol if this constant uses a non-standard name on + your system. */ +/* #undef PTHREAD_CREATE_JOINABLE */ + +/* The size of `size_t', as computed by sizeof. */ +#define SIZEOF_SIZE_T 8 + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define to 1 if the number of available CPU cores can be detected with + cpuset(2). */ +/* #undef TUKLIB_CPUCORES_CPUSET */ + +/* Define to 1 if the number of available CPU cores can be detected with + pstat_getdynamic(). */ +/* #undef TUKLIB_CPUCORES_PSTAT_GETDYNAMIC */ + +/* Define to 1 if the number of available CPU cores can be detected with + sched_getaffinity() */ +#define TUKLIB_CPUCORES_SCHED_GETAFFINITY 1 + +/* Define to 1 if the number of available CPU cores can be detected with + sysconf(_SC_NPROCESSORS_ONLN) or sysconf(_SC_NPROC_ONLN). */ +/* #undef TUKLIB_CPUCORES_SYSCONF */ + +/* Define to 1 if the number of available CPU cores can be detected with + sysctl(). */ +/* #undef TUKLIB_CPUCORES_SYSCTL */ + +/* Define to 1 if the system supports fast unaligned access to 16-bit and + 32-bit integers. */ +#define TUKLIB_FAST_UNALIGNED_ACCESS 1 + +/* Define to 1 if the amount of physical memory can be detected with + _system_configuration.physmem. */ +/* #undef TUKLIB_PHYSMEM_AIX */ + +/* Define to 1 if the amount of physical memory can be detected with + getinvent_r(). */ +/* #undef TUKLIB_PHYSMEM_GETINVENT_R */ + +/* Define to 1 if the amount of physical memory can be detected with + getsysinfo(). */ +/* #undef TUKLIB_PHYSMEM_GETSYSINFO */ + +/* Define to 1 if the amount of physical memory can be detected with + pstat_getstatic(). */ +/* #undef TUKLIB_PHYSMEM_PSTAT_GETSTATIC */ + +/* Define to 1 if the amount of physical memory can be detected with + sysconf(_SC_PAGESIZE) and sysconf(_SC_PHYS_PAGES). */ +#define TUKLIB_PHYSMEM_SYSCONF 1 + +/* Define to 1 if the amount of physical memory can be detected with sysctl(). + */ +/* #undef TUKLIB_PHYSMEM_SYSCTL */ + +/* Define to 1 if the amount of physical memory can be detected with Linux + sysinfo(). */ +/* #undef TUKLIB_PHYSMEM_SYSINFO */ + +/* Define to 1 to use unsafe type punning, e.g. char *x = ...; *(int *)x = + 123; which violates strict aliasing rules and thus is undefined behavior + and might result in broken code. */ +/* #undef TUKLIB_USE_UNSAFE_TYPE_PUNNING */ + +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# define _ALL_SOURCE 1 +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# define _GNU_SOURCE 1 +#endif +/* Enable threading extensions on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# define _POSIX_PTHREAD_SEMANTICS 1 +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# define _TANDEM_SOURCE 1 +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# define __EXTENSIONS__ 1 +#endif + + +/* Version number of package */ +#define VERSION "5.2.6" + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +/* # undef WORDS_BIGENDIAN */ +# endif +#endif + +/* Enable large inode numbers on Mac OS X 10.5. */ +#ifndef _DARWIN_USE_64_BIT_INODE +# define _DARWIN_USE_64_BIT_INODE 1 +#endif + +/* Number of bits in a file offset, on hosts where this is settable. */ +/* #undef _FILE_OFFSET_BITS */ + +/* Define for large files, on AIX-style hosts. */ +/* #undef _LARGE_FILES */ + +/* Define to 1 if on MINIX. */ +/* #undef _MINIX */ + +/* Define to 2 if the system does not provide POSIX.1 features except with + this defined. */ +/* #undef _POSIX_1_SOURCE */ + +/* Define to 1 if you need to in order for `stat' and other things to work. */ +/* #undef _POSIX_SOURCE */ + +/* Define for Solaris 2.5.1 so the uint32_t typedef from , + , or is not used. If the typedef were allowed, the + #define below would cause a syntax error. */ +/* #undef _UINT32_T */ + +/* Define for Solaris 2.5.1 so the uint64_t typedef from , + , or is not used. If the typedef were allowed, the + #define below would cause a syntax error. */ +/* #undef _UINT64_T */ + +/* Define for Solaris 2.5.1 so the uint8_t typedef from , + , or is not used. If the typedef were allowed, the + #define below would cause a syntax error. */ +/* #undef _UINT8_T */ + +/* Define to rpl_ if the getopt replacement functions and variables should be + used. */ +/* #undef __GETOPT_PREFIX */ + +/* Define to the type of a signed integer type of width exactly 32 bits if + such a type exists and the standard includes do not define it. */ +/* #undef int32_t */ + +/* Define to the type of a signed integer type of width exactly 64 bits if + such a type exists and the standard includes do not define it. */ +/* #undef int64_t */ + +/* Define to the type of an unsigned integer type of width exactly 16 bits if + such a type exists and the standard includes do not define it. */ +/* #undef uint16_t */ + +/* Define to the type of an unsigned integer type of width exactly 32 bits if + such a type exists and the standard includes do not define it. */ +/* #undef uint32_t */ + +/* Define to the type of an unsigned integer type of width exactly 64 bits if + such a type exists and the standard includes do not define it. */ +/* #undef uint64_t */ + +/* Define to the type of an unsigned integer type of width exactly 8 bits if + such a type exists and the standard includes do not define it. */ +/* #undef uint8_t */ + +/* Define to the type of an unsigned integer type wide enough to hold a + pointer, if such a type exists, and if the system does not define it. */ +/* #undef uintptr_t */ diff --git a/community/xz/adapted/test_file.sh b/community/xz/adapted/test_file.sh new file mode 100755 index 0000000000000000000000000000000000000000..09237318ec2ad19212fe05b85e39e4354cc765d4 --- /dev/null +++ b/community/xz/adapted/test_file.sh @@ -0,0 +1,74 @@ +# Copyright (c) 2022 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. + +#!/bin/sh +XZ=./xz_test +success=0 +failed=0 + +test -x "$XZ" || XZ= +if test -z "$XZ"; then + echo "NO xz test!!" + exit 77 +fi +echo "" +echo "test good xz files" +for I in ./files/good-*.xz +do + if "$XZ" -dc "$I" > /dev/null; then + let success=$success+1 + else + echo "Good file failed: $I" + let failed=$failed+1 + fi +done + +echo "test bad xz files" +for I in ./files/bad-*.xz +do + if "$XZ" -dc "$I" > /dev/null 2>&1; then + let failed=$failed+1 + echo "Bad file failed: $I" + else + let success=$success+1 + fi +done + +echo "test good lzma files" +for I in ./files/good-*.lzma +do + if "$XZ" -dc "$I" > /dev/null; then + let success=$success+1 + else + echo "Good file failed: $I" + let failed=$failed+1 + fi +done + +echo "test bad lzma files" +for I in ./files/bad-*.lzma +do + if test -n "$XZ" && "$XZ" -dc "$I" > /dev/null 2>&1; then + let failed=$failed+1 + echo "Bad file failed: $I" + else + let success=$success+1 + fi +done +echo "" +let total=$success+$failed +echo "XZ TEST OVER" +echo "test items : $total" +echo "SUCCESS:$success" +echo "FAILED:$failed" +#EOF diff --git a/community/xz/bundle.json b/community/xz/bundle.json new file mode 100644 index 0000000000000000000000000000000000000000..69b6eac1db2729a171ae41438ca5330e6f9f053f --- /dev/null +++ b/community/xz/bundle.json @@ -0,0 +1,33 @@ +{ + "name": "@ohos/xz", + "description": "XZ Utils is free general-purpose data compression software with a high compression ratio.", + "version": "3.1", + "license": "GPLv2", + "publishAs": "code-segment", + "segment": { + "destPath": "third_party/xz" + }, + "dirs": {}, + "scripts": {}, + "readmePath": { + "en": "README" + }, + "component": { + "name": "xz", + "subsystem": "thirdparty", + "syscap": [], + "features": [], + "adapted_system_type": [], + "rom": "", + "ram": "", + "deps": { + "components": [], + "third_party": [] + }, + "build": { + "sub_component": ["//third_party/xz:xz"], + "inner_kits": [], + "test": [] + } + } +} \ No newline at end of file diff --git a/community/xz/docs/hap_integrate.md b/community/xz/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..5d73712d30f95976462a6a06b9832a56ae359cb5 --- /dev/null +++ b/community/xz/docs/hap_integrate.md @@ -0,0 +1,65 @@ +# xz集成到应用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) + +## 编译三方库 +- 下载本仓库 + ``` + git clone https://gitee.com/openharmony-sig/tpc_c_cplusplus.git --depth=1 + ``` + +- 三方库目录结构 + ``` + tpc_c_cplusplus/thirdparty/xz #三方库xz的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── BUILD.gn #gn文件 + ├── bundle.json + ├── HPKBUILD #构建脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md + ``` + +- 编译三方库 + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ``` + cd lycium + ./build.sh xz + ``` + +- 三方库头文件及生成的库 + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ``` + xz/arm64-v8a xz/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的头文件拷贝到该目录下,将编译生成的三方库以及依赖库全部(动态库名字带版本号和不带版本号的都需要)拷贝到工程的libs目录下,如下图所示: +  ![xz_install_dir](pic/xz_install_dir.png) +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + ``` + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/liblzma.so) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/xz/${OHOS_ARCH}/include) + ``` +## 测试三方库 +三方库的测试使用原库自带的测试用例来做测试,[准备三方库测试环境](../../../lycium/README.md#3ci环境准备) + +进入到构建目录执行 ctest 运行测试用例(arm64-v8a-build为构建64位的目录,armeabi-v7a-build为构建32位的目录) + + ![xz_test](pic/xz_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/community/xz/docs/pic/test_result.jpg b/community/xz/docs/pic/test_result.jpg new file mode 100755 index 0000000000000000000000000000000000000000..1b7e4fc7c7b4a566dbcc9d79770b7dabf8407242 Binary files /dev/null and b/community/xz/docs/pic/test_result.jpg differ diff --git a/community/xz/docs/pic/xz_install_dir.png b/community/xz/docs/pic/xz_install_dir.png new file mode 100644 index 0000000000000000000000000000000000000000..42d915bbc25ef5daec97393184fc64688149e4d0 Binary files /dev/null and b/community/xz/docs/pic/xz_install_dir.png differ diff --git a/community/xz/docs/pic/xz_test.png b/community/xz/docs/pic/xz_test.png new file mode 100644 index 0000000000000000000000000000000000000000..2dc217188833a3c1bfffc31f5bcd3c6c2907369b Binary files /dev/null and b/community/xz/docs/pic/xz_test.png differ diff --git a/community/xz/docs/pic/xz_usage.png b/community/xz/docs/pic/xz_usage.png new file mode 100644 index 0000000000000000000000000000000000000000..4585b5c46191237c67e23dfa28b812b5dca318af Binary files /dev/null and b/community/xz/docs/pic/xz_usage.png differ diff --git a/community/xz/docs/rom_integrate.md b/community/xz/docs/rom_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..92d0ddf98f0fd20edac63cdd2c3787adafa32d34 --- /dev/null +++ b/community/xz/docs/rom_integrate.md @@ -0,0 +1,144 @@ +# xz如何集成到系统Rom + +## 准备源码工程 + +本库是基于OpenHarmony-v3.2-Beta1版本,在润和RK3568开发板上验证的。如果是从未使用过RK3568,可以先查看[润和RK3568开发板标准系统快速上手](https://gitee.com/openharmony-sig/knowledge_demo_temp/tree/master/docs/rk3568_helloworld)。 + +## 准备系统Rom源码 + +源码获取方法请参照:[OpenHarmony源码下载](https://gitee.com/openharmony/docs/blob/OpenHarmony-v3.2-Beta1/zh-cn/release-notes/OpenHarmony-v3.2-beta1.md#%E6%BA%90%E7%A0%81%E8%8E%B7%E5%8F%96) + +## 增加构建脚本及配置文件 + +- 下载本仓库代码 + + ```shell + cd ~/ + git clone git@gitee.com:openharmony-sig/tpc_c_cplusplus.git --depth=1 + ``` + +- 三方库目录结构 + + ```shell + cd tpc_c_cplusplus/thirdparty/xz # 进入到仓库代码库目录 + ``` + + ```shell + xz + |-- adapted # 存放三方库适配需要的代码文件 + |-- docs # 存放三方库相关文档的文件夹 + |-- BUILD.gn # 构建脚本,支持rom包集成 + |-- bundle.json # 三方库组件定义文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md + ``` + +- 将本仓库xz文件夹拷贝到third_party下 + + ```shell + cp ~/tpc_c_cplusplus/thirdparty/xz ~/openharmony/third_party/ -arf + ``` + +## 准备三方库源码 + +- 将源码下载到xz目录并将其解压出来。 + +``` shell +cd ~/openharmony/third_party/xz # 进入到xz目录 +git clone https://git.tukaani.org/xz.git -b v5.2.6 # 下载三方库xz 5.26版本代码 +``` + +## 系统Rom中引入三方库 + +准备完三方库代码后,我们需要将三方库加入到编译构建体系中。标准系统编译构建可以参考文档[标准系统编译构建指导](https://gitee.com/openharmony/docs/blob/OpenHarmony-3.2-Beta1/zh-cn/device-dev/subsystems/subsys-build-standard-large.md)。
+我们默认三方库是属于OpenHarmony的thirdparty子系统,如果需要自己定义子系统参考文档[如何为三方库组件中添加一个三方库](https://gitee.com/openharmony-sig/knowledge/blob/master/docs/openharmony_getstarted/port_thirdparty/README.md)
+相关配置已在bundle.json中完成,我们只需要在产品定义中添加xz组件即可。 + +- 在产品配置文件中添加xz的组件
+ 打开//vendor/hihope/rk3568/config.json文件,找到thirdparty子系统并添加xz的组件 + + ``` json + { + "subsystem": "thirdparty", + "components": [ + { + "component": "musl", + "features": [] + }, + { + "component": "xz", + "features": [] + } + ] + }, + ``` + +## 系统Rom中引入三方库测试程序 + +如果需要编译测试用例,在OpenHarmony源码的vendor/hihope/rk356/config.json文件,对应组件的features中打开编译选项,如下 + +``` json + { + "subsystem": "thirdparty", + "components": [ + { + "component": "musl", + "features": [] + }, + { + "component": "xz", + "features": ["enable_xz_test=true"] + } + ] + }, +``` + +## 编译工程 + +- 选择产品 + +```shell +hb set ## hb set 命令会列出所有可选平台,这里我们选择rk3568 +``` + +- 运行编译 + +```shell +hb build --target-cpu arm ## 编译32位系统 +hb build --target-cpu arm64 ## 编译64位系统 +``` + +- 生成文件的路径,可执行文件和库文件都在out/rk3568/thirdparty/xz目录下,同时也打包到了镜像中 + +## 运行效果 + +将编译生成的库和测试文件放到板子上运行,为避免每次将文件推入设备都烧录整个镜像,我们使用hdc_std工具将文件推到开发板上 + +- 首先将hdc_std工具编译出来 + + ```shell + hb set #源码根目录下使用hb set 选择产品ohos-sdk + hb build #最后工具编译出来在out/sdk/ohos-sdk/windows/toolchains/hdc_std.exe + ``` + +- 将工具拷贝到Windows,可以为工具目录配置环境变量,也可以在工具所在目录打开windows命令行 +- 将原生库测试需要的所有文件打包成xz.tar,并拷贝到windows下 +- 将文件推送到开发板,在windows命令行进行如下操作 + + ```shell + hdc_std shell mount -o remount,rw / #修改系统权限为可读写 + hdc_std file send xz.tar / #将文件包推入开发板 + hdc_std shell #进入开发板 + tar xvf xz.tar #解压 + #注意需要将库拷贝到/system/lib 或者/system/lib64目录下 + ``` + +- 运行效果
+ 原生库提供了多个测试脚本,这里以运行测试xz与lzma文件的[test_file.sh](../adapted/test_file.sh)为例显示运行效果,如下图: +  ![result](./pic/test_result.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) diff --git a/community/yaml-cpp-0.6.0/HPKBUILD b/community/yaml-cpp-0.6.0/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..791838837bf4abbf30a7c40d5c1ae3e272e5fd31 --- /dev/null +++ b/community/yaml-cpp-0.6.0/HPKBUILD @@ -0,0 +1,64 @@ +# 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=yaml-cpp +pkgver=yaml-cpp-0.6.0 +pkgrel=0 +pkgdesc="yaml-cpp is a YAML parser and emitter in C++ matching the YAML 1.2 spec." +url="https://github.com/jbeder/yaml-cpp/tree/yaml-cpp-0.6.0" +archs=("armeabi-v7a" "arm64-v8a") +license=("MIT License") +depends=() +makedepends=() +source="https://github.com/jbeder/yaml-cpp/archive/refs/tags/yaml-cpp-0.6.0.zip" + +downloadpackage=true +autounpack=true +buildtools=cmake + +builddir=$pkgname-${pkgver} +packagename=$builddir.zip + +# 为编译设置环境,如设置环境变量,创建编译目录等 +prepare() { + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" -DCMAKE_C_FLAGS="-Wno-unused-command-line-argument" \ + -DCMAKE_CXX_FLAGS="-Wno-unused-command-line-argument" -B$ARCH-build -S./ > $buildlog 2>&1 + $MAKE VERBOSE=1 -C $ARCH-build >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + $MAKE -C $ARCH-build install >> $buildlog 2>&1 + cd $OLDPWD +} + + +check() { + echo "The test must be on an OpenHarmony device!" +} + + +cleanbuild() { + rm -rf ${PWD}/$builddir +} diff --git a/community/yaml-cpp-0.6.0/HPKCHECK b/community/yaml-cpp-0.6.0/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..45087f23bbfe1b9cac2c3352e606b765ef4a975f --- /dev/null +++ b/community/yaml-cpp-0.6.0/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: 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}_${OHOS_SDK_VER}_test.log + + +# 在OH环境执行测试的接口 +openharmonycheck() { + res=0 + cd ${builddir}/${ARCH}-build # 进入到测试目录 + ctest > $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/community/yaml-cpp-0.6.0/README.OpenSource b/community/yaml-cpp-0.6.0/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..f763f2afbba81e83fefa51698a96d02fc84685a3 --- /dev/null +++ b/community/yaml-cpp-0.6.0/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "yaml-cpp-0.6.0", + "License": "MIT License", + "License File": "https://github.com/jbeder/yaml-cpp/blob/master/LICENSE", + "Version Number": "yaml-cpp-0.6.0", + "Owner": "2942375747@qq.com", + "Upstream URL": "https://github.com/jbeder/yaml-cpp", + "Description": "yaml-cpp is a YAML parser and emitter in C++ matching the YAML 1.2 spec." + } +] \ No newline at end of file diff --git a/community/yaml-cpp-0.6.0/README_zh.md b/community/yaml-cpp-0.6.0/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..9ca9ef78b22bbd710d8e7eb6bdca405c5970a4e2 --- /dev/null +++ b/community/yaml-cpp-0.6.0/README_zh.md @@ -0,0 +1,9 @@ +# yaml-cpp-0.6.0三方库说明 +## 功能简介 +yaml-cpp是c++中的YAML解析器和发射器,与YAML 1.2规范相匹配。 +## 三方库版本: +- yaml-cpp-0.6.0 +## 使用约束: +- [IDE和SDK版本](../../docs/constraint.md) +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) \ No newline at end of file diff --git a/community/yaml-cpp-0.6.0/SHA512SUM b/community/yaml-cpp-0.6.0/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..98751bcdf8f50f16cf5f5168ae44c122563990b6 --- /dev/null +++ b/community/yaml-cpp-0.6.0/SHA512SUM @@ -0,0 +1 @@ +78dd0429157578c8e02c9afa5ed99ac204c927536598977a087e45b0187ca3fbbd71944caf37bf204f33227f21d09a3190538b98487a543c424e998f9753a549 yaml-cpp-yaml-cpp-0.6.0.zip \ No newline at end of file diff --git a/community/yaml-cpp-0.6.0/docs/hap_integrate.md b/community/yaml-cpp-0.6.0/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..c12356ce45df06cb50be9dfbac616c769d073a9b --- /dev/null +++ b/community/yaml-cpp-0.6.0/docs/hap_integrate.md @@ -0,0 +1,79 @@ +# yaml-cpp集成到应用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/yaml-cpp-0.6.0 #三方库yaml-cpp-0.6.0的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── HPKCHECK #测试脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md #三方库简介 + ``` + +- 在lycium目录下编译三方库 + + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ```shell + cd lycium + ./build.sh yaml-cpp-0.6.0 + ``` + +- 三方库头文件及生成的库 + + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ```shell + yaml-cpp-0.6.0/arm64-v8a yaml-cpp-0.6.0/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的头文件和静态库文件拷贝到该目录下,如下图所示: +   + +  ![thirdparty_install_dir](pic/yaml-cpp_install_dir.png) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + + ```shell + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/yaml_cpp/${OHOS_ARCH}/lib/libyaml-cpp.a) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/yaml_cpp/${OHOS_ARCH}/include) + ``` + +## 测试三方库 +- 编译出可执行的文件,使用原库自带的测试用例来做测试 [准备三方库测试环境](../../../lycium/README.md#3ci环境准备) +进入到构建目录运行测试用例(注意arm64-v8a为构建64位的目录,armeabi-v7a为构建32位的目录)。执行结果如图所示 + +```shell + cd /data/tpc_c_cplusplus/thirdparty/yaml-cpp-0.6.0/yaml-cpp-yaml-cpp-0.6.0/arm64-v8a-build/ + ctest +``` + ![yaml-cpp_test](pic/yaml-cpp_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/community/yaml-cpp-0.6.0/docs/pic/yaml-cpp_install_dir.png b/community/yaml-cpp-0.6.0/docs/pic/yaml-cpp_install_dir.png new file mode 100644 index 0000000000000000000000000000000000000000..cd7d71d5f1f539bfe0d7e72b41fb10b321341aad Binary files /dev/null and b/community/yaml-cpp-0.6.0/docs/pic/yaml-cpp_install_dir.png differ diff --git a/community/yaml-cpp-0.6.0/docs/pic/yaml-cpp_test.png b/community/yaml-cpp-0.6.0/docs/pic/yaml-cpp_test.png new file mode 100644 index 0000000000000000000000000000000000000000..a3f9ceb87e581f48df3856084a5e8799ed558152 Binary files /dev/null and b/community/yaml-cpp-0.6.0/docs/pic/yaml-cpp_test.png differ diff --git a/community/yyjson-0.6.0/HPKBUILD b/community/yyjson-0.6.0/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..7803806dec769cd58d3554badf5fc948ab49200b --- /dev/null +++ b/community/yyjson-0.6.0/HPKBUILD @@ -0,0 +1,75 @@ +# 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=yyjson-0.6.0 +pkgver=0.6.0 +pkgrel=0 +pkgdesc="yyjson is a high performance JSON library written in ANSI C." +url="https://github.com/ibireme/yyjson/tree/0.6.0" +archs=("armeabi-v7a" "arm64-v8a") +license=("MIT license") +depends=() +makedepends=() +source="https://github.com/ibireme/yyjson/archive/refs/tags/0.6.0.zip" + +downloadpackage=true +autounpack=true +buildtools=cmake +patchflag=true + +builddir=yyjson-0.6.0 +packagename=yyjson-0.6.0.zip + +# 为编译设置环境,如设置环境变量,创建编译目录等 +prepare() { + if $patchflag + then + cd $builddir + #打开构建测试用例的开关 + patch -p1 < `pwd`/../yyjson-0.6.0_oh_pkg.patch + # patch只需要打一次,关闭打patch + patchflag=false + cd $OLDPWD + fi + + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" -DCMAKE_C_FLAGS="-Wno-unused-command-line-argument" \ + -DCMAKE_CXX_FLAGS="-Wno-unused-command-line-argument" -B$ARCH-build -S./ > $buildlog 2>&1 + $MAKE VERBOSE=1 -C $ARCH-build >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + $MAKE -C $ARCH-build install >> $buildlog 2>&1 + cd $OLDPWD +} + + +check() { + echo "The test must be on an OpenHarmony device!" +} + + +cleanbuild() { + rm -rf ${PWD}/$builddir +} \ No newline at end of file diff --git a/community/yyjson-0.6.0/HPKCHECK b/community/yyjson-0.6.0/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..45087f23bbfe1b9cac2c3352e606b765ef4a975f --- /dev/null +++ b/community/yyjson-0.6.0/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: 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}_${OHOS_SDK_VER}_test.log + + +# 在OH环境执行测试的接口 +openharmonycheck() { + res=0 + cd ${builddir}/${ARCH}-build # 进入到测试目录 + ctest > $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/community/yyjson-0.6.0/README.OpenSource b/community/yyjson-0.6.0/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..30ee4f04862e87356845ff0daf48c077ff3ccec8 --- /dev/null +++ b/community/yyjson-0.6.0/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "yyjson-0.6.0", + "License": "MIT License", + "License File": "https://github.com/ibireme/yyjson/blob/master/LICENSE", + "Version Number": "0.6.0", + "Owner": "2942375747@qq.com", + "Upstream URL": "https://github.com/ibireme/yyjson", + "Description": "yyjson is a high performance JSON library written in ANSI C." + } +] \ No newline at end of file diff --git a/community/yyjson-0.6.0/README_zh.md b/community/yyjson-0.6.0/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..7c71e7dc47ee715b7f27c1b30391ef2ee563fa66 --- /dev/null +++ b/community/yyjson-0.6.0/README_zh.md @@ -0,0 +1,9 @@ +# yyjson-0.6.0三方库说明 +## 功能简介 +yyjson是一个用ANSI C编写的高性能JSON库。 +## 三方库版本: +- 0.6.0 +## 使用约束: +- [IDE和SDK版本](../../docs/constraint.md) +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) \ No newline at end of file diff --git a/community/yyjson-0.6.0/SHA512SUM b/community/yyjson-0.6.0/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..ead0ea9e4c8ddd4aed5f93dcc85fe639c9fa0e04 --- /dev/null +++ b/community/yyjson-0.6.0/SHA512SUM @@ -0,0 +1 @@ +a2ca7d5af295b4e162b72c1dd5a1e1a5d8a6c472fbe98fdb9621c9d1c1dbb81d9a8d78a7b4be0313c87d2d90da2042928446ee2c12002514dc9afc8e915f6460 yyjson-0.6.0.zip \ No newline at end of file diff --git a/community/yyjson-0.6.0/docs/hap_integrate.md b/community/yyjson-0.6.0/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..c24c12b9966be6e247d8d6dd5d9fad83308db34a --- /dev/null +++ b/community/yyjson-0.6.0/docs/hap_integrate.md @@ -0,0 +1,80 @@ +# yyjson集成到应用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/yyjson-0.6.0 #三方库yyjson-0.6.0的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── HPKCHECK #测试脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md #三方库简介 + ├── yyjson-0.6.0_oh_pkg.patch #用于yyjson-0.6.0库编译的补丁 + ``` + +- 在lycium目录下编译三方库 + + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ```shell + cd lycium + ./build.sh yyjson-0.6.0 + ``` + +- 三方库头文件及生成的库 + + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ```shell + yyjson-0.6.0/arm64-v8a yyjson-0.6.0/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的头文件拷贝到该目录下,将编译生成的三方库以及依赖库全部(动态库名字带版本号和不带版本号的都需要)拷贝到工程的libs目录下,如下图所示: +   + +  ![thirdparty_install_dir](pic/yyjson_install_dir.png) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + + ```shell + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/yyjson/${OHOS_ARCH}/lib/libyyjson.a) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/yyjson/${OHOS_ARCH}/include) + ``` + +## 测试三方库 +- 编译出可执行的文件,使用原库自带的测试用例来做测试 [准备三方库测试环境](../../../lycium/README.md#3ci环境准备) +进入到构建目录运行测试用例(注意arm64-v8a为构建64位的目录,armeabi-v7a为构建32位的目录)。执行结果如图所示 + +```shell + cd /data/tpc_c_cplusplus/thirdparty/yyjson-0.6.0/yyjson-0.6.0/arm64-v8a-build/ + ctest +``` + ![yyjson_test](pic/yyjson_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/community/yyjson-0.6.0/docs/pic/yyjson_install_dir.png b/community/yyjson-0.6.0/docs/pic/yyjson_install_dir.png new file mode 100644 index 0000000000000000000000000000000000000000..ef17c35dc00773f239c4493b3e46000ed240a9f6 Binary files /dev/null and b/community/yyjson-0.6.0/docs/pic/yyjson_install_dir.png differ diff --git a/community/yyjson-0.6.0/docs/pic/yyjson_test.png b/community/yyjson-0.6.0/docs/pic/yyjson_test.png new file mode 100644 index 0000000000000000000000000000000000000000..a19dffbd6079bf2abd04b32981203842bd95e17a Binary files /dev/null and b/community/yyjson-0.6.0/docs/pic/yyjson_test.png differ diff --git a/community/yyjson-0.6.0/yyjson-0.6.0_oh_pkg.patch b/community/yyjson-0.6.0/yyjson-0.6.0_oh_pkg.patch new file mode 100644 index 0000000000000000000000000000000000000000..90c7a1544e0eca89e959734cf01a66a4750715d4 --- /dev/null +++ b/community/yyjson-0.6.0/yyjson-0.6.0_oh_pkg.patch @@ -0,0 +1,12 @@ +diff -urN yyjson-0.6.0_old/CMakeLists.txt yyjson-0.6.0/CMakeLists.txt +--- yyjson-0.6.0_old/CMakeLists.txt 2022-12-12 19:15:37.000000000 +0800 ++++ yyjson-0.6.0/CMakeLists.txt 2024-10-16 18:53:21.472406536 +0800 +@@ -21,7 +21,7 @@ + + # ------------------------------------------------------------------------------ + # Build Options for tests and docs +-option(YYJSON_BUILD_TESTS "Build all tests" OFF) ++option(YYJSON_BUILD_TESTS "Build all tests" ON) + option(YYJSON_BUILD_FUZZER "Build fuzzer" OFF) + option(YYJSON_BUILD_MISC "Build misc" OFF) + option(YYJSON_BUILD_DOC "Build documentation with doxygen" OFF) \ No newline at end of file diff --git a/community/zlib/HPKBUILD b/community/zlib/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..37ccf3ca69b3ea2d91d2083b13f9366a1771ca9b --- /dev/null +++ b/community/zlib/HPKBUILD @@ -0,0 +1,79 @@ +# Contributor: Jeff Han +# Maintainer: Jeff Han +pkgname=zlib +pkgver=v1.2.13 +pkgrel=0 +pkgdesc="" +url="" +archs=("armeabi-v7a" "arm64-v8a") +license=("zlib License") +depends=() +makedepends=() + +# 官方下载地址source="https://github.com/madler/$pkgname/archive/refs/tags/$pkgver.tar.gz"受网络影响可能存在下载失败的情况,现使用gitee镜像可以与官方仓库保持同步 +source="https://gitee.com/mirrors/$pkgname/repository/archive/$pkgver.zip" + +autounpack=true +downloadpackage=true +buildtools="configure" + +builddir=$pkgname-${pkgver} +packagename=$builddir.zip + +patch_flag=true + +source envset.sh + +prepare() { + mkdir -p $builddir/$ARCH-build + if [ "$patch_flag" == true ] + then + cd $builddir + patch -p1 < ../zlib_ohos_pkg.patch + cd $OLDPWD + patch_flag=false + fi + if [ $ARCH == "armeabi-v7a" ] + then + setarm32ENV + fi + if [ $ARCH == "arm64-v8a" ] + then + setarm64ENV + fi +} + +build() { + cd $builddir/$ARCH-build + PKG_CONFIG_LIBDIR="${pkgconfigpath}" \ + ../configure "$@" > $buildlog 2>&1 + $MAKE VERBOSE=1 >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir/$ARCH-build + $MAKE install >> $buildlog 2>&1 + cd $OLDPWD + if [ $ARCH == "armeabi-v7a" ] + then + unsetarm32ENV + fi + if [ $ARCH == "arm64-v8a" ] + then + unsetarm64ENV + fi +} + +check() { + echo "The test must be on an OpenHarmony device!" + # real test CMD + # make check +} + +# 清理环境 +cleanbuild(){ + rm -rf ${PWD}/$builddir #${PWD}/$packagename +} diff --git a/community/zlib/README.OpenSource b/community/zlib/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..29db2528e11d3c5d280ba8eb381cf0435dada6b1 --- /dev/null +++ b/community/zlib/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "zlib", + "License": "zlib License", + "License File": "https://github.com/madler/zlib/blob/master/LICENSE", + "Version Number": "v1.2.13", + "Owner": "xiafeng@huawei.com", + "Upstream URL": "https://github.com/madler/zlib/releases/download/v1.2.13/zlib-1.2.13.tar.gz", + "Description": "A massively spiffy yet delicately unobtrusive compression library." + } +] \ No newline at end of file diff --git a/community/zlib/README_zh.md b/community/zlib/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..037e8dbd4ebb171920c8849aa44ac81874305193 --- /dev/null +++ b/community/zlib/README_zh.md @@ -0,0 +1,15 @@ +# zlib三方库说明 +## 功能简介 +zlib是提供数据压缩用的函式库。 + +## 三方库版本 +- v1.2.13 + +## 已适配功能 +- 数据压缩 + +## 使用约束 +- [IDE和SDK版本](../../docs/constraint.md) + +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) diff --git a/community/zlib/SHA512SUM b/community/zlib/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..0effb34c2f0bb37597baaed6b16b18cd046f72ca --- /dev/null +++ b/community/zlib/SHA512SUM @@ -0,0 +1 @@ +75cc6141dc740b21b676f900ed230efc98e1baa22744fbc315363cded5ab5fe9a5b593cbe0035509dc91b1512a3bcd20eaecf707fbba15d1a16598cdfc946a41 zlib-v1.2.13.zip diff --git a/community/zlib/docs/hap_integrate.md b/community/zlib/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..a41b0303bf256ac9b3a95ae8f7dd9b8145aff802 --- /dev/null +++ b/community/zlib/docs/hap_integrate.md @@ -0,0 +1,79 @@ +# zlib 集成到应用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/zlib #三方库zlib的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md + ``` + +- 编译三方库 + + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ```shell + cd lycium + ./build.sh zlib + ``` + +- 三方库头文件及生成的库 + + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ```shell + zlib/arm64-v8a zlib/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的库拷贝到该目录下,如下图所示 +   + +  ![thirdparty_install_dir](pic/zlib_install_dir.png) + + + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + + ```shell + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/zlib/${OHOS_ARCH}/lib/libz.a) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/zlib/${OHOS_ARCH}/include) + ``` + + +## 测试三方库 + +三方库的测试使用原库自带的测试用例来做测试,[准备三方库测试环境](../../../lycium/README.md#3ci环境准备) + +进入到构建目录,执行make check (arm64-v8a-build为构建64位的目录,armeabi-v7a-build为构建32位的目录) + + ![zlib_test](pic/zlib_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) \ No newline at end of file diff --git a/community/zlib/docs/pic/zlib_install_dir.png b/community/zlib/docs/pic/zlib_install_dir.png new file mode 100644 index 0000000000000000000000000000000000000000..66d263521701d509d01e5f8bb6743ffc6210d9fc Binary files /dev/null and b/community/zlib/docs/pic/zlib_install_dir.png differ diff --git a/community/zlib/docs/pic/zlib_test.png b/community/zlib/docs/pic/zlib_test.png new file mode 100644 index 0000000000000000000000000000000000000000..29d9adcf809059b7a93a4ce986cbf57b5ab410ac Binary files /dev/null and b/community/zlib/docs/pic/zlib_test.png differ diff --git a/community/zlib/docs/pic/zlib_usage.png b/community/zlib/docs/pic/zlib_usage.png new file mode 100644 index 0000000000000000000000000000000000000000..052c31e146a551a3584d22abe607548d63532748 Binary files /dev/null and b/community/zlib/docs/pic/zlib_usage.png differ diff --git a/community/zlib/zlib_ohos_pkg.patch b/community/zlib/zlib_ohos_pkg.patch new file mode 100644 index 0000000000000000000000000000000000000000..cd6f681f5e0de472686c4289eaa116155ae08da2 --- /dev/null +++ b/community/zlib/zlib_ohos_pkg.patch @@ -0,0 +1,26 @@ +diff -Nura zlib-v1.2.13/configure zlib-v1.2.13patch/configure +--- zlib-v1.2.13/configure 2022-10-13 13:06:55.000000000 +0800 ++++ zlib-v1.2.13patch/configure 2023-11-29 11:29:52.000000000 +0800 +@@ -255,17 +255,11 @@ + AIX*) + LDFLAGS="${LDFLAGS} -Wl,-brtl" ;; + Darwin* | darwin* | *-darwin*) +- shared_ext='.dylib' +- SHAREDLIB=libz$shared_ext +- SHAREDLIBV=libz.$VER$shared_ext +- SHAREDLIBM=libz.$VER1$shared_ext +- LDSHARED=${LDSHARED-"$cc -dynamiclib -install_name $libdir/$SHAREDLIBM -compatibility_version $VER1 -current_version $VER3"} +- if libtool -V 2>&1 | grep Apple > /dev/null; then +- AR="libtool" +- else +- AR="/usr/bin/libtool" +- fi +- ARFLAGS="-o" ;; ++ case "$mname" in ++ *sparc*) ++ LDFLAGS="${LDFLAGS} -Wl,--no-warn-rwx-segments" ;; ++ esac ++ LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,${SRCDIR}zlib.map"} ;; + *) + LDSHARED=${LDSHARED-"$cc -shared"} ;; + esac diff --git a/community/zlib_1_3_1/HPKBUILD b/community/zlib_1_3_1/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..91f1330b0b04f64c4564e3caa08eff8fdb0cc32f --- /dev/null +++ b/community/zlib_1_3_1/HPKBUILD @@ -0,0 +1,66 @@ +# 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: Jeff Han , wen fan +# Maintainer: Jeff Han + +pkgname=zlib_1_3_1 +pkgver=v1.3.1 +pkgrel= +pkgdesc="zlib 1.3.1 is a general purpose data compression library.All the code is thread safe." +url=https://github.com/madler/zlib +archs=(armeabi-v7a arm64-v8a) +license=(Zlib) +depends=() +makedepends=() + +builddir=zlib-${pkgver} +packagename=${builddir}.zip + +source=https://gitee.com/mirrors/zlib/repository/archive/${pkgver} + +autounpack=true +downloadpackage=true +buildtools=cmake + +prepare() { + mkdir -p ${builddir}/${ARCH}-build + return 0 +} + +build() { + cd ${builddir} + PKG_CONFIG_LIBDIR="${pkgconfigpath}" \ + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" \ + -B${ARCH}-build -S./ > ${buildlog} 2>&1 || return -1 + ${MAKE} -C${ARCH}-build VERBOSE=1 >> ${buildlog} 2>&1 || return -1 + cd ${OLDPWD} + return 0 +} + +package() { + cd ${builddir}/${ARCH}-build + ${MAKE} install >> ${buildlog} 2>&1 || return -1 + cd ${OLDPWD} + return 0 +} + +check() { + echo "The test must be on an OpenHarmony device!" + return 0 +} + +cleanbuild() { + rm -rf ${PWD}/${builddir} + return 0 +} diff --git a/community/zlib_1_3_1/HPKCHECK b/community/zlib_1_3_1/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..4b27802c8b97145df735ea91d8b8e96810c88342 --- /dev/null +++ b/community/zlib_1_3_1/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: Jeff Han , wen fan +# Maintainer: Jeff Han + +source HPKBUILD > /dev/null 2>&1 +logfile=${LYCIUM_THIRDPARTY_ROOT}/${pkgname}/${pkgname}_${ARCH}_${OHOS_SDK_VER}_test.log + +checkprepare() { + return 0 +} + +openharmonycheck() { + cd ${builddir}/${ARCH}-build + ctest > ${logfile} 2>&1 + ret=$? + if [ ${ret} -ne 0 ] + then + mkdir ${LYCIUM_FAULT_PATH}/${pkgname} + cp Testing/Temporary/LastTest.log ${LYCIUM_FAULT_PATH}/${pkgname}/ + fi + + cd ${OLDPWD} + return ${ret} +} diff --git a/community/zlib_1_3_1/OAT.xml b/community/zlib_1_3_1/OAT.xml new file mode 100644 index 0000000000000000000000000000000000000000..8c1f4a4604b0605aff883a046d2397e0016221b5 --- /dev/null +++ b/community/zlib_1_3_1/OAT.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/community/zlib_1_3_1/README.OpenSource b/community/zlib_1_3_1/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..81d1ad2b4c1495ab60bdba5959bdfb2951be99cf --- /dev/null +++ b/community/zlib_1_3_1/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "zlib_1_3_1", + "License": "Zlib", + "License File": "https://github.com/madler/zlib/blob/master/LICENSE", + "Version Number": "v1.3.1", + "Owner": "huangminzhong2@huawei.com", + "Upstream URL": "https://github.com/madler/zlib", + "Description": "zlib 1.3.1 is a general purpose data compression library.All the code is thread safe." + } +] diff --git a/community/zlib_1_3_1/README_zh.md b/community/zlib_1_3_1/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..ff484537b56119c8b09e92d540a163b942f1e79c --- /dev/null +++ b/community/zlib_1_3_1/README_zh.md @@ -0,0 +1,15 @@ +# zlib 三方库说明 +## 功能简介 +zlib 是一个通用的数据压缩库。所有代码都是线程安全的。 + +## 三方库版本 +- v1.3.1 + +## 已适配功能 +- 数据压缩 + +## 使用约束 +- [IDE和SDK版本](../../docs/constraint.md) + +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) diff --git a/community/zlib_1_3_1/SHA512SUM b/community/zlib_1_3_1/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..17587a175dc4c337500e2b338b6a0c7e480f3ac0 --- /dev/null +++ b/community/zlib_1_3_1/SHA512SUM @@ -0,0 +1 @@ +db1e7af3ab978c2741979b4ec759f9a600818a4aac6c68ba26832e841a579724bd388c538cb189721e6a5775b6ee74b9cab2330902713b350b3f7ad628d69286 zlib-v1.3.1.zip diff --git a/community/zlib_1_3_1/docs/hap_integrate.md b/community/zlib_1_3_1/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..b8fbf6125dbae3944413d6d38764a0bbc385ae5d --- /dev/null +++ b/community/zlib_1_3_1/docs/hap_integrate.md @@ -0,0 +1,81 @@ +# zlib_1_3_1集成到应用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/zlib_1_3_1 #三方库的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── HPKCHECK #测试脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md #三方库简介 + ├── OAT.xml #扫描结果文件 + ``` + +- 编译三方库 + + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ```shell + cd lycium + ./build.sh zlib_1_3_1 + ``` + +- 三方库头文件及生成的库 + + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ```shell + zlib_1_3_1/arm64-v8a zlib_1_3_1/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的库拷贝到该目录下,如下图所示 +   + +  ![thirdparty_install_dir](pic/zlib_install_dir.png) + + + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + + ```shell + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/zlib/${OHOS_ARCH}/lib/libz.a) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/zlib/${OHOS_ARCH}/include) + ``` + + +## 测试三方库 + +三方库的测试使用原库自带的测试用例来做测试,[准备三方库测试环境](../../../lycium/README.md#3ci环境准备) + +进入到构建目录,执行ctest (arm64-v8a-build为构建64位的目录,armeabi-v7a-build为构建32位的目录) + + ![zlib_test](pic/zlib_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) \ No newline at end of file diff --git a/community/zlib_1_3_1/docs/pic/zlib_install_dir.png b/community/zlib_1_3_1/docs/pic/zlib_install_dir.png new file mode 100644 index 0000000000000000000000000000000000000000..66d263521701d509d01e5f8bb6743ffc6210d9fc Binary files /dev/null and b/community/zlib_1_3_1/docs/pic/zlib_install_dir.png differ diff --git a/community/zlib_1_3_1/docs/pic/zlib_test.png b/community/zlib_1_3_1/docs/pic/zlib_test.png new file mode 100644 index 0000000000000000000000000000000000000000..77451c0502acc543e717e745f990839adda743fc Binary files /dev/null and b/community/zlib_1_3_1/docs/pic/zlib_test.png differ diff --git a/community/zopfli/HPKBUILD b/community/zopfli/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..dc72c39c700d0af9071545f67a73170bc8163fa8 --- /dev/null +++ b/community/zopfli/HPKBUILD @@ -0,0 +1,66 @@ +# 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<2942375747@qq.com>, wangying +# Maintainer: wangyihao<2471389@stu.neu.edu.cn>, wangjialun<2271411@stu.neu.edu.cn>, zhangqian<2371418@stu.neu.edu.cn>, wangying + +pkgname=zopfli +pkgver=zopfli-1.0.3 +pkgrel=0 +pkgdesc="Zopfli Compression Algorithm is a compression library programmed in C" +url="https://github.com/google/zopfli/tree/zopfli-1.0.3" +archs=("armeabi-v7a" "arm64-v8a") +license=("Apache-2.0 license") +depends=() +makedepends=() +source="https://github.com/google/$pkgname/archive/refs/tags/$pkgver.zip" + +downloadpackage=true +autounpack=true +buildtools="cmake" + +builddir=$pkgname-${pkgver} +packagename=$builddir.zip + +prepare() { + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + PKG_CONFIG_LIBDIR="${pkgconfigpath}" \ + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" \ + -DCMAKE_C_FLAGS="-Wno-unused-command-line-argument" \ + -DCMAKE_CXX_FLAGS="-Wno-unused-command-line-argument" \ + -B$ARCH-build -S./ > $buildlog 2>&1 + $MAKE VERBOSE=1 -C $ARCH-build >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + $MAKE -C $ARCH-build install >> $buildlog 2>&1 + cd $OLDPWD +} + + +check() { + echo "The test must be on an OpenHarmony device!" +} + + +cleanbuild() { + rm -rf ${PWD}/$builddir +} diff --git a/community/zopfli/HPKCHECK b/community/zopfli/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..424c97495f93108ae0869d0f935934b2f20c5164 --- /dev/null +++ b/community/zopfli/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: wangjialun<2271411@stu.neu.edu.cn>, zhangqian<2371418@stu.neu.edu.cn>, wangyihao<2942375747@qq.com>, 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 + +checkprepare(){ + return 0 +} + +# 在OH环境执行测试的接口 +openharmonycheck() { + res=0 + cd ${builddir}/${ARCH}-build + ctest > ${logfile} 2>&1 + res=$? + cd $OLDPWD + + return $res +} \ No newline at end of file diff --git a/community/zopfli/OAT.xml b/community/zopfli/OAT.xml new file mode 100644 index 0000000000000000000000000000000000000000..eeb1f946d683c0b81976cd06522096062a6901b9 --- /dev/null +++ b/community/zopfli/OAT.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/community/zopfli/README.OpenSource b/community/zopfli/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..6c8e5d9fd968f63b5a55977725784b4051fe2831 --- /dev/null +++ b/community/zopfli/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "zopfli", + "License": "Apache-2.0 license", + "License File": "https://github.com/google/zopfli/blob/master/COPYING", + "Version Number": "zopfli-1.0.3", + "Owner": "huangminzhong2@huawei.com", + "Upstream URL": "https://github.com/google/zopfli", + "Description": "Zopfli Compression Algorithm is a compression library programmed in C." + } +] \ No newline at end of file diff --git a/community/zopfli/README_zh.md b/community/zopfli/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..18b2f168d593df01185a5bbe7c3dbd1a0562e7ec --- /dev/null +++ b/community/zopfli/README_zh.md @@ -0,0 +1,12 @@ +# zopfli三方库说明 +## 功能简介 +Zopfli压缩算法是一个用C语言编写的压缩库 + +## 三方库版本 +- 1.0.3 + +## 使用约束 +- [IDE和SDK版本](../../docs/constraint.md) + +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) diff --git a/community/zopfli/SHA512SUM b/community/zopfli/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..b2b60c77fd1efd42317a902c4f794a3f76405ec3 --- /dev/null +++ b/community/zopfli/SHA512SUM @@ -0,0 +1 @@ +9731b3fd64c480660b387aa71f95a07ee55a897591e86f404ed391a88c3932216e247a32bf66307d3d13643aa86a5ac36211875533842f1b6bcfa2f21b62548f zopfli-zopfli-1.0.3.zip diff --git a/community/zopfli/docs/hap_integrate.md b/community/zopfli/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..920b08e2f513b2abab40e86f57ed97360cd95be1 --- /dev/null +++ b/community/zopfli/docs/hap_integrate.md @@ -0,0 +1,79 @@ +# zopfli 集成到应用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/zopfli #三方库zopfli的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── HPKCHECK #测试脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md #三方库简介 + ``` + +- 在lycium目录下编译三方库 + + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ```shell + cd lycium + ./build.sh zopfli + ``` + +- 三方库头文件及生成的库 + + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ```shell + zopfli/arm64-v8a zopfli/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +- 编译出可执行的文件进行测试,[准备三方库测试环境](../../../lycium/README.md#3ci环境准备) +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的头文件拷贝到该目录下,将编译生成的三方库以及依赖库全部(动态库名字带版本号和不带版本号的都需要)拷贝到工程的libs目录下,如下图所示: +   + +  ![thirdparty_install_dir](pic/zopfli_install_dir.png) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + + ```shell + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/zopfli/${OHOS_ARCH}/lib/libzopfli.a) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/zopfli/${OHOS_ARCH}/include) + ``` + +## 测试三方库 +在lycium目录下执行脚本./test.sh,自动检测thridparty目录下已编译的三方库, + + +```shell + cd lycium + ./test.sh zopfli +``` + ![zopfli_test](pic/zopfli_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/community/zopfli/docs/pic/zopfli_install_dir.png b/community/zopfli/docs/pic/zopfli_install_dir.png new file mode 100644 index 0000000000000000000000000000000000000000..fb7b0cd29c090cc51cb24d2d6b9fba71ebba7f4a Binary files /dev/null and b/community/zopfli/docs/pic/zopfli_install_dir.png differ diff --git a/community/zopfli/docs/pic/zopfli_test.png b/community/zopfli/docs/pic/zopfli_test.png new file mode 100644 index 0000000000000000000000000000000000000000..b34963e05d83a975e3ec615f9f9bb45573b7f5b0 Binary files /dev/null and b/community/zopfli/docs/pic/zopfli_test.png differ diff --git a/community/zstd_1_5_6/HPKBUILD b/community/zstd_1_5_6/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..d28b649947ff94aad16cfdc8cabc6e8dd9aeb6cf --- /dev/null +++ b/community/zstd_1_5_6/HPKBUILD @@ -0,0 +1,64 @@ +# 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: Jeff Han luozhu <1393302983@qq.com> +# Maintainer: Jeff Han + +pkgname=zstd_1_5_6 +giteepkgname=facebook-${pkgname:0:4} +pkgver=v1.5.6 +pkgrel=0 +pkgdesc="Zstandard, or zstd as short version, is a fast lossless compression algorithm, targeting real-time compression scenarios at zlib-level and better compression ratios" +url="https://github.com/facebook/zstd" +archs=("armeabi-v7a" "arm64-v8a") +license=("BSD or GPLv2") +depends=() +makedepends=() + +source="https://gitee.com/mirrors/$giteepkgname/repository/archive/$pkgver.zip" + +autounpack=true +downloadpackage=true + +builddir=$giteepkgname-${pkgver} +packagename=$builddir.zip + +prepare() { + mkdir -p $builddir/$ARCH-build +} +build() { + cd $builddir + PKG_CONFIG_LIBDIR="${pkgconfigpath}" \ + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" \ + -B$ARCH-build -S./build/cmake -DZSTD_BUILD_TESTS=ON > $buildlog 2>&1 + $MAKE -C $ARCH-build VERBOSE=1 >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + $MAKE -C $ARCH-build install >> $buildlog 2>&1 + cd $OLDPWD +} + +check() { + echo "The test must be on an OpenHarmony device!" +} + +# 清理环境 +cleanbuild(){ + rm -rf ${PWD}/$builddir #${PWD}/$packagename +} + diff --git a/community/zstd_1_5_6/HPKCHECK b/community/zstd_1_5_6/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..a84284c8465bf4e6507270992afb5593b536c5a3 --- /dev/null +++ b/community/zstd_1_5_6/HPKCHECK @@ -0,0 +1,32 @@ +# 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: Jeff Han luozhu <1393302983@qq.com> +# Maintainer: Jeff Han + +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 + ctest > ${logfile} 2>&1 + res=$? + if [ $res -ne 0 ] + then + mkdir -p ${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/community/zstd_1_5_6/OAT.xml b/community/zstd_1_5_6/OAT.xml new file mode 100644 index 0000000000000000000000000000000000000000..5663c536ddecb545bb824af7a320605c8072e4f4 --- /dev/null +++ b/community/zstd_1_5_6/OAT.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/community/zstd_1_5_6/README.OpenSource b/community/zstd_1_5_6/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..b3be9cd9ba0768e9007abc0af3f1bb21916836bd --- /dev/null +++ b/community/zstd_1_5_6/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "zstd_1_5_6", + "License": "BSD-3-Clause or GPL-2.0", + "License File": ["https://github.com/facebook/zstd/blob/dev/LICENSE","https://github.com/facebook/zstd/blob/dev/COPYING"], + "Version Number": "v1.5.6", + "Owner": "hanjinfei@foxmail.com", + "Upstream URL": "https://github.com/facebook/zstd/archive/refs/tags/v1.5.6.tar.gz", + "Description": "Zstandard, or zstd as short version, is a fast lossless compression algorithm, targeting real-time compression scenarios at zlib-level and better compression ratios." + } +] \ No newline at end of file diff --git a/community/zstd_1_5_6/README_zh.md b/community/zstd_1_5_6/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..cd1189d1eecff4a1aa905a57a89312053f833322 --- /dev/null +++ b/community/zstd_1_5_6/README_zh.md @@ -0,0 +1,15 @@ +# zstd 三方库说明 +## 功能简介 +zstd 是一种快速的无损压缩算法,是针对 zlib 级别的实时压缩方案,以及更好的压缩比。 + +## 三方库版本 +- v1.5.6 + +## 已适配功能 +- 完成了生成和解码 .zst 格式以及字典压缩、解压缩 + +## 使用约束 +- [IDE和SDK版本](../../docs/constraint.md) + +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) \ No newline at end of file diff --git a/community/zstd_1_5_6/SHA512SUM b/community/zstd_1_5_6/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..a0c3996ea164cc41d56913dde4a20c97183506b0 --- /dev/null +++ b/community/zstd_1_5_6/SHA512SUM @@ -0,0 +1 @@ +dc6deab73ca403c0e78eca80a70db7273705fbf380743fba16d1bf9e22261f17a6414b33744c6b53f17c10ef0574a9e055d5c3ccaa9d6318b7d6ec931dfb7ec6 facebook-zstd-v1.5.6.zip diff --git a/community/zstd_1_5_6/docs/hap_integrate.md b/community/zstd_1_5_6/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..f06f411f4ef9989fec7913bf438d8ce6c93b5115 --- /dev/null +++ b/community/zstd_1_5_6/docs/hap_integrate.md @@ -0,0 +1,67 @@ +# zstd_1_5_6集成到应用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) + +## 编译三方库 +- 下载本仓库 + ``` + git clone https://gitee.com/openharmony-sig/tpc_c_cplusplus.git --depth=1 + ``` + +- 三方库目录结构 + ``` + tpc_c_cplusplus/thirdparty/zstd_1_5_6 # 三方库zstd_1_5_6的目录结构如下 + ├── docs # 三方库相关文档的文件夹 + ├── HPKBUILD # 构建脚本 + ├── HPKCHECK # 测试脚本 + ├── SHA512SUM # 三方库校验文件 + ├── README.OpenSource # 说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md # 三方库说明文档 + ├── OAT.xml # OAT开源审查文本 + ``` + +- 在编译三方库 + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ``` + cd lycium + ./build.sh zstd_1_5_6 + ``` + +- 三方库头文件及生成的库 + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ``` + zstd_1_5_6/arm64-v8a zstd_1_5_6/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的库拷贝到该目录下,如下图所示 + ![zstd_install_dir](pic/zstd_install_dir.png) +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + ``` + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/zstd_1_5_6/${OHOS_ARCH}/lib/libzstd.a) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/zstd_1_5_6/${OHOS_ARCH}/include) + ``` +## 测试三方库 +三方库的测试使用原库自带的测试用例来做测试,[准备三方库测试环境](../../../lycium/README.md#3ci环境准备) + +进入到构建目录执行 ctest 运行测试用例(arm64-v8a-build为构建64位的目录,armeabi-v7a-build为构建32位的目录) + +![zstd_test](pic/zstd_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/community/zstd_1_5_6/docs/pic/results.png b/community/zstd_1_5_6/docs/pic/results.png new file mode 100644 index 0000000000000000000000000000000000000000..d42365e818698ed10c51e62a5a4137cbbc24aed7 Binary files /dev/null and b/community/zstd_1_5_6/docs/pic/results.png differ diff --git a/community/zstd_1_5_6/docs/pic/zstd_install_dir.png b/community/zstd_1_5_6/docs/pic/zstd_install_dir.png new file mode 100644 index 0000000000000000000000000000000000000000..4c88893faf448adea166a47de4133c8ea22aaa85 Binary files /dev/null and b/community/zstd_1_5_6/docs/pic/zstd_install_dir.png differ diff --git a/community/zstd_1_5_6/docs/pic/zstd_test.PNG b/community/zstd_1_5_6/docs/pic/zstd_test.PNG new file mode 100644 index 0000000000000000000000000000000000000000..ca03ba68865adbab92da532ab519008caf8a196d Binary files /dev/null and b/community/zstd_1_5_6/docs/pic/zstd_test.PNG differ