SUMMARY="A theoretic integer library written entirely in C"
DESCRIPTION="LibTomMath is a free open source portable number theoretic \
multiple-precision integer library written entirely in C."
HOMEPAGE="https://www.libtom.net/"
COPYRIGHT="2010 Tom St. Denis"
LICENSE="Public Domain"
REVISION="1"
SOURCE_URI="https://github.com/libtom/libtommath/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="f3c20ab5df600d8d89e054d096c116417197827d12732e678525667aa724e30f"

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

PROVIDES="
	libtommath$secondaryArchSuffix = $portVersion
	lib:libtommath$secondaryArchSuffix = $portVersion compat >= 1
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"

PROVIDES_devel="
	libtommath${secondaryArchSuffix}_devel = $portVersion
	devel:libtommath$secondaryArchSuffix = $portVersion compat >= 1
	"
REQUIRES_devel="
	haiku${secondaryArchSuffix}_devel
	libtommath$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	"
BUILD_PREREQUIRES="
	cmd:ar$secondaryArchSuffix
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:libtool$secondaryArchSuffix
	cmd:make
	cmd:ranlib$secondaryArchSuffix
	cmd:sed
	"

BUILD()
{
	make $jobArgs -f makefile.shared IGNORE_SPEED=1
}

INSTALL()
{
	export LIBPATH=$libDir
	export INCPATH=$includeDir
	make -f makefile.shared install

	rm $libDir/libtommath.la

	prepareInstalledDevelLibs libtommath
	fixPkgconfig

	packageEntries devel $developDir
}

TEST()
{
	make $jobArgs -f makefile.shared IGNORE_SPEED=1 test_standalone
	./test
}
