# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=libconfig
pkgver=1.5
pkgrel=3
pkgdesc="A simple library for manipulating structured configuration files"
url="http://www.hyperrealm.com/libconfig/"
arch="all"
license="LGPL"
makedepends="autoconf automake libtool"
source="$pkgname-$pkgver.tar.gz::https://github.com/hyperrealm/$pkgname/archive/v$pkgver.tar.gz"
subpackages="$pkgname-doc $pkgname-dev $pkgname++:_cxx"

builddir="$srcdir/$pkgname-$pkgver"

prepare() {
	cd "$builddir"
	default_prepare
	autoreconf -vif
}

build() {
	cd "$builddir"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--mandir=/usr/share/man
	make
}

check() {
	cd "$builddir"
	make check
}

package() {
	cd "$builddir"
	make -j1 DESTDIR="$pkgdir/" install
}

_cxx() {
	pkgdesc="C++ bindings for libconfig"
	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/libconfig++.so.* "$subpkgdir"/usr/lib/
}

sha512sums="f3a0a969d56604c473b004fd15e541569a6b7639a23db896e391d6280060c278f0adbae1da92bc2a9a55431e74a9312d7581cc47dc27d043a9ac3b045ae2a8a0  libconfig-1.5.tar.gz"
