# Contributor: William Pitcock <nenolod@dereferenced.org>
# Maintainer: William Pitcock <nenolod@dereferenced.org>
pkgname=libnih
pkgver=1.0.3
pkgrel=4
pkgdesc="glib-like library for embedded use"
url="https://launchpad.net/libnih"
arch="all"
license="LGPL"
depends=
depends_dev="dbus-dev expat-dev"
makedepends="$depends_dev"
install=""
subpackages="$pkgname-dev $pkgname-doc"
source="https://launchpad.net/libnih/${pkgver%.*}/${pkgver}/+download/${pkgname}-${pkgver}.tar.gz
	musl-fix-signals.patch
	"

_builddir="${srcdir}/${pkgname}-${pkgver}"
prepare() {
	local i
	cd "$_builddir"
	update_config_sub || return 1
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done
}

build() {
	cd "$_builddir"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--libdir=/lib \
		--sysconfdir=/etc \
		--localstatedir=/var \
		--disable-nls \
		|| return 1
	make || return 1
}

package() {
	cd "$_builddir"
	make DESTDIR="$pkgdir" install || return 1
}

md5sums="db7990ce55e01daffe19006524a1ccb0  libnih-1.0.3.tar.gz
a2653e792f5d88faa31e5a4a23097150  musl-fix-signals.patch"
sha256sums="897572df7565c0a90a81532671e23c63f99b4efde2eecbbf11e7857fbc61f405  libnih-1.0.3.tar.gz
5d7d51e5ccd4e819bf04be4066717465b086f45a990e8a06372bcfe6a7ac11cc  musl-fix-signals.patch"
sha512sums="fce40d2445b28c27b8838631681ca3206a4f053b2dd4fc488fc9ef98bbd3d933e3d62b82cf346be2ef1677f6457f692cf5544cd915a6bb1e5c618f98ffa101b4  libnih-1.0.3.tar.gz
77a979b3076c4e4229359f28c2e9d4fb66d799a66d60391ab6fd7e0dfe2a615b88330a979877b105293a95ed147546596eca174f52b75beca0457c49a017d040  musl-fix-signals.patch"
