SUMMARY="GNU regular expression matcher"
DESCRIPTION="The grep command searches one or more input files for lines \
containing a match to a specified pattern. By default, grep prints the \
matching lines."
HOMEPAGE="https://www.gnu.org/software/grep/"
COPYRIGHT="1992-2016 Free Software Foundation, Inc."
LICENSE="GNU GPL v3"
REVISION="1"
SOURCE_URI="http://ftp.gnu.org/gnu/grep/grep-$portVersion.tar.xz"
CHECKSUM_SHA256="f248beb9098c5aab94d2fdd03b5a21d705e5ba8a3ce4d8c9f607a670498eec14"
PATCHES="grep-$portVersion.patchset"

ARCHITECTURES="all ?x86_gcc2"

PROVIDES="
	grep = $portVersion compat >= 2
	cmd:egrep = $portVersion compat >= 2
	cmd:fgrep = $portVersion compat >= 2
	cmd:grep = $portVersion compat >= 2
	"
REQUIRES="
	haiku
	lib:libiconv
	lib:libintl
	"

BUILD_REQUIRES="
	devel:libiconv
	devel:libintl
	"
BUILD_PREREQUIRES="
	haiku_devel
	cmd:aclocal
	cmd:autoconf
	cmd:automake
	cmd:gcc
	cmd:gettext
	cmd:ld
	cmd:libtoolize
	cmd:make
	cmd:makeinfo
	"

defineDebugInfoPackage grep \
	$binDir/grep

BUILD()
{
	libtoolize --force --copy --install
	aclocal -I m4
	autoconf
	runConfigure ./configure \
		--disable-perl-regexp --disable-gcc-warnings
	make $jobArgs
}

INSTALL()
{
	make install

	rm $libDir/charset.alias
	rmdir $libDir
}

TEST()
{
	make check
}
