SUMMARY="Tool for generating recognizers from regular expressions"
DESCRIPTION="re2c is a lexer generator for C/C++ and Go. Unlike full-featured \
table-based lexers, re2c generates code that is believed to be as good \
(and fast) as a carefully tuned hand-crafted C/C++ lexer."
HOMEPAGE="http://re2c.org/"
COPYRIGHT="2003-2016 Peter Bumbulis, Brian Young, Dan Nuffer, Marcus Boerger, \
Hartmut Kaiser, Emmanuel Mogenet, Ulya Trofimovich"
LICENSE="Public Domain"
REVISION="1"
SOURCE_URI="https://github.com/skvadrik/re2c/archive/$portVersion.tar.gz"
CHECKSUM_SHA256="f131b3d5b618454caa5f2ddcc8288b797c78781056a40c2899c832493827c003"
SOURCE_FILENAME="re2c-$portVersion.tar.gz"

ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="!x86_gcc2 x86"

if [ "$targetArchitecture" != x86_gcc2 ]; then
	commandSuffix=$secondaryArchSuffix
	commandBinDir=$binDir
else
	commandSuffix=
	commandBinDir=$prefix/bin
fi

PROVIDES="
	re2c$secondaryArchSuffix = $portVersion
	cmd:re2c$commandSuffix = $portVersion
	cmd:re2go$commandSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:automake
	cmd:g++$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	"

BUILD()
{
	./autogen.sh
	runConfigure --omit-dirs binDir ./configure --bindir=$commandBinDir
	make $jobArgs
}

INSTALL()
{
	make install
}

TEST()
{
	make tests
}
