SUMMARY="Cross-platform file change monitor with multiple backends"
DESCRIPTION="A cross-platform file change monitor with multiple backends: \
Apple OS X File System Events, *BSD kqueue, \
Solaris/Illumos File Events Notification, Linux inotify, \
Microsoft Windows and a stat()-based backend."
HOMEPAGE="http://emcrisostomo.github.io/fswatch/"
COPYRIGHT="2013-2018 Enrico M. Crisostomo"
LICENSE="GNU GPL v3"
REVISION="1"
SOURCE_URI="https://github.com/emcrisostomo/fswatch/releases/download/$portVersion/fswatch-$portVersion.tar.gz"
CHECKSUM_SHA256="44d5707adc0e46d901ba95a5dc35c5cc282bd6f331fcf9dbf9fad4af0ed5b29d"
#SOURCE_DIR="fstools-$srcGitRev"
#PATCHES="fstools-$portVersion.patchset"

ARCHITECTURES="all !x86_gcc2"
if [ "$targetArchitecture" = x86_gcc2 ]; then
SECONDARY_ARCHITECTURES="x86"
fi

# On x86_gcc2 we don't want to install the commands in bin/<arch>/, but in bin/.
commandBinDir=$binDir
if [ "$targetArchitecture" = x86_gcc2 ]; then
	commandBinDir=$prefix/bin
fi

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

PROVIDES="
	fswatch$secondaryArchSuffix = $portVersion
	lib:libfswatch$secondaryArchSuffix = $libVersionCompat
	cmd:fswatch = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libiconv$secondaryArchSuffix
	lib:libintl$secondaryArchSuffix
	"

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

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libiconv$secondaryArchSuffix
	devel:libintl$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:cmp
	cmd:dd
	cmd:diff
	cmd:doxygen
	cmd:find
	cmd:gawk
	cmd:grep
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:libtoolize
	cmd:make
	cmd:makeinfo
	cmd:xgettext$secondaryArchSuffix
	"

BUILD()
{
	#./autogen.sh
	autoreconf -fi
	runConfigure --omit-dirs binDir ./configure --bindir=$commandBinDir CXX=g++
	make $jobArgs
}

INSTALL()
{
	make install

	prepareInstalledDevelLib libfswatch

	packageEntries devel \
		$developDir
}

TEST()
{
	make check
}
