SUMMARY="High quality system independent, portable, open source libm implementation"
DESCRIPTION="OpenLibm is an effort to have a high quality, portable, \
standalone C mathematical library (libm). It can be used standalone in \
applications and programming language implementations.

The project was born out of a need to have a good libm for the Julia \
programming langage that worked consistently across compilers and operating \
systems, and in 32-bit and 64-bit environments."
HOMEPAGE="https://openlibm.org"
COPYRIGHT="2011-14 The Julia Project. \
	2008 Stephen L. Moshier \
	1992-2011 The FreeBSD Project. \
	1993 by Sun Microsystems, Inc. \
	1997, 1999 Free Software Foundation, Inc."
LICENSE="MIT
	ISC
	BSD (2-clause)
	GNU LGPL v2.1"
REVISION="2"
SOURCE_URI="https://github.com/JuliaMath/openlibm/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="be983b9e1e40e696e8bbb7eb8f6376d3ca0ae675ae6d82936540385b0eeec15b"
SOURCE_DIR="openlibm-$portVersion"

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

libVersion="3.0"
libVersionCompat="$libVersion compat >= ${libVersion%%.*}"

PROVIDES="
	openlibm$secondaryArchSuffix = $portVersion
	lib:libopenlibm$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"

PROVIDES_devel="
	openlibm${secondaryArchSuffix}_devel = $portVersion
	devel:libopenlibm$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES_devel="
	openlibm$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	"
BUILD_PREREQUIRES="
	cmd:cc$secondaryArchSuffix
	cmd:make
	"

defineDebugInfoPackage openlibm$secondaryArchSuffix \
	"$libDir"/libopenlibm.so.$libVersion

BUILD()
{
	make $jobArgs
}

INSTALL()
{
	make install \
		prefix=$prefix \
		libdir=$developLibDir \
		shlibdir=$libDir \
		includedir=$includeDir \
		pkgconfigdir=$developLibDir/pkgconfig

	prepareInstalledDevelLibs libopenlibm
	fixPkgconfig

	packageEntries devel $developDir
}

TEST()
{
	make test
}
