SUMMARY="Replacements for the old Unix crypt"
DESCRIPTION="libmcrypt is the companion library used by Mcrypt, which is \
itself an enhanced replacement for the old crypt command.
libmcrypt allows developers to use a wide range of encryption functions \
without making drastic changes to their code. It contains the actual \
encryption functions and provides a standardized mechanism for accessing \
them."
HOMEPAGE="http://mcrypt.sourceforge.net/"
COPYRIGHT="1998-2002 Nikos Mavroyanopoulos"
LICENSE="GNU LGPL v2.1"
REVISION="1"
SOURCE_URI="https://downloads.sourceforge.net/mcrypt/libmcrypt-$portVersion.tar.gz"
CHECKSUM_SHA256="e4eb6c074bbab168ac47b947c195ff8cef9d51a211cdd18ca9c9ef34d27a373e"

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86"

libVersion="4.4.8"
libVersionCompat="$libVersion compat >= ${libVersion%%.*}"

PROVIDES="
	libmcrypt$secondaryArchSuffix = $portVersion
	lib:libmcrypt$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"

PROVIDES_devel="
	libmcrypt${secondaryArchSuffix}_devel = $portVersion
	cmd:libmcrypt_config$secondaryArchSuffix = $portVersion
	devel:libmcrypt$secondaryArchSuffix = $libVersion
	"
REQUIRES_devel="
	libmcrypt$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoreconf
	cmd:gcc$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	"

defineDebugInfoPackage libmcrypt$secondaryArchSuffix \
	$libDir/libmcrypt.so.$libVersion

BUILD()
{
	autoreconf -vfi
	runConfigure ./configure
	make $jobArgs
}

INSTALL()
{
	make install

	rm -f $libDir/*.la

	prepareInstalledDevelLib libmcrypt
	fixPkgconfig

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

	packageEntries devel \
		$binDir \
		$dataDir \
		$developDir \
		$maybe_manDir
}

TEST()
{
	make check
}
