SUMMARY="The official C++ interface for the ATK accessibility toolkit library"
DESCRIPTION="The official C++ wrapper for the ATK accessibility toolkit."
HOMEPAGE="https://gitlab.gnome.org/GNOME/atkmm/"
COPYRIGHT="2010-2021 atkmm authors"
LICENSE="GNU LGPL v2.1"
REVISION="1"
SOURCE_URI="https://download.gnome.org/sources/atkmm/2.28/atkmm-$portVersion.tar.xz"
CHECKSUM_SHA256="a0bb49765ceccc293ab2c6735ba100431807d384ffa14c2ebd30e07993fd2fa4"

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

libVersion="1.1.0"
libVersionCompat="$libVersion compat >= ${libVersion%%.*}"
apiVersion="1.6"

PROVIDES="
	atkmm$secondaryArchSuffix = $portVersion
	lib:libatkmm_$apiVersion$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libatk_1.0$secondaryArchSuffix
	lib:libglib_2.0$secondaryArchSuffix
	lib:libglibmm_2.4$secondaryArchSuffix
	lib:libsigc_2.0$secondaryArchSuffix
	"

PROVIDES_devel="
	atkmm${secondaryArchSuffix}_devel = $portVersion
	devel:libatkmm_$apiVersion$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES_devel="
	atkmm$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libatk_1.0$secondaryArchSuffix
	devel:libglibmm_2.4$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:meson
	cmd:ninja
	cmd:pkg_config$secondaryArchSuffix
	"

defineDebugInfoPackage atkmm$secondaryArchSuffix \
	"$libDir"/libatkmm-$apiVersion.so.$libVersion

BUILD()
{
	meson build \
		--prefix=$prefix --includedir=$includeDir \
		--libdir=$libDir --datadir=$dataDir --bindir=$binDir \
		-Dmaintainer-mode=false --buildtype=debugoptimized

	ninja $jobArgs -C build
}

INSTALL()
{
	ninja -C build install

	rm -rf $libDir/*.la

	mv $libDir/atkmm-$apiVersion/include/*.h $includeDir/atkmm-$apiVersion
	rm -rf $libDir/atkmm-$apiVersion

	prepareInstalledDevelLibs \
		libatkmm-$apiVersion

	fixPkgconfig

	sed -i -e 's|-I${libdir}/atkmm-$apiVersion/include||' \
		$developLibDir/pkgconfig/atkmm-$apiVersion.pc

	packageEntries devel \
		$developDir
}
