SUMMARY="Extended version of the yabasic programming language"
DESCRIPTION="yab is an extended version of yabasic, a BASIC programming \
language, with special commands designed for Haiku."
HOMEPAGE="https://software.besly.de/"
COPYRIGHT="1995-2006 Marc-Oliver Ihm (yabasic)
	2006-2009 Jan Bungeroth (yab)
	2013-2020 Jim Saxton (yab improvements)
	2018-2022 Lorenz Glaser (yab improvements)"
LICENSE="Artistic"
REVISION="3"
SOURCE_URI="https://github.com/lorglas/yab/archive/$portVersion.tar.gz"
CHECKSUM_SHA256="fb894dc201c129bb0208a51c2bc30fe155e15e4ef94a9f52c4e86d41f4029611"
SOURCE_FILENAME="yab-$portVersion.tar.gz"
SOURCE_DIR="yab-$portVersion"

ARCHITECTURES="all !x86"

PROVIDES="
	yab = $portVersion
	cmd:yab = $portVersion
	lib:libyab = $portVersion
	lib:libyab_1.7.8 = 1.7.8
	lib:libyab_1.7.9 = 1.7.9
	lib:libyab_1.8.0 = 1.8.0
	lib:libyab_$portVersion = $portVersion
	"
REQUIRES="
	haiku
	"

PROVIDES_devel="
	yab_devel = $portVersion
	devel:yab = $portVersion
	"
REQUIRES_devel="
	yab == $portVersion base
	"

BUILD_REQUIRES="
	haiku_devel
	"
BUILD_PREREQUIRES="
	cmd:bison
	cmd:flex
	cmd:gcc
	cmd:make
	cmd:mkdepend
	"
BUILD()
{
	make
}

INSTALL()
{
	mkdir -p $binDir $libDir
	cp yab $binDir/
	if [ $buildArchitecture == 'x86_gcc2' ]; then
	 cp oldlib_x86_gcc2/libyab.so $libDir/
	 cp oldlib_x86_gcc2/libyab_1.7.8.so $libDir/
	 cp oldlib_x86_gcc2/libyab_1.7.9.so $libDir/
	 cp oldlib_x86_gcc2/libyab_1.8.0.so $libDir/
	fi
	if [ $buildArchitecture == 'x86_64' ]; then
	 cp oldlib_x86_64/libyab.so $libDir/
	 cp oldlib_x86_64/libyab_1.7.8.so $libDir/
	 cp oldlib_x86_64/libyab_1.7.9.so $libDir/
	 cp oldlib_x86_64/libyab_1.8.0.so $libDir/
	fi
	cp libyab* $libDir/
	mkdir -p $dataDir/licenses/
	cp data/licenses/* $dataDir/licenses/

	mkdir -p $developDir/yab-$portVersion
	cp *.c *.cpp *.h RdefApply yabasic.bison yabasic.flex \
		$developDir/yab-$portVersion
	chmod +x $developDir/yab-$portVersion/RdefApply

	packageEntries devel \
		$developDir
}
