SUMMARY="A graph based image processing framework"
DESCRIPTION="GEGL (Generic Graphics Library) is a data flow based image processing framework, \
providing floating point processing and non-destructive image processing capabilities to GNU \
Image Manipulation Program and other projects (imgflo, GNOME Photos, gcut, iconographer, …)

With GEGL you chain together processing operations to represent the desired image processing \
pipeline. GEGL provides operations for image loading and storing, color adjustments, GIMPs \
artistic filters and more forms of image processing GEGL can also be used from the commandline."
HOMEPAGE="https://gegl.org/"
COPYRIGHT="Øyvind Kolås"
LICENSE="GNU LGPL v3"
REVISION="6"
SOURCE_URI="https://download.gimp.org/pub/gegl/0.4/gegl-$portVersion.tar.xz"
CHECKSUM_SHA256="ef63f0bca5b431c6119addd834ca7fbb507c900c4861c57b3667b6f4ccfcaaaa"
PATCHES="gegl-$portVersion.patchset"

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

PROVIDES="
	gegl$secondaryArchSuffix = $portVersion compat >= 0
	cmd:gegl$secondaryArchSuffix
	cmd:gegl_imgcmp$secondaryArchSuffix
	lib:libgegl_0.4$secondaryArchSuffix = 0.433.1 compat >= 0
	lib:libgegl_sc_0.4$secondaryArchSuffix = $portVersion compat >= 0
	lib:libgegl_npd_0.4$secondaryArchSuffix = $portVersion compat >= 0
	"
REQUIRES="
	haiku$secondaryArchSuffix
	xcairo${secondaryArchSuffix}
	lib:libavcodec$secondaryArchSuffix
	lib:libavformat$secondaryArchSuffix
	lib:libavutil$secondaryArchSuffix
	lib:libbabl_0.1$secondaryArchSuffix
	lib:libfribidi$secondaryArchSuffix
	lib:libgdk_pixbuf_2.0$secondaryArchSuffix
	lib:libgexiv2$secondaryArchSuffix
	lib:libglib_2.0$secondaryArchSuffix
	lib:libjpeg$secondaryArchSuffix
	lib:libjson_glib_1.0$secondaryArchSuffix
	lib:libintl$secondaryArchSuffix
	lib:liblcms2$secondaryArchSuffix
	lib:liblensfun$secondaryArchSuffix
	lib:libnsgif$secondaryArchSuffix
	lib:libOpenEXR_3_0$secondaryArchSuffix
	lib:libpango_1.0$secondaryArchSuffix
	lib:libpangocairo_1.0$secondaryArchSuffix
	lib:libpangoft2_1.0$secondaryArchSuffix
	lib:libpng16$secondaryArchSuffix
	lib:libpoppler$secondaryArchSuffix
	lib:libpoppler_glib$secondaryArchSuffix
	lib:libraw$secondaryArchSuffix
	lib:librsvg_2$secondaryArchSuffix
	lib:libtiff$secondaryArchSuffix
	lib:libumfpack$secondaryArchSuffix
	lib:libwebp$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

PROVIDES_devel="
	gegl${secondaryArchSuffix}_devel = $portVersion compat >= 0
	devel:libgegl_0.4$secondaryArchSuffix = 0.433.1 compat >= 0
	devel:libgegl_sc_0.4$secondaryArchSuffix = $portVersion compat >= 0
	devel:libgegl_npd_0.4$secondaryArchSuffix = $portVersion compat >= 0
	"
REQUIRES_devel="
	gegl$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	xcairo${secondaryArchSuffix}_devel
	devel:libavcodec$secondaryArchSuffix
	devel:libavformat$secondaryArchSuffix
	devel:libbabl_0.1$secondaryArchSuffix
	devel:libcairo$secondaryArchSuffix
	devel:libfribidi$secondaryArchSuffix
	devel:libgdk_pixbuf_2.0$secondaryArchSuffix
	devel:libgexiv2$secondaryArchSuffix
	devel:libglib_2.0$secondaryArchSuffix
	devel:libjpeg$secondaryArchSuffix
	devel:libjson_glib_1.0$secondaryArchSuffix
	devel:liblcms2$secondaryArchSuffix
	devel:liblensfun$secondaryArchSuffix
	devel:libnsgif$secondaryArchSuffix
	devel:libOpenEXR_3_0$secondaryArchSuffix
	devel:libpango_1.0$secondaryArchSuffix
	devel:libpangocairo_1.0$secondaryArchSuffix
	devel:libpangoft2_1.0$secondaryArchSuffix
	devel:libpng16$secondaryArchSuffix
	devel:libpoppler$secondaryArchSuffix >= 117
	devel:libraw$secondaryArchSuffix
	devel:librsvg_2$secondaryArchSuffix
	devel:libtiff$secondaryArchSuffix
	devel:libumfpack$secondaryArchSuffix
	devel:libwebp$secondaryArchSuffix
	devel:libX11$secondaryArchSuffix
	devel:libXext$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:find
	cmd:gcc$secondaryArchSuffix
	cmd:make
	cmd:meson
	cmd:ninja
	cmd:perl
	cmd:pkg_config$secondaryArchSuffix
	"

BUILD()
{
	meson \
		--buildtype=release \
		--prefix=$prefix \
		--libdir=$libDir \
		--libexecdir=$binDir \
		--datadir=$dataDir \
		--localedir=$dataDir/locale \
		--includedir=$includeDir \
		--sysconfdir=$settingsDir \
		-Dintrospection=false \
		-Dpango=enabled \
		-Dpangocairo=enabled \
		_build

	cd _build
	ninja
}

INSTALL()
{
	cd _build
	ninja install

	rm $libDir/gegl-0.4/*.json

	prepareInstalledDevelLibs libgegl-0.4 libgegl-sc-0.4 libgegl-npd-0.4
	fixPkgconfig

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