SUMMARY="A C++ library for efficient computations with arbitrary precision numbers"
DESCRIPTION="CLN stands for Class Library for Numbers and is a library for \
high-performance numeric computations with arbitrary precision. It is \
implemented in C++ for high efficiency, type safety and nice syntax and \
supports a wide range of types and functions that operate on them. It is \
highly optimized in terms of both efficiency and speed and provides great \
interoperability."
HOMEPAGE="https://www.ginac.de/CLN/"
COPYRIGHT="1988-2008 Bruno Haible
	2000-2014 Richard Kreckel
	2008-2010 Alexei Sheplyakov"
LICENSE="GNU GPL v2"
REVISION="1"
SOURCE_URI="https://www.ginac.de/CLN/cln-$portVersion.tar.bz2"
CHECKSUM_SHA256="f492530e8879bda529009b6033e1923c8f4aae843149fc28c667c20b094d984a"
PATCHES="cln-$portVersion.patch"

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

libclnVersion="6.0.6"
libclnVersionCompat="$libclnVersion compat >= ${libclnVersion%%.*}"

if [ "$targetArchitecture" != x86_gcc2 ]; then
	commandSuffix=$secondaryArchSuffix
	commandBinDir=$binDir
else
	commandSuffix=
	commandBinDir=$prefix/bin
fi

PROVIDES="
	cln$secondaryArchSuffix = $portVersion
	lib:libcln$secondaryArchSuffix = $libclnVersionCompat
	cmd:pi$commandSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"

PROVIDES_devel="
	cln${secondaryArchSuffix}_devel = $portVersion
	devel:libcln$secondaryArchSuffix = $libclnVersionCompat
	"
REQUIRES_devel="
	cln$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	"
BUILD_PREREQUIRES="
	cmd:awk
	cmd:make
	cmd:g++$secondaryArchSuffix
	"

BUILD()
{
	runConfigure --omit-dirs binDir ./configure --bindir=$commandBinDir
	make $jobArgs
}

INSTALL()
{
	make install

	rm $libDir/*.la

	prepareInstalledDevelLib libcln

	fixPkgconfig

	packageEntries devel \
		$developDir
}
