SUMMARY="An open source PAM library"
DESCRIPTION="OpenPAM is a Pluggable Authentication Modules implementation."
HOMEPAGE="https://www.openpam.org/"
COPYRIGHT="2002-2003 Networks Associates Technology, Inc.
	2004-2017 Dag-Erling Smørgrav"
LICENSE="BSD (3-clause)"
REVISION="4"
SOURCE_URI="http://downloads.sf.net/openpam/openpam-$portVersion.tar.gz"
CHECKSUM_SHA256="22f65222e9faf5729ee5d2db7796d81f95df1a54b03e89ae4713c85e939be85f"

ARCHITECTURES="all ?x86_gcc2"
SECONDARY_ARCHITECTURES="x86"

PROVIDES="
	openpam$secondaryArchSuffix = $portVersion
	lib:libpam$secondaryArchSuffix = 2.0.0 compat >= 2
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libcrypto$secondaryArchSuffix
	"

PROVIDES_devel="
	openpam${secondaryArchSuffix}_devel = $portVersion
	devel:libpam$secondaryArchSuffix = 2.0.0 compat >= 2
	"
REQUIRES_devel="
	openpam$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libcrypto$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:awk
	cmd:gcc$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	"

BUILD()
{
	runConfigure ./configure \
		--with-modules-dir=$libDir/openpam

	make $jobArgs
}

INSTALL()
{
	make install

	for f in pam_deny.la pam_permit.la pam_return.la; do
		rm $libDir/openpam/$f
	done

	rm $libDir/libpam.la

	prepareInstalledDevelLib libpam

	if [ -n "$secondaryArchSuffix" ]; then
		rm -rf $manDir
	fi

	packageEntries devel \
		$developDir
}

TEST()
{
	make check
}
