SUMMARY="A modern, easy-to-use software library for cryptographic standards"
DESCRIPTION="Sodium is a portable, cross-compilable, installable, packageable \
fork of NaCl, with a compatible API, and an extended API to improve usability \
even further.
Its goal is to provide all of the core operations needed to build higher-level \
cryptographic tools.
The design choices emphasize security, and \"magic constants\" have clear \
rationales.
Despite the emphasis on high security, primitives are faster across-the-board \
than most implementations of the NIST standards."
HOMEPAGE="https://github.com/jedisct1/libsodium"
COPYRIGHT="2013-2017 Frank Denis"
LICENSE="ISC"
REVISION="1"
SOURCE_URI="https://download.libsodium.org/libsodium/releases/libsodium-$portVersion.tar.gz"
CHECKSUM_SHA256="6f504490b342a4f8a4c4a02fc9b866cbef8622d5df4e5452b46be121e46636c1"

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"

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

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

PROVIDES_devel="
	libsodium${secondaryArchSuffix}_devel = $portVersion
	devel:libsodium$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES_devel="
	libsodium$secondaryArchSuffix == $portVersion base
	"

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

defineDebugInfoPackage libsodium$secondaryArchSuffix \
	"$libDir"/libsodium.so.$libVersion

BUILD()
{
	runConfigure ./configure --disable-ssp ax_cv_check_cCATCHABLE_ABRT=no
	make
}

INSTALL()
{
	make install

	# remove libtool file
	rm -f $libDir/libsodium.la $libDir/libsodium.a

	prepareInstalledDevelLib libsodium
	fixPkgconfig
	packageEntries devel $developDir
}

TEST()
{
	make check
}
