SUMMARY="Core library of PCManFM-Qt (Qt binding for libfm)"
DESCRIPTION="libfm-qt is the Qt port of libfm, a library providing components \
to build desktop file managers which belongs to LXDE."
HOMEPAGE="https://github.com/lxqt/libfm-qt"
COPYRIGHT="2013-2019 LXQt team"
LICENSE="GNU LGPL v2.1"
REVISION="3"
SOURCE_URI="https://github.com/lxqt/libfm-qt/archive/$portVersion.tar.gz"
CHECKSUM_SHA256="61c05da2afb22a5b869c6df3b62a2f7682ded33d3494bc73efb045a870295871"
SOURCE_DIR="libfm-qt-$portVersion"
PATCHES="libfm_qt-$portVersion.patchset"

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

libVersion="6.0.0"
libVersionCompat="$libVersion compat >= ${libVersion%%.*}"

PROVIDES="
	libfm_qt$secondaryArchSuffix = $portVersion
	lib:libfm_qt$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libexif$secondaryArchSuffix
	lib:libfm$secondaryArchSuffix
	lib:libgio_2.0$secondaryArchSuffix
	lib:libglib_2.0$secondaryArchSuffix
	lib:libgobject_2.0$secondaryArchSuffix
	lib:libgthread_2.0$secondaryArchSuffix
	lib:libintl$secondaryArchSuffix
	lib:libmenu_cache$secondaryArchSuffix
	lib:libQt5Core$secondaryArchSuffix
	lib:libQt5Gui$secondaryArchSuffix
	lib:libQt5Widgets$secondaryArchSuffix
	lib:libxcb$secondaryArchSuffix
	"

PROVIDES_devel="
	libfm_qt${secondaryArchSuffix}_devel = $portVersion
	devel:libfm_qt$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES_devel="
	libfm_qt$secondaryArchSuffix == $portVersion base
	devel:libfm$secondaryArchSuffix
	devel:libQt5Widgets$secondaryArchSuffix
#	devel:libQt5X11Extras$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	lxqt_build_tools$secondaryArchSuffix
	devel:libexif$secondaryArchSuffix
	devel:libfm$secondaryArchSuffix
	devel:libfm_extra$secondaryArchSuffix
	devel:libglib_2.0$secondaryArchSuffix
	devel:libmenu_cache$secondaryArchSuffix
	devel:libQt5Core$secondaryArchSuffix
	devel:libxcb$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:lrelease$secondaryArchSuffix >= 5
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

defineDebugInfoPackage libfm_qt$secondaryArchSuffix \
	"$libDir"/libfm-qt.so.$libVersion

BUILD()
{
	mkdir -p build
	cd build
	cmake .. $cmakeDirArgs \
		-DCMAKE_BUILD_TYPE=Release -DPULL_TRANSLATIONS=no
	make $jobArgs
}

INSTALL()
{
	cd build
	make install

	prepareInstalledDevelLib libfm-qt
	fixPkgconfig

	packageEntries devel \
		"$developDir"
}
