SUMMARY="Monitor applications and system services"
DESCRIPTION="
Einsteinium provides smarter monitoring of applications and system services \
for Haiku. It will restart applications and system services that quit or crash, \
gather statistics on application usage and provide customizable ranked lists of \
applications.
"
HOMEPAGE="https://sourceforge.net/projects/esforhaiku/"
SOURCE_URI="svn://svn.code.sf.net/p/esforhaiku/code/trunk#r79"
REVISION="1"
LICENSE="BSD (3-clause)"
COPYRIGHT="2010-2013 Brian Hill"

ARCHITECTURES="x86_gcc2"

PROVIDES="
	einsteinium = $portVersion
	app:Einsteinium = $portVersion
	cmd:einsteinium_engine = $portVersion
	cmd:einsteinium_daemon = $portVersion
	"

REQUIRES="
	haiku
	lib:libsqlite3
	lib:libxml2
	"

BUILD_REQUIRES="
	haiku_devel
	makefile_engine
	devel:libsqlite3
	devel:libxml2
	cmd:g++
	cmd:gcc
	cmd:make
	"

PATCH()
{
	cd src
	for f in Engine Daemon Preferences Launcher; do
		sed -e "s|/boot/develop|$(finddir B_SYSTEM_DEVELOP_DIRECTORY)|" \
			-e "s|/boot/common/include|$(finddir B_SYSTEM_HEADERS_DIRECTORY)|" -i $f/makefile
	done
}

BUILD()
{
	cd src
	for f in Engine Daemon; do
		pushd $f
		make $jobArgs OBJ_DIR=.
		popd
	done
	for f in Preferences Launcher; do
		pushd $f
		make $jobArgs
		popd
	done
}

INSTALL()
{
	mkdir -p $binDir
	mkdir -p $appsDir
	mkdir -p $preferencesDir
	cd src

	cp Engine/einsteinium_engine Daemon/einsteinium_daemon $binDir
	cp Preferences/Einsteinium_Preferences $preferencesDir/Einsteinium
	cp Launcher/Einsteinium_Launcher $appsDir/Einsteinium

	addPreferencesDeskbarSymlink $preferencesDir/Einsteinium
	addAppDeskbarSymlink $appsDir/Einsteinium
}
