# SliTaz package receipt.

PACKAGE="pam"
VERSION="1.3.0"
CATEGORY="system-tools"
SHORT_DESC="Pluggable Authentication Modules."
MAINTAINER="pascal.bellard@slitaz.org"
SOURCE="Linux-PAM"
TARBALL="$SOURCE-$VERSION.tar.bz2"
WEB_SITE="http://www.us.kernel.org/pub/linux/libs/pam/"
# Download sources from a non-https mirror so that tazwok can
# cook the toolchain (pam is a build-depend of busybox).
# It's because at this moment tazwok doesn't have access to https
# compatible wget.
WGET_URL="http://linux-pam.org/library/$TARBALL"

DEPENDS="glibc-base libdb"
BUILD_DEPENDS="flex db db-dev"

# Rules to configure and make the package.
compile_rules()
{
	cd $src
	./configure --sysconfdir=/etc --disable-nis \
		 $CONFIGURE_ARGS &&
	make && make install
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
	mkdir -p $fs/lib
	cp -a $_pkg/etc $fs
	cp -a $_pkg/sbin $fs
	cp -a $_pkg/lib/*so* $fs/lib
	cp -a $_pkg/lib/security $fs/lib
	rm -f $fs/lib/security/*.la
	cp -a $stuff/* $fs	
}

pre_remove()
{
	# If busybox-pam is installed, trigger its removal right now. Once pam shared
	# library will be removed, it will be too late. Don't worry about this, while
	# removing busybox-pam will replace itself by a non-pam busybox.
	if [ -d /var/lib/tazpkg/installed/busybox-pam ]; then
		tazpkg remove busybox-pam --auto
	fi
}