# Contributor: A. Wilcox <awilfox@adelielinux.org>
# Maintainer: A. Wilcox <awilfox@adelielinux.org>
pkgname=tinyxml2
pkgver=7.1.0
pkgrel=0
pkgdesc="Small, efficient C++ XML parser"
url=" "
arch="all"
license="Zlib"
depends=""
makedepends="cmake"
subpackages="$pkgname-dev"
source="tinyxml2-$pkgver.tar.gz::https://github.com/leethomason/tinyxml2/archive/$pkgver.tar.gz"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=RelWithDebugInfo \
		-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
		-DCMAKE_C_FLAGS="$CFLAGS" \
		${CMAKE_CROSSOPTS} .
	make
}

check() {
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest
}

package() {
	make DESTDIR="$pkgdir" install
}

sha512sums="09d5f37018f79a593ff35e33d4296c9ec643a22e83c0cee4c37949300f86201eee07e9b7e6ba55044d8abb438d5d21b70d5843a96ae4652389bb164047ec31e1  tinyxml2-7.1.0.tar.gz"