SUMMARY="A light-weight scripting language"
DESCRIPTION="
Squirrel is a light weight programming language featuring higher-order \
functions, classes/inheritance, delegation, tail recursion, generators, \
cooperative threads, exception handling, reference counting and garbage \
collection on demand.  C-like syntax.
"
HOMEPAGE="http://www.squirrel-lang.org"
SOURCE_URI="https://squirrel.googlecode.com/files/squirrel_3_0_4_stable.tar.gz"
CHECKSUM_SHA256="6a3706accf9872aafea1eb3f3f3018b135e2671033824ccebf0735a98b2440a5"
LICENSE="MIT"
COPYRIGHT="2004-2013 Alberto Demichelis"
REVISION="1"

ARCHITECTURES="!x86 ?x86_64"
if [ $effectiveTargetArchitecture != x86_gcc2 ]; then
	# x86_gcc2 is fine as primary target architecture as long as we're building
	# for a different secondary architecture.
	ARCHITECTURES="$ARCHITECTURES x86_gcc2"
else
	ARCHITECTURES="$ARCHITECTURES !x86_gcc2"
fi
SECONDARY_ARCHITECTURES="x86"

PROVIDES="
	squirrel$secondaryArchSuffix = $portVersion
	cmd:sq$secondaryArchSuffix = $portVersion
	"

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

SOURCE_DIR="SQUIRREL3"

BUILD()
{
	make $jobArgs
}

INSTALL()
{
	mkdir -p $binDir
	cp -r bin/* $binDir
	
	mkdir -p $includeDir
	cp -r include/* $includeDir
	
	mkdir -p $developDocDir
	cp -r doc/* $developDocDir
	
	mkdir -p $libDir
	cp -r lib/* $develLibDir
	
	rm -rf $libDir
	
	packageEntries devel \
				$developDir
}

PROVIDES_devel="
	libsquirrel${secondaryArchSuffix}_devel = $portVersion
	devel:libsquirrel$secondaryArchSuffix = $portVersion
	devel:libsqstdlib$secondaryArchSuffix = $portVersion
	"

REQUIRES_devel="
	squirrel$secondaryArchSuffix == $portVersion base
	"
