diff --git a/thirdparty/libxslt/HPKBUILD b/thirdparty/libxslt/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..ed2188fcdc23eb9f3064af36a1160aa57b39e8e3 --- /dev/null +++ b/thirdparty/libxslt/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: chengkan +# Maintainer: chengkan +pkgname=libxslt +pkgver=1.1.38 +pkgrel=0 +pkgdesc="libxslt itself is a an XML language to define transformation for XML" +url="https://gitlab.gnome.org/GNOME/libxslt/-/wikis/home" +archs=("armeabi-v7a" "arm64-v8a") +license=("MIT license") +depends=("libxml2") +makedepends=() + +source="https://mirror.ossplanet.net/gnome/sources/$pkgname/1.1/$pkgname-$pkgver.tar.xz" + +autounpack=true +downloadpackage=true +buildtools="configure" + +builddir=$pkgname-${pkgver} +packagename=$builddir.tar.xz + +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 + PKG_CONFIG_LIBDIR=$pkgconfigpath ./configure "$@" --enable-static --without-python --host=$host >> `pwd`/build.log 2>&1 + + # 增加check_test目标用来执行测试程序,禁止make check阶段运行测试程序 + sed -i 's/\t$(MAKE) $(AM_MAKEFLAGS) check-local/check_test: $(MAKE) $(AM_MAKEFLAGS) check-local/g' ./tests/Makefile + sed -i 's/\t$(MAKE) $(AM_MAKEFLAGS) check-local/check_test: $(MAKE) $(AM_MAKEFLAGS) check-local/g' ./tests/xmlspec/Makefile + sed -i 's/\t$(MAKE) $(AM_MAKEFLAGS) check-local/check_test: $(MAKE) $(AM_MAKEFLAGS) check-local/g' ./tests/XSLTMark/Makefile + sed -i 's/\t$(MAKE) $(AM_MAKEFLAGS) check-local/check_test: $(MAKE) $(AM_MAKEFLAGS) check-local/g' ./tests/fuzz/Makefile + sed -i 's/\t$(MAKE) $(AM_MAKEFLAGS) check-local/check_test: $(MAKE) $(AM_MAKEFLAGS) check-local/g' ./tests/multiple/Makefile + sed -i 's/\t$(MAKE) $(AM_MAKEFLAGS) check-local/check_test: $(MAKE) $(AM_MAKEFLAGS) check-local/g' ./tests/xinclude/Makefile + sed -i 's/\t$(MAKE) $(AM_MAKEFLAGS) check-local/check_test: $(MAKE) $(AM_MAKEFLAGS) check-local/g' ./tests/docbook/Makefile + + make -j4 >> `pwd`/build.log 2>&1 + # 编译测试程序 + make check >> `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!" + ## real test CMD + ## 进入到编译目录下的tests目录执行 + ## make check_test +} + +# 清理环境 +cleanbuild() { + rm -rf ${PWD}/$builddir ${PWD}/$builddir-${archs[0]}-build ${PWD}/$builddir-${archs[1]}-build #${PWD}/$packagename +} diff --git a/thirdparty/libxslt/HPKCHECK b/thirdparty/libxslt/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..65eaf30a2a7e63cc0294378c07ef130759e9c9af --- /dev/null +++ b/thirdparty/libxslt/HPKCHECK @@ -0,0 +1,43 @@ +# 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: chengkan +# Maintainer: chengkan +source HPKBUILD > /dev/null 2>&1 +logfile=${LYCIUM_THIRDPARTY_ROOT}/${pkgname}/${pkgname}_${ARCH}_${OHOS_SDK_VER}_test.log +HASSED=false +checkprepare(){ + export LIBXSLT_PLUGINS_PATH=`pwd`/$builddir-$ARCH-build/tests/.libs + + # 检查/usr/bin目录下是否存在sed软连接 + if [ ! -L "/usr/bin/sed" ]; then + # 创建软连接 + ln -s /usr/bin/busybox /usr/bin/sed + else + HASSED = true + fi +} +openharmonycheck() { + res=0 + cd $builddir-$ARCH-build/tests + /usr/bin/make check_test >> ${logfile} 2>&1 + res=$? + + unset LIBXSLT_PLUGINS_PATH + cd $OLDPWD + + if [ $HASSED == false ];then + rm -rf /usr/bin/sed + fi + + return $res +} diff --git a/thirdparty/libxslt/OAT.xml b/thirdparty/libxslt/OAT.xml new file mode 100644 index 0000000000000000000000000000000000000000..5eecdd6202e272a5143978ac32f31977d23001c7 --- /dev/null +++ b/thirdparty/libxslt/OAT.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/libxslt/README.OpenSource b/thirdparty/libxslt/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..f837ce81536809b85993d7d5301a5f8da32025be --- /dev/null +++ b/thirdparty/libxslt/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "libxslt", + "License": "MIT license", + "License File": "https://gitlab.gnome.org/GNOME/libxslt/-/wikis/home", + "Version Number": "1.1.38", + "Owner": "kanchengc@isoftstone.com", + "Upstream URL": "https://download.gnome.org/sources/libxslt/1.1/libxslt-1.1.38.tar.xz", + "Description": "libxslt itself is a an XML language to define transformation for XML." + } +] diff --git a/thirdparty/libxslt/README_zh.md b/thirdparty/libxslt/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..cb1640d76cbb980edcaab93b7ba233d82bb26f43 --- /dev/null +++ b/thirdparty/libxslt/README_zh.md @@ -0,0 +1,14 @@ +# libxslt三方库说明 +## 功能简介 +Libxslt库用于处理和转换XML文档。 +## 使用约束 +- IDE版本:DevEco Studio 3.1 Release + +- SDK:ohos_sdk_public 4.0.8.1 (API Version 10 Release) + +- 三方库版本:1.1.38 + +- 当前适配功能:允许通过使用XSLT样式表来转换XML文档的结构和内容。 + +## 集成方式 ++ [系统hap包集成](docs/hap_integrate.md) diff --git a/thirdparty/libxslt/SHA512SUM b/thirdparty/libxslt/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..fbf0cadd11246b3fc514808f9e2aa921c87cf021 --- /dev/null +++ b/thirdparty/libxslt/SHA512SUM @@ -0,0 +1 @@ +2836bd2990b95680db0960ac4c465d0c6c28a293ad095a224c05021a1c8d2576a45e41da8947a31f4ef3e6ef368cbda65243661e311c9886c19694be5a7c9a8e libxslt-1.1.38.tar.xz diff --git a/thirdparty/libxslt/docs/hap_integrate.md b/thirdparty/libxslt/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..eec161b7ba0f76e5a3100f51ee922705a2f4b6a8 --- /dev/null +++ b/thirdparty/libxslt/docs/hap_integrate.md @@ -0,0 +1,99 @@ +# libxslt集成到应用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/libxslt #三方库libxslt的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── HPKCHECK #自动化测试脚本 + ├── OAT.xml #版权检验文件 + ├── README_zh.md + ``` + + +- 在lycium目录下编译三方库 + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ``` + + cd lycium + ./build.sh libxslt + ``` +- 三方库头文件及生成的库 + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ``` + libxslt/arm64-v8a libxslt/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 +- 在IDE的libs目录下,将编译生成的库拷贝到该目录下.如下图所示 + ![libxslt_install](pic/libxslt_install.png) +- 在entry/src/main/cpp目录下的CMakeLists.txt中添加如下语句 + ``` + + #将三方库加入工程中 + target_link_libraries(entry PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/libxslt.a + ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/libexslt.a + ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/libz.a + ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/libxml2.so.2 + ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/liblzma.so.5 + ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/libz.so.1) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libxml2/${OHOS_ARCH}/include/libxml2/libxml + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libxslt/${OHOS_ARCH}/include/libexslt + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libxslt/${OHOS_ARCH}/include/libxslt + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/xz/${OHOS_ARCH}/include + ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/zlib/${OHOS_ARCH}/include) + ``` +## 测试三方库 +三方库的测试使用原库自带的测试用例来做测试,[准备三方库测试环境](../../../lycium/README.md#3ci环境准备) + + + +- 将测试资源导入到开发板 +mount -o remount,rw / #重新挂载系统 +ln -s /usr/bin/busybox /usr/bin/sed #创建sed软连接 +- 设置依赖服务程序路径 +``` +32位系统 +export LD_LIBRARY_PATH=/data/local/tmp/tpc_c_cplusplus/lycium/usr/libxml2/armeabi-v7a/lib:/data/local/tmp/tpc_c_cplusplus/lycium/usr/libxslt/armeabi-v7a/lib:/data/local/tmp/tpc_c_cplusplus/lycium/usr/xz/armeabi-v7a/lib:/data/local/tmp/tpc_c_cplusplus/lycium/usr/zlib/armeabi-v7a/lib:/data/local/tmp/tpc_c_cplusplus/lycium/main/libxslt/libxslt-1.1.38-armeabi-v7a-build/tests/.libs + +export LIBXSLT_PLUGINS_PATH=/data/local/tmp/tpc_c_cplusplus/lycium/main/libxslt/libxslt-1.1.38-armeabi-v7a-build/tests/.libs + +##64位系统 +export LD_LIBRARY_PATH=/data/local/tmp/tpc_c_cplusplus/lycium/usr/libxml2/arm64-v8a/lib:/data/local/tmp/tpc_c_cplusplus/lycium/usr/libxslt/arm64-v8a/lib:/data/local/tmp/tpc_c_cplusplus/lycium/usr/xz/arm64-v8a/lib:/data/local/tmp/tpc_c_cplusplus/lycium/usr/zlib/arm64-v8a/lib:/data/local/tmp/tpc_c_cplusplus/lycium/main/libxslt/libxslt-1.1.38-arm64-v8a-build/tests/.libs + +export LIBXSLT_PLUGINS_PATH=/data/local/tmp/tpc_c_cplusplus/lycium/main/libxslt/libxslt-1.1.38-arm64-v8a-build/tests/.libs + +``` +- 进入到构建目录$ARCH-build/tests下执行 /usr/bin/make check_test 运行测试用例,如下截图(arm64-v8a-build为构建64位的目录,armeabi-v7a-build为构建32位的目录) + + + +![libxslt](pic/libxslt_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/libxslt/docs/pic/libxslt_install.png b/thirdparty/libxslt/docs/pic/libxslt_install.png new file mode 100644 index 0000000000000000000000000000000000000000..973527ce5c54403810ce830677b6bf7db5e6a356 Binary files /dev/null and b/thirdparty/libxslt/docs/pic/libxslt_install.png differ diff --git a/thirdparty/libxslt/docs/pic/libxslt_test.png b/thirdparty/libxslt/docs/pic/libxslt_test.png new file mode 100644 index 0000000000000000000000000000000000000000..d279c54f99ca783ec4f24d692ebc28f84f2ec198 Binary files /dev/null and b/thirdparty/libxslt/docs/pic/libxslt_test.png differ