# Contributor: Leo <thinkabit.ukim@gmail.com>
# Maintainer: Laurent Bercot <ska-devel@skarnet.org>
pkgname=nsss
pkgver=0.2.0.5
pkgrel=0
pkgdesc="A small and statically linkable alternative to Name Service Switch"
url="https://skarnet.org/software/nsss"
arch="all"
license="ISC"
options="!check"
makedepends="skalibs-dev>=2.13"
subpackages="$pkgname-dev $pkgname-doc"
source="https://skarnet.org/software/nsss/nsss-$pkgver.tar.gz"

build() {
	./configure \
		--enable-shared \
		--enable-static \
		--disable-allstatic \
		--prefix=/usr \
		--libdir=/usr/lib \
		--libexecdir="/usr/lib/$pkgname" \
		--with-dynlib=/lib
	make
}

check() {
	# To run this, you need the s6-ipcserver package installed.
	# Checks are disabled because s6-ipcserver may be built with nsss,
	# and we want to avoid cycles.
	mkdir -p ROOT
	make DESTDIR="$builddir/ROOT" install
	env LD_LIBRARY_PATH="$builddir/ROOT/usr/lib" make check
}

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

	mkdir -p "$pkgdir/usr/share/doc"
	cp -a doc "$pkgdir/usr/share/doc/$pkgname"
}

sha512sums="
18450122ddaba22b9fe80f082f13c6265cfa91d7fe6125cfb46949447d17ab9b9b886838b3a9f3a4e5e60291cf04bddfe2d1403d6cf087e7c05cdefc1d98e614  nsss-0.2.0.5.tar.gz
"
