SUMMARY="A uniform interface to hash algorithms"
DESCRIPTION="Libmhash is a library that provides a uniform interface to \
several hash algorithms. It supports the basics for message authentication \
by following rfc2104 (HMAC). It also includes some key generation algorithms \
which are based on hash algorithms."
HOMEPAGE="http://mhash.sourceforge.net/"
COPYRIGHT="1998 Nikos Mavroyanopoulos
	1999, 2000 Sascha Schumman, Nikos Mavroyanopoulos"
LICENSE="GNU LGPL v2"
REVISION="1"
SOURCE_URI="https://downloads.sourceforge.net/mhash/mhash-$portVersion.tar.gz"
CHECKSUM_SHA256="3dcad09a63b6f1f634e64168dd398e9feb9925560f9b671ce52283a79604d13e"

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86"

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

PROVIDES="
	mhash$secondaryArchSuffix = $portVersion
	lib:libmhash$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"

PROVIDES_devel="
	mhash${secondaryArchSuffix}_devel = $portVersion
	devel:libmhash$secondaryArchSuffix = $libVersion
	"
REQUIRES_devel="
	mhash$secondaryArchSuffix == $portVersion base
	"

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

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

INSTALL()
{
	make install

	# libtool
	rm -f $libDir/*.la

	prepareInstalledDevelLib libmhash
	fixPkgconfig

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

	# devel package
	packageEntries devel \
		$developDir \
		$maybe_manDir
}

TEST()
{
	make check
}
