SUMMARY="The famous 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="https://www.gnu.org/software/sed/"
COPYRIGHT="1989-2018 Free Software Foundation, Inc."
LICENSE="GNU GPL v3"
REVISION="1"
SOURCE_URI="https://ftpmirror.gnu.org/sed/sed-$portVersion.tar.xz
	https://ftp.gnu.org/gnu/sed/sed-$portVersion.tar.xz"
CHECKSUM_SHA256="f79b0cfea71b37a8eeec8490db6c5f7ae7719c35587f21edb0617f370eeff633"
PATCHES="sed-$portVersion.patchset"

ARCHITECTURES="all !x86_gcc2 ?x86 ?arm"
if [ "$targetArchitecture" = x86_gcc2 ]; then
SECONDARY_ARCHITECTURES="?x86"
fi

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

PROVIDES="
	sed$secondaryArchSuffix = $portVersion compat >= 4
	cmd:sed = $portVersion compat >= 4
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"
if [ -n "$secondaryArchSuffix" ]; then
CONFLICTS="
	sed
	"
fi

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	"
BUILD_PREREQUIRES="
	cmd:awk
	cmd:cmp
	cmd:g++$secondaryArchSuffix
	cmd:grep
	cmd:ld$secondaryArchSuffix
	cmd:make
	"

TEST_REQUIRES="
	cmd:cmp
	"

defineDebugInfoPackage sed$secondaryArchSuffix \
	"$commandBinDir"/sed


BUILD()
{
	runConfigure --omit-dirs binDir ./configure --bindir="$commandBinDir" \
		--without-included-regex \
		--disable-rpath --with-gnu-ld
	make $jobArgs
}

INSTALL()
{
	make install
}

TEST()
{
	# SKIP:	bug32082.sh, bug32271-2.sh, inplace-selinux.sh, invalid-mb-seq-UMR.sh,
	#		newline-dfa-bug.sh, obinary.sh, regex-max-int.sh,
	# FAIL:	panic-tests.sh,
	#
	# TOTAL: 67
	# PASS:  57
	# SKIP:  9
	# XFAIL: 0
	# FAIL:  1
	# XPASS: 0
	# ERROR: 0
	make check
}
