# Description:	Linux-PAM (Pluggable Authentication Modules for Linux)
# URL:		http://www.kernel.org/pub/linux/libs/pam/
# Maintainer:	Alan Mizrahi, alan at mizrahi dot com dot ve

name=linux-pam
version=1.1.8
release=2
source=(
http://www.linux-pam.org/library/Linux-PAM-$version.tar.bz2
other
system-auth
)

build() {
	cd Linux-PAM-$version

	# pam_userdb needs the dbm api of libdb.
	# if the api isn't there, we disable the module
	db="$(grep -q __db_ndbm_open /usr/lib/libdb.* || echo --disable-db)"

	./configure \
		--sysconfdir=/etc \
		--prefix=/usr \
		--libdir=/lib \
		--mandir=/usr/man \
		--disable-nls \
		"$db"

	make
	make DESTDIR=$PKG install

	rm -rf $PKG/usr/share $PKG/lib/security/*.la
	mkdir -m 755 $PKG/etc/pam.d
	install -D -m 644 -o root -g root $SRC/other $PKG/etc/pam.d/other
	install -D -m 644 -o root -g root $SRC/system-auth $PKG/etc/pam.d/system-auth

	# the unix_chkpwd helper need the setuid bit
	chmod u+s $PKG/sbin/unix_chkpwd
}
