diff --git a/thirdparty/openal-soft/HPKBUILD b/thirdparty/openal-soft/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..bcb419ad08f54d7f74724d4c5ed101ab95b5b5c3 --- /dev/null +++ b/thirdparty/openal-soft/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: TangShaoteng +# Maintainer: TangShaoteng +pkgname=openal-soft +pkgver=1.23.1 +pkgrel=0 +pkgdesc="OpenAL Soft is an LGPL-licensed, cross-platform, software implementation of the OpenAL 3D audio API." +url="https://openal-soft.org" +archs=("armeabi-v7a" "arm64-v8a") +license=("LGPLv2") +depends=("pulseaudio" "libsndfile") +makedepends=() + +source="https://github.com/kcat/$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 + # 添加控制动态库的符号可见性开关 + patch -p1 < `pwd`/../openal-soft_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 "$@" -DOHOS_ARCH=$ARCH -DSNDFILE_FOUND=TRUE -DALSOFT_INSTALL_EXAMPLES=ON \ + -DALSOFT_REQUIRE_PULSEAUDIO=ON -DVISIBILITY_PRESET_HIDDEN=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() { + 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" + fi + echo "The test must be on an OpenHarmony device!" + # real test cmd + # ./openal-info + # ./alrecord -c 2 -b 16 -r 44100 -t 5 -o record.wav + # ./alplay record.wav + # ./altonegen + # ./alstream /system/etc/graphic/bootsound.wav + # ./alhrtf /system/etc/graphic/bootsound.wav + # ./allatency /system/etc/graphic/bootsound.wav + # ./alreverb /system/etc/graphic/bootsound.wav + # ./almultireverb /system/etc/graphic/bootsound.wav +} + +# 清理环境 +cleanbuild() { + rm -rf ${PWD}/$builddir #${PWD}/$packagename +} + diff --git a/thirdparty/openal-soft/HPKCHECK b/thirdparty/openal-soft/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..1f0cf60675ba289ec0fa31d23b43013751f31f58 --- /dev/null +++ b/thirdparty/openal-soft/HPKCHECK @@ -0,0 +1,27 @@ +# Contributor: chengkan +# Maintainer: chengkan +source HPKBUILD > /dev/null 2>&1 +logfile=${LYCIUM_THIRDPARTY_ROOT}/${pkgname}/${pkgname}_${ARCH}_${OHOS_SDK_VER}_test.log +OLD_LD_LIBRARY_PATH=$LD_LIBRARY_PATH +checkprepare(){ + export LD_LIBRARY_PATH=`pwd`/$builddir-$ARCH-build:$LD_LIBRARY_PATH + +} +openharmonycheck() { + res=0 + cd $builddir-$ARCH-build/src/test + make check >> ${logfile} 2>&1 + res=$? + + if [ $res -ne 0 ] + then + mkdir ${LYCIUM_FAULT_PATH}/${pkgname} + cp -rf *.log ${LYCIUM_FAULT_PATH}/${pkgname}/ + fi + + export LD_LIBRARY_PATH=$OLD_LD_LIBRARY_PATH + unset OLD_LD_LIBRARY_PATH + cd $OLDPWD + + return $res +} diff --git a/thirdparty/openal-soft/OAT.xml b/thirdparty/openal-soft/OAT.xml new file mode 100644 index 0000000000000000000000000000000000000000..5eecdd6202e272a5143978ac32f31977d23001c7 --- /dev/null +++ b/thirdparty/openal-soft/OAT.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/openal-soft/README.OpenSource b/thirdparty/openal-soft/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..96a2a1b963d4a2f78611d2311d2849d1bfc1e835 --- /dev/null +++ b/thirdparty/openal-soft/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "openfst", + "License": "Apache-2.0 license", + "License File": "https://www.openfst.org/twiki/bin/view/FST/DistCopying", + "Version Number": "1.8.2", + "Owner": "kanchengc@isoftstone.com", + "Upstream URL": "https://www.openfst.org/twiki/pub/FST/FstDownload/openfst-1.8.2.tar.gz", + "Description": "OpenFst is a library for constructing, combining, optimizing, and searching weighted finite-state transducers (FSTs)." + } +] diff --git a/thirdparty/openal-soft/README_zh.md b/thirdparty/openal-soft/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..3520da421ee77a805f71c56872736172acaea8ea --- /dev/null +++ b/thirdparty/openal-soft/README_zh.md @@ -0,0 +1,17 @@ +# openfst三方库说明 +## 功能简介 +openfst 是一个开源的有限状态转换(FST)库,主要用于构建、操作和分析有限状态自动机和有限状态转换。 +## 使用约束 +- ROM版本:OpenHarmony3.2Release + +- IDE版本:DevEco Studio 3.1 Release + +- SDK:ohos_sdk_public 4.0.8.1 (API Version 10 Release) + +- 三方库版本:1.8.2 + +- 当前适配功能:构建,操作,分析加权有限状态转换(weighted finite-state transducer,WFST),并且支持对输入和输出序列进行操作 + + +## 集成方式 ++ [系统hap包集成](docs/hap_integrate.md) diff --git a/thirdparty/openal-soft/SHA512SUM b/thirdparty/openal-soft/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..a36faa3eaac1dc5580533eeb9ca97f3337a9f6d0 --- /dev/null +++ b/thirdparty/openal-soft/SHA512SUM @@ -0,0 +1 @@ +21f768484978e4321b733004988cb5ecf43d908e7e08f2d421a338633fcfb2ade722d035de73742470ff135ab538d6b9b56df14020976adb1d1e081dfb095c6b openal-soft-1.23.1.tar.gz diff --git a/thirdparty/openal-soft/docs/hap_integrate.md b/thirdparty/openal-soft/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..a88f07ae02e3b1f49366a8925dfd878ac86ab0d7 --- /dev/null +++ b/thirdparty/openal-soft/docs/hap_integrate.md @@ -0,0 +1,97 @@ +# openfst集成到应用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 4.0.8.1 (API Version 10 Release)](https://gitee.com/link?target=http%3A%2F%2Fdownload.ci.openharmony.cn%2Fversion%2FMaster_Version%2FOpenHarmony_4.0.8.1%2F20230608_091058%2Fversion-Master_Version-OpenHarmony_4.0.8.1-20230608_091058-ohos-sdk-public.tar.gz) +- [DevEco Studio 3.1 Release](https://gitee.com/link?target=https%3A%2F%2Fcontentcenter-vali-drcn.dbankcdn.cn%2Fpvt_2%2FDeveloperAlliance_package_901_9%2F81%2Fv3%2FtgRUB84wR72nTfE8Ir_xMw%2Fdevecostudio-windows-3.1.0.501.zip%3FHW-CC-KV%3DV1%26HW-CC-Date%3D20230621T074329Z%26HW-CC-Expire%3D315360000%26HW-CC-Sign%3D22F6787DF6093ECB4D4E08F9379B114280E1F65DA710599E48EA38CB24F3DBF2) +- [准备三方库构建环境](../../../lycium/README.md#1编译环境准备) +- [准备三方库测试环境](../../../lycium/README.md#3ci环境准备) + +## 编译三方库 +- 下载本仓库 + ``` + git clone https://gitee.com/openharmony-sig/tpc_c_cplusplus.git --depth=1 + ``` +- 三方库目录结构 + ``` + tpc_c_cplusplus/thirdparty/openfst #三方库openfst的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── openfst_oh_pkg.patch #补丁文件 + ├── OAT.xml #版权校验文件 + ├── HPKCHECK #自动化测试脚本 + ├── README_zh.md + ``` + + +- 在lycium目录下编译三方库 + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ``` + + cd lycium + ./build.sh openfst + ``` +- 三方库头文件及生成的库 + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ``` + openfst/arm64-v8a openfst/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的库拷贝到该目录下,如下图所示 + ![openfst_install](pic/openfst_install.png) +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + ``` + + #将三方库加入到工程 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/openfst/${OHOS_ARCH}/lib/libfst.a + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/openfst/${OHOS_ARCH}/lib/libfstscript.a + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/openfst/${OHOS_ARCH}/lib/libfstcompact.a + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/openfst/${OHOS_ARCH}/lib/libfstcompressscript.a + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/openfst/${OHOS_ARCH}/lib/libfstconst.a + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/openfst/${OHOS_ARCH}/lib/libfstfar.a + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/openfst/${OHOS_ARCH}/lib/libfstfarscript.a + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/openfst/${OHOS_ARCH}/lib/libfstlinearscript.a + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/openfst/${OHOS_ARCH}/lib/libfstlookahead.a + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/openfst/${OHOS_ARCH}/lib/libfstpdtscript.a + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/openfst/${OHOS_ARCH}/lib/libfstmpdtscript.a + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/openfst/${OHOS_ARCH}/lib/libfstngram.a) + + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/openfst/${OHOS_ARCH}/include) + + ``` + ![openfst_usage](pic/openfst_usage.png) +## 测试三方库 +三方库的测试使用原库自带的测试用例来做测试,[准备三方库测试环境](../../../lycium/README.md#3ci环境准备) + + + +- 将测试资源导入到开发板 +- 设置依赖服务程序路径 +``` +32位系统 +export LD_LIBRARY_PATH=/data/local/tmp/tpc_c_cplusplus/lycium/usr/openfst/armeabi-v7a/lib:/data/local/tmp/tpc_c_cplusplus/thirdparty/openfst/openfst-1.8.2-armeabi-v7a-build + +##64位系统 +export LD_LIBRARY_PATH=/data/local/tmp/tpc_c_cplusplus/lycium/usr/openfst/arm64-v8a/lib:/data/local/tmp/tpc_c_cplusplus/thirdparty/openfst/openfst-1.8.2-arm64-v8a-build +``` +- 进入到构建目录$ARCH-build/src/test下执行 make check 运行测试用例,如下截图(arm64-v8a-build为构建64位的目录,armeabi-v7a-build为构建32位的目录) + + + +![openfst](pic/openfst_test.png) + +## 参考资料 +- [润和RK3568开发板标准系统快速上手](https://gitee.com/openharmony-sig/knowledge_demo_temp/tree/master/docs/rk3568_helloworld) +- [OpenHarmony三方库地址](https://gitee.com/openharmony-tpc) +- [OpenHarmony知识体系](https://gitee.com/openharmony-sig/knowledge) +- [通过DevEco Studio开发一个NAPI工程](https://gitee.com/openharmony-sig/knowledge_demo_temp/blob/master/docs/napi_study/docs/hello_napi.md) diff --git a/thirdparty/openal-soft/docs/pic/openfst_install.png b/thirdparty/openal-soft/docs/pic/openfst_install.png new file mode 100755 index 0000000000000000000000000000000000000000..49fca3506a976226a52890b853162111e152273b Binary files /dev/null and b/thirdparty/openal-soft/docs/pic/openfst_install.png differ diff --git a/thirdparty/openal-soft/docs/pic/openfst_test.png b/thirdparty/openal-soft/docs/pic/openfst_test.png new file mode 100755 index 0000000000000000000000000000000000000000..4f32430910c2968dc26fdea6ac2448d1d55a0ce4 Binary files /dev/null and b/thirdparty/openal-soft/docs/pic/openfst_test.png differ diff --git a/thirdparty/openal-soft/docs/pic/openfst_usage.png b/thirdparty/openal-soft/docs/pic/openfst_usage.png new file mode 100755 index 0000000000000000000000000000000000000000..1a64ae30b7843ed76e2e94a1e1838070b7fe9483 Binary files /dev/null and b/thirdparty/openal-soft/docs/pic/openfst_usage.png differ diff --git a/thirdparty/openal-soft/openal-soft_oh_pkg.patch b/thirdparty/openal-soft/openal-soft_oh_pkg.patch new file mode 100644 index 0000000000000000000000000000000000000000..f5373751b38b42c8f12f27df04acb65f4212a3fd --- /dev/null +++ b/thirdparty/openal-soft/openal-soft_oh_pkg.patch @@ -0,0 +1,16 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index b231a1e..8e3d6ca 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -30,8 +30,11 @@ if(CMAKE_SYSTEM_NAME STREQUAL "iOS") + endif() + endif() + ++option(VISIBILITY_PRESET_HIDDEN "set the library visibility preset to hidden" ON) ++if(VISIBILITY_PRESET_HIDDEN) + set(CMAKE_C_VISIBILITY_PRESET hidden) + set(CMAKE_CXX_VISIBILITY_PRESET hidden) ++endif() + + if(COMMAND CMAKE_POLICY) + cmake_policy(SET CMP0003 NEW)