SUMMARY="A specialized computer algebra system"
DESCRIPTION="PARI/GP is a specialized computer algebra system, primarily \
aimed at number theorists, but has been put to good use in many other \
different fields, from topology or numerical analysis to physics.

Although quite an amount of symbolic manipulation is possible, PARI does \
badly compared to systems like Axiom, Magma, Maple, Mathematica, Maxima, or \
Reduce on such tasks, e.g.~multivariate polynomials, formal integration, \
etc. On the other hand, the three main advantages of the system are its \
speed, the possibility of using directly data types which are familiar to \
mathematicians, and its extensive algebraic number theory module (from \
the above-mentioned systems, only Magma provides similar features)."
HOMEPAGE="https://pari.math.u-bordeaux.fr/"
COPYRIGHT="2000-2018 The PARI Group, Bordeaux"
LICENSE="GNU GPL v2"
REVISION="2"
SOURCE_URI="https://pari.math.u-bordeaux.fr/pub/pari/unix/pari-$portVersion.tar.gz"
CHECKSUM_SHA256="3835caccaa3e0c64764521032d89efeb8773cce841f6655fec6d58e790f4c9a1"
PATCHES="pari-$portVersion.patchset"

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"

portVers=${portVersion%.*}

PROVIDES="
	pari$secondaryArchSuffix = $portVersion compat >= 2
	cmd:gp$secondaryArchSuffix
	cmd:gp_$portVers$secondaryArchSuffix
	cmd:gphelp$secondaryArchSuffix
	cmd:tex2mail$secondaryArchSuffix
	lib:libpari_gmp$secondaryArchSuffix = $portVersion compat >= 2
	"
REQUIRES="
	haiku$secondaryArchSuffix
	pari_data == $portVersion
	lib:libgmp$secondaryArchSuffix
	lib:libncurses$secondaryArchSuffix
	"

PROVIDES_devel="
	pari${secondaryArchSuffix}_devel = $portVersion compat >= 2
	devel:libpari_gmp$secondaryArchSuffix = $portVersion compat >= 2
	"
REQUIRES_devel="
	pari$secondaryArchSuffix == $portVersion base
	devel:libgmp$secondaryArchSuffix
	devel:libncurses$secondaryArchSuffix
	"

if [ -z "$secondaryArchSuffix" ]; then
	SUMMARY_data="A specialized computer algebra system (data files)"
	ARCHITECTURES_data="any"
	PROVIDES_data="
		pari_data = $portVersion
		"
	REQUIRES_data=""
fi

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libgmp$secondaryArchSuffix
	devel:libncurses$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:diff
	cmd:ld$secondaryArchSuffix
	cmd:make
	cmd:sed
	"

BUILD()
{
	./Configure --prefix=$prefix --bindir=$binDir --includedir=$includeDir \
		--libdir=$libDir --mandir=$manDir --datadir=$dataDir \
		--sysdatadir=$libDir/pari
	make -C Ohaiku-* $jobArgs all
}

INSTALL()
{
	make install
	rm $libDir/libpari.so
	if [ -n "$secondaryArchSuffix" ]; then
		rm -rf $dataDir $documentationDir
	else
		packageEntries data $dataDir
	fi

	prepareInstalledDevelLib libpari-gmp
	fixPkgconfig
	packageEntries devel $developDir
}

TEST()
{
	make dobench
#	make test-all
}
