SUMMARY="A stream editor"
DESCRIPTION="
Sed is a stream editor, i.e. it can be used to perform basic text \
transformations on an input stream (a file or input from a pipeline).
While in some ways similar to an editor which permits scripted edits (such as \
ed), sed works by making only one pass over the input(s), and is consequently \
more efficient. But it is sed's ability to filter text in a pipeline which \
particularly distinguishes it from other types of editors.
"
HOMEPAGE="http://www.gnu.org/software/sed"
COPYRIGHT="1989-2009 Free Software Foundation, Inc."
LICENSE="GNU GPL v3"
SOURCE_URI="http://ftp.gnu.org/gnu/sed/sed-4.2.1.tar.gz"
CHECKSUM_SHA256="8773541ce097fdc4c5b9e7da12a82dffbb30cd91f7bc169f52f05f93b7fc3060"
REVISION="6"
ARCHITECTURES="x86_gcc2 x86 x86_64 arm"

PATCHES="sed-4.2.1.patchset"

PROVIDES="
	sed = $portVersion compat >= 4
	cmd:sed = $portVersion compat >= 4
	"
REQUIRES="
	haiku
	"
BUILD_PREREQUIRES="
	haiku_devel
	cmd:gcc
	cmd:ld
	cmd:make
	cmd:awk
	cmd:grep
	"

defineDebugInfoPackage sed \
	$binDir/sed


BUILD()
{
	# First we bootstrap to generate a really boring sed
	./bootstrap.sh
	export PATH="${sourceDir}/sed/:${PATH}"
	echo $PATH

	runConfigure ./configure \
		--enable-regex-tests --without-included-regex \
		--disable-rpath --with-gnu-ld
	make $jobArgs
}

INSTALL()
{
	# Use our generated sed for make
	export PATH="${sourceDir}/sed/:${PATH}"

	make install
	rm $libDir/charset.alias
	rmdir $libDir
}
