SUMMARY="Provides GObjects and helper methods to read and write AppStream metadata"
DESCRIPTION="This library provides GObjects and helper methods to make it easy to \
read and write AppStream metadata. It also provides a simple DOM implementation \
that makes it easy to edit nodes and convert to and from the standardized XML \
representation.

What this library allows you to do:
* Read and write compressed AppStream XML files
* Add and search for applications in an application store
* Get screenshot image data and release announcements
* Easily retrieve the best application data for the current locale
* Efficiently interface with more heavy-weight parsers like expat."
HOMEPAGE="https://people.freedesktop.org/~hughsient/appstream-glib/"
COPYRIGHT="2007-2022 Richard Hughes"
LICENSE="GNU LGPL v2"
REVISION="3"
SOURCE_URI="https://people.freedesktop.org/~hughsient/appstream-glib/releases/appstream-glib-$portVersion.tar.xz"
SOURCE_DIR="appstream-glib-$portVersion"
CHECKSUM_SHA256="ca1ed22e3bde3912cb903aaa7de085d55771da454f1c0573fd9608e1de9c4002"

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

PROVIDES="
	appstream_glib$secondaryArchSuffix = $portVersion compat >= 0
	lib:libappstream_glib$secondaryArchSuffix = 8.0.10 compat >= 8
	cmd:appstream_builder = $portVersion
	cmd:appstream_compose = $portVersion
	cmd:appstream_util = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	xcairo$secondaryArchSuffix
	lib:libarchive$secondaryArchSuffix
	lib:libfontconfig$secondaryArchSuffix
	lib:libfreetype$secondaryArchSuffix
	lib:libfribidi$secondaryArchSuffix
	lib:libgdk_3$secondaryArchSuffix
	lib:libgtk_3$secondaryArchSuffix
	lib:libgdk_pixbuf_2.0$secondaryArchSuffix
	lib:libglib_2.0$secondaryArchSuffix
	lib:libjson_glib_1.0$secondaryArchSuffix
	lib:libintl$secondaryArchSuffix
	lib:libpango_1.0$secondaryArchSuffix
	lib:libpangocairo_1.0$secondaryArchSuffix
	lib:libpangoft2_1.0$secondaryArchSuffix
	lib:libsoup_2.4$secondaryArchSuffix
	lib:libuuid$secondaryArchSuffix >= 1.3
	lib:libxml2$secondaryArchSuffix
	lib:libxslt$secondaryArchSuffix
	lib:libyaml_0$secondaryArchSuffix
	"

PROVIDES_devel="
	appstream_glib${secondaryArchSuffix}_devel = $portVersion compat >= 0
	devel:libappstream_glib$secondaryArchSuffix = 8.0.10 compat >= 8
	"
REQUIRES_devel="
	appstream_glib$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	xcairo${secondaryArchSuffix}_devel
	lib:libgdk_3$secondaryArchSuffix
	devel:libarchive$secondaryArchSuffix
	devel:libfontconfig$secondaryArchSuffix
	devel:libfreetype$secondaryArchSuffix
	devel:libfribidi$secondaryArchSuffix
	devel:libgtk_3$secondaryArchSuffix
	devel:libgdk_3$secondaryArchSuffix
	devel:libgdk_pixbuf_2.0$secondaryArchSuffix
	devel:libglib_2.0$secondaryArchSuffix
	devel:libjson_glib_1.0$secondaryArchSuffix
	devel:libpango_1.0$secondaryArchSuffix
	devel:libpangocairo_1.0$secondaryArchSuffix
	devel:libpangoft2_1.0$secondaryArchSuffix
	devel:libsoup_2.4$secondaryArchSuffix
	devel:libuuid$secondaryArchSuffix >= 1.3
	devel:libX11$secondaryArchSuffix
	devel:libXext$secondaryArchSuffix
	devel:libxml2$secondaryArchSuffix
	devel:libxslt$secondaryArchSuffix
	devel:libyaml_0$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:find
	cmd:gcc$secondaryArchSuffix
	cmd:gperf
	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 \
		-Drpm=false \
		-Dstemmer=false \
		-Dgtk-doc=false \
		-Dman=false \
		_build

	cd _build
	ninja
}

INSTALL()
{
	cd _build
	ninja install

	rm -rf $prefix/share

	prepareInstalledDevelLibs libappstream-glib
	fixPkgconfig

	# devel package
	packageEntries devel \
		$developDir
}
