# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=log4cplus
pkgver=2.1.2
pkgrel=0
pkgdesc="Logging Framework for C++"
url="https://github.com/log4cplus/log4cplus"
arch="all"
license="Apache-2.0 AND BSD-2-Clause"
checkdepends="findutils"
subpackages="
	$pkgname-static
	$pkgname-dev
	$pkgname-unicode
	"
source="https://github.com/log4cplus/log4cplus/releases/download/REL_${pkgver//./_}/log4cplus-$pkgver.tar.xz"

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--disable-implicit-initialization \
		--enable-lto \
		--enable-static \
		--with-working-c-locale
	make
}

check() {
	make check || {
		find . -name testsuite.log -type f -ls \
			-printf '%P {{{\n' \
			-exec cat -v -n '{}' ';' \
			-printf '}}} %P\n'
		return 1
	}
}

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

unicode() {
	pkgdesc="$pkgdesc (Unicode)"

	amove ./usr/lib/liblog4cplusU*
}

sha512sums="
d6285e4964e8eda072b61e0585d5fe08c1d942b688752baf75ba230d49691070156ab4da1803d82d0c09128bcb87e21910e38ee9441df13ff762d527fe431444  log4cplus-2.1.2.tar.xz
"
