SUMMARY="A dynamic, any to any, pixel format conversion library"
DESCRIPTION="babl is pixel encoding and color space conversion engine in C.

It allows converting between different methods of storing pixels known as \
pixel formats that have with different bitdepths and other data representations, \
color models, color spaces and component permutations.

A vocabulary to formulate new pixel formats from existing primitives is provided \
as well as the framework to add new color models, spaces and data types."
HOMEPAGE="https://gegl.org/babl/"
COPYRIGHT="Øyvind Kolås"
LICENSE="GNU LGPL v3"
REVISION="1"
SOURCE_URI="https://download.gimp.org/pub/babl/0.1/babl-$portVersion.tar.xz"
CHECKSUM_SHA256="4f0d7f4aaa0bb2e725f349adf7b351a957d9fb26d555d9895a7af816b4167039"

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

PROVIDES="
	babl$secondaryArchSuffix = $portVersion compat >= 0
	lib:libbabl_0.1$secondaryArchSuffix = 0.187.1 compat >= 0
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:liblcms2$secondaryArchSuffix
	"

PROVIDES_devel="
	babl${secondaryArchSuffix}_devel = $portVersion compat >= 0
	devel:libbabl_0.1$secondaryArchSuffix = 0.187.1 compat >= 0
	"
REQUIRES_devel="
	babl$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libgirepository_1.0$secondaryArchSuffix
	devel:libglib_2.0$secondaryArchSuffix
	devel:liblcms2$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:find
	cmd:gcc$secondaryArchSuffix
	cmd:make
	cmd:meson
	cmd:pkg_config$secondaryArchSuffix
	"

BUILD()
{
	meson \
		--buildtype=release \
		--prefix=$prefix \
		--libdir=$libDir \
		--libexecdir=$binDir \
		--datadir=$dataDir \
		--includedir=$includeDir \
		--sysconfdir=$settingsDir \
		-Dwith-docs=false \
		build

	cd build
	ninja
}

INSTALL()
{
	cd build
	ninja install

	prepareInstalledDevelLibs libbabl-0.1
	fixPkgconfig

	# devel package
	packageEntries devel \
		$developDir
}
