SUMMARY="Celestial Mechanics and Astronomical Calculation Library"
DESCRIPTION="libnova is a general purpose, double precision, Celestial \
Mechanics, Astrometry and Astrodynamics library.

The intended audience of libnova is C / C++ programmers, astronomers and \
anyone else interested in calculating positions of astronomical objects \
or celestial mechanics.

The current version of libnova can calculate:
* Aberration
* Nutation
* Apparent Position
* Dynamical Time
* Julian Day
* Precession
* Proper Motion
* Sidereal Time
* Solar Coordinates (using VSOP87)
* Coordinate Transformations
* Planetary Positions Mercury - Pluto (Mercury - Neptune using VSOP87)
* Planetary Magnitude, illuminated disk and phase angle.
* Lunar Position (using ELP82), phase angle.
* Elliptic Motion of bodies (Asteroid + Comet positional and orbit data)
* Asteroid + Comet magnitudes
* Parabolic Motion of bodies (Comet positional data)
* Orbit velocities and lengths
* Atmospheric refraction
* Rise, Set and Transit times.
* Semidiameters of the Sun, Moon, Planets and asteroids.
* Angular separation of bodies
* Hyperbolic motion of bodies
* Heliocentric (barycentric) time correction"
HOMEPAGE="http://libnova.sourceforge.net/"
COPYRIGHT="2000 - 2005 Liam Girdwood
	2000 - 2005, 2009, 2011, 2015 Petr Kubanek
	2015 Jeroen Vreeken
	2015 Lukasz Komsta
	1999, 2000 Juan Carlos Remis"
LICENSE="GNU LGPL v2"
REVISION="2"
SOURCE_URI="https://dev.gentoo.org/~asturm/distfiles/libnova-$portVersion.tar.xz"
CHECKSUM_SHA256="699a6ffe0b70a2b4f594ca4231eedfc772161460a9de7ff90dd1d92fd3ba7d39"

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

portVersionCompat="${portVersion%.*}"
libVersion="0.0.0"
libVersionCompat="$libVersion compat >= ${libVersion%%.*}"

PROVIDES="
	libnova$secondaryArchSuffix = $portVersion
	lib:libnova$secondaryArchSuffix = $libVersionCompat
	lib:libnova_$portVersionCompat$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"

PROVIDES_devel="
	libnova${secondaryArchSuffix}_devel = $portVersion
	cmd:libnovaconfig$secondaryArchSuffix
	devel:libnova$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES_devel="
	haiku$secondaryArchSuffix
	libnova$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:automake
	cmd:gcc$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

defineDebugInfoPackage libnova$secondaryArchSuffix \
	$libDir/libnova-$portVersionCompat.so.$libVersion

BUILD()
{
	libtoolize --force --copy --install
	aclocal -I m4
	autoconf
	automake --add-missing --force-missing
	runConfigure ./configure
	make $jobArgs
}

INSTALL()
{
	make install

	mkdir -p $includeDir
	mv $prefix/include/* $includeDir
	rmdir $prefix/include/

	# prepare develop/lib
	prepareInstalledDevelLib libnova
	fixPkgconfig

	# devel package
	packageEntries devel \
		$binDir \
		$developDir
}

TEST()
{
	make check
}
