# 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=libkml
pkgver=master
pkgrel=0
pkgdesc="Libkml is an open-source C++library used for parsing and generating KML (Keyhole Markup Language) files. KML is an XML based file format used to represent geospatial data and is widely used in geographic information systems such as Google Earth and Google Maps."
url="https://github.com/libkml/libkml"
archs=("armeabi-v7a" "arm64-v8a")
license=("")
depends=("boost" "googletest" "uriparser" "libexpat" "minizip-ng-1.2" "zlib")
makedepends=()
autounpack=true
downloadpackage=true
buildtools="cmake"
commitid="916a801ed3143ab82c07ec108bad271aa441da16"
source="https://github.com/libkml/libkml/archive/${commitid}.zip"
builddir=${pkgname}-${commitid}
packagename=${builddir}.zip
patchflag=true
prepare() {
if $patchflag
then
cd $builddir
patch -p1 < `pwd`/../libkml_oh_pkg.patch >> $publicbuildlog 2>&1
# 解决用例操作/tmp路径没权限问题 更改写入测试目录 /tmp 为可访问的目录
# patch只需要打一次,关闭打patch
patchflag=false
cd $OLDPWD
fi
mkdir -p $builddir/$ARCH-build
}
build() {
cd $builddir
${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" -DBUILD_TESTING=ON -DOHOS_ALLOW_UNDEFINED_SYMBOLS=ON\
-DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} \
-I${LYCIUM_ROOT}/usr/libexpat/${ARCH}/include \
-I${LYCIUM_ROOT}/usr/uriparser/$ARCH/include \
-I${LYCIUM_ROOT}/usr/minizip-ng-1.2/${ARCH}/include \
-I${LYCIUM_ROOT}/usr/googletest/${ARCH}/include \
-L${LYCIUM_ROOT}/usr/zlib/${ARCH}/lib \
-L${LYCIUM_ROOT}/usr/minizip-ng-1.2/${ARCH}/lib \
-L${LYCIUM_ROOT}/usr/libexpat/${ARCH}/lib \
-lz -laes -lminizip -lexpat" \
-DCMAKE_C_FLAGS="${CMAKE_C_FLAGS} \
-I${LYCIUM_ROOT}/usr/libexpat/${ARCH}/include \
-I${LYCIUM_ROOT}/usr/uriparser/$ARCH/include \
-I${LYCIUM_ROOT}/usr/minizip-ng-1.2/${ARCH}/include \
-I${LYCIUM_ROOT}/usr/googletest/${ARCH}/include \
-L${LYCIUM_ROOT}/usr/zlib/${ARCH}/lib \
-L${LYCIUM_ROOT}/usr/minizip-ng-1.2/${ARCH}/lib \
-L${LYCIUM_ROOT}/usr/libexpat/${ARCH}/lib \
-lz -laes -lminizip -lexpat" \
-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 >> $buildlog 2>&1
ret=$?
cd $OLDPWD
return $ret
}
check() {
echo "The test must be on an OpenHarmony device!"
}
cleanbuild() {
rm -rf ${PWD}/$builddir
}