SUMMARY="Core library of PCManFM file manager"
DESCRIPTION="A glib/gio-based library providing some file management /
utilities and related-widgets missing in gtk+/glib. This is the core of /
PCManFM. The library is desktop independent (not LXDE specific) and has /
clean API. It can be used to develop other applications requiring file /
management functionality. For example, you can create your own file manager /
with facilities provided by libfm."
HOMEPAGE="https://lxde.org/"
COPYRIGHT="
	Hong Jen Yee, aka PCMan
	Jürgen Hötzel
	Andriy Grytsenko (LStranger)
	"
LICENSE="GNU GPL v2"
REVISION="2"
SOURCE_URI="https://github.com/lxde/libfm/archive/$portVersion.tar.gz"
CHECKSUM_SHA256="021efa7bcbbba88ab5af4a05c34c08b41c071abdeefb13986b02681c4c03c115"

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

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

GLOBAL_WRITABLE_FILES="
	settings/xdg/libfm/libfm.conf keep-old
	"

PROVIDES="
	libfm$secondaryArchSuffix = $portVersion
	lib:libfm$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libexif$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
	"

PROVIDES_devel="
	libfm${secondaryArchSuffix}_devel = $portVersion
	devel:libfm$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES_devel="
	libfm$secondaryArchSuffix == $portVersion base
	devel:libgio_2.0$secondaryArchSuffix
	devel:libglib_2.0$secondaryArchSuffix
	devel:libgthread_2.0$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libexif$secondaryArchSuffix
	devel:libglib_2.0$secondaryArchSuffix
	devel:libmenu_cache$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:gcc$secondaryArchSuffix
	cmd:gtkdocize
	cmd:intltoolize
	cmd:ld$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	cmd:vala
	cmd:which
	"

defineDebugInfoPackage libfm$secondaryArchSuffix \
	$libDir/libfm.so.$libVersion

BUILD()
{
	./autogen.sh
	runConfigure ./configure --without-gtk --disable-gtk-doc
	make $jobArgs
true
}

INSTALL()
{
	make install
	rm -f $libDir/libfm.la

	prepareInstalledDevelLibs libfm
	fixPkgconfig

	# Remove files installed by split-off libfm-extra package
	rm -rf $includeDir/libfm-1.0/fm-{extra,version,xml-file}.h
	rm -rf $libDir/libfm-extra*
	rm -rf $developLibDir/libfm-extra*
	rm -rf $developLibDir/pkgconfig/libfm-extra.pc

	packageEntries devel \
		$developDir
}

TEST()
{
	make check
}
