SUMMARY="A REXX interpreter with Haiku scripting integration"
DESCRIPTION="Rexx (Restructured Extended Executor) is an interpreted \
programming language developed at IBM by Mike Cowlishaw. It is a structured, \
high-level programming language designed for ease of learning and reading.

BeBRexx 1.3.2 is the first public release of a port of Bill Vlachoudis' BRexx \
version 1.3 to BeOS, a REXX interpreter with a number of improvements and \
additions:
* Support for Haiku application scripting.
* Support for running BRexx scripts from the desktop.
* Additional functions and features."
HOMEPAGE="http://www.verifiedlogic.com/"
COPYRIGHT="1991-1999 Be Incorporated
	1999 Willy Langeveld
	1999 Vassilis Vlachoudis"
LICENSE="Public Domain
	BSD (3-clause)"
REVISION="4"
srcGitRev="63d956a8a44beecbb3597d904ce97e159575aebc"
SOURCE_URI="https://github.com/pulkomandy/BeBrexx/archive/$srcGitRev.tar.gz"
SOURCE_DIR="BeBrexx-$srcGitRev"
CHECKSUM_SHA256="26db8f9ce0bf318cf63495a3050ee94e4d2ccb0a734898efdf0aa72016ed9a27"

ARCHITECTURES="x86_gcc2"
SECONDARY_ARCHITECTURES="x86"

PROVIDES="
	brexx$secondaryArchSuffix = $portVersion
	lib:libPortManager$secondaryArchSuffix
	"

REQUIRES="
	haiku$secondaryArchSuffix
	"

if [ -z "$secondaryArchSuffix" ]; then
PROVIDES="$PROVIDES
	cmd:PortManager
	cmd:rx
	"
else
REQUIRES="$REQUIRES
	brexx == $portVersion base
	"
fi

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	"
BUILD_PREREQUIRES="
	makefile_engine
	cmd:gcc$secondaryArchSuffix
	cmd:make
	"

PROVIDES_devel="
	brexx${secondaryArchSuffix}_devel = $portVersion
	devel:libPortManager$secondaryArchSuffix
"

REQUIRES_devel="
	brexx$secondaryArchSuffix == $portVersion base
"

BUILD()
{
	make all OBJ_DIR=obj
}

INSTALL()
{
	if [ -z "$secondaryArchSuffix" ]; then
		mkdir -p $binDir
		mkdir -p $prefix/servers
		copyattr -d PortManager/obj/PortManager $prefix/servers
		copyattr -d src/obj/rx $binDir
	fi

	mkdir -p $libDir
	copyattr -d PortLib/obj/libPortManager.so $libDir

	mkdir -p $includeDir
	cp PortLib/PortManager.h $includeDir

	prepareInstalledDevelLibs libPortManager

	packageEntries devel $developDir
}

TEST()
{
	export LIBRARY_PATH=PortLib/obj:$LIBRARY_PATH
	make test OBJ_DIR=obj
}
