SUMMARY="Utility to convert images in astronomical FITS to PNG format"
DESCRIPTION="FITS format is a general purpose astronomical image format.
FITS images stores measurements of a physical quantity - an array of the
angular distribution of the photon events or the optical intensity.
Fitspng does visualization of such array by converting them to the
images in PNG format."
HOMEPAGE="http://integral.physics.muni.cz/fitspng/"
COPYRIGHT="2006 - 2019, F. Hroch,
	Masaryk University, Brno, Czech Republic."
LICENSE="GNU GPL v3"
REVISION="2"
SOURCE_URI="ftp://integral.physics.muni.cz/pub/fitspng/fitspng-$portVersion.tar.gz"
CHECKSUM_SHA256="caa7fc2f0c90bbd14b9499a705d74bb07df9f6ecf53454b9614ec3b30459f89e"

ARCHITECTURES="all !x86_gcc2 ?arm ?ppc ?sparc"
SECONDARY_ARCHITECTURES="x86"

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

PROVIDES="
	fitspng$secondaryArchSuffix = $portVersion
	cmd:fitspng$commandSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libcfitsio$secondaryArchSuffix
	lib:libpng16$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libcfitsio$secondaryArchSuffix
	devel:libpng16$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoreconf
	cmd:awk
	cmd:gcc$secondaryArchSuffix
	cmd:make
	"

BUILD()
{
	if [ $effectiveTargetArchitecture == x86_64 ]; then
		GCC5FLAGS="--enable-x86-64"
	fi

	CFLAGS="-O4 -DNEBUG"

	autoreconf -vfi
	runConfigure --omit-dirs binDir ./configure --bindir="$commandBinDir"

	make $jobArgs
}

INSTALL()
{
	make install
}
