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="http://www.gnu.org/software/grep/"
LICENSE="GNU GPL v3"
COPYRIGHT="1992-2012 Free Software Foundation, Inc."
SOURCE_URI="http://ports-space.haiku-files.org/source/grep-2.14.tar.bz2"
CHECKSUM_SHA256="0aa728dbb92eeec776f9551fcee1931717984a91cfd8c3df3dfb40709243ae6f"
# XZ file format:
#SOURCE_URI="http://ftp.gnu.org/pub/gnu/grep/grep-2.14.tar.xz"
#CHECKSUM_MD5="d4a3f03849d1e17ce56ab76aa5a24cab"
REVISION="5"
ARCHITECTURES="x86_gcc2 x86 x86_64 arm"

PATCHES="grep-2.14-gcc2.patch"

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
	"

defineDebugInfoPackage grep \
	$binDir/egrep \
	$binDir/fgrep \
	$binDir/grep


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

INSTALL()
{
	make install

	rm $libDir/charset.alias
	rmdir $libDir
}

TEST()
{
	make check
}
