# Contributor: A. Wilcox <awilfox@adelielinux.org>
# Maintainer: A. Wilcox <awilfox@adelielinux.org>
pkgname=libtap
pkgver=1.14.0
pkgrel=0
pkgdesc="C library implementing the Test Anything Protocol (TAP)"
url="https://www.shlomifish.org/open-source/projects/libtap/"
arch="all"
license="BSD-3-Clause"
depends=""
makedepends="cmake perl"
subpackages="$pkgname-dev $pkgname-doc"
source="http://web-cpan.shlomifish.org/downloads/libtap-$pkgver.tar.xz"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-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="1d78f9ed5b554a7a9f8a2a6e3dcb30e09ba5bd4b98c77499e57599be615413f6c6dddb3dd498b6ac49a5449e54e1134a6a4816adaab5b993e3c0027edc2a2404  libtap-1.14.0.tar.xz"