SUMMARY="C++ interface for Pango"
DESCRIPTION="A C++ wrapper for the Pango text layout library"
HOMEPAGE="https://pango.gnome.org/"
COPYRIGHT="2021 pangomm authors"
LICENSE="GNU LGPL v2.1"
REVISION="1"
SOURCE_URI="https://download.gnome.org/sources/pangomm/2.46/pangomm-${portVersion}.tar.xz"
CHECKSUM_SHA256="57442ab4dc043877bfe3839915731ab2d693fc6634a71614422fb530c9eaa6f4"

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

libVersion="1.0.30"
libVersionCompat="$libVersion compat >= ${libVersion%%.*}"
apiVers="1.4"

PROVIDES="
	pangomm$secondaryArchSuffix = $portVersion
	lib:libpangomm_$apiVers$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libcairomm_1.0$secondaryArchSuffix
	lib:libglibmm$secondaryArchSuffix
	lib:libpango_1.0$secondaryArchSuffix
	lib:libsigc_2.0$secondaryArchSuffix
	lib:libglib_2.0$secondaryArchSuffix
	"

PROVIDES_devel="
	pangomm${secondaryArchSuffix}_devel = $portVersion
	devel:libpangomm_$apiVers$secondaryArchSuffix
	"
REQUIRES_devel="
	pangomm$secondaryArchSuffix == $portVersion base
	devel:libcairomm_1.0$secondaryArchSuffix
	devel:libglibmm$secondaryArchSuffix
	devel:libpango_1.0$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libcairomm_1.0$secondaryArchSuffix
	devel:libglibmm$secondaryArchSuffix
	devel:libpango_1.0$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:meson
	cmd:ninja
	cmd:pkg_config$secondaryArchSuffix
	"

defineDebugInfoPackage pangomm$secondaryArchSuffix \
	"$libDir"/libpangomm-$apiVers.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/pangomm-$apiVers/include/*.h $includeDir/pangomm-$apiVers
	rm -rf $libDir/pangomm-$apiVers

	prepareInstalledDevelLibs \
		libpangomm-$apiVers

	fixPkgconfig

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

	packageEntries devel \
		$developDir
}
