SUMMARY="A file manager for Haiku"
DESCRIPTION="BAfx is a file manager for BeOS/Haiku. It uses a single window \
with two panes for source and destination folder.
The file manager is still in early stages of development. A built-in text and \
image viewer are planned for future releases."
HOMEPAGE="https://github.com/marbocub/BAfx"
COPYRIGHT="2012-2014 marbocub"
LICENSE="MIT"
REVISION="4"
srcGitRev="ebd3db8a2231618f649bfb1215f6c8d209c73315"
SOURCE_URI="https://github.com/marbocub/BAfx/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="e904b5509e40eb0a860b50da9c8685492ea9288f1130ce7036cb2bfc48b4568d"
SOURCE_DIR="BAfx-$srcGitRev"
ADDITIONAL_FILES="bafx.rdef"

ARCHITECTURES="all"

PROVIDES="
	bafx = $portVersion
	app:BAfx = $portVersion
	"
REQUIRES="
	haiku
	"

BUILD_REQUIRES="
	haiku_devel
	"
BUILD_PREREQUIRES="
	makefile_engine
	cmd:cut
	cmd:g++
	cmd:make
	cmd:sed
	"

BUILD()
{
	make OBJ_DIR=objects \
		BUILDHOME=`finddir B_SYSTEM_DEVELOP_DIRECTORY`
}

INSTALL()
{
	install -d -m 755 $appsDir
	install -t $appsDir objects/BAfx
	addAppDeskbarSymlink $appsDir/BAfx

	local MAJOR="`echo "$portVersion" | cut -d. -f1`"
	local MIDDLE="`echo "$portVersion" | cut -d. -f2`"
	local MINOR="`echo "$portVersion" | cut -d. -f3`"
	sed \
		-e "s|@MAJOR@|$MAJOR|" \
		-e "s|@MIDDLE@|$MIDDLE|" \
		-e "s|@MINOR@|$MINOR|" \
		$portDir/additional-files/bafx.rdef > bafx.rdef

	addResourcesToBinaries bafx.rdef \
		$appsDir/BAfx
}
