# 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 <hanjinfei@foxmail.com>,li-santian <2372581223@qq.com>
# Maintainer: Jeff Han <hanjinfei@foxmail.com>
pkgname=uriparser
pkgver=uriparser-0.9.8
pkgrel=0
pkgdesc="uriparser is a strictly RFC 3986 compliant URI parsing and handling library written in C89."
url="https://github.com/uriparser/uriparser"
archs=("armeabi-v7a" "arm64-v8a")
license=("BSD 3-Clause License")
depends=("googletest")
makedepends=()
source="https://codeload.github.com/$pkgname/$pkgname/zip/refs/tags/$pkgver"
downloadpackage=true
autounpack=true
builddir=$pkgname-${pkgver}
packagename=$builddir.zip
source envset.sh
prepare() {
mkdir -p $builddir/$ARCH-build
}
build() {
cd $builddir
${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" \
-DCAMEK_BUILD_TYPE=Release \
-DURIPARSER_BUILD_DOCS:BOOL=OFF \
-DCMAKE_INSTALL_PREFIX=${PWD}/../../../lycium/usr/$pkgname/$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
return 0
}
check() {
echo "The test must be on an OpenHarmony device!"
cd $builddir/$ARCH-build/
if [[ "${OHOS_SDK: -1}" == "/" ]]; then
sed -i.bak "s|${OHOS_SDK}native/build-tools/cmake/bin/cmake|cmake|g" Makefile
sed -i.bak "s|${OHOS_SDK}native/build-tools/cmake/bin/ctest|ctest|g" Makefile
else
sed -i.bak "s|${OHOS_SDK}/native/build-tools/cmake/bin/cmake|cmake|g" Makefile
sed -i.bak "s|${OHOS_SDK}/native/build-tools/cmake/bin/ctest|ctest|g" Makefile
fi
cd $OLDPWD
}
# 清理环境
cleanbuild() {
rm -rf ${PWD}/$builddir
}