SUMMARY="Elliptic Curve Method for Integer Factorization"
DESCRIPTION="C implementation of the Elliptic Curve Method for factorizing integers"
HOMEPAGE="http://ecm.gforge.inria.fr/"
COPYRIGHT="2001-2016 GMP-ECM Authors"
LICENSE="
	GNU GPL v3
	GNU LGPL v3
	"
REVISION="1"
SOURCE_URI="https://gforge.inria.fr/frs/download.php/file/36224/ecm-$portVersion.tar.gz"
CHECKSUM_SHA256="0cf7b3eee8462cc6f98b418b47630e1eb6b3f4f8c3fc1fb005b08e2a1811ba43"
SOURCE_DIR="ecm-$portVersion"

ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"

libVersion="1.0.0"
libVersionCompat="$libVersion compat >= 1"

PROVIDES="
	gmp_ecm$secondaryArchSuffix = $portVersion
	cmd:ecm$secondaryArchSuffix = $portVersion
	lib:libecm$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libgmp$secondaryArchSuffix
	lib:libgomp$secondaryArchSuffix
	"

PROVIDES_devel="
	gmp_ecm${secondaryArchSuffix}_devel = $portVersion
	devel:libecm$secondaryArchSuffix = $libVersion
	"
REQUIRES_devel="
	gmp_ecm$secondaryArchSuffix == $portVersion base
	haiku${secondaryArchSuffix}_devel
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libgmp$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:awk
	cmd:cmp
	cmd:gcc$secondaryArchSuffix
	cmd:m4
	cmd:make
	"

BUILD()
{
	runConfigure ./configure --enable-shared --enable-openmp
	make $jobArgs
}

INSTALL()
{
	make install

	install -d -m 755 "$docDir"
	install -t "$docDir" -m 644 AUTHORS NEWS README*

	rm "$libDir"/*.la

	prepareInstalledDevelLib libecm

	packageEntries devel \
		"$developDir" \
		"$docDir/NEWS"
}

TEST()
{
	make check
}
