SUMMARY="Simple command line calculator"
DESCRIPTION="amath features a case sensitive command line interface, internal \
IEEE 754 calculations with 15 significant digits, calculations with real and \
complex numbers, variables and user defined functions, logarithmic and exponential \
functions, trigonometric and hyperbolic function and selected mathematical \
constants and rounding functions."
HOMEPAGE="https://amath.innolan.net/"
COPYRIGHT="2014-2018 Carsten Sonne Larsen"
LICENSE="BSD (2-clause)"
REVISION="1"
SOURCE_URI="http://dist2.innolan.net/amath-$portVersion.tar.gz"
CHECKSUM_SHA256="ed77eb2a367a7462a0d13dc7d2188deb7464f59c166bdc346c3abcd9c0a4e31c"

ARCHITECTURES="all"

PROVIDES="
	amath = $portVersion
	cmd:amath
	"
REQUIRES="
	haiku
	"

BUILD_REQUIRES="
	haiku_devel
	"
BUILD_PREREQUIRES="
	cmd:gcc
	cmd:make
	"

if [ "$effectiveTargetArchitecture" = x86_gcc2 ]; then
PATCH()
{
	sed -i -e 's/^\(gcclib="-lstdc++\)"$/\1.r4"/;' configure
}
fi

BUILD()
{
	./configure LDFLAGS=-lbe
	make static $jobArgs
}

INSTALL()
{
	mkdir -p $binDir $manDir/man1
	cp amath $binDir/amath
	cp amath.1 $manDir/man1/amath.1
}

TEST()
{
	LIBRARY_PATH="$sourceDir/src/lib:$sourceDir/src/cplex:$sourceDir/src/real:$sourceDir/src/clib${LIBRARY_PATH:+:$LIBRARY_PATH}" \
	"$sourceDir"/amath --test
}
