SUMMARY="Image Quantization Library"
DESCRIPTION="Small, portable C library for high-quality conversion of RGBA \
images to 8-bit indexed-color (palette) images."
HOMEPAGE="https://pngquant.org/lib/"
COPYRIGHT="2009-2018 by Kornel Lesiński
	1997-2002 by Greg Roelofs
	1989-1991 by Jef Poskanzer"
LICENSE="MIT
	GNU GPL v3"
REVISION="1"
SOURCE_URI="https://github.com/ImageOptim/libimagequant/archive/$portVersion.tar.gz"
CHECKSUM_SHA256="1f46deec3fa280335cf7f0be3ede6006bb420ba8159a03d1f6938e8d283d03ae"
SOURCE_FILENAME="libimagequant-$portVersion.tar.gz"

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

PROVIDES="
	libimagequant$secondaryArchSuffix = $portVersion
	lib:libimagequant$secondaryArchSuffix = 0
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libgomp$secondaryArchSuffix
	"

PROVIDES_devel="
	libimagequant${secondaryArchSuffix}_devel = $portVersion
	devel:libimagequant$secondaryArchSuffix = 0
	"
REQUIRES_devel="
	libimagequant$secondaryArchSuffix == $portVersion base
	"

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

BUILD()
{
	# Hand rolled configure script, so not all flags are supported.
	./configure --prefix=$prefix --libdir=$libDir --includedir=$includeDir \
		--pkgconfigdir=$libDir/pkgconfig --with-openmp=static --enable-sse
	make $jobArgs
}

INSTALL()
{
	make install

	prepareInstalledDevelLib \
		libimagequant
	fixPkgconfig

	packageEntries devel \
		$developDir
}
