SUMMARY="A tool for generating scanners"
DESCRIPTION="Flex is a fast lexical analyser generator. It is a tool for \
generating programs that perform pattern-matching on text."
HOMEPAGE="https://github.com/westes/flex/"
COPYRIGHT="2001-2007 The Flex Project
	1990, 1997 The Regents of the University of California"
LICENSE="Flex"
REVISION="2"
SOURCE_URI="$HOMEPAGE/releases/download/v$portVersion/flex-$portVersion.tar.gz"
CHECKSUM_SHA256="e87aae032bf07c26f85ac0ed3250998c37621d95f8bd748b31f15b33c45ee995"
PATCHES="flex-$portVersion.patchset"

ARCHITECTURES="all"

PROVIDES="
	flex = $portVersion compat >= 2.5
	cmd:flex = $portVersion compat >= 2.5
	cmd:flex++ = $portVersion compat >= 2.5
	cmd:lex = $portVersion compat >= 2.5
	devel:libfl = 2.0.0 compat >= 2
	"
REQUIRES="
	haiku
	cmd:m4
	"

BUILD_REQUIRES="
	haiku_devel
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:automake
	cmd:autopoint
	cmd:find
	cmd:gcc
	cmd:gzip
	cmd:help2man
	cmd:ld
	cmd:libtoolize
	cmd:make
	cmd:makeinfo
	cmd:yacc
	"

BUILD()
{
	rm -f aclocal.m4
	autoreconf -fi
	runConfigure ./configure \
		--disable-rpath --with-gnu-ld --disable-shared \
		--disable-dependency-tracking --disable-nls
	make $jobArgs
}

INSTALL()
{
	make install

	rm $libDir/libfl.la

	# Create symlink to lex
	ln -s $binDir/flex $binDir/lex

	# prepare develop/lib
	prepareInstalledDevelLib libfl
}

TEST()
{
	make check
}
