SUMMARY="C++ library for platform-independent programs"
DESCRIPTION="Some of the highlights include:

- A typesafe, multi-threaded event system that's very simple to use yet \
extremely efficient
- Timers for periodic events
- A datetime class that not only tracks timestamp but also their accuracy, \
which simplifies dealing with timestamps originating from different sources
- Simple process handling for spawning child processes with redirected I/O"
HOMEPAGE="https://lib.filezilla-project.org/"
COPYRIGHT="2015-2021 Tim Kosse"
LICENSE="GNU GPL v2"
REVISION="1"
SOURCE_URI="https://download.filezilla-project.org/libfilezilla/libfilezilla-$portVersion.tar.bz2"
CHECKSUM_SHA256="c16df6dacdb2ded4f6e05141b4681eda91a5a1ba052900a24a9f84e65a50dc40"
PATCHES="libfilezilla-$portVersion.patchset"

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

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

PROVIDES="
	libfilezilla$secondaryArchSuffix = $portVersion
	lib:libfilezilla$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libgnutls$secondaryArchSuffix
	lib:libiconv$secondaryArchSuffix
	lib:libnettle$secondaryArchSuffix
	"

PROVIDES_devel="
	libfilezilla${secondaryArchSuffix}_devel = $portVersion
	devel:libfilezilla$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES_devel="
	libfilezilla$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libcppunit$secondaryArchSuffix
	devel:libgmp$secondaryArchSuffix
	devel:libgnutls$secondaryArchSuffix
	devel:libiconv$secondaryArchSuffix
	devel:libnettle$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:automake
	cmd:doxygen
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	cmd:xgettext
	"

defineDebugInfoPackage libfilezilla$secondaryArchSuffix \
	"$libDir"/libfilezilla.so.$libVersion

BUILD()
{
	export CPPFLAGS="-D_BSD_SOURCE"
	export LDFLAGS="-lbsd"

	autoreconf -vfi
	runConfigure ./configure
	make $jobArgs
}

INSTALL()
{
	make install

	rm -f $libDir/libfilezilla.la

	prepareInstalledDevelLibs libfilezilla
	fixPkgconfig

	packageEntries devel \
		$developDir
}

TEST()
{
	make check
}
